commit 08def4b8d9173da7a48998759688e3732f43b452 Author: 刘名喜 Date: Tue Oct 29 16:34:09 2024 +0800 原始版本 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..977eb76 --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +###################################################################### +# Build Tools + +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +target/ +!.mvn/wrapper/maven-wrapper.jar + +###################################################################### +# IDE + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### JRebel ### +rebel.xml + +### NetBeans ### +nbproject/private/ +build/* +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +###################################################################### +# Others +*.log +*.xml.versionsBackup +*.swp + +!*/build/*.java +!*/build/*.html +!*/build/*.xml +application-druid.yml \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b559d41 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2018 ktg + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..5add876 --- /dev/null +++ b/README.en.md @@ -0,0 +1,36 @@ +# ktg-mes + +#### Description +一款开源、免费的MES生产执行管理系统 + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md new file mode 100644 index 0000000..11071a2 --- /dev/null +++ b/README.md @@ -0,0 +1,130 @@ +

+ logo +

+

苦糖果MES

+

专业、通用、开源、免费的MES系统

+

+star + +

+ +# ktg-mes + +### 系统简介 +苦糖果MES系统是一款B/S结构、开源、免费的生产执行管理系统。 + +此系统基于本人多年离散智造行业的业务经验及J2EE项目经验开发。 + +主要目的是为国内离散制造业的中小企业提供一个专业化、通用性、低成本的MES系统解决方案。 + +系统将提供“售前”、“实施”、“用户培训”、“运维”等多个阶段的指导文档和教学视频,以帮助非IT专业人士顺利完成MES项目的实施应用。 + +- 前端代码地址:https://gitee.com/kutangguo/ktg-mes-ui + +- 触控屏端地址:https://gitee.com/kutangguo/ktg-mes-pad + +- PC端在线体验地址: [http://www.029tec.com](http://www.029tec.com/) 【请不要修改账户密码,以免影响其他人体验】 + +- 当前开发进度请参考doc->开发进度->进度甘特图.xlsx + +- 第一版售前PPT请查看doc->售前资料->《苦糖果MES系统产品介绍(A4横板).pptx》 + +- 操作手册/软件说明书请参考doc->售前资料->《苦糖果生产执行管理系统-【软件说明书】.docx》 + +欢迎交流沟通:QQ:411641505 + +支持作者请Star + +### 系统架构 + +当前版本基于RuoYi前后端分离版本开发。详情请参照:https://gitee.com/y_project/RuoYi-Vue + +触控屏端请参考Uniapp相关文档 + +### 功能简介 + +PC端: + +- 系统管理 + +- 主数据 + + - 物料产品管理 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E7%89%A9%E6%96%99%E4%BA%A7%E5%93%81%E8%AE%BE%E7%BD%AE.png) + + - 工作站设置 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E5%B7%A5%E4%BD%9C%E7%AB%99%E8%AE%BE%E7%BD%AE.png) + +- 生产管理 + + - 生产排产 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E7%94%9F%E4%BA%A7%E6%8E%92%E4%BA%A7.png) + +- 质量管理 + +- 生产排班 + + - 节假日/工作日设置 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E8%8A%82%E5%81%87%E6%97%A5%E8%AE%BE%E7%BD%AE.png) + + - 排班日历 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E6%8E%92%E7%8F%AD%E6%97%A5%E5%8E%86.png) + + + +- 仓储管理 + + - 库存现有量 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E5%BA%93%E5%AD%98%E7%8E%B0%E6%9C%89%E9%87%8F.png) + + - 条码管理 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E6%9D%A1%E7%A0%81%E7%AE%A1%E7%90%86.png) + +- 设备管理 + +- 统计报表 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E6%8A%A5%E8%A1%A8%E8%AE%BE%E8%AE%A1.png) + +- 大屏展示 + +Android端: + +- 生产管理 +- 质量管理 +- 仓储管理 +- 设备管理 + +触控屏端: + +- 登录 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E8%A7%A6%E6%8E%A7%E5%B1%8F-%E7%99%BB%E5%BD%95%E9%A1%B5%E9%9D%A2.png) + +- 生产 + +- 质量 + + ![](https://gitee.com/kutangguo/ktg-mes/raw/master/doc/%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3/%E5%8E%9F%E5%9E%8B%E8%AE%BE%E8%AE%A1/%E6%88%AA%E5%9B%BE/%E8%A7%A6%E6%8E%A7%E5%B1%8F-%E8%B4%A8%E9%87%8F%E7%AE%A1%E7%90%86.png) + +- 工序 + +- 设备 + +PDA: + +- 仓储 +- 生产 + +完整功能清单及简介请参照doc->设计文档->功能设计->《功能清单.xml》 + +### 安装部署 + +请参照doc->实施文档 \ No newline at end of file diff --git a/bin/clean.bat b/bin/clean.bat new file mode 100644 index 0000000..24c0974 --- /dev/null +++ b/bin/clean.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] target· +echo. + +%~d0 +cd %~dp0 + +cd .. +call mvn clean + +pause \ No newline at end of file diff --git a/bin/package.bat b/bin/package.bat new file mode 100644 index 0000000..c693ec0 --- /dev/null +++ b/bin/package.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] Weḅwar/jarļ +echo. + +%~d0 +cd %~dp0 + +cd .. +call mvn clean package -Dmaven.test.skip=true + +pause \ No newline at end of file diff --git a/bin/run.bat b/bin/run.bat new file mode 100644 index 0000000..9677bf8 --- /dev/null +++ b/bin/run.bat @@ -0,0 +1,14 @@ +@echo off +echo. +echo [��Ϣ] ʹ��Jar��������Web���̡� +echo. + +cd %~dp0 +cd ../ktg-admin/target + +set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m + +java -jar %JAVA_OPTS% ktg-admin.jar + +cd bin +pause \ No newline at end of file diff --git a/doc/售前资料/~$果生产执行管理系统-【软件说明书】.docx b/doc/售前资料/~$果生产执行管理系统-【软件说明书】.docx new file mode 100644 index 0000000..0830bb0 Binary files /dev/null and b/doc/售前资料/~$果生产执行管理系统-【软件说明书】.docx differ diff --git a/doc/售前资料/苦糖果MES系统产品介绍(A4横板).pptx b/doc/售前资料/苦糖果MES系统产品介绍(A4横板).pptx new file mode 100644 index 0000000..ef4ccea Binary files /dev/null and b/doc/售前资料/苦糖果MES系统产品介绍(A4横板).pptx differ diff --git a/doc/售前资料/苦糖果生产执行管理系统-【软件说明书】.docx b/doc/售前资料/苦糖果生产执行管理系统-【软件说明书】.docx new file mode 100644 index 0000000..b4062db Binary files /dev/null and b/doc/售前资料/苦糖果生产执行管理系统-【软件说明书】.docx differ diff --git a/doc/实施文档/inital.sql b/doc/实施文档/inital.sql new file mode 100644 index 0000000..cc8a39e --- /dev/null +++ b/doc/实施文档/inital.sql @@ -0,0 +1,19 @@ +##初始化产品物料分类的根节点 +insert into md_item_type(item_type_code,item_type_name,parent_type_id,ancestors,item_or_product,order_num,enable_flag +)values ('ITEM_TYPE_0000','物料产品分类',0,'0','PRODUCT',1,'Y'); + + +insert into dv_machinery_type(machinery_type_code,machinery_type_name,parent_type_id,ancestors,enable_flag) +values ('M_TYPE_000','设备分类',0,'0','Y'); + +##初始化一个虚拟的线边库 +insert into wm_warehouse (warehouse_code,warehouse_name,location,area,charge) values('XBK_VIRTUAL','线边库-虚拟',null,-1,null); + +##初始化一个虚拟的线边库库区 +insert into wm_storage_location (location_code,location_name,warehouse_id,area,area_flag) values('XBKKQ_VIRTUAL','线边库库区-虚拟',200,-1,'Y'); + + +##初始化一个虚拟的线边库库位 +insert into wm_storage_area (area_code,area_name,location_id,area,enable_flag) values('XBKKW_VIRTUAL','线边库库位-虚拟',200,-1,'Y'); + + diff --git a/doc/实施文档/ktgmes_20230505_115713.sql.gz b/doc/实施文档/ktgmes_20230505_115713.sql.gz new file mode 100644 index 0000000..cd70d60 Binary files /dev/null and b/doc/实施文档/ktgmes_20230505_115713.sql.gz differ diff --git a/doc/实施文档/ktgmes_20231016_191857.sql.gz b/doc/实施文档/ktgmes_20231016_191857.sql.gz new file mode 100644 index 0000000..29c319c Binary files /dev/null and b/doc/实施文档/ktgmes_20231016_191857.sql.gz differ diff --git a/doc/实施文档/ktgmes_20231105_214848.sql.gz b/doc/实施文档/ktgmes_20231105_214848.sql.gz new file mode 100644 index 0000000..ccd48f1 Binary files /dev/null and b/doc/实施文档/ktgmes_20231105_214848.sql.gz differ diff --git a/doc/实施文档/ktgmes_20231113_222038.sql.gz b/doc/实施文档/ktgmes_20231113_222038.sql.gz new file mode 100644 index 0000000..88e9dea Binary files /dev/null and b/doc/实施文档/ktgmes_20231113_222038.sql.gz differ diff --git a/doc/实施文档/ktgmes_20240909_111515.sql.gz b/doc/实施文档/ktgmes_20240909_111515.sql.gz new file mode 100644 index 0000000..2b4b998 Binary files /dev/null and b/doc/实施文档/ktgmes_20240909_111515.sql.gz differ diff --git a/doc/实施文档/sys_auto_code.sql b/doc/实施文档/sys_auto_code.sql new file mode 100644 index 0000000..cf106b6 --- /dev/null +++ b/doc/实施文档/sys_auto_code.sql @@ -0,0 +1,431 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_auto_code_part +-- ---------------------------- +DROP TABLE IF EXISTS `sys_auto_code_part`; +CREATE TABLE `sys_auto_code_part` ( + `part_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分段ID', + `rule_id` bigint(20) NOT NULL COMMENT '规则ID', + `part_index` int(11) NOT NULL COMMENT '分段序号', + `part_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分段类型,INPUTCHAR:输入字符,NOWDATE:当前日期时间,FIXCHAR:固定字符,SERIALNO:流水号', + `part_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分段编号', + `part_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分段名称', + `part_length` int(11) NOT NULL COMMENT '分段长度', + `date_format` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `input_character` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '输入字符', + `fix_character` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '固定字符', + `seria_start_no` int(11) NULL DEFAULT NULL COMMENT '流水号起始值', + `seria_step` int(11) NULL DEFAULT NULL COMMENT '流水号步长', + `seria_now_no` int(11) NULL DEFAULT NULL COMMENT '流水号当前值', + `cycle_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流水号是否循环', + `cycle_method` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '循环方式,YEAR:按年,MONTH:按月,DAY:按天,HOUR:按小时,MINITE:按分钟,OTHER:按传入字符变', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT 0 COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT 0 COMMENT '预留字段4', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`part_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 289 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '编码生成规则组成表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_auto_code_part +-- ---------------------------- +INSERT INTO `sys_auto_code_part` VALUES (200, 205, 2, 'SERIALNO', 'P1', '流水号', 8, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 21:13:17', 'admin', '2022-04-26 22:47:49'); +INSERT INTO `sys_auto_code_part` VALUES (201, 205, 1, 'FIXCHAR', 'P0', '前缀', 4, NULL, NULL, 'ITEM', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 22:44:03', 'admin', '2022-08-15 15:59:19'); +INSERT INTO `sys_auto_code_part` VALUES (202, 206, 1, 'FIXCHAR', 'P1', '前缀', 10, NULL, NULL, 'ITEM_TYPE_', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 23:02:12', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (203, 206, 2, 'SERIALNO', 'P2', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 23:02:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (204, 207, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'C', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 21:21:04', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (205, 207, 2, 'SERIALNO', 'SERIAL', '流水号部分', 5, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 21:21:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (206, 208, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'V', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 22:50:38', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (207, 208, 2, 'SERIALNO', 'SERIAL', '流水号', 5, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 22:51:02', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (208, 209, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'WS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 17:49:16', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (209, 209, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 17:49:40', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (210, 210, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'WH', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 22:00:17', 'admin', '2022-08-16 18:58:36'); +INSERT INTO `sys_auto_code_part` VALUES (211, 210, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 22:00:40', 'admin', '2022-07-30 11:26:14'); +INSERT INTO `sys_auto_code_part` VALUES (212, 211, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'L', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 14:50:29', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (213, 211, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 14:52:12', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (214, 212, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'A', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 18:38:29', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (215, 212, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 18:38:51', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (216, 213, 1, 'FIXCHAR', 'PREFIX', '前缀', 7, NULL, NULL, 'M_TYPE_', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 19:46:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (217, 213, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 19:47:03', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (218, 214, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'M', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 21:26:59', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (219, 214, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 21:27:18', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (220, 215, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'MO', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:40:23', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (222, 215, 2, 'NOWDATE', 'DATEPART', '年月日部分', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:58:57', 'admin', '2022-05-09 12:46:34'); +INSERT INTO `sys_auto_code_part` VALUES (223, 215, 3, 'SERIALNO', 'SERIAL', '流水号部分', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:59:31', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (224, 216, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'WS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-10 21:55:51', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (225, 216, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-10 21:56:19', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (226, 217, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'TT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 00:22:02', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (227, 217, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 00:22:25', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (228, 218, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'T', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 22:07:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (229, 218, 2, 'SERIALNO', 'SERIAL', '流水号', 5, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 22:08:17', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (230, 219, 1, 'FIXCHAR', 'PREFIX', '前缀', 7, NULL, NULL, 'PROCESS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 00:10:13', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (231, 219, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 00:10:33', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (232, 220, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'R', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 23:07:01', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (233, 220, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1000, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 23:07:23', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (234, 221, 1, 'FIXCHAR', 'PREFIX', '固定前缀', 4, NULL, NULL, 'TASK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:22:53', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (235, 221, 2, 'NOWDATE', 'YEAR', '年份', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:23:39', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (236, 221, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:24:03', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (237, 222, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'I', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 21:57:46', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (238, 222, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 21:58:05', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (239, 223, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'QCT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:43:31', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (240, 223, 2, 'NOWDATE', 'YEAR', '年份', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:44:04', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (241, 223, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:44:25', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (242, 224, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'DF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 11:33:52', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (243, 224, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 11:34:11', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (244, 225, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'IQC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:29:59', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (245, 225, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:30:28', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (246, 225, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:31:00', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (247, 226, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'R', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:51:47', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (248, 226, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:52:10', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (249, 226, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:52:58', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (250, 227, 1, 'FIXCHAR', 'PREFIX', '固定前缀', 1, NULL, NULL, 'T', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 19:54:45', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (251, 227, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 19:55:06', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (252, 228, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'PLAN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:08:39', 'admin', '2022-07-31 16:42:59'); +INSERT INTO `sys_auto_code_part` VALUES (253, 228, 2, 'NOWDATE', 'YEAR', '年', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:08:59', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (254, 228, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:09:24', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (255, 229, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'RTV', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 16:06:14', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (256, 229, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 16:06:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (257, 229, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 16:07:10', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (258, 230, 1, 'FIXCHAR', 'PREFIX', '固定前缀', 3, NULL, NULL, 'SUB', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 20:28:22', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (259, 230, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 20:28:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (260, 231, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'PLAN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:50:22', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (261, 231, 2, 'NOWDATE', 'YEAR', '年份', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:50:43', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (262, 231, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:51:07', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (263, 232, 1, 'FIXCHAR', '1', '1', 3, NULL, NULL, 'BAT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-14 12:02:54', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (264, 232, 2, 'NOWDATE', '2', '2', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-14 12:03:16', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (265, 233, 1, 'FIXCHAR', 'PREFIX', '前缀', 5, NULL, NULL, 'ISSUE', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:32:46', 'admin', '2022-07-17 19:35:44'); +INSERT INTO `sys_auto_code_part` VALUES (266, 233, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:33:22', 'admin', '2022-07-17 19:35:57'); +INSERT INTO `sys_auto_code_part` VALUES (267, 233, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:33:45', 'admin', '2022-07-17 19:36:05'); +INSERT INTO `sys_auto_code_part` VALUES (271, 234, 1, 'INPUTCHAR', 'PREFIX', '1', 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-30 14:20:49', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (275, 236, 1, 'FIXCHAR', '前缀', '固定字符', 2, NULL, NULL, 'IF', NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-19 10:48:20', 'admin', '2022-08-19 14:13:30'); +INSERT INTO `sys_auto_code_part` VALUES (276, 236, 2, 'NOWDATE', '后缀', '固定字段', 4, 'yyyyMMddss', NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-19 14:12:19', 'admin', '2022-08-19 14:19:39'); +INSERT INTO `sys_auto_code_part` VALUES (277, 237, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'IPQC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:07:43', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (278, 237, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:08:18', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (279, 237, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:08:46', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (280, 238, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'OQC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:30:53', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (281, 238, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:32:11', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (282, 238, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:32:38', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (283, 239, 1, 'FIXCHAR', '001', '前缀', 5, NULL, NULL, 'PBACK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:49:07', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (284, 239, 2, 'NOWDATE', '002', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:49:31', 'admin', '2022-09-03 23:49:44'); +INSERT INTO `sys_auto_code_part` VALUES (285, 239, 3, 'SERIALNO', '003', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:50:10', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (286, 240, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'RT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:19:25', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (287, 240, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:19:47', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (288, 240, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:20:09', '', NULL); + +-- ---------------------------- +-- Table structure for sys_auto_code_result +-- ---------------------------- +DROP TABLE IF EXISTS `sys_auto_code_result`; +CREATE TABLE `sys_auto_code_result` ( + `code_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '记录ID', + `rule_id` bigint(20) NOT NULL COMMENT '规则ID', + `gen_date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '生成日期时间', + `gen_index` int(11) NULL DEFAULT NULL COMMENT '最后产生的序号', + `last_result` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '最后产生的值', + `last_serial_no` int(11) NULL DEFAULT NULL COMMENT '最后产生的流水号', + `last_input_char` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '最后传入的参数', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT 0 COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT 0 COMMENT '预留字段4', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`code_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 420 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '编码生成记录表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_auto_code_result +-- ---------------------------- +INSERT INTO `sys_auto_code_result` VALUES (200, 205, '20220808095803', 76, 'ITEM00000076', 76, NULL, '', NULL, NULL, 0, 0, '', '2022-04-26 22:28:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (201, 206, '20220813231829', 62, 'ITEM_TYPE_0062', 62, NULL, '', NULL, NULL, 0, 0, '', '2022-04-27 10:17:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (202, 207, '20220802144206', 10, 'C00010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-06 21:22:23', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (203, 208, '20220805160743', 10, 'V00010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-06 22:52:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (204, 209, '20220805111938', 12, 'WS012', 12, NULL, '', NULL, NULL, 0, 0, '', '2022-05-07 17:54:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (205, 210, '20220729090506', 2, 'WH002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-05-07 22:01:31', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (206, 211, '20220729085518', 10, 'L010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 14:52:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (207, 212, '20220810082205', 11, 'A0011', 11, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 18:39:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (208, 213, '20220823091541', 24, 'M_TYPE_024', 24, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 19:47:31', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (209, 214, '20220819091251', 26, 'M0026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 21:38:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (210, 215, '20220509234547', 21, 'MO202205090021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-05-09 12:46:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (212, 216, '20220818103207', 34, 'WS0034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-05-10 21:59:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (213, 217, '20220816195823', 25, 'TT025', 25, NULL, '', NULL, NULL, 0, 0, '', '2022-05-11 00:22:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (214, 218, '20220804162652', 10, 'T00010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-11 22:35:05', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (215, 219, '20220729122036', 46, 'PROCESS046', 46, NULL, '', NULL, NULL, 0, 0, '', '2022-05-12 00:10:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (217, 220, '20220809171633', 29, 'R1028', 1028, NULL, '', NULL, NULL, 0, 0, '', '2022-05-12 23:11:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (219, 215, '20220514155158', 26, 'MO202205140026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-05-14 15:24:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (220, 215, '20220515134342', 5, 'MO202205150005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-05-15 13:41:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (221, 221, '20220828090047', 69, 'TASK20220069', 69, NULL, '', NULL, NULL, 0, 0, '', '2022-05-15 18:29:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (222, 222, '20220812142031', 13, 'I0013', 13, NULL, '', NULL, NULL, 0, 0, '', '2022-05-17 21:58:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (223, 223, '20220901212456', 42, 'QCT2022042', 42, NULL, '', NULL, NULL, 0, 0, '', '2022-05-17 22:44:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (224, 224, '20220819144546', 8, 'DF008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-05-19 11:37:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (225, 225, '20220519230422', 21, 'IQC20220519021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-05-19 16:49:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (226, 226, '20220522220740', 8, 'R20220522008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-05-22 20:53:25', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (227, 227, '20220814214249', 25, 'T025', 25, NULL, '', NULL, NULL, 0, 0, '', '2022-06-06 19:55:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (228, 228, '20220823150049', 121, 'PLAN2022121', 121, NULL, '', NULL, NULL, 0, 0, '', '2022-06-06 22:09:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (229, 229, '20220613162434', 2, 'RTV20220613002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-06-13 16:19:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (230, 226, '20220613164021', 1, 'R20220613001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-06-13 16:40:22', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (231, 229, '20220614161107', 3, 'RTV20220614003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-06-14 11:11:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (232, 226, '20220614122043', 3, 'R20220614003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-06-14 11:34:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (233, 230, '20220812221323', 4, 'SUB004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-06-16 20:29:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (234, 231, '20220901230257', 50, 'PLAN2022050', 50, NULL, '', NULL, NULL, 0, 0, '', '2022-06-16 21:51:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (235, 226, '20220717124046', 2, 'R20220717002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-07-17 12:40:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (236, 233, '20220717194751', 2, 'ISSUE20220717002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-07-17 19:36:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (237, 233, '20220725150745', 8, 'ISSUE20220725008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-07-25 11:16:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (238, 215, '20220727133912', 3, 'MO202207270003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-27 13:39:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (239, 229, '20220727135402', 3, 'RTV20220727003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-27 13:53:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (240, 215, '20220728231952', 1, 'MO202207280001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-07-28 23:19:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (241, 211, '20220729085519', 1, 'L011', 11, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 08:55:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (242, 211, '20220801170339', 6, 'L017', 17, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 08:55:20', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (243, 229, '20220729091253', 4, 'RTV20220729004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 08:56:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (244, 210, '20220729090520', 3, 'WH005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 09:05:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (245, 210, '20220801161858', 52, 'WH060', 60, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 09:05:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (246, 215, '20220729111608', 3, 'MO202207290003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 09:30:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (247, 219, '20220729122132', 3, 'PROCESS049', 49, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 12:21:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (248, 215, '20220730170708', 6, 'MO202207300006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-07-30 14:41:08', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (249, 226, '20220730164005', 3, 'R20220730003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-30 16:30:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (250, 219, '20220730170439', 3, 'PROCESS052', 52, NULL, '', NULL, NULL, 0, 0, '', '2022-07-30 17:02:43', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (251, 215, '20220731161554', 1, 'MO202207310001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-07-31 16:15:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (252, 226, '20220801162854', 33, 'R20220801033', 33, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 11:11:28', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (253, 215, '20220801154407', 1, 'MO202208010001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 15:44:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (254, 210, '20220801161857', 1, 'WH060', 60, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 16:18:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (255, 210, '20220801161857', 1, 'WH060', 60, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 16:18:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (256, 210, '20220809140656', 13, 'WH073', 73, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 16:26:43', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (257, 219, '20220801172652', 3, 'PROCESS055', 55, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 17:14:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (258, 215, '20220802174313', 13, 'MO202208020013', 13, NULL, '', NULL, NULL, 0, 0, '', '2022-08-02 09:27:31', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (259, 225, '20220802180956', 2, 'IQC20220802002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-02 17:54:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (260, 229, '20220802180930', 2, 'RTV20220802002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-02 18:01:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (261, 215, '20220803152758', 3, 'MO202208030003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-03 15:19:17', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (262, 218, '20220810105807', 7, 'T00017', 17, NULL, '', NULL, NULL, 0, 0, '', '2022-08-04 16:34:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (263, 209, '20220813133944', 14, 'WS026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-08-05 11:19:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (264, 226, '20220805131441', 4, 'R20220805004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-08-05 13:09:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (265, 208, '20220808161115', 4, 'V00014', 14, NULL, '', NULL, NULL, 0, 0, '', '2022-08-05 16:27:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (266, 205, '20220812160022', 12, 'ITEM00000088', 88, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 10:01:12', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (267, 229, '20220808105742', 2, 'RTV20220808002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 10:44:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (268, 207, '20220813112402', 14, 'C00024', 24, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 15:52:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (269, 208, '20220814231644', 10, 'V00024', 24, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 16:11:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (270, 219, '20220809091746', 2, 'PROCESS057', 57, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 09:17:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (271, 219, '20220813232649', 11, 'PROCESS068', 68, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 09:22:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (272, 215, '20220809173457', 7, 'MO202208090007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 12:27:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (273, 210, '20220809140657', 1, 'WH074', 74, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 14:06:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (274, 210, '20220814231315', 5, 'WH079', 79, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 14:06:58', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (275, 220, '20220813113700', 12, 'R1040', 1040, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 17:16:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (276, 226, '20220809174609', 2, 'R20220809002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 17:36:22', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (277, 211, '20220810082146', 5, 'L022', 22, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:21:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (278, 211, '20220824224223', 20, 'L042', 42, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:21:48', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (279, 212, '20220810082207', 2, 'A0013', 13, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:22:06', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (280, 212, '20220810083445', 4, 'A0017', 17, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:22:08', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (281, 218, '20220814194551', 6, 'T00023', 23, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 10:58:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (282, 215, '20220810141929', 7, 'MO202208100007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 12:30:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (283, 215, '20220811155054', 2, 'MO202208110002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-11 15:50:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (284, 215, '20220812163345', 36, 'MO202208120036', 36, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 11:40:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (285, 225, '20220812202238', 5, 'IQC20220812005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 13:54:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (286, 222, '20220822090243', 21, 'I0034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 14:20:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (287, 205, '20220813012808', 21, 'ITEM00000109', 109, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 16:00:23', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (288, 226, '20220812214513', 3, 'R20220812003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 16:51:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (289, 205, '20220813133124', 10, 'ITEM00000119', 119, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 01:28:09', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (290, 226, '20220813152657', 5, 'R20220813005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 01:47:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (291, 215, '20220813232357', 10, 'MO202208130010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 08:50:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (292, 207, '20220813134013', 7, 'C00031', 31, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 11:24:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (293, 220, '20220815153054', 12, 'R1052', 1052, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 11:37:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (294, 209, '20220816172957', 8, 'WS034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 13:39:46', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (295, 207, '20220813134017', 6, 'C00037', 37, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 13:40:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (296, 207, '20220815132333', 20, 'C00057', 57, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 13:40:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (297, 225, '20220813225044', 3, 'IQC20220813003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 15:14:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (298, 205, '20220815085111', 12, 'ITEM00000131', 131, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 21:48:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (299, 230, '20220815103546', 5, 'SUB009', 9, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 22:00:17', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (300, 206, '20220815143043', 4, 'ITEM_TYPE_0066', 66, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 23:18:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (301, 219, '20220815164921', 9, 'PROCESS077', 77, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 23:32:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (302, 215, '20220814231425', 5, 'MO202208140005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 10:40:29', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (303, 212, '20220818105233', 4, 'A0021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 11:19:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (304, 227, '20220814214249', 1, 'T026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 21:42:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (305, 227, '20220817195511', 33, 'T058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 21:42:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (306, 210, '20220817170523', 21, 'WH100', 100, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 23:13:23', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (307, 208, '20220816133617', 7, 'V00031', 31, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 23:16:45', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (308, 205, '20220815110633', 5, 'ITEM00000136', 136, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 08:51:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (309, 218, '20220823093332', 36, 'T00059', 59, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 09:53:55', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (310, 215, '20220815185151', 18, 'MO202208150018', 18, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 10:12:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (311, 226, '20220815143729', 8, 'R20220815008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 10:44:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (312, 205, '20220815140036', 3, 'ITEM00000139', 139, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 11:06:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (313, 225, '20220815111142', 1, 'IQC20220815001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 11:11:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (314, 207, '20220815132338', 6, 'C00063', 63, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 13:23:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (315, 207, '20220815132340', 4, 'C00067', 67, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 13:23:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (316, 207, '20220822100445', 95, 'C00162', 162, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 13:23:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (317, 230, '20220818164931', 21, 'SUB030', 30, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 14:40:05', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (318, 205, '20220817093425', 51, 'ITEM00000190', 190, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 15:43:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (319, 219, '20220818141839', 28, 'PROCESS105', 105, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 16:50:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (320, 229, '20220815172658', 2, 'RTV20220815002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 17:12:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (321, 220, '20220815200538', 2, 'R1054', 1054, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 19:52:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (322, 220, '20220816155501', 6, 'R1060', 1060, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 00:59:25', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (323, 226, '20220816173419', 18, 'R20220816018', 18, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 09:24:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (324, 215, '20220816232550', 38, 'MO202208160038', 38, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 10:18:25', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (325, 225, '20220816201615', 4, 'IQC20220816004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 10:32:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (326, 208, '20220816140813', 5, 'V00036', 36, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 13:36:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (327, 208, '20220823111843', 12, 'V00048', 48, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 14:08:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (328, 229, '20220816195356', 6, 'RTV20220816006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 17:35:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (329, 220, '20220818105353', 6, 'R1066', 1066, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 19:55:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (330, 217, '20220819093714', 7, 'TT032', 32, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 19:58:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (331, 215, '20220817222518', 14, 'MO202208170014', 14, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 08:47:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (332, 209, '20220820094836', 17, 'WS051', 51, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 08:55:43', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (333, 229, '20220817091138', 2, 'RTV20220817002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 09:11:36', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (334, 205, '20220818115033', 32, 'ITEM00000222', 222, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 09:34:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (335, 206, '20220822091118', 19, 'ITEM_TYPE_0085', 85, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 11:14:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (336, 226, '20220817205507', 22, 'R20220817022', 22, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 14:03:20', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (337, 225, '20220817203604', 5, 'IQC20220817005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 15:57:28', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (338, 210, '20220817170524', 1, 'WH101', 101, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 17:05:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (339, 233, '20220817231312', 6, 'ISSUE20220817006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 23:02:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (340, 226, '20220818211659', 12, 'R20220818012', 12, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 09:30:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (341, 210, '20220822145345', 35, 'WH136', 136, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 09:39:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (342, 225, '20220818165508', 12, 'IQC20220818012', 12, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 09:41:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (343, 229, '20220818180526', 7, 'RTV20220818007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 10:10:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (344, 215, '20220818230633', 77, 'MO202208180077', 77, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 10:33:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (345, 220, '20220819091351', 17, 'R1083', 1083, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 10:53:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (346, 212, '20220820170019', 5, 'A0026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 11:07:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (347, 216, '20220818164828', 11, 'WS0045', 45, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 11:39:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (348, 227, '20220818160823', 8, 'T066', 66, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 13:40:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (349, 205, '20220818134540', 1, 'ITEM00000223', 223, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 13:45:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (350, 205, '20220818141238', 3, 'ITEM00000226', 226, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 14:04:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (351, 205, '20220819101459', 33, 'ITEM00000259', 259, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 14:13:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (352, 219, '20220818144345', 2, 'PROCESS107', 107, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 14:43:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (353, 227, '20220818175718', 3, 'T069', 69, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 16:08:27', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (354, 216, '20220910104817', 51, 'WS0096', 96, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 16:48:30', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (355, 230, '20220823102743', 18, 'SUB048', 48, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 16:56:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (356, 227, '20220820110823', 7, 'T076', 76, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 17:57:45', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (357, 219, '20220824212645', 79, 'PROCESS186', 186, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 00:22:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (358, 226, '20220819211451', 22, 'R20220819022', 22, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 08:46:50', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (359, 215, '20220819211957', 44, 'MO202208190044', 44, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 08:47:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (360, 225, '20220819213654', 41, 'IQC20220819041', 41, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 08:49:46', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (361, 214, '20220821094813', 15, 'M0041', 41, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 09:12:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (362, 220, '20220819173023', 13, 'R1096', 1096, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 09:13:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (363, 217, '20220821133355', 15, 'TT047', 47, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 09:37:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (364, 236, '20220819111319', 3, '32323232323232323232323232ITEM_TYPE_', 14, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 11:13:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (365, 236, '20220819142129', 64, 'IF2022081929', 72, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 11:16:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (366, 236, '20220819145515', 12, 'IF2022081915', 1094, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 14:21:30', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (367, 236, '20220819205101', 16, 'IF2022081901', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 16:18:20', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (368, 236, '20220823103219', 76, 'IF2022082319', 48, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 20:51:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (369, 229, '20220819205514', 1, 'RTV20220819001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 20:55:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (370, 220, '20220824213017', 25, 'R1121', 1121, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 21:12:27', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (371, 209, '20220820160129', 7, 'WS058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 09:48:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (372, 215, '20220820222241', 39, 'MO202208200039', 39, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 10:00:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (373, 226, '20220820215444', 21, 'R20220820021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 10:13:38', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (374, 227, '20220820110825', 2, 'T078', 78, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 11:08:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (375, 227, '20220820220731', 17, 'T095', 95, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 11:08:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (376, 225, '20220820160353', 3, 'IQC20220820003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 13:27:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (377, 209, '20220824222208', 21, 'WS079', 79, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 16:01:30', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (378, 227, '20220823083639', 10, 'T105', 105, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 22:07:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (379, 215, '20220821192938', 5, 'MO202208210005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 00:51:58', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (380, 214, '20220821094815', 1, 'M0042', 42, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 09:48:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (381, 212, '20220902103729', 4, 'A0030', 30, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 13:28:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (382, 214, '20220823173340', 13, 'M0055', 55, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 13:31:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (383, 217, '20220823205336', 11, 'TT058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 13:45:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (384, 226, '20220821225220', 7, 'R20220821007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 15:16:36', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (385, 215, '20220822234830', 19, 'MO202208220019', 19, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 08:38:59', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (386, 226, '20220822192029', 25, 'R20220822025', 25, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 08:48:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (387, 219, '20220822090456', 1, 'PROCESS140', 140, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:04:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (388, 219, '20220822090503', 1, 'PROCESS152', 152, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:05:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (389, 206, '20220824214316', 7, 'ITEM_TYPE_0092', 92, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:11:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (390, 229, '20220822155824', 7, 'RTV20220822007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:13:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (391, 207, '20220822100442', 1, 'C00153', 153, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 10:04:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (392, 207, '20220822102252', 5, 'C00167', 167, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 10:05:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (393, 207, '20220824215506', 31, 'C00198', 198, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 10:22:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (394, 210, '20220823083833', 3, 'WH139', 139, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 14:53:46', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (395, 225, '20220822154721', 1, 'IQC20220822001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 15:47:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (396, 226, '20220823203609', 20, 'R20220823020', 20, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 00:41:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (397, 215, '20220823200644', 52, 'MO202208230052', 52, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 07:51:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (398, 210, '20220824224111', 17, 'WH156', 156, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 08:38:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (399, 229, '20220823205401', 5, 'RTV20220823005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 08:43:32', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (400, 227, '20220823184025', 12, 'T117', 117, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 08:58:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (401, 225, '20220823192837', 7, 'IQC20220823007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 09:47:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (402, 236, '20220823173612', 17, 'IF2022082312', 51, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 10:41:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (403, 208, '20220823181426', 10, 'V00058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 15:09:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (404, 236, '20220823192141', 10, 'IF2022082341', 154, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 19:08:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (405, 236, '20220824215239', 10, 'IF2022082439', 92, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 19:21:45', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (406, 215, '20220828084935', 6, 'MO202208280006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-08-28 08:36:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (407, 237, '20220829224554', 4, 'IPQC202208290004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-08-29 22:09:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (408, 225, '20220831211548', 3, 'IQC20220831003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-31 20:57:09', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (409, 238, '20220901212705', 4, 'OQC20220901004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-09-01 20:35:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (410, 226, '20220902104056', 4, 'R20220902004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-09-02 10:36:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (411, 233, '20220902104302', 1, 'ISSUE20220902001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-02 10:43:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (412, 239, '20220904223417', 10, 'PBACK20220904010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-09-03 23:50:32', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (413, 237, '20220909211934', 1, 'IPQC202209090001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-09 21:19:38', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (414, 226, '20220910111422', 2, 'R20220910002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-10 10:57:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (415, 226, '20220912232033', 1, 'R20220912001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-12 23:20:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (416, 226, '20220913223354', 1, 'R20220913001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-13 22:33:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (417, 233, '20220913225049', 2, 'ISSUE20220913002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-13 22:35:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (418, 240, '20220915232017', 1, 'RT202209150001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-15 23:20:17', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (419, 226, '20220916212404', 1, 'R20220916001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-16 21:24:06', '', NULL); + +-- ---------------------------- +-- Table structure for sys_auto_code_rule +-- ---------------------------- +DROP TABLE IF EXISTS `sys_auto_code_rule`; +CREATE TABLE `sys_auto_code_rule` ( + `rule_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '规则ID', + `rule_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则编码', + `rule_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则名称', + `rule_desc` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `max_length` int(11) NULL DEFAULT NULL COMMENT '最大长度', + `is_padded` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '是否补齐', + `padded_char` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '补齐字符', + `padded_method` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'L' COMMENT '补齐方式', + `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Y' COMMENT '是否启用', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT 0 COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT 0 COMMENT '预留字段4', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`rule_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 241 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '编码生成规则表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_auto_code_rule +-- ---------------------------- +INSERT INTO `sys_auto_code_rule` VALUES (206, 'ITEM_TYPE_CODE', '物料分类编码', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 23:01:09', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (207, 'CLIENT_CODE', '客户编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 21:20:29', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (208, 'VENDOR_CODE', '供应商编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 22:50:13', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (209, 'WORKSHOP_CODE', '车间编码生成规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 17:48:52', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (210, 'WAREHOUSE_CODE', '仓库编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 21:59:51', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (211, 'LOCATION_CODE', '库区编码生成规则', NULL, 4, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 14:49:56', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (212, 'AREA_CODE', '库位编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 18:38:08', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (213, 'MACHINERY_TYPE_CODE', '设备类型编码规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 19:46:09', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (214, 'MACHINERY_CODE', '设备编码规则', NULL, 13, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 21:26:39', 'admin', '2022-08-23 09:15:17'); +INSERT INTO `sys_auto_code_rule` VALUES (215, 'WORKORDER_CODE', '生产工单编码规则1', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:39:59', 'admin', '2022-08-20 09:12:40'); +INSERT INTO `sys_auto_code_rule` VALUES (216, 'WORKSTATION_CODE', '工作站编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-10 21:55:24', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (217, 'TOOL_TYPE_CODE', '工装夹具类型编码', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 00:21:37', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (218, 'TOOL_CODE', '工装夹具编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 22:07:17', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (219, 'PROCESS_CODE', '工序编码规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 00:09:45', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (220, 'ROUTE_CODE', '工艺流程编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 23:06:36', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (221, 'TASK_CODE', '生产任务编码规则', NULL, 12, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:22:29', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (222, 'QC_INDEX_CODE', '检测项编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 21:57:23', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (223, 'QC_TEMPLATE_CODE', '检测模板编码规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:43:08', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (224, 'DEFECT_CODE', '常见缺陷编码', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 11:33:27', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (225, 'QC_IQC_CODE', '来料检验单编码规则', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:28:07', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (226, 'ITEMRECPT_CODE', '物料入库单编码规则', NULL, 12, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:51:29', 'admin', '2022-05-22 20:53:12'); +INSERT INTO `sys_auto_code_rule` VALUES (227, 'CAL_TEAM_CODE', '班组编码规则', NULL, 4, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 19:54:22', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (228, 'CAL_PLAN_CODE', '排班计划编号', NULL, 11, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:08:10', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (229, 'WM_RTVENDOR_CODE', '供应商退货单编码', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 15:48:07', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (230, 'SUBJECT_CODE', '设备点检保养项目编码', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 20:27:54', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (231, 'CHECKPLAN_CODE', '点检编码规则', NULL, 11, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:50:00', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (232, 'BATCH_CODE', '批次规则', NULL, 11, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-14 12:02:10', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (233, 'ISSUE_CODE', '生产领料单编码', NULL, 16, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:32:10', 'admin', '2022-07-17 19:32:57'); +INSERT INTO `sys_auto_code_rule` VALUES (234, '1', '2', NULL, 1, 'Y', '3', 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-29 16:34:20', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (236, 'ITEM_CODE', '物料规则', NULL, 10, 'N', '32', 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-08-19 10:44:20', 'admin', '2022-08-19 11:26:02'); +INSERT INTO `sys_auto_code_rule` VALUES (237, 'IPQC_CODE', '过程检验单编码', NULL, 16, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:07:13', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (238, 'OQC_CODE', '出货编码规则', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:30:31', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (239, 'PBACK_CODE', '生产退料单编码', '生产退料单编码', 16, 'N', '0', 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:47:11', 'admin', '2022-09-03 23:47:57'); +INSERT INTO `sys_auto_code_rule` VALUES (240, 'RTISSUE_CODE', '生产退库单编号规则', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:18:40', 'admin', '2022-09-15 23:19:04'); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/sys_auto_code_part.sql b/doc/实施文档/sys_auto_code_part.sql new file mode 100644 index 0000000..0e2f5a5 --- /dev/null +++ b/doc/实施文档/sys_auto_code_part.sql @@ -0,0 +1,137 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_auto_code_part +-- ---------------------------- +DROP TABLE IF EXISTS `sys_auto_code_part`; +CREATE TABLE `sys_auto_code_part` ( + `part_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分段ID', + `rule_id` bigint(20) NOT NULL COMMENT '规则ID', + `part_index` int(11) NOT NULL COMMENT '分段序号', + `part_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分段类型,INPUTCHAR:输入字符,NOWDATE:当前日期时间,FIXCHAR:固定字符,SERIALNO:流水号', + `part_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分段编号', + `part_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分段名称', + `part_length` int(11) NOT NULL COMMENT '分段长度', + `date_format` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `input_character` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '输入字符', + `fix_character` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '固定字符', + `seria_start_no` int(11) NULL DEFAULT NULL COMMENT '流水号起始值', + `seria_step` int(11) NULL DEFAULT NULL COMMENT '流水号步长', + `seria_now_no` int(11) NULL DEFAULT NULL COMMENT '流水号当前值', + `cycle_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流水号是否循环', + `cycle_method` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '循环方式,YEAR:按年,MONTH:按月,DAY:按天,HOUR:按小时,MINITE:按分钟,OTHER:按传入字符变', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT 0 COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT 0 COMMENT '预留字段4', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`part_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 304 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '编码生成规则组成表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_auto_code_part +-- ---------------------------- +INSERT INTO `sys_auto_code_part` VALUES (200, 205, 2, 'SERIALNO', 'P1', '流水号', 8, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 21:13:17', 'admin', '2022-04-26 22:47:49'); +INSERT INTO `sys_auto_code_part` VALUES (201, 205, 1, 'FIXCHAR', 'P0', '前缀', 4, NULL, NULL, 'ITEM', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 22:44:03', 'admin', '2022-08-15 15:59:19'); +INSERT INTO `sys_auto_code_part` VALUES (202, 206, 1, 'FIXCHAR', 'P1', '前缀', 10, NULL, NULL, 'ITEM_TYPE_', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 23:02:12', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (203, 206, 2, 'SERIALNO', 'P2', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 23:02:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (204, 207, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'C', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 21:21:04', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (205, 207, 2, 'SERIALNO', 'SERIAL', '流水号部分', 5, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 21:21:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (206, 208, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'V', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 22:50:38', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (207, 208, 2, 'SERIALNO', 'SERIAL', '流水号', 5, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 22:51:02', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (208, 209, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'WS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 17:49:16', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (209, 209, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 17:49:40', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (210, 210, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'WH', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 22:00:17', 'admin', '2022-08-16 18:58:36'); +INSERT INTO `sys_auto_code_part` VALUES (211, 210, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 22:00:40', 'admin', '2022-07-30 11:26:14'); +INSERT INTO `sys_auto_code_part` VALUES (212, 211, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'L', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 14:50:29', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (213, 211, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 14:52:12', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (214, 212, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'A', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 18:38:29', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (215, 212, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 18:38:51', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (216, 213, 1, 'FIXCHAR', 'PREFIX', '前缀', 7, NULL, NULL, 'M_TYPE_', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 19:46:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (217, 213, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 19:47:03', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (218, 214, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'M', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 21:26:59', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (219, 214, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 21:27:18', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (220, 215, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'MO', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:40:23', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (222, 215, 2, 'NOWDATE', 'DATEPART', '年月日部分', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:58:57', 'admin', '2022-05-09 12:46:34'); +INSERT INTO `sys_auto_code_part` VALUES (223, 215, 3, 'SERIALNO', 'SERIAL', '流水号部分', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:59:31', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (224, 216, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'WS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-10 21:55:51', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (225, 216, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-10 21:56:19', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (226, 217, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'TT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 00:22:02', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (227, 217, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 00:22:25', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (228, 218, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'T', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 22:07:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (229, 218, 2, 'SERIALNO', 'SERIAL', '流水号', 5, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 22:08:17', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (230, 219, 1, 'FIXCHAR', 'PREFIX', '前缀', 7, NULL, NULL, 'PROCESS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 00:10:13', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (231, 219, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 00:10:33', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (232, 220, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'R', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 23:07:01', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (233, 220, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1000, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 23:07:23', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (234, 221, 1, 'FIXCHAR', 'PREFIX', '固定前缀', 4, NULL, NULL, 'TASK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:22:53', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (235, 221, 2, 'NOWDATE', 'YEAR', '年份', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:23:39', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (236, 221, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:24:03', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (237, 222, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'I', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 21:57:46', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (238, 222, 2, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 21:58:05', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (239, 223, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'QCT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:43:31', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (240, 223, 2, 'NOWDATE', 'YEAR', '年份', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:44:04', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (241, 223, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:44:25', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (242, 224, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'DF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 11:33:52', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (243, 224, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 11:34:11', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (244, 225, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'IQC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:29:59', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (245, 225, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:30:28', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (246, 225, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:31:00', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (247, 226, 1, 'FIXCHAR', 'PREFIX', '前缀', 1, NULL, NULL, 'R', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:51:47', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (248, 226, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:52:10', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (249, 226, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:52:58', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (250, 227, 1, 'FIXCHAR', 'PREFIX', '固定前缀', 1, NULL, NULL, 'T', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 19:54:45', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (251, 227, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 19:55:06', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (252, 228, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'PLAN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:08:39', 'admin', '2022-07-31 16:42:59'); +INSERT INTO `sys_auto_code_part` VALUES (253, 228, 2, 'NOWDATE', 'YEAR', '年', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:08:59', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (254, 228, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:09:24', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (255, 229, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'RTV', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 16:06:14', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (256, 229, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 16:06:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (257, 229, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 16:07:10', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (258, 230, 1, 'FIXCHAR', 'PREFIX', '固定前缀', 3, NULL, NULL, 'SUB', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 20:28:22', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (259, 230, 2, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 20:28:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (260, 231, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'PLAN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:50:22', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (261, 231, 2, 'NOWDATE', 'YEAR', '年份', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:50:43', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (262, 231, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:51:07', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (263, 232, 1, 'FIXCHAR', '1', '1', 3, NULL, NULL, 'BAT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-14 12:02:54', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (264, 232, 2, 'NOWDATE', '2', '2', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-14 12:03:16', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (265, 233, 1, 'FIXCHAR', 'PREFIX', '前缀', 5, NULL, NULL, 'ISSUE', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:32:46', 'admin', '2022-07-17 19:35:44'); +INSERT INTO `sys_auto_code_part` VALUES (266, 233, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:33:22', 'admin', '2022-07-17 19:35:57'); +INSERT INTO `sys_auto_code_part` VALUES (267, 233, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:33:45', 'admin', '2022-07-17 19:36:05'); +INSERT INTO `sys_auto_code_part` VALUES (271, 234, 1, 'INPUTCHAR', 'PREFIX', '1', 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-07-30 14:20:49', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (275, 236, 1, 'FIXCHAR', '前缀', '固定字符', 2, NULL, NULL, 'IF', NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-19 10:48:20', 'admin', '2022-08-19 14:13:30'); +INSERT INTO `sys_auto_code_part` VALUES (276, 236, 2, 'NOWDATE', '后缀', '固定字段', 4, 'yyyyMMddss', NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-19 14:12:19', 'admin', '2022-08-19 14:19:39'); +INSERT INTO `sys_auto_code_part` VALUES (277, 237, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'IPQC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:07:43', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (278, 237, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:08:18', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (279, 237, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:08:46', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (280, 238, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'OQC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:30:53', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (281, 238, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:32:11', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (282, 238, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:32:38', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (283, 239, 1, 'FIXCHAR', '001', '前缀', 5, NULL, NULL, 'PBACK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:49:07', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (284, 239, 2, 'NOWDATE', '002', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:49:31', 'admin', '2022-09-03 23:49:44'); +INSERT INTO `sys_auto_code_part` VALUES (285, 239, 3, 'SERIALNO', '003', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'N', NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:50:10', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (286, 240, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'RT', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:19:25', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (287, 240, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:19:47', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (288, 240, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:20:09', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (289, 241, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'PR', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-23 10:58:17', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (290, 241, 2, 'NOWDATE', 'DATE', '年月日', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-23 10:58:44', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (291, 241, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-23 10:59:06', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (292, 242, 1, 'FIXCHAR', 'PREFIX', '前缀', 3, NULL, NULL, 'REP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-28 22:01:19', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (293, 242, 2, 'NOWDATE', 'DATE', '日期', 4, 'yyyy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-09-28 22:01:39', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (294, 242, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'YEAR', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-28 22:02:00', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (295, 243, 1, 'FIXCHAR', 'PERFIX', '前缀', 2, NULL, NULL, 'PS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-10-05 19:46:02', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (296, 243, 2, 'NOWDATE', 'DATA', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-10-05 19:46:24', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (297, 243, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-10-05 19:46:48', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (298, 244, 1, 'FIXCHAR', 'PREFIX', '前缀', 2, NULL, NULL, 'RS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-10-06 21:40:42', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (299, 244, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-10-06 21:41:03', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (300, 244, 3, 'SERIALNO', 'SERIAL', '流水号', 3, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-10-06 21:41:22', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (301, 245, 1, 'FIXCHAR', 'PREFIX', '前缀', 4, NULL, NULL, 'PACK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-10-11 01:22:38', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (302, 245, 2, 'NOWDATE', 'DATE', '日期', 8, 'yyyyMMdd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 'admin', '2022-10-11 01:23:09', '', NULL); +INSERT INTO `sys_auto_code_part` VALUES (303, 245, 3, 'SERIALNO', 'SERIAL', '流水号', 4, NULL, NULL, NULL, 1, 1, NULL, 'Y', 'DAY', NULL, NULL, NULL, 0, 0, 'admin', '2022-10-11 01:23:35', '', NULL); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/sys_auto_code_result.sql b/doc/实施文档/sys_auto_code_result.sql new file mode 100644 index 0000000..72bfd6a --- /dev/null +++ b/doc/实施文档/sys_auto_code_result.sql @@ -0,0 +1,259 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_auto_code_result +-- ---------------------------- +DROP TABLE IF EXISTS `sys_auto_code_result`; +CREATE TABLE `sys_auto_code_result` ( + `code_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '记录ID', + `rule_id` bigint(20) NOT NULL COMMENT '规则ID', + `gen_date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '生成日期时间', + `gen_index` int(11) NULL DEFAULT NULL COMMENT '最后产生的序号', + `last_result` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '最后产生的值', + `last_serial_no` int(11) NULL DEFAULT NULL COMMENT '最后产生的流水号', + `last_input_char` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '最后传入的参数', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT 0 COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT 0 COMMENT '预留字段4', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`code_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 430 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '编码生成记录表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_auto_code_result +-- ---------------------------- +INSERT INTO `sys_auto_code_result` VALUES (200, 205, '20220808095803', 76, 'ITEM00000076', 76, NULL, '', NULL, NULL, 0, 0, '', '2022-04-26 22:28:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (201, 206, '20220813231829', 62, 'ITEM_TYPE_0062', 62, NULL, '', NULL, NULL, 0, 0, '', '2022-04-27 10:17:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (202, 207, '20220802144206', 10, 'C00010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-06 21:22:23', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (203, 208, '20220805160743', 10, 'V00010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-06 22:52:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (204, 209, '20220805111938', 12, 'WS012', 12, NULL, '', NULL, NULL, 0, 0, '', '2022-05-07 17:54:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (205, 210, '20220729090506', 2, 'WH002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-05-07 22:01:31', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (206, 211, '20220729085518', 10, 'L010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 14:52:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (207, 212, '20220810082205', 11, 'A0011', 11, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 18:39:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (208, 213, '20220823091541', 24, 'M_TYPE_024', 24, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 19:47:31', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (209, 214, '20220819091251', 26, 'M0026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-05-08 21:38:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (210, 215, '20220509234547', 21, 'MO202205090021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-05-09 12:46:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (212, 216, '20220818103207', 34, 'WS0034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-05-10 21:59:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (213, 217, '20220816195823', 25, 'TT025', 25, NULL, '', NULL, NULL, 0, 0, '', '2022-05-11 00:22:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (214, 218, '20220804162652', 10, 'T00010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-05-11 22:35:05', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (215, 219, '20220729122036', 46, 'PROCESS046', 46, NULL, '', NULL, NULL, 0, 0, '', '2022-05-12 00:10:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (217, 220, '20220809171633', 29, 'R1028', 1028, NULL, '', NULL, NULL, 0, 0, '', '2022-05-12 23:11:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (219, 215, '20220514155158', 26, 'MO202205140026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-05-14 15:24:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (220, 215, '20220515134342', 5, 'MO202205150005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-05-15 13:41:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (221, 221, '20220927111039', 87, 'TASK20220087', 87, NULL, '', NULL, NULL, 0, 0, '', '2022-05-15 18:29:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (222, 222, '20220812142031', 13, 'I0013', 13, NULL, '', NULL, NULL, 0, 0, '', '2022-05-17 21:58:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (223, 223, '20220901212456', 42, 'QCT2022042', 42, NULL, '', NULL, NULL, 0, 0, '', '2022-05-17 22:44:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (224, 224, '20220819144546', 8, 'DF008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-05-19 11:37:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (225, 225, '20220519230422', 21, 'IQC20220519021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-05-19 16:49:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (226, 226, '20220522220740', 8, 'R20220522008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-05-22 20:53:25', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (227, 227, '20220814214249', 25, 'T025', 25, NULL, '', NULL, NULL, 0, 0, '', '2022-06-06 19:55:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (228, 228, '20220823150049', 121, 'PLAN2022121', 121, NULL, '', NULL, NULL, 0, 0, '', '2022-06-06 22:09:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (229, 229, '20220613162434', 2, 'RTV20220613002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-06-13 16:19:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (230, 226, '20220613164021', 1, 'R20220613001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-06-13 16:40:22', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (231, 229, '20220614161107', 3, 'RTV20220614003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-06-14 11:11:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (232, 226, '20220614122043', 3, 'R20220614003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-06-14 11:34:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (233, 230, '20220812221323', 4, 'SUB004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-06-16 20:29:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (234, 231, '20220901230257', 50, 'PLAN2022050', 50, NULL, '', NULL, NULL, 0, 0, '', '2022-06-16 21:51:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (235, 226, '20220717124046', 2, 'R20220717002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-07-17 12:40:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (236, 233, '20220717194751', 2, 'ISSUE20220717002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-07-17 19:36:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (237, 233, '20220725150745', 8, 'ISSUE20220725008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-07-25 11:16:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (238, 215, '20220727133912', 3, 'MO202207270003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-27 13:39:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (239, 229, '20220727135402', 3, 'RTV20220727003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-27 13:53:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (240, 215, '20220728231952', 1, 'MO202207280001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-07-28 23:19:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (241, 211, '20220729085519', 1, 'L011', 11, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 08:55:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (242, 211, '20220801170339', 6, 'L017', 17, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 08:55:20', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (243, 229, '20220729091253', 4, 'RTV20220729004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 08:56:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (244, 210, '20220729090520', 3, 'WH005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 09:05:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (245, 210, '20220801161858', 52, 'WH060', 60, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 09:05:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (246, 215, '20220729111608', 3, 'MO202207290003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 09:30:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (247, 219, '20220729122132', 3, 'PROCESS049', 49, NULL, '', NULL, NULL, 0, 0, '', '2022-07-29 12:21:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (248, 215, '20220730170708', 6, 'MO202207300006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-07-30 14:41:08', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (249, 226, '20220730164005', 3, 'R20220730003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-07-30 16:30:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (250, 219, '20220730170439', 3, 'PROCESS052', 52, NULL, '', NULL, NULL, 0, 0, '', '2022-07-30 17:02:43', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (251, 215, '20220731161554', 1, 'MO202207310001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-07-31 16:15:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (252, 226, '20220801162854', 33, 'R20220801033', 33, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 11:11:28', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (253, 215, '20220801154407', 1, 'MO202208010001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 15:44:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (254, 210, '20220801161857', 1, 'WH060', 60, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 16:18:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (255, 210, '20220801161857', 1, 'WH060', 60, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 16:18:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (256, 210, '20220809140656', 13, 'WH073', 73, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 16:26:43', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (257, 219, '20220801172652', 3, 'PROCESS055', 55, NULL, '', NULL, NULL, 0, 0, '', '2022-08-01 17:14:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (258, 215, '20220802174313', 13, 'MO202208020013', 13, NULL, '', NULL, NULL, 0, 0, '', '2022-08-02 09:27:31', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (259, 225, '20220802180956', 2, 'IQC20220802002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-02 17:54:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (260, 229, '20220802180930', 2, 'RTV20220802002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-02 18:01:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (261, 215, '20220803152758', 3, 'MO202208030003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-03 15:19:17', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (262, 218, '20220810105807', 7, 'T00017', 17, NULL, '', NULL, NULL, 0, 0, '', '2022-08-04 16:34:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (263, 209, '20220813133944', 14, 'WS026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-08-05 11:19:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (264, 226, '20220805131441', 4, 'R20220805004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-08-05 13:09:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (265, 208, '20220808161115', 4, 'V00014', 14, NULL, '', NULL, NULL, 0, 0, '', '2022-08-05 16:27:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (266, 205, '20220812160022', 12, 'ITEM00000088', 88, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 10:01:12', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (267, 229, '20220808105742', 2, 'RTV20220808002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 10:44:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (268, 207, '20220813112402', 14, 'C00024', 24, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 15:52:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (269, 208, '20220814231644', 10, 'V00024', 24, NULL, '', NULL, NULL, 0, 0, '', '2022-08-08 16:11:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (270, 219, '20220809091746', 2, 'PROCESS057', 57, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 09:17:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (271, 219, '20220813232649', 11, 'PROCESS068', 68, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 09:22:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (272, 215, '20220809173457', 7, 'MO202208090007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 12:27:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (273, 210, '20220809140657', 1, 'WH074', 74, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 14:06:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (274, 210, '20220814231315', 5, 'WH079', 79, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 14:06:58', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (275, 220, '20220813113700', 12, 'R1040', 1040, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 17:16:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (276, 226, '20220809174609', 2, 'R20220809002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-09 17:36:22', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (277, 211, '20220810082146', 5, 'L022', 22, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:21:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (278, 211, '20220927131733', 23, 'L045', 45, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:21:48', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (279, 212, '20220810082207', 2, 'A0013', 13, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:22:06', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (280, 212, '20220810083445', 4, 'A0017', 17, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 08:22:08', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (281, 218, '20220814194551', 6, 'T00023', 23, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 10:58:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (282, 215, '20220810141929', 7, 'MO202208100007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-10 12:30:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (283, 215, '20220811155054', 2, 'MO202208110002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-11 15:50:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (284, 215, '20220812163345', 36, 'MO202208120036', 36, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 11:40:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (285, 225, '20220812202238', 5, 'IQC20220812005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 13:54:10', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (286, 222, '20220822090243', 21, 'I0034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 14:20:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (287, 205, '20220813012808', 21, 'ITEM00000109', 109, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 16:00:23', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (288, 226, '20220812214513', 3, 'R20220812003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-12 16:51:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (289, 205, '20220813133124', 10, 'ITEM00000119', 119, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 01:28:09', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (290, 226, '20220813152657', 5, 'R20220813005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 01:47:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (291, 215, '20220813232357', 10, 'MO202208130010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 08:50:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (292, 207, '20220813134013', 7, 'C00031', 31, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 11:24:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (293, 220, '20220815153054', 12, 'R1052', 1052, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 11:37:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (294, 209, '20220816172957', 8, 'WS034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 13:39:46', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (295, 207, '20220813134017', 6, 'C00037', 37, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 13:40:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (296, 207, '20220815132333', 20, 'C00057', 57, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 13:40:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (297, 225, '20220813225044', 3, 'IQC20220813003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 15:14:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (298, 205, '20220815085111', 12, 'ITEM00000131', 131, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 21:48:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (299, 230, '20220815103546', 5, 'SUB009', 9, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 22:00:17', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (300, 206, '20220815143043', 4, 'ITEM_TYPE_0066', 66, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 23:18:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (301, 219, '20220815164921', 9, 'PROCESS077', 77, NULL, '', NULL, NULL, 0, 0, '', '2022-08-13 23:32:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (302, 215, '20220814231425', 5, 'MO202208140005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 10:40:29', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (303, 212, '20220818105233', 4, 'A0021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 11:19:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (304, 227, '20220814214249', 1, 'T026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 21:42:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (305, 227, '20220817195511', 33, 'T058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 21:42:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (306, 210, '20220817170523', 21, 'WH100', 100, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 23:13:23', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (307, 208, '20220816133617', 7, 'V00031', 31, NULL, '', NULL, NULL, 0, 0, '', '2022-08-14 23:16:45', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (308, 205, '20220815110633', 5, 'ITEM00000136', 136, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 08:51:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (309, 218, '20220823093332', 36, 'T00059', 59, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 09:53:55', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (310, 215, '20220815185151', 18, 'MO202208150018', 18, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 10:12:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (311, 226, '20220815143729', 8, 'R20220815008', 8, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 10:44:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (312, 205, '20220815140036', 3, 'ITEM00000139', 139, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 11:06:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (313, 225, '20220815111142', 1, 'IQC20220815001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 11:11:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (314, 207, '20220815132338', 6, 'C00063', 63, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 13:23:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (315, 207, '20220815132340', 4, 'C00067', 67, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 13:23:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (316, 207, '20220822100445', 95, 'C00162', 162, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 13:23:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (317, 230, '20220818164931', 21, 'SUB030', 30, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 14:40:05', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (318, 205, '20220817093425', 51, 'ITEM00000190', 190, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 15:43:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (319, 219, '20220818141839', 28, 'PROCESS105', 105, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 16:50:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (320, 229, '20220815172658', 2, 'RTV20220815002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 17:12:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (321, 220, '20220815200538', 2, 'R1054', 1054, NULL, '', NULL, NULL, 0, 0, '', '2022-08-15 19:52:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (322, 220, '20220816155501', 6, 'R1060', 1060, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 00:59:25', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (323, 226, '20220816173419', 18, 'R20220816018', 18, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 09:24:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (324, 215, '20220816232550', 38, 'MO202208160038', 38, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 10:18:25', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (325, 225, '20220816201615', 4, 'IQC20220816004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 10:32:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (326, 208, '20220816140813', 5, 'V00036', 36, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 13:36:19', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (327, 208, '20220823111843', 12, 'V00048', 48, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 14:08:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (328, 229, '20220816195356', 6, 'RTV20220816006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 17:35:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (329, 220, '20220818105353', 6, 'R1066', 1066, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 19:55:41', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (330, 217, '20220819093714', 7, 'TT032', 32, NULL, '', NULL, NULL, 0, 0, '', '2022-08-16 19:58:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (331, 215, '20220817222518', 14, 'MO202208170014', 14, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 08:47:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (332, 209, '20220820094836', 17, 'WS051', 51, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 08:55:43', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (333, 229, '20220817091138', 2, 'RTV20220817002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 09:11:36', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (334, 205, '20220818115033', 32, 'ITEM00000222', 222, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 09:34:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (335, 206, '20220822091118', 19, 'ITEM_TYPE_0085', 85, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 11:14:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (336, 226, '20220817205507', 22, 'R20220817022', 22, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 14:03:20', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (337, 225, '20220817203604', 5, 'IQC20220817005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 15:57:28', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (338, 210, '20220817170524', 1, 'WH101', 101, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 17:05:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (339, 233, '20220817231312', 6, 'ISSUE20220817006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-08-17 23:02:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (340, 226, '20220818211659', 12, 'R20220818012', 12, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 09:30:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (341, 210, '20220822145345', 35, 'WH136', 136, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 09:39:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (342, 225, '20220818165508', 12, 'IQC20220818012', 12, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 09:41:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (343, 229, '20220818180526', 7, 'RTV20220818007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 10:10:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (344, 215, '20220818230633', 77, 'MO202208180077', 77, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 10:33:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (345, 220, '20220819091351', 17, 'R1083', 1083, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 10:53:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (346, 212, '20220820170019', 5, 'A0026', 26, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 11:07:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (347, 216, '20220818164828', 11, 'WS0045', 45, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 11:39:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (348, 227, '20220818160823', 8, 'T066', 66, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 13:40:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (349, 205, '20220818134540', 1, 'ITEM00000223', 223, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 13:45:40', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (350, 205, '20220818141238', 3, 'ITEM00000226', 226, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 14:04:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (351, 205, '20220819101459', 33, 'ITEM00000259', 259, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 14:13:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (352, 219, '20220818144345', 2, 'PROCESS107', 107, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 14:43:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (353, 227, '20220818175718', 3, 'T069', 69, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 16:08:27', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (354, 216, '20220927110257', 73, 'WS0118', 118, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 16:48:30', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (355, 230, '20220823102743', 18, 'SUB048', 48, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 16:56:44', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (356, 227, '20220820110823', 7, 'T076', 76, NULL, '', NULL, NULL, 0, 0, '', '2022-08-18 17:57:45', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (357, 219, '20220927100835', 87, 'PROCESS194', 194, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 00:22:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (358, 226, '20220819211451', 22, 'R20220819022', 22, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 08:46:50', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (359, 215, '20220819211957', 44, 'MO202208190044', 44, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 08:47:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (360, 225, '20220819213654', 41, 'IQC20220819041', 41, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 08:49:46', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (361, 214, '20220821094813', 15, 'M0041', 41, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 09:12:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (362, 220, '20220819173023', 13, 'R1096', 1096, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 09:13:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (363, 217, '20220821133355', 15, 'TT047', 47, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 09:37:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (364, 236, '20220819111319', 3, '32323232323232323232323232ITEM_TYPE_', 14, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 11:13:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (365, 236, '20220819142129', 64, 'IF2022081929', 72, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 11:16:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (366, 236, '20220819145515', 12, 'IF2022081915', 1094, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 14:21:30', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (367, 236, '20220819205101', 16, 'IF2022081901', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 16:18:20', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (368, 236, '20220823103219', 76, 'IF2022082319', 48, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 20:51:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (369, 229, '20220819205514', 1, 'RTV20220819001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 20:55:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (370, 220, '20220927100854', 26, 'R1122', 1122, NULL, '', NULL, NULL, 0, 0, '', '2022-08-19 21:12:27', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (371, 209, '20220820160129', 7, 'WS058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 09:48:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (372, 215, '20220820222241', 39, 'MO202208200039', 39, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 10:00:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (373, 226, '20220820215444', 21, 'R20220820021', 21, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 10:13:38', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (374, 227, '20220820110825', 2, 'T078', 78, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 11:08:24', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (375, 227, '20220820220731', 17, 'T095', 95, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 11:08:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (376, 225, '20220820160353', 3, 'IQC20220820003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 13:27:37', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (377, 209, '20220927105615', 22, 'WS080', 80, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 16:01:30', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (378, 227, '20220823083639', 10, 'T105', 105, NULL, '', NULL, NULL, 0, 0, '', '2022-08-20 22:07:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (379, 215, '20220821192938', 5, 'MO202208210005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 00:51:58', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (380, 214, '20220821094815', 1, 'M0042', 42, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 09:48:15', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (381, 212, '20221005194759', 8, 'A0034', 34, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 13:28:13', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (382, 214, '20220823173340', 13, 'M0055', 55, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 13:31:39', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (383, 217, '20220823205336', 11, 'TT058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 13:45:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (384, 226, '20220821225220', 7, 'R20220821007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-21 15:16:36', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (385, 215, '20220822234830', 19, 'MO202208220019', 19, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 08:38:59', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (386, 226, '20220822192029', 25, 'R20220822025', 25, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 08:48:16', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (387, 219, '20220822090456', 1, 'PROCESS140', 140, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:04:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (388, 219, '20220822090503', 1, 'PROCESS152', 152, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:05:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (389, 206, '20220927101231', 10, 'ITEM_TYPE_0095', 95, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:11:56', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (390, 229, '20220822155824', 7, 'RTV20220822007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 09:13:49', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (391, 207, '20220822100442', 1, 'C00153', 153, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 10:04:42', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (392, 207, '20220822102252', 5, 'C00167', 167, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 10:05:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (393, 207, '20220927102713', 32, 'C00199', 199, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 10:22:53', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (394, 210, '20220823083833', 3, 'WH139', 139, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 14:53:46', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (395, 225, '20220822154721', 1, 'IQC20220822001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-08-22 15:47:21', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (396, 226, '20220823203609', 20, 'R20220823020', 20, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 00:41:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (397, 215, '20220823200644', 52, 'MO202208230052', 52, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 07:51:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (398, 210, '20220927131638', 18, 'WH157', 157, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 08:38:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (399, 229, '20220823205401', 5, 'RTV20220823005', 5, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 08:43:32', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (400, 227, '20220823184025', 12, 'T117', 117, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 08:58:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (401, 225, '20220823192837', 7, 'IQC20220823007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 09:47:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (402, 236, '20220823173612', 17, 'IF2022082312', 51, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 10:41:04', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (403, 208, '20220823181426', 10, 'V00058', 58, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 15:09:35', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (404, 236, '20220823192141', 10, 'IF2022082341', 154, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 19:08:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (405, 236, '20220927102019', 16, 'IF2022092719', 95, NULL, '', NULL, NULL, 0, 0, '', '2022-08-23 19:21:45', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (406, 215, '20220828084935', 6, 'MO202208280006', 6, NULL, '', NULL, NULL, 0, 0, '', '2022-08-28 08:36:52', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (407, 237, '20220829224554', 4, 'IPQC202208290004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-08-29 22:09:01', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (408, 225, '20220831211548', 3, 'IQC20220831003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-08-31 20:57:09', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (409, 238, '20220901212705', 4, 'OQC20220901004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-09-01 20:35:11', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (410, 226, '20220902104056', 4, 'R20220902004', 4, NULL, '', NULL, NULL, 0, 0, '', '2022-09-02 10:36:07', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (411, 233, '20220902104302', 1, 'ISSUE20220902001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-02 10:43:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (412, 239, '20220904223417', 10, 'PBACK20220904010', 10, NULL, '', NULL, NULL, 0, 0, '', '2022-09-03 23:50:32', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (413, 237, '20220909211934', 1, 'IPQC202209090001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-09 21:19:38', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (414, 226, '20220910111422', 2, 'R20220910002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-10 10:57:18', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (415, 226, '20220912232033', 1, 'R20220912001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-12 23:20:33', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (416, 226, '20220913223354', 1, 'R20220913001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-13 22:33:54', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (417, 233, '20220913225049', 2, 'ISSUE20220913002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-13 22:35:02', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (418, 240, '20220915232017', 1, 'RT202209150001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-15 23:20:17', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (419, 226, '20220916212404', 1, 'R20220916001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-16 21:24:06', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (420, 241, '20220923105914', 1, 'PR20220923001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-09-23 10:59:14', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (421, 215, '20220926212817', 2, 'MO202209260002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-26 21:27:05', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (422, 215, '20220927112106', 2, 'MO202209270002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-27 10:25:50', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (423, 226, '20220927131833', 2, 'R20220927002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-27 13:15:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (424, 242, '20220928220423', 2, 'REP2022002', 2, NULL, '', NULL, NULL, 0, 0, '', '2022-09-28 22:02:26', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (425, 243, '20221005194837', 3, 'PS20221005003', 3, NULL, '', NULL, NULL, 0, 0, '', '2022-10-05 19:46:57', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (426, 233, '20221006132703', 1, 'ISSUE20221006001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-10-06 13:27:03', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (427, 244, '20221006214134', 1, 'RS20221006001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-10-06 21:41:34', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (428, 245, '20221011233528', 7, 'PACK202210110007', 7, NULL, '', NULL, NULL, 0, 0, '', '2022-10-11 01:23:50', '', NULL); +INSERT INTO `sys_auto_code_result` VALUES (429, 240, '20221015152217', 1, 'RT202210150001', 1, NULL, '', NULL, NULL, 0, 0, '', '2022-10-15 15:22:17', '', NULL); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/sys_auto_code_rule.sql b/doc/实施文档/sys_auto_code_rule.sql new file mode 100644 index 0000000..d49340e --- /dev/null +++ b/doc/实施文档/sys_auto_code_rule.sql @@ -0,0 +1,73 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_auto_code_rule +-- ---------------------------- +DROP TABLE IF EXISTS `sys_auto_code_rule`; +CREATE TABLE `sys_auto_code_rule` ( + `rule_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '规则ID', + `rule_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则编码', + `rule_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则名称', + `rule_desc` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `max_length` int(11) NULL DEFAULT NULL COMMENT '最大长度', + `is_padded` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '是否补齐', + `padded_char` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '补齐字符', + `padded_method` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'L' COMMENT '补齐方式', + `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Y' COMMENT '是否启用', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1', + `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2', + `attr3` int(11) NULL DEFAULT 0 COMMENT '预留字段3', + `attr4` int(11) NULL DEFAULT 0 COMMENT '预留字段4', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`rule_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 246 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '编码生成规则表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_auto_code_rule +-- ---------------------------- +INSERT INTO `sys_auto_code_rule` VALUES (206, 'ITEM_TYPE_CODE', '物料分类编码', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-04-26 23:01:09', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (207, 'CLIENT_CODE', '客户编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 21:20:29', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (208, 'VENDOR_CODE', '供应商编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-06 22:50:13', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (209, 'WORKSHOP_CODE', '车间编码生成规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 17:48:52', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (210, 'WAREHOUSE_CODE', '仓库编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-07 21:59:51', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (211, 'LOCATION_CODE', '库区编码生成规则', NULL, 4, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 14:49:56', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (212, 'AREA_CODE', '库位编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 18:38:08', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (213, 'MACHINERY_TYPE_CODE', '设备类型编码规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 19:46:09', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (214, 'MACHINERY_CODE', '设备编码规则', NULL, 13, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-08 21:26:39', 'admin', '2022-08-23 09:15:17'); +INSERT INTO `sys_auto_code_rule` VALUES (215, 'WORKORDER_CODE', '生产工单编码规则1', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-09 11:39:59', 'admin', '2022-08-20 09:12:40'); +INSERT INTO `sys_auto_code_rule` VALUES (216, 'WORKSTATION_CODE', '工作站编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-10 21:55:24', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (217, 'TOOL_TYPE_CODE', '工装夹具类型编码', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 00:21:37', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (218, 'TOOL_CODE', '工装夹具编码规则', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-11 22:07:17', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (219, 'PROCESS_CODE', '工序编码规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 00:09:45', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (220, 'ROUTE_CODE', '工艺流程编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-12 23:06:36', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (221, 'TASK_CODE', '生产任务编码规则', NULL, 12, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-15 18:22:29', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (222, 'QC_INDEX_CODE', '检测项编码规则', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 21:57:23', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (223, 'QC_TEMPLATE_CODE', '检测模板编码规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-17 22:43:08', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (224, 'DEFECT_CODE', '常见缺陷编码', NULL, 5, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 11:33:27', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (225, 'QC_IQC_CODE', '来料检验单编码规则', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-19 16:28:07', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (226, 'ITEMRECPT_CODE', '物料入库单编码规则', NULL, 12, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-05-22 20:51:29', 'admin', '2022-05-22 20:53:12'); +INSERT INTO `sys_auto_code_rule` VALUES (227, 'CAL_TEAM_CODE', '班组编码规则', NULL, 4, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 19:54:22', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (228, 'CAL_PLAN_CODE', '排班计划编号', NULL, 11, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-06 22:08:10', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (229, 'WM_RTVENDOR_CODE', '供应商退货单编码', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-13 15:48:07', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (230, 'SUBJECT_CODE', '设备点检保养项目编码', NULL, 6, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 20:27:54', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (231, 'CHECKPLAN_CODE', '点检编码规则', NULL, 11, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-06-16 21:50:00', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (232, 'BATCH_CODE', '批次规则', NULL, 11, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-14 12:02:10', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (233, 'ISSUE_CODE', '生产领料单编码', NULL, 16, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-17 19:32:10', 'admin', '2022-07-17 19:32:57'); +INSERT INTO `sys_auto_code_rule` VALUES (234, '1', '2', NULL, 1, 'Y', '3', 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-07-29 16:34:20', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (236, 'ITEM_CODE', '物料规则', NULL, 10, 'N', '32', 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-08-19 10:44:20', 'admin', '2022-08-19 11:26:02'); +INSERT INTO `sys_auto_code_rule` VALUES (237, 'IPQC_CODE', '过程检验单编码', NULL, 16, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-08-29 22:07:13', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (238, 'OQC_CODE', '出货编码规则', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-01 20:30:31', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (239, 'PBACK_CODE', '生产退料单编码', '生产退料单编码', 16, 'N', '0', 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-03 23:47:11', 'admin', '2022-09-03 23:47:57'); +INSERT INTO `sys_auto_code_rule` VALUES (240, 'RTISSUE_CODE', '生产退库单编号规则', NULL, 14, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-15 23:18:40', 'admin', '2022-09-15 23:19:04'); +INSERT INTO `sys_auto_code_rule` VALUES (241, 'PRODUCTRECPT_CODE', '产品入库单编码规则', NULL, 13, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-23 10:57:47', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (242, 'REPAIR_CODE', '维修工单编号规则', NULL, 10, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-09-28 21:59:54', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (243, 'PRODUCTSALSE_CODE', '销售出库单编号', NULL, 13, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-10-05 19:45:35', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (244, 'RTSALSE_CODE', '销售退货单编码规则', NULL, 13, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-10-06 21:40:18', '', NULL); +INSERT INTO `sys_auto_code_rule` VALUES (245, 'PACKAGE_CODE', '装箱单编码规则', NULL, 16, 'N', NULL, 'L', 'Y', NULL, NULL, NULL, 0, 0, 'admin', '2022-10-11 01:22:08', '', NULL); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/sys_dict_data.sql b/doc/实施文档/sys_dict_data.sql new file mode 100644 index 0000000..064d240 --- /dev/null +++ b/doc/实施文档/sys_dict_data.sql @@ -0,0 +1,157 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_data`; +CREATE TABLE `sys_dict_data` ( + `dict_code` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `dict_sort` int(4) NULL DEFAULT 0 COMMENT '字典排序', + `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典标签', + `dict_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典键值', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型', + `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', + `list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表格回显样式', + `is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)', + `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_code`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 200 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典数据表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dict_data +-- ---------------------------- +INSERT INTO `sys_dict_data` VALUES (1, 1, '男', '0', 'sys_user_sex', '', 'info', 'Y', '0', 'admin', '2022-04-07 00:29:32', 'admin', '2022-08-19 20:53:31', '性别男'); +INSERT INTO `sys_dict_data` VALUES (2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '性别女'); +INSERT INTO `sys_dict_data` VALUES (3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '性别未知'); +INSERT INTO `sys_dict_data` VALUES (4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '显示菜单'); +INSERT INTO `sys_dict_data` VALUES (5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '隐藏菜单'); +INSERT INTO `sys_dict_data` VALUES (6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '默认分组'); +INSERT INTO `sys_dict_data` VALUES (11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '系统分组'); +INSERT INTO `sys_dict_data` VALUES (12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '系统默认是'); +INSERT INTO `sys_dict_data` VALUES (13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '系统默认否'); +INSERT INTO `sys_dict_data` VALUES (14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '通知'); +INSERT INTO `sys_dict_data` VALUES (15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '公告'); +INSERT INTO `sys_dict_data` VALUES (16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '关闭状态'); +INSERT INTO `sys_dict_data` VALUES (18, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '新增操作'); +INSERT INTO `sys_dict_data` VALUES (19, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '修改操作'); +INSERT INTO `sys_dict_data` VALUES (20, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '删除操作'); +INSERT INTO `sys_dict_data` VALUES (21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '授权操作'); +INSERT INTO `sys_dict_data` VALUES (22, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '导出操作'); +INSERT INTO `sys_dict_data` VALUES (23, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '导入操作'); +INSERT INTO `sys_dict_data` VALUES (24, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '强退操作'); +INSERT INTO `sys_dict_data` VALUES (25, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '生成操作'); +INSERT INTO `sys_dict_data` VALUES (26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '清空操作'); +INSERT INTO `sys_dict_data` VALUES (27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (100, 1, '物料', 'ITEM', 'mes_item_product', NULL, 'default', 'N', '0', 'admin', '2022-04-16 16:34:46', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (101, 2, '产品', 'PRODUCT', 'mes_item_product', NULL, 'default', 'N', '0', 'admin', '2022-04-16 16:35:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (102, 1, '输入字符', 'INPUTCHAR', 'sys_autocode_parttype', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:33:47', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (103, 2, '当前日期时间', 'NOWDATE', 'sys_autocode_parttype', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:34:07', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (104, 3, '固定字符', 'FIXCHAR', 'sys_autocode_parttype', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:34:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (105, 4, '流水号', 'SERIALNO', 'sys_autocode_parttype', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:34:53', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (106, 1, '按年', 'YEAR', 'sys_autocode_cyclemethod', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:35:17', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (107, 2, '按月', 'MONTH', 'sys_autocode_cyclemethod', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:35:29', 'admin', '2022-04-26 15:35:55', NULL); +INSERT INTO `sys_dict_data` VALUES (108, 3, '按天', 'DAY', 'sys_autocode_cyclemethod', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:36:13', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (109, 4, '按小时', 'HOUR', 'sys_autocode_cyclemethod', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:36:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (110, 5, '按分钟', 'MINUTE', 'sys_autocode_cyclemethod', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:36:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (111, 6, '按传入字符', 'OTHER', 'sys_autocode_cyclemethod', NULL, 'default', 'N', '0', 'admin', '2022-04-26 15:37:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (112, 1, '企业客户', 'ENTERPRISE', 'mes_client_type', NULL, 'default', 'N', '0', 'admin', '2022-05-06 20:54:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (113, 2, '个人', 'PERSON', 'mes_client_type', NULL, 'default', 'N', '0', 'admin', '2022-05-06 20:55:00', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (114, 1, '优质供应商', 'A', 'mes_vendor_level', NULL, 'default', 'N', '0', 'admin', '2022-05-06 22:45:52', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (115, 2, '正常', 'B', 'mes_vendor_level', NULL, 'default', 'N', '0', 'admin', '2022-05-06 22:46:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (116, 3, '重点关注', 'C', 'mes_vendor_level', NULL, 'default', 'N', '0', 'admin', '2022-05-06 22:46:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (117, 4, '劣质供应商', 'D', 'mes_vendor_level', NULL, 'default', 'N', '0', 'admin', '2022-05-06 22:46:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (118, 5, '黑名单', 'E', 'mes_vendor_level', NULL, 'default', 'N', '0', 'admin', '2022-05-06 22:46:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (119, 1, '草稿', 'PREPARE', 'mes_order_status', NULL, 'default', 'N', '0', 'admin', '2022-05-09 10:35:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (120, 2, '已确认', 'CONFIRMED', 'mes_order_status', NULL, 'default', 'N', '0', 'admin', '2022-05-09 10:36:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (121, 3, '审批中', 'APPROVING', 'mes_order_status', NULL, 'default', 'N', '0', 'admin', '2022-05-09 10:39:30', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (122, 4, '已审批', 'APPROVED', 'mes_order_status', NULL, 'default', 'N', '0', 'admin', '2022-05-09 10:39:45', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (123, 5, '已完成', 'FINISHED', 'mes_order_status', NULL, 'default', 'N', '0', 'admin', '2022-05-09 10:40:07', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (124, 1, '客户订单', 'ORDER', 'mes_workorder_sourcetype', NULL, 'default', 'N', '0', 'admin', '2022-05-09 11:23:47', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (125, 2, '库存备货', 'STORE', 'mes_workorder_sourcetype', NULL, 'default', 'N', '0', 'admin', '2022-05-09 11:24:04', 'admin', '2022-05-09 11:24:24', NULL); +INSERT INTO `sys_dict_data` VALUES (126, 1, '定期维护', 'REGULAR', 'mes_mainten_type', NULL, 'default', 'N', '0', 'admin', '2022-05-10 23:40:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (127, 2, '按使用次数维护', 'USAGE', 'mes_mainten_type', NULL, 'default', 'N', '0', 'admin', '2022-05-10 23:41:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (128, 1, '在库', 'STORE', 'mes_tool_status', NULL, 'default', 'N', '0', 'admin', '2022-05-11 20:51:13', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (129, 2, '被领用', 'ISSUE', 'mes_tool_status', NULL, 'default', 'N', '0', 'admin', '2022-05-11 20:51:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (130, 3, '报废', 'SCRAP', 'mes_tool_status', NULL, 'default', 'N', '0', 'admin', '2022-05-11 20:52:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (131, 4, '维修中', 'REPARE', 'mes_tool_status', NULL, 'default', 'N', '0', 'admin', '2022-05-11 20:52:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (132, 1, 'S-to-S', 'SS', 'mes_link_type', NULL, 'default', 'N', '0', 'admin', '2022-05-13 21:51:28', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (133, 2, 'F-to-F', 'FF', 'mes_link_type', NULL, 'default', 'N', '0', 'admin', '2022-05-13 21:51:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (134, 3, 'S-to-F', 'SF', 'mes_link_type', NULL, 'default', 'N', '0', 'admin', '2022-05-13 21:52:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (135, 4, 'F-to-S', 'FS', 'mes_link_type', NULL, 'default', 'N', '0', 'admin', '2022-05-13 21:52:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (136, 1, '秒', 'SECOND', 'mes_time_type', NULL, 'default', 'N', '0', 'admin', '2022-05-14 08:41:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (137, 2, '分钟', 'MINUTE', 'mes_time_type', NULL, 'default', 'N', '0', 'admin', '2022-05-14 08:41:25', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (138, 3, '小时', 'HOUR', 'mes_time_type', NULL, 'default', 'N', '0', 'admin', '2022-05-14 08:41:46', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (139, 4, '天', 'DAY', 'mes_time_type', NULL, 'default', 'N', '0', 'admin', '2022-05-14 08:41:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (140, 5, '周', 'WEEK', 'mes_time_type', NULL, 'default', 'N', '0', 'admin', '2022-05-14 08:42:12', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (141, 6, '月', 'MONTH', 'mes_time_type', NULL, 'default', 'N', '0', 'admin', '2022-05-14 08:42:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (142, 1, '尺寸', 'SIZE', 'mes_index_type', NULL, 'default', 'N', '0', 'admin', '2022-05-17 21:26:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (143, 2, '外观', 'APPEARANCE', 'mes_index_type', NULL, 'default', 'N', '0', 'admin', '2022-05-17 21:28:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (144, 3, '重量', 'WEIGHT', 'mes_index_type', NULL, 'default', 'N', '0', 'admin', '2022-05-17 21:28:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (145, 4, '性能', 'PERFORMANCE', 'mes_index_type', NULL, 'default', 'N', '0', 'admin', '2022-05-17 21:29:28', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (146, 5, '成分', 'COMPONENT', 'mes_index_type', NULL, 'default', 'N', '0', 'admin', '2022-05-17 21:30:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (147, 1, '[来料检验]', 'IQC', 'mes_qc_type', NULL, 'default', 'N', '0', 'admin', '2022-05-18 09:38:58', 'admin', '2022-05-18 10:38:43', NULL); +INSERT INTO `sys_dict_data` VALUES (148, 2, '[首检]', 'FIRST', 'mes_qc_type', NULL, 'default', 'N', '0', 'admin', '2022-05-18 09:39:19', 'admin', '2022-09-08 22:22:34', NULL); +INSERT INTO `sys_dict_data` VALUES (149, 3, '[末检]', 'FINAL', 'mes_qc_type', NULL, 'default', 'N', '0', 'admin', '2022-05-18 09:39:46', 'admin', '2022-09-08 22:22:39', NULL); +INSERT INTO `sys_dict_data` VALUES (150, 4, '[巡检]', 'PATROL', 'mes_qc_type', NULL, 'default', 'N', '0', 'admin', '2022-05-18 09:40:05', 'admin', '2022-09-08 22:22:55', NULL); +INSERT INTO `sys_dict_data` VALUES (151, 5, '[成品检验]', 'FQC', 'mes_qc_type', NULL, 'default', 'N', '0', 'admin', '2022-05-18 09:40:27', 'admin', '2022-05-18 10:39:08', NULL); +INSERT INTO `sys_dict_data` VALUES (152, 6, '[发货检验]', 'OQC', 'mes_qc_type', NULL, 'default', 'N', '0', 'admin', '2022-05-18 09:40:52', 'admin', '2022-05-18 10:39:14', NULL); +INSERT INTO `sys_dict_data` VALUES (153, 1, '致命缺陷', 'CR', 'mes_defect_level', NULL, 'default', 'N', '0', 'admin', '2022-05-19 10:24:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (154, 2, '严重缺陷', 'MAJ', 'mes_defect_level', NULL, 'default', 'N', '0', 'admin', '2022-05-19 10:24:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (155, 3, '轻微缺陷', 'MIN', 'mes_defect_level', NULL, 'default', 'N', '0', 'admin', '2022-05-19 10:24:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (156, 1, '检验通过', 'ACCEPT', 'mes_qc_result', NULL, 'default', 'N', '0', 'admin', '2022-05-19 16:38:07', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (157, 2, '检验不通过', 'REJECT', 'mes_qc_result', NULL, 'default', 'N', '0', 'admin', '2022-05-19 16:38:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (159, 1, '白班', 'SINGLE', 'mes_shift_type', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:33:56', 'admin', '2022-06-06 21:35:05', NULL); +INSERT INTO `sys_dict_data` VALUES (160, 2, '两班倒', 'SHIFT_TWO', 'mes_shift_type', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:34:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (161, 3, '三班倒', 'SHIFT_THREE', 'mes_shift_type', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:34:38', 'admin', '2022-06-06 21:34:45', NULL); +INSERT INTO `sys_dict_data` VALUES (162, 1, '按天', 'DAY', 'mes_shift_method', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:39:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (163, 2, '按周', 'WEEK', 'mes_shift_method', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:40:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (164, 3, '按月', 'MONTH', 'mes_shift_method', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:40:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (165, 4, '按季度', 'QUARTER', 'mes_shift_method', NULL, 'default', 'N', '0', 'admin', '2022-06-06 21:40:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (166, 1, '注塑', 'ZS', 'mes_calendar_type', NULL, 'default', 'N', '0', 'admin', '2022-06-08 13:27:23', 'admin', '2022-06-11 21:05:57', NULL); +INSERT INTO `sys_dict_data` VALUES (167, 2, '机加工', 'CNC', 'mes_calendar_type', NULL, 'default', 'N', '0', 'admin', '2022-06-08 13:27:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (168, 3, '组装', 'ZZ', 'mes_calendar_type', NULL, 'default', 'N', '0', 'admin', '2022-06-08 13:27:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (169, 4, '仓库', 'CK', 'mes_calendar_type', NULL, 'default', 'N', '0', 'admin', '2022-06-08 13:28:24', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (170, 1, '设备点检', 'CHECK', 'mes_dvsubject_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 16:50:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (171, 2, '设备保养', 'MAINTEN', 'mes_dvsubject_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 16:51:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (172, 1, '小时', 'HOUR', 'mes_cycle_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 20:47:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (173, 2, '天', 'DAY', 'mes_cycle_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 20:49:07', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (174, 3, '周', 'WEEK', 'mes_cycle_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 20:49:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (175, 4, '月', 'MONTH', 'mes_cycle_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 20:49:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (176, 5, '季度', 'QUARTER', 'mes_cycle_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 20:50:00', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (177, 6, '年', 'YEAR', 'mes_cycle_type', NULL, 'default', 'N', '0', 'admin', '2022-06-16 20:50:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (178, 1, '设备点检计划', 'CHECK', 'dv_plan_type', NULL, 'default', 'N', '0', 'admin', '2022-06-19 17:03:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (179, 2, '设备保养计划', 'MAINTEN', 'dv_plan_type', NULL, 'default', 'N', '0', 'admin', '2022-06-19 17:03:56', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (180, 1, 'QR二维码', 'QR_CODE', 'mes_barcode_formart', NULL, 'default', 'N', '0', 'admin', '2022-08-01 11:06:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (181, 2, 'EAN码', 'EAN_CODE', 'mes_barcode_formart', NULL, 'default', 'N', '0', 'admin', '2022-08-01 11:07:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (182, 3, 'UPC码', 'UPC_CODE', 'mes_barcode_formart', NULL, 'default', 'N', '0', 'admin', '2022-08-01 11:07:58', 'admin', '2022-08-01 11:08:03', NULL); +INSERT INTO `sys_dict_data` VALUES (183, 1, '物料产品条码', 'ITEM', 'mes_barcode_type', NULL, 'default', 'N', '0', 'admin', '2022-08-01 11:09:07', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (184, 2, '小包装条码', 'BOX_SMALL', 'mes_barcode_type', NULL, 'default', 'N', '0', 'admin', '2022-08-01 11:10:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (185, 3, '库存条码', 'STOCK', 'mes_barcode_type', NULL, 'default', 'N', '0', 'admin', '2022-08-01 11:10:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (186, 1, '修复成功', 'SUCCESS', 'mes_repair_result', NULL, 'default', 'N', '0', 'admin', '2022-08-06 11:27:48', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (187, 2, '报废', 'SCRAP', 'mes_repair_result', NULL, 'default', 'N', '0', 'admin', '2022-08-06 11:28:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (188, 0, '汉族', '0', 'nation_type', NULL, 'default', 'N', '0', 'admin', '2022-08-15 14:26:52', 'admin', '2022-08-15 14:27:35', NULL); +INSERT INTO `sys_dict_data` VALUES (189, 1, '首检', 'FIRST', 'mes_ipqc_type', NULL, 'default', 'N', '0', 'admin', '2022-08-29 20:19:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (190, 2, '末检', 'FINAL', 'mes_ipqc_type', NULL, 'default', 'N', '0', 'admin', '2022-08-29 20:19:38', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (191, 3, '自检', 'SELF', 'mes_ipqc_type', NULL, 'default', 'N', '0', 'admin', '2022-08-29 20:19:52', 'admin', '2022-08-29 20:19:57', NULL); +INSERT INTO `sys_dict_data` VALUES (192, 4, '巡检', 'PATROL', 'mes_ipqc_type', NULL, 'default', 'N', '0', 'admin', '2022-08-29 20:20:13', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (193, 5, '点检', 'CHECK', 'mes_ipqc_type', NULL, 'default', 'N', '0', 'admin', '2022-08-29 20:20:28', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (194, 6, '终检', 'FQC', 'mes_ipqc_type', NULL, 'default', 'N', '0', 'admin', '2022-08-29 20:20:44', 'admin', '2022-08-29 20:58:07', NULL); +INSERT INTO `sys_dict_data` VALUES (195, 1, '自行报工', 'SELF', 'mes_feedback_type', NULL, 'default', 'N', '0', 'admin', '2022-10-02 15:52:45', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (196, 2, '统一报工', 'UNI', 'mes_feedback_type', NULL, 'default', 'N', '0', 'admin', '2022-10-02 15:53:03', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (197, 1, '停机', 'STOP', 'mes_machinery_status', NULL, 'default', 'N', '0', 'admin', '2022-10-09 19:24:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (198, 2, '生产中', 'WORKING', 'mes_machinery_status', NULL, 'default', 'N', '0', 'admin', '2022-10-09 19:24:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (199, 3, '维修中', 'REPAIR', 'mes_machinery_status', NULL, 'default', 'N', '0', 'admin', '2022-10-09 19:25:28', '', NULL, NULL); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/sys_dict_type.sql b/doc/实施文档/sys_dict_type.sql new file mode 100644 index 0000000..3acb0e2 --- /dev/null +++ b/doc/实施文档/sys_dict_type.sql @@ -0,0 +1,64 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_type`; +CREATE TABLE `sys_dict_type` ( + `dict_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典主键', + `dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型', + `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_id`) USING BTREE, + UNIQUE INDEX `dict_type`(`dict_type`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 129 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典类型表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dict_type +-- ---------------------------- +INSERT INTO `sys_dict_type` VALUES (1, '用户性别', 'sys_user_sex', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '用户性别列表'); +INSERT INTO `sys_dict_type` VALUES (2, '菜单状态', 'sys_show_hide', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '菜单状态列表'); +INSERT INTO `sys_dict_type` VALUES (3, '系统开关', 'sys_normal_disable', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '系统开关列表'); +INSERT INTO `sys_dict_type` VALUES (4, '任务状态', 'sys_job_status', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '任务状态列表'); +INSERT INTO `sys_dict_type` VALUES (5, '任务分组', 'sys_job_group', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '任务分组列表'); +INSERT INTO `sys_dict_type` VALUES (6, '系统是否', 'sys_yes_no', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '系统是否列表'); +INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '通知类型列表'); +INSERT INTO `sys_dict_type` VALUES (8, '通知状态', 'sys_notice_status', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '通知状态列表'); +INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '操作类型列表'); +INSERT INTO `sys_dict_type` VALUES (10, '系统状态', 'sys_common_status', '0', 'admin', '2022-04-07 00:29:32', '', NULL, '登录状态列表'); +INSERT INTO `sys_dict_type` VALUES (100, '物料or产品', 'mes_item_product', '0', 'admin', '2022-04-16 16:34:20', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (101, '编码规则组成类型', 'sys_autocode_parttype', '0', 'admin', '2022-04-26 15:32:42', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (102, '编码规则组成循环方式', 'sys_autocode_cyclemethod', '0', 'admin', '2022-04-26 15:33:02', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (103, '客户类型', 'mes_client_type', '0', 'admin', '2022-05-06 20:53:28', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (104, '供应商级别', 'mes_vendor_level', '0', 'admin', '2022-05-06 22:44:56', 'admin', '2022-05-06 22:45:35', NULL); +INSERT INTO `sys_dict_type` VALUES (105, '单据状态【通用】', 'mes_order_status', '0', 'admin', '2022-05-09 10:34:41', 'admin', '2022-05-09 10:35:10', NULL); +INSERT INTO `sys_dict_type` VALUES (106, '生产工单来源', 'mes_workorder_sourcetype', '0', 'admin', '2022-05-09 11:23:22', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (107, '维护类型表', 'mes_mainten_type', '0', 'admin', '2022-05-10 23:40:36', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (108, '工装夹具状态', 'mes_tool_status', '0', 'admin', '2022-05-11 20:50:46', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (109, '工序关系类型', 'mes_link_type', '0', 'admin', '2022-05-13 21:50:44', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (110, '时间单位', 'mes_time_type', '0', 'admin', '2022-05-14 08:40:53', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (111, '检测项类型', 'mes_index_type', '0', 'admin', '2022-05-17 21:26:05', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (112, '检测类型', 'mes_qc_type', '0', 'admin', '2022-05-18 09:38:32', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (113, '缺陷等级', 'mes_defect_level', '0', 'admin', '2022-05-19 10:23:38', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (114, '检验结果', 'mes_qc_result', '0', 'admin', '2022-05-19 16:37:45', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (116, '倒班方式', 'mes_shift_type', '0', 'admin', '2022-06-06 21:33:17', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (117, '轮班方式', 'mes_shift_method', '0', 'admin', '2022-06-06 21:39:26', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (118, '排班类型', 'mes_calendar_type', '0', 'admin', '2022-06-08 13:26:56', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (119, '设备点检保养项目类型', 'mes_dvsubject_type', '0', 'admin', '2022-06-16 16:50:14', 'admin', '2022-06-16 16:50:29', NULL); +INSERT INTO `sys_dict_type` VALUES (120, '设备点检频率', 'mes_cycle_type', '0', 'admin', '2022-06-16 20:47:19', 'admin', '2022-06-16 20:51:22', NULL); +INSERT INTO `sys_dict_type` VALUES (121, '设备点检保养计划类型', 'dv_plan_type', '0', 'admin', '2022-06-19 17:03:18', 'admin', '2022-06-19 17:04:17', NULL); +INSERT INTO `sys_dict_type` VALUES (122, '条码格式', 'mes_barcode_formart', '0', 'admin', '2022-08-01 11:05:54', 'admin', '2022-08-01 11:06:15', NULL); +INSERT INTO `sys_dict_type` VALUES (123, '条码类型', 'mes_barcode_type', '0', 'admin', '2022-08-01 11:08:27', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (124, '维修结果', 'mes_repair_result', '0', 'admin', '2022-08-06 11:27:05', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (125, '民族', 'nation_type', '0', 'admin', '2022-08-15 14:25:55', 'admin', '2022-08-15 14:26:34', '民族'); +INSERT INTO `sys_dict_type` VALUES (126, '过程质量检验类型', 'mes_ipqc_type', '0', 'admin', '2022-08-29 20:18:48', 'admin', '2022-08-29 20:18:59', NULL); +INSERT INTO `sys_dict_type` VALUES (127, '生产报工类型', 'mes_feedback_type', '0', 'admin', '2022-10-02 15:51:21', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (128, '设备状态', 'mes_machinery_status', '0', 'admin', '2022-10-09 19:23:54', '', NULL, NULL); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/sys_menu.sql b/doc/实施文档/sys_menu.sql new file mode 100644 index 0000000..1e5b47b --- /dev/null +++ b/doc/实施文档/sys_menu.sql @@ -0,0 +1,368 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` ( + `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '菜单ID', + `menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单名称', + `parent_id` bigint(20) NULL DEFAULT 0 COMMENT '父菜单ID', + `order_num` int(4) NULL DEFAULT 0 COMMENT '显示顺序', + `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '路由地址', + `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件路径', + `query` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由参数', + `is_frame` int(1) NULL DEFAULT 1 COMMENT '是否为外链(0是 1否)', + `is_cache` int(1) NULL DEFAULT 0 COMMENT '是否缓存(0缓存 1不缓存)', + `menu_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)', + `visible` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0显示 1隐藏)', + `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0正常 1停用)', + `perms` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限标识', + `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '#' COMMENT '菜单图标', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注', + PRIMARY KEY (`menu_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2256 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '菜单权限表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 1, 'system', NULL, '', 1, 0, 'M', '0', '0', '', 'system', 'admin', '2022-04-07 00:29:31', '', NULL, '系统管理目录'); +INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 2, 'monitor', NULL, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', '2022-04-07 00:29:31', '', NULL, '系统监控目录'); +INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 3, 'tool', NULL, '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', '2022-04-07 00:29:31', '', NULL, '系统工具目录'); +INSERT INTO `sys_menu` VALUES (100, '用户管理', 2210, 4, 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', '2022-04-07 00:29:31', 'admin', '2022-08-13 21:41:42', '用户管理菜单'); +INSERT INTO `sys_menu` VALUES (101, '角色管理', 2210, 3, 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', '2022-04-07 00:29:31', 'admin', '2022-08-13 21:42:03', '角色管理菜单'); +INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', '2022-04-07 00:29:31', '', NULL, '菜单管理菜单'); +INSERT INTO `sys_menu` VALUES (103, '部门管理', 2210, 1, 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', '2022-04-07 00:29:31', 'admin', '2022-08-13 21:42:27', '部门管理菜单'); +INSERT INTO `sys_menu` VALUES (104, '岗位管理', 2210, 2, 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', '2022-04-07 00:29:31', 'admin', '2022-08-13 21:42:38', '岗位管理菜单'); +INSERT INTO `sys_menu` VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', '2022-04-07 00:29:31', '', NULL, '字典管理菜单'); +INSERT INTO `sys_menu` VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', '2022-04-07 00:29:31', '', NULL, '参数设置菜单'); +INSERT INTO `sys_menu` VALUES (107, '通知公告', 1, 8, 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', '2022-04-07 00:29:31', '', NULL, '通知公告菜单'); +INSERT INTO `sys_menu` VALUES (108, '日志管理', 1, 9, 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', '2022-04-07 00:29:31', '', NULL, '日志管理菜单'); +INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', '2022-04-07 00:29:31', '', NULL, '在线用户菜单'); +INSERT INTO `sys_menu` VALUES (110, '定时任务', 2, 2, 'job', 'monitor/job/index', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', '2022-04-07 00:29:31', '', NULL, '定时任务菜单'); +INSERT INTO `sys_menu` VALUES (111, '数据监控', 2, 3, 'druid', 'monitor/druid/index', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', '2022-04-07 00:29:31', '', NULL, '数据监控菜单'); +INSERT INTO `sys_menu` VALUES (112, '服务监控', 2, 4, 'server', 'monitor/server/index', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', '2022-04-07 00:29:31', '', NULL, '服务监控菜单'); +INSERT INTO `sys_menu` VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', '2022-04-07 00:29:31', '', NULL, '缓存监控菜单'); +INSERT INTO `sys_menu` VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', '2022-04-07 00:29:31', '', NULL, '表单构建菜单'); +INSERT INTO `sys_menu` VALUES (115, '代码生成', 3, 2, 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', '2022-04-07 00:29:31', '', NULL, '代码生成菜单'); +INSERT INTO `sys_menu` VALUES (116, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', '2022-04-07 00:29:31', '', NULL, '系统接口菜单'); +INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', '2022-04-07 00:29:31', '', NULL, '操作日志菜单'); +INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', '2022-04-07 00:29:31', '', NULL, '登录日志菜单'); +INSERT INTO `sys_menu` VALUES (1001, '用户查询', 100, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1002, '用户新增', 100, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1003, '用户修改', 100, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1004, '用户删除', 100, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1005, '用户导出', 100, 5, '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1006, '用户导入', 100, 6, '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1007, '重置密码', 100, 7, '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1008, '角色查询', 101, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1009, '角色新增', 101, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1010, '角色修改', 101, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1011, '角色删除', 101, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1012, '角色导出', 101, 5, '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1013, '菜单查询', 102, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1014, '菜单新增', 102, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1015, '菜单修改', 102, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1016, '菜单删除', 102, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1017, '部门查询', 103, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1018, '部门新增', 103, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1019, '部门修改', 103, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1020, '部门删除', 103, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1021, '岗位查询', 104, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1022, '岗位新增', 104, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1023, '岗位修改', 104, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1024, '岗位删除', 104, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1025, '岗位导出', 104, 5, '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1026, '字典查询', 105, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1027, '字典新增', 105, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1028, '字典修改', 105, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1029, '字典删除', 105, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1030, '字典导出', 105, 5, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1031, '参数查询', 106, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1032, '参数新增', 106, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1033, '参数修改', 106, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1034, '参数删除', 106, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1035, '参数导出', 106, 5, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1036, '公告查询', 107, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1037, '公告新增', 107, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1038, '公告修改', 107, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1039, '公告删除', 107, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1040, '操作查询', 500, 1, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1041, '操作删除', 500, 2, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1042, '日志导出', 500, 4, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1043, '登录查询', 501, 1, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1044, '登录删除', 501, 2, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1045, '日志导出', 501, 3, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1049, '任务查询', 110, 1, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1050, '任务新增', 110, 2, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1051, '任务修改', 110, 3, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1052, '任务删除', 110, 4, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1053, '状态修改', 110, 5, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1054, '任务导出', 110, 7, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1055, '生成查询', 115, 1, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1056, '生成修改', 115, 2, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1057, '生成删除', 115, 3, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1058, '导入代码', 115, 2, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1059, '预览代码', 115, 4, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1060, '生成代码', 115, 5, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', '2022-04-07 00:29:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2000, '主数据', 0, 4, 'mes/md', NULL, NULL, 1, 0, 'M', '0', '0', '', 'build', 'admin', '2022-04-16 14:41:55', 'admin', '2022-08-18 11:44:29', ''); +INSERT INTO `sys_menu` VALUES (2001, '物料产品管理', 2000, 1, 'mditem', 'mes/md/mditem/index', NULL, 1, 0, 'C', '0', '0', 'ms:md:mditem', 'excel', 'admin', '2022-04-16 14:44:00', 'admin', '2022-05-04 18:13:08', ''); +INSERT INTO `sys_menu` VALUES (2002, '物料产品分类', 2000, 2, 'itemtype', 'mes/md/itemtype/index', NULL, 1, 0, 'C', '0', '0', 'mes:md:itemtype', 'nested', 'admin', '2022-04-16 16:03:18', 'admin', '2022-04-16 16:05:56', ''); +INSERT INTO `sys_menu` VALUES (2003, '编码规则', 1, 10, 'autocodeRule', 'system/autocode/index', NULL, 1, 0, 'C', '0', '0', 'system:autocode:rule', 'code', 'admin', '2022-04-24 21:43:28', 'admin', '2022-04-24 21:49:31', ''); +INSERT INTO `sys_menu` VALUES (2004, '编码规则查询', 2003, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:autocode:rule:list', '#', 'admin', '2022-04-24 21:46:05', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2005, '编码规则新增', 2003, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:autocode:rule:add', '#', 'admin', '2022-04-24 21:46:30', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2006, '编码规则更新', 2003, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:autocode:rule:edit', '#', 'admin', '2022-04-24 21:46:59', 'admin', '2022-04-24 21:47:42', ''); +INSERT INTO `sys_menu` VALUES (2007, '编码规则删除', 2003, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:autocode:rule:remove', '#', 'admin', '2022-04-24 21:47:20', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2008, '新增物料分类', 2002, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:itemtype:add', '#', 'admin', '2022-04-27 16:46:06', 'admin', '2022-08-16 16:15:39', ''); +INSERT INTO `sys_menu` VALUES (2009, '更新物料分类', 2002, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:itemtype:edit', '#', 'admin', '2022-04-27 16:46:51', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2010, '删除物料分类', 2002, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:itemtype:remove', '#', 'admin', '2022-04-27 16:47:16', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2011, '新增物料产品', 2001, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:mditem:add', '#', 'admin', '2022-04-27 16:47:46', 'admin', '2022-08-17 08:56:36', ''); +INSERT INTO `sys_menu` VALUES (2012, '更新物料产品', 2001, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:mditem:edit', '#', 'admin', '2022-04-27 16:48:11', 'admin', '2022-05-04 18:05:40', ''); +INSERT INTO `sys_menu` VALUES (2013, '删除物料产品', 2001, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:mditem:remove', '#', 'admin', '2022-04-27 16:48:36', 'admin', '2022-05-04 18:05:55', ''); +INSERT INTO `sys_menu` VALUES (2014, '计量单位', 2000, 3, 'unitmeasure', 'mes/md/unitmeasure/index', NULL, 1, 0, 'C', '0', '0', 'mes:md:unitmeasure', 'tab', 'admin', '2022-04-27 18:08:08', 'admin', '2022-04-27 21:27:43', ''); +INSERT INTO `sys_menu` VALUES (2015, '新增单位', 2014, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:unitmeasure:add', '#', 'admin', '2022-04-27 18:14:06', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2016, '更新单位', 2014, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:unitmeasure:edit', '#', 'admin', '2022-04-27 18:14:25', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2017, '删除单位', 2014, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:unitmeasure:remove', '#', 'admin', '2022-04-27 18:14:44', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2018, '物料明细查看', 2001, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:mditem:query', '#', 'admin', '2022-05-04 17:51:19', 'admin', '2022-05-04 18:06:04', ''); +INSERT INTO `sys_menu` VALUES (2019, '物料分类明细', 2002, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:itemtype:query', '#', 'admin', '2022-05-04 17:52:22', 'admin', '2022-08-16 16:16:59', ''); +INSERT INTO `sys_menu` VALUES (2020, '单位明细', 2014, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:unitmeasure:query', '#', 'admin', '2022-05-04 17:54:06', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2021, '物料产品列表查询', 2001, 0, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:mditem:list', '#', 'admin', '2022-05-04 18:04:36', 'admin', '2022-05-04 18:05:23', ''); +INSERT INTO `sys_menu` VALUES (2022, '物料分类列表查询', 2002, 0, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:itemtype:list', '#', 'admin', '2022-05-04 18:08:57', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2023, '单位列表查询', 2014, 0, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:unitmeasure:list', '#', 'admin', '2022-05-04 18:09:25', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2024, '客户管理', 2000, 4, 'client', 'mes/md/client/index', NULL, 1, 0, 'C', '0', '0', 'mes:md:client', 'people', 'admin', '2022-05-06 20:37:28', 'admin', '2022-05-06 20:43:03', ''); +INSERT INTO `sys_menu` VALUES (2025, '客户列表查询', 2024, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:client:list', '#', 'admin', '2022-05-06 20:38:07', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2026, '客户新增', 2024, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:client:add', '#', 'admin', '2022-05-06 20:38:33', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2027, '客户编辑', 2024, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:client:edit', '#', 'admin', '2022-05-06 20:38:55', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2028, '客户明细', 2024, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:client:query', '#', 'admin', '2022-05-06 20:39:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2029, '客户删除', 2024, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:client:remove', '#', 'admin', '2022-05-06 20:39:49', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2030, '供应商管理', 2000, 5, 'vendor', 'mes/md/vendor/index', NULL, 1, 0, 'C', '0', '0', 'mes:md:vendor', 'peoples', 'admin', '2022-05-06 22:34:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2031, '供应商列表查询', 2030, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:vendor:list', '#', 'admin', '2022-05-06 22:34:34', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2032, '供应商查看', 2030, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:vendor:query', '#', 'admin', '2022-05-06 22:35:16', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2033, '供应商新增', 2030, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:vendor:add', '#', 'admin', '2022-05-06 22:35:38', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2034, '供应商编辑', 2030, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:vendor:edit', '#', 'admin', '2022-05-06 22:35:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2035, '供应商删除', 2030, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:vendor:remove', '#', 'admin', '2022-05-06 22:36:21', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2036, '车间设置', 2000, 6, 'workshop', 'mes/md/workshop/index', NULL, 1, 0, 'C', '0', '0', 'mes:md:workshop', 'zip', 'admin', '2022-05-07 16:40:48', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2037, '车间列表查询', 2036, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workshop:list', '#', 'admin', '2022-05-07 16:41:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2038, '车间查看', 2036, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workshop:query', '#', 'admin', '2022-05-07 16:41:36', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2039, '车间新增', 2036, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workshop:add', '#', 'admin', '2022-05-07 16:41:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2040, '车间修改', 2036, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workshop:edit', '#', 'admin', '2022-05-07 16:42:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2041, '车间删除', 2036, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workshop:remove', '#', 'admin', '2022-05-07 16:42:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2042, '仓储管理', 0, 5, 'mes/wm', NULL, NULL, 1, 0, 'M', '0', '0', '', 'zip', 'admin', '2022-05-07 21:06:28', 'admin', '2022-08-13 21:44:45', ''); +INSERT INTO `sys_menu` VALUES (2043, '仓库设置', 2042, 1, 'warehouse', 'mes/wm/warehouse/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:warehouse', 'dict', 'admin', '2022-05-07 21:07:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2044, '仓库清单查询', 2043, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:warehouse:list', '#', 'admin', '2022-05-07 21:08:25', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2045, '仓库查看', 2043, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:warehouse:query', '#', 'admin', '2022-05-07 21:08:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2046, '仓库新增', 2043, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:warehouse:add', '#', 'admin', '2022-05-07 21:09:29', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2047, '仓库编辑', 2043, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:warehouse:edit', '#', 'admin', '2022-05-07 21:09:51', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2048, '仓库删除', 2043, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:warehouse:remove', '#', 'admin', '2022-05-07 21:10:13', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2049, '库区列表查询', 2043, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:location:list', '#', 'admin', '2022-05-08 18:19:51', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2050, '库区查看', 2043, 7, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:location:query', '#', 'admin', '2022-05-08 18:20:28', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2051, '库区新增', 2043, 8, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:location:add', '#', 'admin', '2022-05-08 18:20:57', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2052, '库区编辑', 2043, 9, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:location:edit', '#', 'admin', '2022-05-08 18:21:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2053, '库区删除', 2043, 10, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:location:remove', '#', 'admin', '2022-05-08 18:21:57', 'admin', '2022-05-08 18:24:34', ''); +INSERT INTO `sys_menu` VALUES (2054, '库位列表查询', 2043, 11, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:area:list', '#', 'admin', '2022-05-08 18:22:30', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2055, '库位查看', 2043, 12, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:area:query', '#', 'admin', '2022-05-08 18:22:54', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2056, '库位新增', 2043, 13, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:area:add', '#', 'admin', '2022-05-08 18:23:17', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2057, '库位编辑', 2043, 14, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:area:edit', '#', 'admin', '2022-05-08 18:23:43', 'admin', '2022-05-08 18:23:53', ''); +INSERT INTO `sys_menu` VALUES (2058, '库位删除', 2043, 15, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:area:remove', '#', 'admin', '2022-05-08 18:24:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2059, '设备管理', 0, 6, 'mes/dv', NULL, NULL, 1, 0, 'M', '0', '0', NULL, 'redis', 'admin', '2022-05-08 19:10:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2060, '设备类型设置', 2059, 1, 'machinerytype', 'mes/dv/machinerytype/index', NULL, 1, 0, 'C', '0', '0', 'mes:dv:machinerytype', 'swagger', 'admin', '2022-05-08 19:11:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2061, '设备类型列表', 2060, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinerytype:list', '#', 'admin', '2022-05-08 19:12:35', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2062, '设备类型查看', 2060, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinerytype:query', '#', 'admin', '2022-05-08 19:12:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2063, '设备类型新增', 2060, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinerytype:add', '#', 'admin', '2022-05-08 19:13:16', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2064, '设备类型编辑', 2060, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinerytype:edit', '#', 'admin', '2022-05-08 19:13:33', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2065, '设备类型删除', 2060, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinerytype:remove', '#', 'admin', '2022-05-08 19:13:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2066, '设备台账', 2059, 2, 'machinery', 'mes/dv/machinery/index', NULL, 1, 0, 'C', '0', '0', 'mes:dv:machinery', 'system', 'admin', '2022-05-08 21:28:16', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2067, '设备列表查询', 2066, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinery:list', '#', 'admin', '2022-05-08 21:29:14', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2068, '设备查看', 2066, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinery:query', '#', 'admin', '2022-05-08 21:29:35', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2069, '设备新增', 2066, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinery:add', '#', 'admin', '2022-05-08 21:30:00', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2070, '设备编辑', 2066, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinery:edit', '#', 'admin', '2022-05-08 21:30:16', 'admin', '2022-05-08 21:30:40', ''); +INSERT INTO `sys_menu` VALUES (2071, '设备删除', 2066, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:machinery:remove', '#', 'admin', '2022-05-08 21:30:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2072, '生产管理', 0, 8, 'mes/pro', NULL, NULL, 1, 0, 'M', '0', '0', '', 'switch', 'admin', '2022-05-09 10:58:07', 'admin', '2022-05-11 00:07:21', ''); +INSERT INTO `sys_menu` VALUES (2073, '生产工单', 2072, 1, 'workorder', 'mes/pro/workorder/index', NULL, 1, 0, 'C', '0', '0', 'mes:pro:workorder', 'log', 'admin', '2022-05-09 10:59:26', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2074, '工单列表查询', 2073, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorder:list', '#', 'admin', '2022-05-09 11:00:02', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2075, '工单查看', 2073, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorder:query', '#', 'admin', '2022-05-09 11:00:24', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2076, '工单新增', 2073, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorder:add', '#', 'admin', '2022-05-09 11:00:55', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2077, '工单编辑', 2073, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorder:edit', '#', 'admin', '2022-05-09 11:01:16', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2078, '工单删除', 2073, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorder:remove', '#', 'admin', '2022-05-09 11:01:38', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2079, 'BOM列表查询', 2001, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:bom:list', '#', 'admin', '2022-05-10 10:17:25', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2080, 'BOM查看', 2001, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:bom:query', '#', 'admin', '2022-05-10 10:17:55', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2081, 'BOM新增', 2001, 7, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:bom:add', '#', 'admin', '2022-05-10 10:18:22', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2082, 'BOM编辑', 2001, 8, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:bom:edit', '#', 'admin', '2022-05-10 10:18:44', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2083, 'BOM删除', 2001, 9, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:bom:remove', '#', 'admin', '2022-05-10 10:19:05', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2084, '工单BOM列表查询', 2073, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorderbom:list', '#', 'admin', '2022-05-10 16:17:25', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2085, '工单BOM查看', 2073, 7, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorderbom:query', '#', 'admin', '2022-05-10 16:17:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2086, '工单BOM编辑', 2073, 8, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorderbom:edit', '#', 'admin', '2022-05-10 16:18:28', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2087, '工单BOM删除', 2073, 9, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorderbom:remove', '#', 'admin', '2022-05-10 16:18:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2088, '工作站', 2000, 7, 'workstation', 'mes/md/workstation/index', NULL, 1, 0, 'C', '0', '0', 'mes:md:workstation', 'job', 'admin', '2022-05-10 21:44:36', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2089, '工作站列表查询', 2088, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstation:list', '#', 'admin', '2022-05-10 21:45:11', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2090, '工作站查看', 2088, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstation:query', '#', 'admin', '2022-05-10 21:45:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2091, '工作站新增', 2088, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstation:add', '#', 'admin', '2022-05-10 21:45:48', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2092, '工作站编辑', 2088, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstation:edit', '#', 'admin', '2022-05-10 21:46:05', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2093, '工作站删除', 2088, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstation:remove', '#', 'admin', '2022-05-10 21:46:28', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2094, '工作站导出', 2088, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstation:export', '#', 'admin', '2022-05-10 21:47:04', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2095, '工装夹具管理', 0, 7, 'tm', NULL, NULL, 1, 0, 'M', '0', '0', NULL, 'lock', 'admin', '2022-05-11 00:07:13', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2096, '类型设置', 2095, 1, 'tooltype', 'mes/tm/tooltype/index', NULL, 1, 0, 'C', '0', '0', 'mes:tm:tooltype', 'tree', 'admin', '2022-05-11 00:08:25', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2097, '类型列表查询', 2096, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tooltype:list', '#', 'admin', '2022-05-11 00:09:01', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2098, '类型查看', 2096, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tooltype:query', '#', 'admin', '2022-05-11 00:09:27', 'admin', '2022-05-11 00:09:48', ''); +INSERT INTO `sys_menu` VALUES (2099, '类型新增', 2096, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tooltype:add', '#', 'admin', '2022-05-11 00:10:14', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2100, '类型编辑', 2096, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tooltype:edit', '#', 'admin', '2022-05-11 00:10:35', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2101, '类型删除', 2096, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tooltype:remove', '#', 'admin', '2022-05-11 00:10:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2102, '工装夹具台账', 2095, 2, 'tool', 'mes/tm/tool/index', NULL, 1, 0, 'C', '0', '0', 'mes:tm:tool', 'date-range', 'admin', '2022-05-11 21:23:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2103, '工装夹具列表查询', 2102, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tool:list', '#', 'admin', '2022-05-11 21:23:53', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2104, '工装夹具查看', 2102, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tool:query', '#', 'admin', '2022-05-11 21:24:15', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2105, '工装夹具新增', 2102, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tool:add', '#', 'admin', '2022-05-11 21:24:35', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2106, '工装夹具编辑', 2102, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tool:edit', '#', 'admin', '2022-05-11 21:24:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2107, '工装夹具删除', 2102, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tool:remove', '#', 'admin', '2022-05-11 21:25:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2108, '工装夹具导出', 2102, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:tm:tool:export', '#', 'admin', '2022-05-11 21:25:46', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2109, '工序设置', 2072, 2, 'process', 'mes/pro/process/index', NULL, 1, 0, 'C', '0', '0', 'mes:pro:process', 'druid', 'admin', '2022-05-12 00:03:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2110, '工序列表查询', 2109, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:process:list', '#', 'admin', '2022-05-12 00:04:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2111, '工序查看', 2109, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:process:query', '#', 'admin', '2022-05-12 00:04:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2112, '工序新增', 2109, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:process:add', '#', 'admin', '2022-05-12 00:04:54', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2113, '工序编辑', 2109, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:process:edit', '#', 'admin', '2022-05-12 00:05:10', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2114, '工序删除', 2109, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:process:remove', '#', 'admin', '2022-05-12 00:05:28', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2115, '工序导出', 2109, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:process:export', '#', 'admin', '2022-05-12 00:05:41', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2116, '工艺流程', 2072, 3, 'proroute', 'mes/pro/proroute/index', NULL, 1, 0, 'C', '0', '0', 'mes:pro:proroute', 'nested', 'admin', '2022-05-12 23:08:26', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2117, '工艺流程列表查询', 2116, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:proroute:list', '#', 'admin', '2022-05-12 23:08:51', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2118, '工艺流程查看', 2116, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:proroute:query', '#', 'admin', '2022-05-12 23:09:13', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2119, '工艺流程新增', 2116, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:proroute:add', '#', 'admin', '2022-05-12 23:09:36', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2120, '工艺流程编辑', 2116, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:proroute:edit', '#', 'admin', '2022-05-12 23:09:53', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2121, '工艺流程删除', 2116, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:proroute:remove', '#', 'admin', '2022-05-12 23:10:11', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2122, '工艺流程导出', 2116, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:proroute:export', '#', 'admin', '2022-05-12 23:10:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2123, '生产排产', 2072, 4, 'proschedule', 'mes/pro/schedule/index', NULL, 1, 0, 'C', '0', '0', 'mes:pro:schedule', 'build', 'admin', '2022-05-15 15:01:21', 'admin', '2022-05-15 15:01:36', ''); +INSERT INTO `sys_menu` VALUES (2124, '质量管理', 0, 9, 'mes/qc', NULL, NULL, 1, 0, 'M', '0', '0', '', 'time-range', 'admin', '2022-05-17 21:51:23', 'admin', '2022-08-13 21:45:33', ''); +INSERT INTO `sys_menu` VALUES (2125, '检测项设置', 2124, 2, 'qcindex', 'mes/qc/qcindex/index', NULL, 1, 0, 'C', '0', '0', 'mes:qc:qcindex', 'checkbox', 'admin', '2022-05-17 21:52:33', 'admin', '2022-05-19 11:26:35', ''); +INSERT INTO `sys_menu` VALUES (2126, '检测项列表查询', 2125, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcindex:list', '#', 'admin', '2022-05-17 21:53:07', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2127, '检测项查看', 2125, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcindex:query', '#', 'admin', '2022-05-17 21:53:36', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2128, '检测项新增', 2125, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcindex:add', '#', 'admin', '2022-05-17 21:54:04', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2129, '检测项编辑', 2125, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcindex:edit', '#', 'admin', '2022-05-17 21:54:24', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2130, '检测项删除', 2125, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcindex:remove', '#', 'admin', '2022-05-17 21:54:50', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2131, '检测项导出', 2125, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcindex:export', '#', 'admin', '2022-05-17 21:55:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2132, '检测模板', 2124, 3, 'qctemplate', 'mes/qc/qctemplate/index', NULL, 1, 0, 'C', '0', '0', 'mes:qc:qctemplate', 'example', 'admin', '2022-05-17 22:23:48', 'admin', '2022-05-19 11:26:41', ''); +INSERT INTO `sys_menu` VALUES (2133, '检测模板列表查询', 2132, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qctemplate:list', '#', 'admin', '2022-05-17 22:24:05', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2134, '检测模板查看', 2132, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qctemplate:query', '#', 'admin', '2022-05-17 22:24:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2135, '检测模板新增', 2132, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qctemplate:add', '#', 'admin', '2022-05-17 22:24:50', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2136, '检测模板编辑', 2132, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qctemplate:edit', '#', 'admin', '2022-05-17 22:25:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2137, '检测模板删除', 2132, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qctemplate:remove', '#', 'admin', '2022-05-17 22:25:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2138, '常见缺陷', 2124, 1, 'qcdefect', 'mes/qc/qcdefect/index', NULL, 1, 0, 'C', '0', '0', 'mes:qc:qcdefect', 'bug', 'admin', '2022-05-19 11:26:15', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2139, '缺陷列表查询', 2138, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcdefect:list', '#', 'admin', '2022-05-19 11:27:04', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2140, '缺陷查看', 2138, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcdefect:query', '#', 'admin', '2022-05-19 11:27:28', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2141, '缺陷新增', 2138, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcdefect:add', '#', 'admin', '2022-05-19 11:27:47', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2142, '缺陷编辑', 2138, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcdefect:edit', '#', 'admin', '2022-05-19 11:28:11', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2143, '缺陷删除', 2138, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:qcdefect:remove', '#', 'admin', '2022-05-19 11:28:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2144, '来料检验', 2124, 4, 'iqc', 'mes/qc/iqc/iqc', NULL, 1, 0, 'C', '0', '0', 'mes:qc:iqc', 'edit', 'admin', '2022-05-19 16:32:24', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2145, '来料检验单列表查询', 2144, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:iqc:list', '#', 'admin', '2022-05-19 16:33:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2146, '来料检验单查看', 2144, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:iqc:query', '#', 'admin', '2022-05-19 16:33:41', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2147, '来料检验单新增', 2144, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:iqc:add', '#', 'admin', '2022-05-19 16:34:01', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2148, '来料检验单编辑', 2144, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:iqc:edit', '#', 'admin', '2022-05-19 16:34:19', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2149, '来料检验单删除', 2144, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:iqc:remove', '#', 'admin', '2022-05-19 16:34:35', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2150, '来料检验单导出', 2144, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:iqc:export', '#', 'admin', '2022-05-19 16:34:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2151, '物料入库单', 2042, 3, 'itemrecpt', 'mes/wm/itemrecpt/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:itemrecpt', 'form', 'admin', '2022-05-22 17:35:11', 'admin', '2022-06-14 16:22:12', ''); +INSERT INTO `sys_menu` VALUES (2152, '物料入库单列表查询', 2151, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecpt:list', '#', 'admin', '2022-05-22 17:35:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2153, '物料入库单查看', 2151, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecpt:query', '#', 'admin', '2022-05-22 17:35:53', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2154, '物料入库单新增', 2151, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecpt:add', '#', 'admin', '2022-05-22 17:36:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2155, '物料入库单编辑', 2151, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecpt:edit', '#', 'admin', '2022-05-22 17:36:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2156, '物料入库单删除', 2151, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecpt:remove', '#', 'admin', '2022-05-22 17:36:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2157, '库存现有量', 2042, 2, 'wmstock', 'mes/wm/wmstock/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:wmstock', 'chart', 'admin', '2022-05-30 23:36:40', 'admin', '2022-06-14 16:22:19', ''); +INSERT INTO `sys_menu` VALUES (2158, '库存现有量列表查询', 2157, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:wmstock:list', '#', 'admin', '2022-05-30 23:37:07', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2159, '库存现有量导出', 2157, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:wmstock:export', '#', 'admin', '2022-05-30 23:37:30', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2160, '排班管理', 0, 10, 'cal', NULL, NULL, 1, 0, 'M', '0', '0', NULL, 'peoples', 'admin', '2022-06-05 21:52:34', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2161, '班组设置 ', 2160, 1, 'team', 'mes/cal/team/index', NULL, 1, 0, 'C', '0', '0', 'mes:cal:team', 'peoples', 'admin', '2022-06-05 21:53:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2162, '班组列表查看', 2161, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:team:list', '#', 'admin', '2022-06-05 21:56:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2163, '班组查看', 2161, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:team:query', '#', 'admin', '2022-06-05 21:57:20', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2164, '班组新增', 2161, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:team:add', '#', 'admin', '2022-06-05 21:57:40', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2165, '班组编辑', 2161, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:team:edit', '#', 'admin', '2022-06-05 21:57:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2168, '排班计划', 2160, 2, 'plan', 'mes/cal/plan/index', NULL, 1, 0, 'C', '0', '0', 'mes:cal:plan', 'build', 'admin', '2022-06-06 21:47:04', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2169, '排班计划列表查询', 2168, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:plan:list', '#', 'admin', '2022-06-06 21:47:27', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2170, '排班计划查看', 2168, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:plan:query', '#', 'admin', '2022-06-06 21:47:49', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2171, '排班计划新增', 2168, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:plan:add', '#', 'admin', '2022-06-06 21:48:13', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2172, '排班计划编辑', 2168, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:plan:edit', '#', 'admin', '2022-06-06 21:48:30', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2173, '排班计划删除', 2168, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:plan:remove', '#', 'admin', '2022-06-06 21:48:49', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2174, '节假日设置', 2160, 3, 'holiday', 'mes/cal/holiday/index', NULL, 1, 0, 'C', '0', '0', 'mes:cal:holiday', 'date', 'admin', '2022-06-07 23:25:52', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2175, '节假日查看', 2174, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:holiday:query', '#', 'admin', '2022-06-07 23:26:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2176, '节假日设置', 2174, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:holiday:edit', '#', 'admin', '2022-06-07 23:26:41', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2177, '排班日历', 2160, 4, 'calendar', 'mes/cal/calendar/index', NULL, 1, 0, 'C', '0', '0', 'mes:cal:calendar', 'date-range', 'admin', '2022-06-09 21:08:06', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2178, '查看排班日历', 2177, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:calendar:list', '#', 'admin', '2022-06-09 21:08:52', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2179, '供应商退货', 2042, 4, 'rtvendor', 'mes/wm/rtvendor/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:rtvendor', 'link', 'admin', '2022-06-13 15:29:43', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2180, '退货单列表查询', 2179, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendor:list', '#', 'admin', '2022-06-13 15:30:45', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2181, '退货单信息查看', 2179, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendor:query', '#', 'admin', '2022-06-13 15:31:13', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2182, '退货单新增', 2179, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendor:add', '#', 'admin', '2022-06-13 15:31:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2183, '退货单编辑', 2179, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendor:edit', '#', 'admin', '2022-06-13 15:31:49', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2184, '退货单删除', 2179, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendor:remove', '#', 'admin', '2022-06-13 15:32:06', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2185, '点检保养项目', 2059, 3, 'dvsubject', 'mes/dv/subject/index', NULL, 1, 0, 'C', '0', '0', 'mes:dv:dvsubject', 'cascader', 'admin', '2022-06-16 20:17:37', 'admin', '2022-06-16 20:20:44', ''); +INSERT INTO `sys_menu` VALUES (2186, '项目列表查询', 2185, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:dvsubject:list', '#', 'admin', '2022-06-16 20:18:10', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2187, '项目信息查看', 2185, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:dvsubject:query', '#', 'admin', '2022-06-16 20:18:37', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2188, '项目信息新增', 2185, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:dvsubject:add', '#', 'admin', '2022-06-16 20:18:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2189, '项目信息编辑', 2185, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:dvsubject:edit', '#', 'admin', '2022-06-16 20:19:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2190, '项目删除', 2185, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:dvsubject:remove', '#', 'admin', '2022-06-16 20:19:54', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2191, '点检保养计划', 2059, 4, 'checkplan', 'mes/dv/checkplan/index', NULL, 1, 0, 'C', '0', '0', 'mes:dv:checkplan', 'build', 'admin', '2022-06-16 21:35:31', 'admin', '2022-09-01 22:17:50', ''); +INSERT INTO `sys_menu` VALUES (2192, '点检计划列表查询', 2191, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:list', '#', 'admin', '2022-06-16 21:36:03', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2193, '点检计划查看', 2191, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:query', '#', 'admin', '2022-06-16 21:36:34', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2194, '点检计划新增', 2191, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:add', '#', 'admin', '2022-06-16 21:36:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2195, '点检计划编辑', 2191, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:edit', '#', 'admin', '2022-06-16 21:37:15', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2196, '点检计划删除', 2191, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:remove', '#', 'admin', '2022-06-16 21:37:35', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2197, '生产领料', 2042, 5, 'issue', 'mes/wm/issue/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:issueheader', 'edit', 'admin', '2022-07-17 19:24:17', 'admin', '2022-08-22 13:52:30', ''); +INSERT INTO `sys_menu` VALUES (2198, '生产领料新增', 2197, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueheader:add', '#', 'admin', '2022-07-17 19:24:43', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2199, '生产领料列表查询', 2197, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueheader:list', '#', 'admin', '2022-07-17 19:25:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2200, '生产领料信息查看', 2197, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueheader:query', '#', 'admin', '2022-07-17 19:25:37', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2201, '生产领料编辑', 2197, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueheader:edit', '#', 'admin', '2022-07-17 19:25:54', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2202, '生产领料删除', 2197, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueheader:remove', '#', 'admin', '2022-07-17 19:26:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2203, '条码清单', 2042, 10, 'barcode', 'mes/wm/barcode/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:barcode', 'barcode', 'admin', '2022-08-01 11:19:01', 'admin', '2022-10-10 12:50:47', ''); +INSERT INTO `sys_menu` VALUES (2204, '条码清单', 2203, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:barcode:list', '#', 'admin', '2022-08-01 11:19:23', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2205, '维修单', 2059, 5, 'repair', 'mes/dv/repair/index', NULL, 1, 0, 'C', '0', '0', 'mes:dv:repair', 'system', 'admin', '2022-08-06 15:19:26', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2206, '维修单列表查询', 2205, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repair:list', '#', 'admin', '2022-08-06 15:19:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2207, '维修单查看', 2205, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repair:query', '#', 'admin', '2022-08-06 15:20:19', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2208, '维修单修改', 2205, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repair:edit', '#', 'admin', '2022-08-06 15:20:41', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2209, '维修单删除', 2205, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repair:remove', '#', 'admin', '2022-08-06 15:20:58', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2210, '组织架构', 0, 0, 'user', NULL, NULL, 1, 0, 'M', '0', '0', NULL, 'tree', 'admin', '2022-08-13 21:41:16', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2214, '过程检验', 2124, 5, 'ipqc', 'mes/qc/ipqc/index', NULL, 1, 0, 'C', '0', '0', 'mes:qc:ipqc', 'job', 'admin', '2022-08-29 20:46:27', 'admin', '2022-08-29 20:46:45', ''); +INSERT INTO `sys_menu` VALUES (2215, '过程检验单列表查询', 2214, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:list', '#', 'admin', '2022-08-29 20:47:26', 'admin', '2022-08-29 20:47:46', ''); +INSERT INTO `sys_menu` VALUES (2216, '过程检验单详情查看', 2214, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:query', '#', 'admin', '2022-08-29 20:48:10', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2217, '过程检验单新增', 2214, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:add', '#', 'admin', '2022-08-29 20:48:39', 'admin', '2022-08-29 20:48:56', ''); +INSERT INTO `sys_menu` VALUES (2218, '过程检验单编辑', 2214, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:edit', '#', 'admin', '2022-08-29 20:49:22', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2219, '过程检验单删除', 2214, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:remove', '#', 'admin', '2022-08-29 20:49:44', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2220, '出货检验', 2124, 6, 'oqc', 'mes/qc/oqc/index', NULL, 1, 0, 'C', '0', '0', 'mes:qc:oqc', 'guide', 'admin', '2022-08-31 22:17:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2221, '出货检验单列表查询', 2220, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqc:list', '#', 'admin', '2022-08-31 22:18:20', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2222, '出货检验单明细查看', 2220, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqc:query', '#', 'admin', '2022-08-31 22:18:47', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2223, '出货检验单新增', 2220, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqc:add', '#', 'admin', '2022-08-31 22:19:10', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2224, '出货检验单编辑', 2220, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqc:edit', '#', 'admin', '2022-08-31 22:19:27', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2225, '出货检验单删除', 2220, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqc:remove', '#', 'admin', '2022-08-31 22:19:45', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2226, '生产退料', 2042, 6, 'rtissue', 'mes/wm/rtissue/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:rtissue', 'logininfor', 'admin', '2022-09-03 23:39:43', 'admin', '2022-09-15 22:59:05', '生产退料单头菜单'); +INSERT INTO `sys_menu` VALUES (2227, '生产退料单列表查询', 2226, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtissue:list', '#', 'admin', '2022-09-03 23:39:43', 'admin', '2022-09-15 22:59:42', ''); +INSERT INTO `sys_menu` VALUES (2228, '生产退料单头新增', 2226, 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtissue:add', '#', 'admin', '2022-09-03 23:39:43', 'admin', '2022-09-15 22:59:55', ''); +INSERT INTO `sys_menu` VALUES (2229, '生产退料单头修改', 2226, 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtissue:edit', '#', 'admin', '2022-09-03 23:39:43', 'admin', '2022-09-15 23:00:06', ''); +INSERT INTO `sys_menu` VALUES (2230, '生产退料单头删除', 2226, 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtissue:remove', '#', 'admin', '2022-09-03 23:39:43', 'admin', '2022-09-15 23:00:17', ''); +INSERT INTO `sys_menu` VALUES (2231, '生产退料明细查看', 2226, 5, '#', '', NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtissue:query', '#', 'admin', '2022-09-03 23:39:43', 'admin', '2022-09-15 23:00:44', ''); +INSERT INTO `sys_menu` VALUES (2232, '产品入库', 2042, 7, 'productrecpt', 'mes/wm/productrecpt/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:productrecpt', 'shopping', 'admin', '2022-09-22 21:02:47', 'admin', '2022-10-06 18:20:41', ''); +INSERT INTO `sys_menu` VALUES (2233, '产品入库单列表查询', 2232, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:productrecpt:list', '#', 'admin', '2022-09-22 21:03:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2234, '产品入库单明细查看', 2232, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:productrecpt:query', '#', 'admin', '2022-09-22 21:03:34', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2235, '产品入库单编辑', 2232, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:productrecpt:edit', '#', 'admin', '2022-09-22 21:03:57', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2236, '产品入库单删除', 2232, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:productrecpt:remove', '#', 'admin', '2022-09-22 21:04:15', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2237, '生产报工', 2072, 5, 'feedback', 'mes/pro/feedback/index', NULL, 1, 0, 'C', '0', '0', 'mes:pro:feedback', 'chart', 'admin', '2022-10-03 20:13:20', 'admin', '2022-10-03 20:13:43', ''); +INSERT INTO `sys_menu` VALUES (2238, '销售出库', 2042, 8, 'productsalse', 'mes/wm/productsalse/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:productsalse', 'guide', 'admin', '2022-10-05 18:54:42', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2239, '出库单列表查询', 2238, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:productsalse:list', '#', 'admin', '2022-10-05 18:55:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2240, '销售出库单明细查看', 2238, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:productsalse:query', '#', 'admin', '2022-10-05 18:55:43', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2241, '销售出库单新增', 2238, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:productsalse:add', '#', 'admin', '2022-10-05 18:56:04', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2242, '销售出库单编辑', 2238, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:productsalse:edit', '#', 'admin', '2022-10-05 18:56:21', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2243, '销售出库单删除', 2238, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:productsalse:remove', '#', 'admin', '2022-10-05 18:56:51', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2244, '销售退货', 2042, 9, 'rtsalse', 'mes/wm/rtsalse/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:rtsalse', 'link', 'admin', '2022-10-06 21:28:47', 'admin', '2022-10-06 22:02:18', ''); +INSERT INTO `sys_menu` VALUES (2245, '退货单列表查询', 2244, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtsalse:list', '#', 'admin', '2022-10-06 21:29:27', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2246, '销售退货单明细查看', 2244, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtsalse:query', '#', 'admin', '2022-10-06 21:29:51', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2247, '销售退货单新增', 2244, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtsalse:add', '#', 'admin', '2022-10-06 21:30:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2248, '销售退货单编辑', 2244, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtsalse:edit', '#', 'admin', '2022-10-06 21:30:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2249, '销售退货单删除', 2244, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtsalse:remove', '#', 'admin', '2022-10-06 21:31:03', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2250, '装箱管理', 2042, 11, 'package', 'mes/wm/package/index', NULL, 1, 0, 'C', '0', '0', 'mes:wm:package', 'table', 'admin', '2022-10-10 12:48:22', 'admin', '2022-10-10 12:51:46', ''); +INSERT INTO `sys_menu` VALUES (2251, '装箱单列表查询', 2250, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:package:list', '#', 'admin', '2022-10-10 12:49:03', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2252, '装箱单明细查看', 2250, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:package:query', '#', 'admin', '2022-10-10 12:49:26', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2253, '装箱单新增', 2250, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:package:add', '#', 'admin', '2022-10-10 12:49:42', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2254, '装箱单编辑', 2250, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:package:edit', '#', 'admin', '2022-10-10 12:50:01', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2255, '装箱单删除', 2250, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:package:remove', '#', 'admin', '2022-10-10 12:50:23', '', NULL, ''); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/实施文档/初始化配置数据.xlsx b/doc/实施文档/初始化配置数据.xlsx new file mode 100644 index 0000000..098384e Binary files /dev/null and b/doc/实施文档/初始化配置数据.xlsx differ diff --git a/doc/实施文档/系统权限清单.xlsx b/doc/实施文档/系统权限清单.xlsx new file mode 100644 index 0000000..d8fbb7f Binary files /dev/null and b/doc/实施文档/系统权限清单.xlsx differ diff --git a/doc/开发进度/进度甘特图.xlsx b/doc/开发进度/进度甘特图.xlsx new file mode 100644 index 0000000..3713e8d Binary files /dev/null and b/doc/开发进度/进度甘特图.xlsx differ diff --git a/doc/设计文档/功能设计/功能清单.xlsx b/doc/设计文档/功能设计/功能清单.xlsx new file mode 100644 index 0000000..f0586e7 Binary files /dev/null and b/doc/设计文档/功能设计/功能清单.xlsx differ diff --git a/doc/设计文档/原型设计/原型/APP.rp b/doc/设计文档/原型设计/原型/APP.rp new file mode 100644 index 0000000..3f5297b Binary files /dev/null and b/doc/设计文档/原型设计/原型/APP.rp differ diff --git a/doc/设计文档/原型设计/截图/工作站设置.png b/doc/设计文档/原型设计/截图/工作站设置.png new file mode 100644 index 0000000..819fdd9 Binary files /dev/null and b/doc/设计文档/原型设计/截图/工作站设置.png differ diff --git a/doc/设计文档/原型设计/截图/库存现有量.png b/doc/设计文档/原型设计/截图/库存现有量.png new file mode 100644 index 0000000..ec54324 Binary files /dev/null and b/doc/设计文档/原型设计/截图/库存现有量.png differ diff --git a/doc/设计文档/原型设计/截图/报表设计.png b/doc/设计文档/原型设计/截图/报表设计.png new file mode 100644 index 0000000..0c82a14 Binary files /dev/null and b/doc/设计文档/原型设计/截图/报表设计.png differ diff --git a/doc/设计文档/原型设计/截图/排班日历.png b/doc/设计文档/原型设计/截图/排班日历.png new file mode 100644 index 0000000..d6b78e4 Binary files /dev/null and b/doc/设计文档/原型设计/截图/排班日历.png differ diff --git a/doc/设计文档/原型设计/截图/条码管理.png b/doc/设计文档/原型设计/截图/条码管理.png new file mode 100644 index 0000000..a2e5703 Binary files /dev/null and b/doc/设计文档/原型设计/截图/条码管理.png differ diff --git a/doc/设计文档/原型设计/截图/物料产品设置.png b/doc/设计文档/原型设计/截图/物料产品设置.png new file mode 100644 index 0000000..5a850f3 Binary files /dev/null and b/doc/设计文档/原型设计/截图/物料产品设置.png differ diff --git a/doc/设计文档/原型设计/截图/生产排产.png b/doc/设计文档/原型设计/截图/生产排产.png new file mode 100644 index 0000000..f681c56 Binary files /dev/null and b/doc/设计文档/原型设计/截图/生产排产.png differ diff --git a/doc/设计文档/原型设计/截图/节假日设置.png b/doc/设计文档/原型设计/截图/节假日设置.png new file mode 100644 index 0000000..421a8bd Binary files /dev/null and b/doc/设计文档/原型设计/截图/节假日设置.png differ diff --git a/doc/设计文档/原型设计/截图/触控屏-登录页面.png b/doc/设计文档/原型设计/截图/触控屏-登录页面.png new file mode 100644 index 0000000..ce59e8b Binary files /dev/null and b/doc/设计文档/原型设计/截图/触控屏-登录页面.png differ diff --git a/doc/设计文档/原型设计/截图/触控屏-质量管理.png b/doc/设计文档/原型设计/截图/触控屏-质量管理.png new file mode 100644 index 0000000..3cb992a Binary files /dev/null and b/doc/设计文档/原型设计/截图/触控屏-质量管理.png differ diff --git a/doc/设计文档/原型设计/草图/IQC-打印.png b/doc/设计文档/原型设计/草图/IQC-打印.png new file mode 100644 index 0000000..4dc92e4 Binary files /dev/null and b/doc/设计文档/原型设计/草图/IQC-打印.png differ diff --git a/doc/设计文档/原型设计/草图/IQC.png b/doc/设计文档/原型设计/草图/IQC.png new file mode 100644 index 0000000..91775e5 Binary files /dev/null and b/doc/设计文档/原型设计/草图/IQC.png differ diff --git a/doc/设计文档/原型设计/草图/IQC2.png b/doc/设计文档/原型设计/草图/IQC2.png new file mode 100644 index 0000000..1eb973c Binary files /dev/null and b/doc/设计文档/原型设计/草图/IQC2.png differ diff --git a/doc/设计文档/原型设计/草图/巡检计划.png b/doc/设计文档/原型设计/草图/巡检计划.png new file mode 100644 index 0000000..e78e9d6 Binary files /dev/null and b/doc/设计文档/原型设计/草图/巡检计划.png differ diff --git a/doc/设计文档/原型设计/草图/库存核心.png b/doc/设计文档/原型设计/草图/库存核心.png new file mode 100644 index 0000000..fd713fa Binary files /dev/null and b/doc/设计文档/原型设计/草图/库存核心.png differ diff --git a/doc/设计文档/原型设计/草图/手机端-首页.png b/doc/设计文档/原型设计/草图/手机端-首页.png new file mode 100644 index 0000000..314f48d Binary files /dev/null and b/doc/设计文档/原型设计/草图/手机端-首页.png differ diff --git a/doc/设计文档/原型设计/草图/排产.png b/doc/设计文档/原型设计/草图/排产.png new file mode 100644 index 0000000..fb4057f Binary files /dev/null and b/doc/设计文档/原型设计/草图/排产.png differ diff --git a/doc/设计文档/原型设计/草图/排班日历-班组.png b/doc/设计文档/原型设计/草图/排班日历-班组.png new file mode 100644 index 0000000..a513b29 Binary files /dev/null and b/doc/设计文档/原型设计/草图/排班日历-班组.png differ diff --git a/doc/设计文档/原型设计/草图/排班日历-类型.png b/doc/设计文档/原型设计/草图/排班日历-类型.png new file mode 100644 index 0000000..e933176 Binary files /dev/null and b/doc/设计文档/原型设计/草图/排班日历-类型.png differ diff --git a/doc/设计文档/原型设计/草图/排班计划.png b/doc/设计文档/原型设计/草图/排班计划.png new file mode 100644 index 0000000..25a8d2b Binary files /dev/null and b/doc/设计文档/原型设计/草图/排班计划.png differ diff --git a/doc/设计文档/原型设计/草图/触控屏-生产.png b/doc/设计文档/原型设计/草图/触控屏-生产.png new file mode 100644 index 0000000..b3ab97d Binary files /dev/null and b/doc/设计文档/原型设计/草图/触控屏-生产.png differ diff --git a/doc/设计文档/原型设计/草图/触控屏-登录.png b/doc/设计文档/原型设计/草图/触控屏-登录.png new file mode 100644 index 0000000..c9fb4d5 Binary files /dev/null and b/doc/设计文档/原型设计/草图/触控屏-登录.png differ diff --git a/doc/设计文档/原型设计/草图/质量检测-缺陷记录.png b/doc/设计文档/原型设计/草图/质量检测-缺陷记录.png new file mode 100644 index 0000000..f6dc651 Binary files /dev/null and b/doc/设计文档/原型设计/草图/质量检测-缺陷记录.png differ diff --git a/doc/设计文档/原型设计/草图/质量检测-缺陷记录2.png b/doc/设计文档/原型设计/草图/质量检测-缺陷记录2.png new file mode 100644 index 0000000..27775a5 Binary files /dev/null and b/doc/设计文档/原型设计/草图/质量检测-缺陷记录2.png differ diff --git a/doc/设计文档/原型设计/草图/质量检测.png b/doc/设计文档/原型设计/草图/质量检测.png new file mode 100644 index 0000000..f3daac0 Binary files /dev/null and b/doc/设计文档/原型设计/草图/质量检测.png differ diff --git a/doc/设计文档/原型设计/草图/首页.png b/doc/设计文档/原型设计/草图/首页.png new file mode 100644 index 0000000..91f4080 Binary files /dev/null and b/doc/设计文档/原型设计/草图/首页.png differ diff --git a/doc/设计文档/数据库设计/mes-cal.sql b/doc/设计文档/数据库设计/mes-cal.sql new file mode 100644 index 0000000..fc8a1ab --- /dev/null +++ b/doc/设计文档/数据库设计/mes-cal.sql @@ -0,0 +1,172 @@ +-- ---------------------------- +-- 1、班组表 +-- ---------------------------- +drop table if exists cal_team; +create table cal_team ( + team_id bigint(20) not null auto_increment comment '班组ID', + team_code varchar(64) not null comment '班组编号', + team_name varchar(255) not null comment '班组名称', + calendar_type varchar(64) comment '班组类型', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (team_id) +) engine=innodb auto_increment=200 comment = '班组表'; + + +-- ---------------------------- +-- 2、班组成员表 +-- ---------------------------- +drop table if exists cal_team_member; +create table cal_team_member ( + member_id bigint(20) not null auto_increment comment '班组成员ID', + team_id bigint(20) not null comment '班组ID', + user_id bigint(20) not null comment '用户ID', + user_name varchar(64) not null comment '用户名', + nick_name varchar(64) comment '用户昵称', + tel varchar(64) comment '电话', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (member_id) +) engine=innodb auto_increment=200 comment = '班组成员表'; + + +-- ---------------------------- +-- 3、排班计划 +-- ---------------------------- +drop table if exists cal_plan; +create table cal_plan ( + plan_id bigint(20) not null auto_increment comment '计划ID', + plan_code varchar(64) not null comment '计划编号', + plan_name varchar(255) not null comment '计划名称', + calendar_type varchar(64) comment '班组类型', + start_date datetime not null comment '开始日期', + end_date datetime not null comment '结束日期', + shift_type varchar(64) comment '轮班方式', + shift_method varchar(64) comment '倒班方式', + shift_count int(11) comment '数', + status varchar(64) default 'PREPARE' comment '状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (plan_id) +) engine=innodb auto_increment=200 comment = '排班计划表'; + + + +-- ---------------------------- +-- 4、计划班次 +-- ---------------------------- +drop table if exists cal_shift; +create table cal_shift ( + shift_id bigint(20) not null auto_increment comment '班次ID', + plan_id bigint(20) not null comment '计划ID', + order_num int(2) not null comment '序号', + shift_name varchar(64) not null comment '班次名称', + start_time varchar(10) not null comment '开始时间', + end_time varchar(10) not null comment '结束时间', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (shift_id) +) engine=innodb auto_increment=200 comment = '计划班次表'; + + +-- ---------------------------- +-- 5、计划班组 +-- ---------------------------- +drop table if exists cal_plan_team; +create table cal_plan_team ( + record_id bigint(20) not null auto_increment comment '流水号', + plan_id bigint(20) not null comment '计划ID', + team_id bigint(20) not null comment '班组ID', + team_code varchar(64) comment '班组编号', + team_name varchar(64) comment '班组名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '计划班组表'; + + +-- ---------------------------- +-- 6、节假日设置 +-- ---------------------------- +drop table if exists cal_holiday; +create table cal_holiday ( + holiday_id bigint(20) not null auto_increment comment '流水号', + the_day datetime comment '日期', + holiday_type varchar(64) comment '日期类型', + start_time datetime comment '开始时间', + end_time datetime comment '结束时间', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (holiday_id) +) engine=innodb auto_increment=200 comment = '节假日设置'; + + +-- ---------------------------- +-- 7、班组排班表 +-- ---------------------------- +drop table if exists cal_teamshift; +create table cal_teamshift ( + record_id bigint(20) not null auto_increment comment '流水号', + the_day varchar(64) not null comment '日期', + team_id bigint(20) not null comment '班组ID', + team_name varchar(255) comment '班组名称', + shift_id bigint(20) not null comment '班次ID', + shift_name varchar(255) comment '班次名称', + order_num int(11) comment '序号', + plan_id bigint(20) comment '计划ID', + calendar_type varchar(64) comment '班组类型', + shift_type varchar(64) comment '轮班方式', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '班组排班表'; + diff --git a/doc/设计文档/数据库设计/mes-dv.sql b/doc/设计文档/数据库设计/mes-dv.sql new file mode 100644 index 0000000..ea4b659 --- /dev/null +++ b/doc/设计文档/数据库设计/mes-dv.sql @@ -0,0 +1,372 @@ +-- ---------------------------- +-- 1、设备类型表 +-- ---------------------------- +drop table if exists dv_machinery_type; +create table dv_machinery_type ( + machinery_type_id bigint(20) not null auto_increment comment '设备类型ID', + machinery_type_code varchar(64) not null comment '设备类型编码', + machinery_type_name varchar(255) not null comment '设备类型名称', + parent_type_id bigint(20) default 0 comment '父类型ID', + ancestors varchar(255) not null comment '所有父节点ID', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (machinery_type_id) +) engine=innodb auto_increment=200 comment = '设备类型表'; + + +-- ---------------------------- +-- 2、设备表 +-- ---------------------------- +drop table if exists dv_machinery; +create table dv_machinery ( + machinery_id bigint(20) not null auto_increment comment '设备类型ID', + machinery_code varchar(64) not null comment '设备类型编码', + machinery_name varchar(255) not null comment '设备类型名称', + machinery_brand varchar(255) comment '品牌', + machinery_spec varchar(255) comment '规格型号', + machinery_type_id bigint(20) not null comment '设备类型ID', + machinery_type_code varchar(64) comment '设备类型编码', + machinery_type_name varchar(255) comment '设备类型名称', + workshop_id bigint(20) not null comment '所属车间ID', + workshop_code varchar(64) comment '所属车间编码', + workshop_name varchar(255) comment '所属车间名称', + status varchar(64) default 'STOP' not null comment '设备状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (machinery_id) +) engine=innodb auto_increment=200 comment = '设备表'; + + +-- ---------------------------- +-- 3、设备点检保养项目表 +-- ---------------------------- +drop table if exists dv_subject; +create table dv_subject ( + subject_id bigint(20) not null auto_increment comment '项目ID', + subject_code varchar(64) not null comment '项目编码', + subject_name varchar(255) comment '项目名称', + subject_type varchar(64) default 0 comment '项目类型', + subject_content varchar(500) not null comment '项目内容', + subject_standard varchar(255) comment '标准', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (subject_id) +) engine=innodb auto_increment=200 comment = '设备点检保养项目表'; + + + +-- ---------------------------- +-- 4、设备点检保养计划头表 +-- ---------------------------- +drop table if exists dv_check_plan; +create table dv_check_plan ( + plan_id bigint(20) not null auto_increment comment '计划ID', + plan_code varchar(64) not null comment '计划编码', + plan_name varchar(255) comment '计划名称', + plan_type varchar(64) not null comment '计划类型', + start_date datetime comment '开始日期', + end_date datetime comment '结束日期', + cycle_type varchar(64) comment '频率', + cycle_count int(11) comment '次数', + status varchar(64) comment '状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (plan_id) +) engine=innodb auto_increment=200 comment = '设备点检保养计划头表'; + + + + +-- ---------------------------- +-- 5、点检保养计划设备表 +-- ---------------------------- +drop table if exists dv_check_machinery; +create table dv_check_machinery ( + record_id bigint(20) not null auto_increment comment '流水号', + plan_id bigint(20) not null comment '计划ID', + machinery_id bigint(20) not null comment '设备ID', + machinery_code varchar(64) not null comment '设备编码', + machinery_name varchar(255) not null comment '设备名称', + machinery_brand varchar(255) comment '品牌', + machinery_spec varchar(255) comment '规格型号', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '点检设备表'; + + +-- ---------------------------- +-- 6、点检保养计划项目表 +-- ---------------------------- +drop table if exists dv_check_subject; +create table dv_check_subject ( + record_id bigint(20) not null auto_increment comment '流水号', + plan_id bigint(20) not null comment '计划ID', + subject_id bigint(20) not null comment '项目ID', + subject_code varchar(64) not null comment '项目编码', + subject_name varchar(255) comment '项目名称', + subject_type varchar(64) comment '项目类型', + subject_content varchar(500) not null comment '项目内容', + subject_standard varchar(255) comment '标准', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '点检项目表'; + + + +-- ---------------------------- +-- 7、设备点检记录表 +-- ---------------------------- +drop table if exists dv_check_record; +create table dv_check_record ( + record_id bigint(20) not null auto_increment comment '计划ID', + plan_id bigint(20) comment '计划ID', + plan_code varchar(64) comment '计划编码', + plan_name varchar(255) comment '计划名称', + plan_type varchar(64) comment '计划类型', + machinery_id bigint(20) not null comment '设备ID', + machinery_code varchar(64) not null comment '设备编码', + machinery_name varchar(255) not null comment '设备名称', + machinery_brand varchar(255) comment '品牌', + machinery_spec varchar(255) comment '规格型号', + check_time datetime not null comment '点检时间', + status varchar(64) default 'PREPARE' comment '状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '设备点检记录表'; + + +-- ---------------------------- +-- 8、设备点检记录行表 +-- ---------------------------- +drop table if exists dv_check_record_line; +create table dv_check_record_line ( + line_id bigint(20) not null auto_increment comment '计划ID', + record_id bigint(20) not null comment '计划ID', + subject_id bigint(20) not null comment '项目ID', + subject_code varchar(64) not null comment '项目编码', + subject_name varchar(255) comment '项目名称', + subject_type varchar(64) comment '项目类型', + subject_content varchar(500) not null comment '项目内容', + subject_standard varchar(255) comment '标准', + check_status varchar(64) not null comment '点检结果', + check_result varchar(500) comment '异常描述', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '设备点检记录行表'; + + + + + + +-- ---------------------------- +-- 7、设备保养记录表 +-- ---------------------------- +drop table if exists dv_mainten_record; +create table dv_mainten_record ( + record_id bigint(20) not null auto_increment comment '计划ID', + plan_id bigint(20) comment '计划ID', + plan_code varchar(64) comment '计划编码', + plan_name varchar(255) comment '计划名称', + plan_type varchar(64) comment '计划类型', + machinery_id bigint(20) not null comment '设备ID', + machinery_code varchar(64) not null comment '设备编码', + machinery_name varchar(255) not null comment '设备名称', + machinery_brand varchar(255) comment '品牌', + machinery_spec varchar(255) comment '规格型号', + mainten_time datetime not null comment '保养时间', + status varchar(64) default 'PREPARE' comment '状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '设备保养记录表'; + + +-- ---------------------------- +-- 8、设备保养记录行表 +-- ---------------------------- +drop table if exists dv_mainten_record_line; +create table dv_mainten_record_line ( + line_id bigint(20) not null auto_increment comment '计划ID', + record_id bigint(20) not null comment '计划ID', + subject_id bigint(20) not null comment '项目ID', + subject_code varchar(64) not null comment '项目编码', + subject_name varchar(255) comment '项目名称', + subject_type varchar(64) comment '项目类型', + subject_content varchar(500) not null comment '项目内容', + subject_standard varchar(255) comment '标准', + mainten_status varchar(64) not null comment '保养结果', + mainten_result varchar(500) comment '异常描述', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '设备保养记录行表'; + + + + + +-- ---------------------------- +-- 7、设备维修单 +-- ---------------------------- +drop table if exists dv_repair; +create table dv_repair ( + repair_id bigint(20) not null auto_increment comment '维修单ID', + repair_code varchar(64) not null comment '维修单编号', + repair_name varchar(255) comment '维修单名称', + machinery_id bigint(20) not null comment '设备ID', + machinery_code varchar(64) not null comment '设备编码', + machinery_name varchar(255) not null comment '设备名称', + machinery_brand varchar(255) comment '品牌', + machinery_spec varchar(255) comment '规格型号', + machinery_type_id bigint(20) not null comment '设备类型ID', + require_date datetime comment '报修日期', + finish_date datetime comment '维修完成日期', + confirm_date datetime comment '验收日期', + repair_result varchar(64) comment '维修结果', + accepted_by varchar(64) comment '维修人员', + confirm_by varchar(64) comment '验收人员', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (repair_id) +) engine=innodb auto_increment=200 comment = '设备维修单'; + + + +-- ---------------------------- +-- 7、设备维修单行 +-- ---------------------------- +drop table if exists dv_repair_line; +create table dv_repair_line ( + line_id bigint(20) not null auto_increment comment '行ID', + repair_id bigint(20) not null comment '维修单ID', + subject_id bigint(20) comment '项目ID', + subject_code varchar(64) comment '项目编码', + subject_name varchar(255) comment '项目名称', + subject_type varchar(64) comment '项目类型', + subject_content varchar(500) comment '项目内容', + subject_standard varchar(255) comment '标准', + malfunction varchar(500) not null comment '故障描述', + malfunction_url varchar(255) comment '故障描述资源', + repair_des varchar(500) comment '维修情况', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '设备维修单行'; + + +-- ---------------------------- +-- 7、设备开停机记录表 +-- ---------------------------- +drop table if exists dv_dss_record; +create table dv_dss_record ( + record_id bigint(20) not null auto_increment comment '记录ID', + plan_code varchar(64) comment '记录编号', + record_type varchar(64) default 'STOP' comment '记录类型', + machinery_id bigint(20) not null comment '设备ID', + machinery_code varchar(64) not null comment '设备编码', + machinery_name varchar(255) not null comment '设备名称', + machinery_brand varchar(255) comment '品牌', + machinery_spec varchar(255) comment '规格型号', + record_time datetime not null comment '记录时间', + status varchar(64) default 'PREPARE' comment '状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '设备保养记录表'; \ No newline at end of file diff --git a/doc/设计文档/数据库设计/mes-md.sql b/doc/设计文档/数据库设计/mes-md.sql new file mode 100644 index 0000000..579fcfd --- /dev/null +++ b/doc/设计文档/数据库设计/mes-md.sql @@ -0,0 +1,372 @@ +-- ---------------------------- +-- 1、物料产品表 +-- ---------------------------- +drop table if exists md_item; +create table md_item ( + item_id bigint(20) not null auto_increment comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + specification varchar(500) default null comment '规格型号', + unit_of_measure varchar(64) not null comment '单位编码', + unit_name varchar(64) comment '单位名称' + item_or_product varchar(20) not null comment '产品物料标识', + item_type_id bigint(20) default 0 comment '物料类型ID', + item_type_code varchar(64) default '' comment '物料类型编码', + item_type_name varchar(255) default '' comment '物料类型名称', + enable_flag char(1) default 'Y' not null comment '是否启用', + safe_stock_flag char(1) default 'N' not null comment '是否设置安全库存', + min_stock double(12,4) default 0 comment '最低库存量', + max_stock double(12,4) default 0 comment '最大库存量', + high_value char(1) default 'N' not null comment '高价值物资', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (item_id) +) engine=innodb auto_increment=200 comment = '物料产品表'; + +-- ---------------------------- +-- 2、物料产品分类表 +-- ---------------------------- +drop table if exists md_item_type; +create table md_item_type ( + item_type_id bigint(20) not null auto_increment comment '产品物料类型ID', + item_type_code varchar(64) not null comment '产品物料类型编码', + item_type_name varchar(255) not null comment '产品物料类型名称', + parent_type_id bigint default 0 not null comment '父类型ID', + ancestors varchar(255) not null comment '所有层级父节点', + item_or_product varchar(20) not null comment '产品物料标识', + order_num int(11) default 1 comment '排列顺序', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (item_type_id) +) engine=innodb auto_increment=200 comment = '物料产品分类表'; + +-- ---------------------------- +-- 3、产品BOM关系表 +-- ---------------------------- +drop table if exists md_product_bom; +create table md_product_bom ( + bom_id bigint(20) not null auto_increment comment '流水号', + item_id bigint(20) not null comment '物料产品ID', + bom_item_id bigint(20) not null comment 'BOM物料ID', + bom_item_code varchar(64) not null comment 'BOM物料编码', + bom_item_name varchar(255) not null comment 'BOM物料名称', + bom_item_spec varchar(500) comment 'BOM物料规格', + unit_of_measure varchar(64) not null comment 'BOM物料单位', + item_or_product varchar(20) not null comment '产品物料标识', + quantity double(12,4) default 0 not null comment '物料使用比例', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (bom_id) +) engine=innodb auto_increment=200 comment = '产品BOM关系表'; + + +-- ---------------------------- +-- 4、供应商表 +-- ---------------------------- +drop table if exists md_vendor; +create table md_vendor ( + vendor_id bigint(20) not null auto_increment comment '供应商ID', + vendor_code varchar(64) not null comment '供应商编码', + vendor_name varchar(255) not null comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + vendor_en varchar(255) comment '供应商英文名称', + vendor_des varchar(500) comment '供应商简介', + vendor_logo varchar(255) comment '供应商LOGO地址', + vendor_level varchar(64) comment '供应商等级', + vendor_score int(11) comment '供应商评分', + address varchar(500) comment '供应商地址', + website varchar(255) comment '供应商官网地址', + email varchar(255) comment '供应商邮箱地址', + tel varchar(64) comment '供应商电话', + contact1 varchar(64) comment '联系人1', + contact1_tel varchar(64) comment '联系人1-电话', + contact1_email varchar(255) comment '联系人1-邮箱', + contact2 varchar(64) comment '联系人2', + contact2_tel varchar(64) comment '联系人2-电话', + contact2_email varchar(255) comment '联系人2-邮箱', + credit_code varchar(64) comment '统一社会信用代码', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (vendor_id) +) engine=innodb auto_increment=200 comment = '供应商表'; + + +-- ---------------------------- +-- 5、客户表 +-- ---------------------------- +drop table if exists md_client; +create table md_client ( + client_id bigint(20) not null auto_increment comment '客户ID', + client_code varchar(64) not null comment '客户编码', + client_name varchar(255) not null comment '客户名称', + client_nick varchar(255) comment '客户简称', + client_en varchar(255) comment '客户英文名称', + client_des varchar(500) comment '客户简介', + client_logo varchar(255) comment '客户LOGO地址', + client_type varchar(64) default 'ENTERPRISE' comment '客户类型', + address varchar(500) comment '客户地址', + website varchar(255) comment '客户官网地址', + email varchar(255) comment '客户邮箱地址', + tel varchar(64) comment '客户电话', + contact1 varchar(64) comment '联系人1', + contact1_tel varchar(64) comment '联系人1-电话', + contact1_email varchar(255) comment '联系人1-邮箱', + contact2 varchar(64) comment '联系人2', + contact2_tel varchar(64) comment '联系人2-电话', + contact2_email varchar(255) comment '联系人2-邮箱', + credit_code varchar(64) comment '统一社会信用代码', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (client_id) +) engine=innodb auto_increment=200 comment = '客户表'; + +-- ---------------------------- +-- 6、单位表 +-- ---------------------------- +drop table if exists md_unit_measure; +create table md_unit_measure ( + measure_id bigint(20) not null auto_increment comment '单位ID', + measure_code varchar(64) not null comment '单位编码', + measure_name varchar(255) not null comment '单位名称', + primary_flag char(1) default 'Y' not null comment '是否是主单位', + primary_id bigint(20) comment '主单位ID', + change_rate double(12,4) comment '与主单位换算比例', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (measure_id) +) engine=innodb auto_increment=200 comment = '单位表'; + + +-- ---------------------------- +-- 7、车间表 +-- ---------------------------- +drop table if exists md_workshop; +create table md_workshop ( + workshop_id bigint(20) not null auto_increment comment '车间ID', + workshop_code varchar(64) not null comment '车间编码', + workshop_name varchar(255) not null comment '车间名称', + area double(12,2) comment '面积', + charge varchar(64) comment '负责人', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (workshop_id) +) engine=innodb auto_increment=200 comment = '车间表'; + + +-- ---------------------------- +-- 8、工作站表 +-- ---------------------------- +drop table if exists md_workstation; +create table md_workstation ( + workstation_id bigint(20) not null auto_increment comment '工作站ID', + workstation_code varchar(64) not null comment '工作站编码', + workstation_name varchar(255) not null comment '工作站名称', + workstation_address varchar(255) comment '工作站地点', + workshop_id bigint(20) comment '所在车间ID', + workshop_code varchar(64) comment '所在车间编码', + workshop_name varchar(255) comment '所在车间名称', + process_id bigint(20) comment '工序ID', + process_code varchar(64) comment '工序编码', + process_name varchar(255) comment '工序名称', + warehouse_id bigint(20) not null comment '线边库ID', + warehouse_code varchar(64) comment '线边库编码', + warehouse_name varchar(255) comment '线边库名称', + location_id bigint(20) not null comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) not null comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (workstation_id) +) engine=innodb auto_increment=200 comment = '工作站表'; + + +-- ---------------------------- +-- 9、设备资源表 +-- ---------------------------- +drop table if exists md_workstation_machine; +create table md_workstation_machine ( + record_id bigint(20) not null auto_increment comment '记录ID', + workstation_id bigint(20) not null comment '工作站ID', + machinery_id bigint(20) not null comment '设备ID', + machinery_code varchar(64) comment '设备编码', + machinery_name varchar(255) comment '设备名称', + quantity int(4) default 1 comment '数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '设备资源表'; + + +-- ---------------------------- +-- 10、人力资源表 +-- ---------------------------- +drop table if exists md_workstation_worker; +create table md_workstation_worker ( + record_id bigint(20) not null auto_increment comment '记录ID', + workstation_id bigint(20) not null comment '工作站ID', + post_id bigint(20) not null comment '岗位ID', + post_code varchar(64) comment '岗位编码', + post_name varchar(255) comment '岗位名称', + quantity int(4) default 1 not null comment '数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '人力资源表'; + + +-- ---------------------------- +-- 11、工装夹具资源表 +-- ---------------------------- +drop table if exists md_workstation_tool; +create table md_workstation_tool ( + record_id bigint(20) not null auto_increment comment '记录ID', + workstation_id bigint(20) not null comment '工作站ID', + tool_type_id bigint(20) not null comment '工装夹具类型ID', + tool_type_code varchar(64) comment '类型编码', + tool_type_name varchar(255) comment '类型名称', + quantity int(4) default 1 not null comment '数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '工装夹具资源表'; + + +-- ---------------------------- +-- 12、产品SOP表 +-- ---------------------------- +drop table if exists md_product_sop; +create table md_product_sop ( + sop_id bigint(20) not null auto_increment comment '记录ID', + item_id bigint(20) not null comment '物料产品ID', + order_num int(4) comment '排列顺序', + process_id bigint(20) comment '对应的工序', + process_code varchar(64) comment '工序编号', + process_name varchar(255) comment '工序名称', + sop_title varchar(255) comment '标题', + sop_description varchar(500) comment '详细描述', + sop_url varchar(255) comment '图片地址', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (sop_id) +) engine=innodb auto_increment=200 comment = '产品SOP表'; + + +-- ---------------------------- +-- 12、产品SIP表 +-- ---------------------------- +drop table if exists md_product_sip; +create table md_product_sip ( + sip_id bigint(20) not null auto_increment comment '记录ID', + item_id bigint(20) not null comment '物料产品ID', + order_num int(4) comment '排列顺序', + process_id bigint(20) comment '对应的工序', + process_code varchar(64) comment '工序编号', + process_name varchar(255) comment '工序名称', + sip_title varchar(255) comment '标题', + sip_description varchar(500) comment '详细描述', + sip_url varchar(255) comment '图片地址', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (sip_id) +) engine=innodb auto_increment=200 comment = '产品SIP表'; diff --git a/doc/设计文档/数据库设计/mes-pro.sql b/doc/设计文档/数据库设计/mes-pro.sql new file mode 100644 index 0000000..bf7e31b --- /dev/null +++ b/doc/设计文档/数据库设计/mes-pro.sql @@ -0,0 +1,572 @@ +-- ---------------------------- +-- 1、生产工单表 +-- ---------------------------- +drop table if exists pro_workorder; +create table pro_workorder ( + workorder_id bigint(20) not null auto_increment comment '工单ID', + workorder_code varchar(64) not null comment '工单编码', + workorder_name varchar(255) not null comment '工单名称', + workorder_type varchar(64) default 'SELF' comment '工单类型', + order_source varchar(64) not null comment '来源类型', + source_code varchar(64) comment '来源单据', + product_id bigint(20) not null comment '产品ID', + product_code varchar(64) not null comment '产品编号', + product_name varchar(255) not null comment '产品名称', + product_spc varchar(255) comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + quantity double(14,2) default 0 not null comment '生产数量', + quantity_produced double(14,2) default 0 comment '已生产数量', + quantity_changed double(14,2) default 0 comment '调整数量', + quantity_scheduled double(14,2) default 0 comment '已排产数量', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编号', + vendor_name varchar(255) comment '供应商名称', + batch_code varchar(64) comment '批次号', + request_date datetime not null comment '需求日期', + parent_id bigint(20) default 0 not null comment '父工单', + ancestors varchar(500) not null comment '所有父节点ID', + finish_date datetime comment '完成时间', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (workorder_id) +) engine=innodb auto_increment=200 comment = '生产工单表'; + + +-- ---------------------------- +-- 2、生产工单BOM组成表 +-- ---------------------------- +drop table if exists pro_workorder_bom; +create table pro_workorder_bom ( + line_id bigint(20) not null auto_increment comment '行ID', + workorder_id bigint(20) not null comment '生产工单ID', + item_id bigint(20) not null comment 'BOM物料ID', + item_code varchar(64) not null comment 'BOM物料编号', + item_name varchar(255) not null comment 'BOM物料名称', + item_spc varchar(255) comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + item_or_product varchar(20) not null comment '物料产品标识', + quantity double(14,2) default 0 not null comment '预计使用量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '生产工单BOM组成表'; + + +-- ---------------------------- +-- 3、生产工序表 +-- ---------------------------- +drop table if exists pro_process; +create table pro_process ( + process_id bigint(20) not null auto_increment comment '工序ID', + process_code varchar(64) not null comment '工序编码', + process_name varchar(255) not null comment '工序名称', + attention varchar(1000) comment '工艺要求', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (process_id) +) engine=innodb auto_increment=200 comment = '生产工序表'; + + +-- ---------------------------- +-- 4、生产工序内容表 +-- ---------------------------- +drop table if exists pro_process_content; +create table pro_process_content ( + content_id bigint(20) not null auto_increment comment '内容ID', + process_id bigint(20) not null comment '工序ID', + order_num int(4) default 0 comment '顺序编号', + content_text varchar(500) comment '内容说明', + device varchar(255) comment '辅助设备', + material varchar(255) comment '辅助材料', + doc_url varchar(255) comment '材料URL', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (content_id) +) engine=innodb auto_increment=200 comment = '生产工序内容表'; + + +-- ---------------------------- +-- 3、工艺路线表 +-- ---------------------------- +drop table if exists pro_route; +create table pro_route ( + route_id bigint(20) not null auto_increment comment '工艺路线ID', + route_code varchar(64) not null comment '工艺路线编号', + route_name varchar(255) not null comment '工艺路线名称', + route_desc varchar(500) comment '工艺路线说明', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (route_id) +) engine=innodb auto_increment=200 comment = '工艺路线表'; + + +-- ---------------------------- +-- 4、工艺组成表 +-- ---------------------------- +drop table if exists pro_route_process; +create table pro_route_process ( + record_id bigint(20) not null auto_increment comment '记录ID', + route_id bigint(20) not null comment '工艺路线ID', + process_id bigint(20) not null comment '工序ID', + process_code varchar(64) comment '工序编码', + process_name varchar(255) comment '工序名称', + order_num int(4) default 1 comment '序号', + next_process_id bigint(20) not null comment '工序ID', + next_process_code varchar(64) comment '工序编码', + next_process_name varchar(255) comment '工序名称', + link_type varchar(64) default 'SS' comment '与下一道工序关系', + default_pre_time int(11) default 0 comment '准备时间', + default_suf_time int(11) default 0 comment '等待时间', + color_code char(7) default '#00AEF3' comment '甘特图显示颜色', + key_flag varchar(64) default 'N' comment '关键工序', + is_check char(1) default 'N' comment '是否检验', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '工艺组成表'; + + +-- ---------------------------- +-- 4、产品制程 +-- ---------------------------- +drop table if exists pro_route_product; +create table pro_route_product ( + record_id bigint(20) not null auto_increment comment '记录ID', + route_id bigint(20) not null comment '工艺路线ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + specification varchar(500) default null comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + quantity int(11) default 1 comment '生产数量', + production_time double(12,2) default 1 comment '生产用时', + time_unit_type varchar(64) default 'MINUTE' comment '时间单位', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '产品制程'; + + + +-- ---------------------------- +-- 4、产品制程物料BOM表 +-- ---------------------------- +drop table if exists pro_route_product_bom; +create table pro_route_product_bom ( + record_id bigint(20) not null auto_increment comment '记录ID', + route_id bigint(20) not null comment '工艺路线ID', + process_id bigint(20) not null comment '工序ID', + product_id bigint(20) not null comment '产品BOM中的唯一ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + specification varchar(500) default null comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + quantity double(12,2) default 1 comment '用料比例', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '产品制程物料BOM表'; + + +-- ---------------------------- +-- 4、生产任务表 +-- ---------------------------- +drop table if exists pro_task; +create table pro_task ( + task_id bigint(20) not null auto_increment comment '任务ID', + task_code varchar(64) not null comment '任务编号', + task_name varchar(255) not null comment '任务名称', + workorder_id bigint(20) not null comment '生产工单ID', + workorder_code varchar(64) not null comment '生产工单编号', + workorder_name varchar(255) not null comment '工单名称', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) not null comment '工作站编号', + workstation_name varchar(255) not null comment '工作站名称', + route_id bigint(20) not null comment '工艺ID', + route_code varchar(64) comment '工艺编号', + process_id bigint(20) not null comment '工序ID', + process_code varchar(64) comment '工序编码', + process_name varchar(255) comment '工序名称', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + quantity double(14,2) default 1 not null comment '排产数量', + quantity_produced double(14,2) default 0 comment '已生产数量', + quantity_quanlify double(14,2) default 0 comment '合格品数量', + quantity_unquanlify double(14,2) default 0 comment '不良品数量', + quantity_changed double(14,2) default 0 comment '调整数量', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + client_nick varchar(255) comment '客户简称', + start_time datetime default CURRENT_TIMESTAMP comment '开始生产时间', + duration int(11) default 1 comment '生产时长', + end_time datetime comment '完成生产时间', + color_code char(7) default '#00AEF3' comment '甘特图显示颜色', + request_date datetime comment '需求日期', + status varchar(64) default 'NORMARL' comment '生产状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (task_id) +) engine=innodb auto_increment=200 comment = '生产任务表'; + + +-- ---------------------------- +-- 4、生产报工记录表 +-- ---------------------------- +drop table if exists pro_feedback; +create table pro_feedback ( + record_id bigint(20) not null auto_increment comment '记录ID', + feedback_type varchar(64) not null comment '报工类型', + feedback_code varchar(64) comment '报工单编号', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(255) comment '工作站名称', + workorder_id bigint(20) not null comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + workorder_name varchar(255) comment '生产工单名称', + route_id bigint(20) not null comment '工艺流程ID', + route_code varchar(64) comment '工艺流程编号', + process_id bigint(20) not null comment '工序ID', + process_code varchar(64) comment '工序编码', + process_name varchar(255) comment '工序名称', + task_id bigint(20) comment '生产任务ID', + task_code varchar(64) comment '生产任务编号', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + unit_of_measure varchar(64) comment '单位', + specification varchar(500) comment '规格型号', + quantity double(14,2) comment '排产数量', + quantity_feedback double(14,2) comment '本次报工数量', + quantity_qualified double(14,2) comment '合格品数量', + quantity_unquanlified double(14,2) comment '不良品数量', + quantity_uncheck double(14,2) comment '待检测数量', + user_name varchar(64) comment '报工用户名', + nick_name varchar(64) comment '昵称', + feedback_channel varchar(64) comment '报工途径', + feedback_time datetime comment '报工时间', + record_user varchar(64) comment '记录人', + record_nick varchar(64) comment '记录人名称', + status varchar(64) default 'PREPARE' comment '状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '生产报工记录表'; + + + + + +-- ---------------------------- +-- 4、生产任务投料表 +-- ---------------------------- +drop table if exists pro_task_issue; +create table pro_task_issue ( + record_id bigint(20) not null auto_increment comment '记录ID', + task_id bigint(20) not null comment '生产任务ID', + workorder_id bigint(20) comment '生产工单ID', + workstation_id bigint(20) comment '工作站ID', + source_doc_id bigint(20) not null comment '单据ID', + source_doc_code varchar(64) comment '单据编号', + batch_code varchar(64) comment '投料批次', + source_line_id bigint(20) comment '行ID', + item_id bigint(20) comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + specification varchar(500) default null comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + quantity_issued double(12,2) comment '总的投料数量', + quantity_available double(12,2) comment '当前可用数量', + quantity_used double(12,2) comment '当前使用数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '生产任务投料表'; + + + + +-- ---------------------------- +-- 4、流转单表 +-- ---------------------------- +drop table if exists pro_trans_order; +create table pro_trans_order ( + trans_order_id bigint(20) not null auto_increment comment '流转单ID', + trans_order_code varchar(64) comment '流转单编号', + task_id bigint(20) not null comment '生产任务ID', + task_code varchar(64) comment '生产任务编号', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(255) comment '工作站名称', + process_id bigint(20) comment '工序ID', + process_code varchar(64) comment '工序编号', + process_name varchar(255) comment '工序名称', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + workorder_name varchar(255) comment '生产工单名称', + batch_code varchar(64) comment '批次号', + item_id bigint(20) comment '产品物料ID', + item_code varchar(64) not null comment '产品物料编码', + item_name varchar(255) not null comment '产品物料名称', + specification varchar(500) default null comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + barcode_url varchar(255) comment '赋码地址', + quantity_transfered double(12,2) comment '流转数量', + produce_date datetime comment '生产日期', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (trans_order_id) +) engine=innodb auto_increment=200 comment = '流转单表'; + + + + + +-- ---------------------------- +-- 4、物料消耗记录表 +-- ---------------------------- +drop table if exists pro_trans_consume; +create table pro_trans_consume ( + record_id bigint(20) not null auto_increment comment '记录ID', + trans_order_id bigint(20) comment '流转单ID', + trans_order_code varchar(64) comment '流转单编号', + task_id bigint(20) not null comment '生产任务ID', + workstation_id bigint(20) not null comment '工作站ID', + process_id bigint(20) comment '工序ID', + workorder_id bigint(20) comment '生产工单ID', + batch_code varchar(64) comment '批次号', + source_doc_id bigint(20) comment '被消耗单据ID', + source_doc_code varchar(64) comment '被消耗单据编号', + source_doc_type varchar(64) comment '被消耗单据类型', + source_line_id bigint(20) comment '被消耗单据行ID', + source_batch_code varchar(64) comment '被消耗物料批次号', + item_id bigint(20) comment '被消耗产品物料ID', + item_code varchar(64) not null comment '被消耗产品物料编码', + item_name varchar(255) not null comment '被消耗产品物料名称', + specification varchar(500) default null comment '规格型号', + unit_of_measure varchar(64) not null comment '单位', + quantity_consumed double(12,2) comment '消耗数量', + consume_date datetime comment '消耗时间', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '物料消耗记录表'; + + + +-- ---------------------------- +-- 4、上下工记录表 +-- ---------------------------- +drop table if exists pro_workrecord; +create table pro_workrecord ( + record_id bigint(20) not null auto_increment comment '记录ID', + user_id bigint(20) not null comment '用户ID', + user_name varchar(64) comment '用户名', + nick_name bigint(125) comment '名称', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(125) comment '工作站名称', + operation_flag char(1) not null comment '操作类型', + operation_time datetime comment '操作时间', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '上下工记录表'; + + + +-- ---------------------------- +-- 4、用户工作站绑定关系 +-- ---------------------------- +drop table if exists pro_user_workstation; +create table pro_user_workstation ( + record_id bigint(20) not null auto_increment comment '记录ID', + user_id bigint(20) not null comment '用户ID', + user_name varchar(64) comment '用户名', + nick_name bigint(125) comment '名称', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(125) comment '工作站名称', + operation_time datetime comment '操作时间', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '用户工作站绑定关系'; + + +-- ---------------------------- +-- 4、安灯呼叫记录 +-- ---------------------------- +drop table if exists pro_andon_record; +create table pro_andon_record ( + record_id bigint(20) not null auto_increment comment '记录ID', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(125) comment '工作站名称', + user_id bigint(20) not null comment '用户ID', + user_name varchar(64) comment '用户名', + nick_name varchar(125) comment '名称', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + workorder_name varchar(255) comment '生产工单名称', + process_id bigint(20) comment '工序ID', + process_code varchar(64) comment '工序编号', + process_name varchar(255) comment '工序名称', + andon_reason varchar(500) not null comment '呼叫原因', + andon_level varchar(64) default 'LEVEL3' comment '级别', + operation_time datetime comment '操作时间', + status varchar(64) default 'ACTIVE' comment '激活中', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '安灯呼叫记录'; + +-- ---------------------------- +-- 4、停机记录 +-- ---------------------------- +drop table if exists pro_shutdown_record; +create table pro_shutdown_record ( + record_id bigint(20) not null auto_increment comment '记录ID', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(125) comment '工作站名称', + machinery_id bigint(20) comment '设备ID', + machinery_code varchar(64) comment '设备编号', + machinery_name varchar(255) comment '设备名称', + shutdown_reason varchar(500) not null comment '停机原因', + operation_time datetime comment '操作时间', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '停机记录记录'; + + diff --git a/doc/设计文档/数据库设计/mes-qc.sql b/doc/设计文档/数据库设计/mes-qc.sql new file mode 100644 index 0000000..e483340 --- /dev/null +++ b/doc/设计文档/数据库设计/mes-qc.sql @@ -0,0 +1,432 @@ +-- ---------------------------- +-- 1、检测项表 +-- ---------------------------- +drop table if exists qc_index; +create table qc_index ( + index_id bigint(20) not null auto_increment comment '检测项ID', + index_code varchar(64) not null comment '检测项编码', + index_name varchar(255) not null comment '检测项名称', + index_type varchar(64) not null comment '检测项类型', + qc_tool varchar(255) comment '检测工具', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (index_id) +) engine=innodb auto_increment=200 comment = '检测项表'; + + +-- ---------------------------- +-- 2、检测模板表 +-- ---------------------------- +drop table if exists qc_template; +create table qc_template ( + template_id bigint(20) not null auto_increment comment '检测模板ID', + template_code varchar(64) not null comment '检测模板编号', + template_name varchar(255) not null comment '检测模板名称', + qc_types varchar(255) not null comment '检测种类', + enable_flag char(1) default 'Y' comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (template_id) +) engine=innodb auto_increment=200 comment = '检测模板表'; + + +-- ---------------------------- +-- 3、检测模板-检测项表 +-- ---------------------------- +drop table if exists qc_template_index; +create table qc_template_index ( + record_id bigint(20) not null auto_increment comment '记录ID', + template_id bigint(20) not null comment '检测模板ID', + index_id bigint(20) not null comment '检测项ID', + index_code varchar(64) not null comment '检测项编码', + index_name varchar(255) not null comment '检测项名称', + index_type varchar(64) not null comment '检测项类型', + qc_tool varchar(255) comment '检测工具', + check_method varchar(500) comment '检测要求', + stander_val double(12,4) comment '标准值', + unit_of_measure varchar(64) comment '单位', + threshold_max double(12,4) comment '误差上限', + threshold_min double(12,4) comment '误差下限', + doc_url varchar(255) comment '说明图', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '检测模板-检测项表'; + + + +-- ---------------------------- +-- 4、检测模板-产品表 +-- ---------------------------- +drop table if exists qc_template_product; +create table qc_template_product ( + record_id bigint(20) not null auto_increment comment '记录ID', + template_id bigint(20) not null comment '检测模板ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_check int(11) default 1 comment '最低检测数', + quantity_unqualified int(11) default 0 comment '最大不合格数', + cr_rate double(12,2) default 0 comment '最大致命缺陷率', + maj_rate double(12,2) default 0 comment '最大严重缺陷率', + min_rate double(12,2) default 100 comment '最大轻微缺陷率', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '检测模板-产品表'; + + +-- ---------------------------- +-- 5、常用缺陷表 +-- ---------------------------- +drop table if exists qc_defect; +create table qc_defect ( + defect_id bigint(20) not null auto_increment comment '缺陷ID', + defect_code varchar(64) not null comment '缺陷编码', + defect_name varchar(500) not null comment '缺陷描述', + index_type varchar(64) not null comment '检测项类型', + defect_level varchar(64) not null comment '缺陷等级', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (defect_id) +) engine=innodb auto_increment=200 comment = '常见缺陷表'; + + + +-- ---------------------------- +-- 6、来料检验单表 +-- ---------------------------- +drop table if exists qc_iqc; +create table qc_iqc ( + iqc_id bigint(20) not null auto_increment comment '来料检验单ID', + iqc_code varchar(64) not null comment '来料检验单编号', + iqc_name varchar(500) not null comment '来料检验单名称', + template_id bigint(20) not null comment '检验模板ID', + source_doc_id bigint(20) comment '来源单据ID', + source_doc_type varchar(64) comment '来源单据类型', + source_doc_code varchar(64) comment '来源单据编号', + source_line_id bigint(20) comment '来源单据行ID', + vendor_id bigint(20) not null comment '供应商ID', + vendor_code varchar(64) not null comment '供应商编码', + vendor_name varchar(255) not null comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + vendor_batch varchar(64) comment '供应商批次号', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_min_check int(11) default 1 comment '最低检测数', + quantity_max_unqualified int(11) default 0 comment '最大不合格数', + quantity_recived double(12,2) not null comment '本次接收数量', + quantity_check int(11) not null comment '本次检测数量', + quantity_unqualified int(11) default 0 comment '不合格数', + cr_rate double(12,2) default 0 comment '致命缺陷率', + maj_rate double(12,2) default 0 comment '严重缺陷率', + min_rate double(12,2) default 0 comment '轻微缺陷率', + cr_quantity int(11) default 0 comment '致命缺陷数量', + maj_quantity int(11) default 0 comment '严重缺陷数量', + min_quantity int(11) default 0 comment '轻微缺陷数量', + check_result varchar(64) comment '检测结果', + recive_date datetime comment '来料日期', + inspect_date datetime comment '检测日期', + inspector varchar(64) comment '检测人员', + status varchar(64) comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (iqc_id) +) engine=innodb auto_increment=200 comment = '来料检验单表'; + + + + +-- ---------------------------- +-- 7、来料检验单行表 +-- ---------------------------- +drop table if exists qc_iqc_line; +create table qc_iqc_line ( + line_id bigint(20) not null auto_increment comment '记录ID', + iqc_id bigint(20) not null comment '检验单ID', + index_id bigint(20) not null comment '检测项ID', + index_code varchar(64) comment '检测项编码', + index_name varchar(255) comment '检测项名称', + index_type varchar(64) comment '检测项类型', + qc_tool varchar(255) comment '检测工具', + check_method varchar(500) comment '检测要求', + stander_val double(12,4) comment '标准值', + unit_of_measure varchar(64) comment '单位', + threshold_max double(12,4) comment '误差上限', + threshold_min double(12,4) comment '误差下限', + cr_quantity int(11) default 0 comment '致命缺陷数量', + maj_quantity int(11) default 0 comment '严重缺陷数量', + min_quantity int(11) default 0 comment '轻微缺陷数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '来料检验单行表'; + + + + +-- ---------------------------- +-- 8、检验单缺陷记录表 +-- ---------------------------- +drop table if exists qc_defect_record; +create table qc_defect_record ( + record_id bigint(20) not null auto_increment comment '缺陷ID', + qc_type varchar(64) not null comment '检验单类型', + qc_id bigint(20) not null comment '检验单ID', + line_id bigint(20) not null comment '检验单行ID', + defect_name varchar(500) not null comment '缺陷描述', + defect_level varchar(64) not null comment '缺陷等级', + defect_quantity int(11) default 1 comment '缺陷数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '检验单缺陷记录表'; + + + + + +-- ---------------------------- +-- 9、过程检验单表 +-- ---------------------------- +drop table if exists qc_ipqc; +create table qc_ipqc ( + ipqc_id bigint(20) not null auto_increment comment '检验单ID', + ipqc_code varchar(64) not null comment '检验单编号', + ipqc_name varchar(255) comment '检验单名称', + ipqc_type varchar(64) not null comment '检验类型', + template_id bigint(20) not null comment '检验模板ID', + source_doc_id bigint(20) comment '来源单据ID', + source_doc_type varchar(64) comment '来源单据类型', + source_doc_code varchar(64) comment '来源单据编号', + source_line_id bigint(20) comment '来源单据行ID', + workorder_id bigint(20) not null comment '工单ID', + workorder_code varchar(64) comment '工单编码', + workorder_name varchar(255) comment '工单名称', + task_id bigint(20) comment '任务ID', + task_code varchar(64) comment '任务编号', + task_name varchar(255) comment '任务名称', + workstation_id bigint(20) not null comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(255) comment '工作站名称', + process_id bigint(20) comment '工序ID', + process_code varchar(64) comment '工序编码', + process_name varchar(255) comment '工序名称', + + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + + quantity_check double(12,4) default 1 comment '检测数量', + quantity_unqualified double(12,4) default 0 comment '不合格数', + quantity_qualified double(12,4) comment '合格品数量', + + cr_rate double(12,2) default 0 comment '致命缺陷率', + maj_rate double(12,2) default 0 comment '严重缺陷率', + min_rate double(12,2) default 0 comment '轻微缺陷率', + cr_quantity double(12,4) default 0 comment '致命缺陷数量', + maj_quantity double(12,4) default 0 comment '严重缺陷数量', + min_quantity double(12,4) default 0 comment '轻微缺陷数量', + check_result varchar(64) comment '检测结果', + + inspect_date datetime comment '检测日期', + inspector varchar(64) comment '检测人员', + status varchar(64) comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (ipqc_id) +) engine=innodb auto_increment=200 comment = '过程检验单表'; + + +-- ---------------------------- +-- 10、过程检验单行表 +-- ---------------------------- +drop table if exists qc_ipqc_line; +create table qc_ipqc_line ( + line_id bigint(20) not null auto_increment comment '记录ID', + ipqc_id bigint(20) not null comment '检验单ID', + index_id bigint(20) not null comment '检测项ID', + index_code varchar(64) comment '检测项编码', + index_name varchar(255) comment '检测项名称', + index_type varchar(64) comment '检测项类型', + qc_tool varchar(255) comment '检测工具', + check_method varchar(500) comment '检测要求', + stander_val double(12,4) comment '标准值', + unit_of_measure varchar(64) comment '单位', + threshold_max double(12,4) comment '误差上限', + threshold_min double(12,4) comment '误差下限', + cr_quantity double(12,4) default 0 comment '致命缺陷数量', + maj_quantity double(12,4) default 0 comment '严重缺陷数量', + min_quantity double(12,4) default 0 comment '轻微缺陷数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '过程检验单行表'; + + +-- ---------------------------- +-- 12、出货检验单表 +-- ---------------------------- +drop table if exists qc_oqc; +create table qc_oqc ( + oqc_id bigint(20) not null auto_increment comment '出货检验单ID', + oqc_code varchar(64) not null comment '出货检验单编号', + oqc_name varchar(500) comment '出货检验单名称', + template_id bigint(20) not null comment '检验模板ID', + source_doc_id bigint(20) comment '来源单据ID', + source_doc_type varchar(64) comment '来源单据类型', + source_doc_code varchar(64) comment '来源单据编号', + source_line_id bigint(20) comment '来源单据行ID', + client_id bigint(20) not null comment '客户ID', + client_code varchar(64) not null comment '客户编码', + client_name varchar(255) not null comment '客户名称', + batch_code varchar(64) comment '批次号', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + + quantity_min_check double(12,4) default 1 comment '最低检测数', + quantity_max_unqualified double(12,4) default 0 comment '最大不合格数', + quantity_out double(12,4) not null comment '发货数量', + quantity_check double(12,4) not null comment '本次检测数量', + quantity_unqualified double(12,4) default 0 comment '不合格数', + quantity_quanlified double(12,4) default 0 comment '合格数量', + cr_rate double(12,4) default 0 comment '致命缺陷率', + maj_rate double(12,4) default 0 comment '严重缺陷率', + min_rate double(12,4) default 0 comment '轻微缺陷率', + cr_quantity double(12,4) default 0 comment '致命缺陷数量', + maj_quantity double(12,4) default 0 comment '严重缺陷数量', + min_quantity double(12,4) default 0 comment '轻微缺陷数量', + check_result varchar(64) comment '检测结果', + + out_date datetime comment '出货日期', + inspect_date datetime comment '检测日期', + inspector varchar(64) comment '检测人员', + status varchar(64) comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (oqc_id) +) engine=innodb auto_increment=200 comment = '出货检验单表'; + + +-- ---------------------------- +-- 13、出货检验单行表 +-- ---------------------------- +drop table if exists qc_oqc_line; +create table qc_oqc_line ( + line_id bigint(20) not null auto_increment comment '记录ID', + oqc_id bigint(20) not null comment '检验单ID', + index_id bigint(20) not null comment '检测项ID', + index_code varchar(64) comment '检测项编码', + index_name varchar(255) comment '检测项名称', + index_type varchar(64) comment '检测项类型', + qc_tool varchar(255) comment '检测工具', + check_method varchar(500) comment '检测要求', + stander_val double(12,4) comment '标准值', + unit_of_measure varchar(64) comment '单位', + threshold_max double(12,4) comment '误差上限', + threshold_min double(12,4) comment '误差下限', + cr_quantity double(12,4) default 0 comment '致命缺陷数量', + maj_quantity double(12,4) default 0 comment '严重缺陷数量', + min_quantity double(12,4) default 0 comment '轻微缺陷数量', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '出货检验单行表'; + + + + diff --git a/doc/设计文档/数据库设计/mes-tm.sql b/doc/设计文档/数据库设计/mes-tm.sql new file mode 100644 index 0000000..d5ed492 --- /dev/null +++ b/doc/设计文档/数据库设计/mes-tm.sql @@ -0,0 +1,56 @@ +-- ---------------------------- +-- 1、工装夹具类型表 +-- ---------------------------- +drop table if exists tm_tool_type; +create table tm_tool_type ( + tool_type_id bigint(20) not null auto_increment comment '工装夹具类型ID', + tool_type_code varchar(64) not null comment '类型编码', + tool_type_name varchar(255) not null comment '类型名称', + code_flag char(1) default 'Y' not null comment '是否编码管理', + mainten_type varchar(20) comment '保养维护类型', + mainten_period int(11) comment '保养周期', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (tool_type_id) +) engine=innodb auto_increment=200 comment = '工装夹具类型表'; + + + +-- ---------------------------- +-- 2、工装夹具清单表 +-- ---------------------------- +drop table if exists tm_tool; +create table tm_tool ( + tool_id bigint(20) not null auto_increment comment '工装夹具ID', + tool_code varchar(64) comment '工装夹具编码', + tool_name varchar(255) not null comment '工装夹具名称', + brand varchar(255) comment '品牌', + spec varchar(255) comment '型号', + tool_type_id bigint(11) not null comment '工装夹具类型ID', + tool_type_code varchar(64) comment '工装夹具类型编码', + tool_type_name varchar(255) comment '工装夹具类型名称', + code_flag char(1) default 'Y' not null comment '是否单独编码管理', + quantity int(11) default 1 not null comment '数量', + quantity_avail int(11) default 1 comment '可用数量', + mainten_type varchar(20) comment '保养维护类型', + next_mainten_period int(11) comment '下一次保养周期', + next_mainten_date datetime comment '下一次保养日期', + status varchar(64) default 'STORE' comment '状态[MES_TOOL_STATUS]', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (tool_id) +) engine=innodb auto_increment=200 comment = '工装夹具清单表'; \ No newline at end of file diff --git a/doc/设计文档/数据库设计/mes-wm.sql b/doc/设计文档/数据库设计/mes-wm.sql new file mode 100644 index 0000000..6467553 --- /dev/null +++ b/doc/设计文档/数据库设计/mes-wm.sql @@ -0,0 +1,1390 @@ +-- ---------------------------- +-- 1、仓库表 +-- ---------------------------- +drop table if exists wm_warehouse; +create table wm_warehouse ( + warehouse_id bigint(20) not null auto_increment comment '仓库ID', + warehouse_code varchar(64) not null UNIQUE comment '仓库编码', + warehouse_name varchar(255) not null comment '仓库名称', + location varchar(500) comment '位置', + area double(12,2) comment '面积', + charge varchar(64) comment '负责人', + enable_flag char(1) default 'N' comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (warehouse_id) +) engine=innodb auto_increment=200 comment = '仓库表'; + + + +-- ---------------------------- +-- 2、库区表 +-- ---------------------------- +drop table if exists wm_storage_location; +create table wm_storage_location ( + location_id bigint(20) not null auto_increment comment '库区ID', + location_code varchar(64) not null UNIQUE comment '库区编码', + location_name varchar(255) not null comment '库区名称', + warehouse_id bigint(20) not null comment '仓库ID', + area double(12,2) comment '面积', + area_flag char(1) default 'Y' comment '是否开启库位管理', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (location_id) +) engine=innodb auto_increment=200 comment = '库区表'; + + +-- ---------------------------- +-- 3、库位表 +-- ---------------------------- +drop table if exists wm_storage_area; +create table wm_storage_area ( + area_id bigint(20) not null auto_increment comment '库位ID', + area_code varchar(64) not null UNIQUE comment '库位编码', + area_name varchar(255) not null comment '库位名称', + location_id bigint(20) not null comment '库区ID', + area double(8,2) comment '面积', + max_loa double(8,2) comment '最大载重量', + position_x int(11) comment '库位位置X', + position_y int(11) comment '库位位置y', + position_z int(11) comment '库位位置z', + enable_flag char(1) comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (area_id) +) engine=innodb auto_increment=200 comment = '库位表'; + + + + +-- ---------------------------- +-- 4、库存事务表 +-- ---------------------------- +drop table if exists wm_transaction; +create table wm_transaction ( + transaction_id bigint(20) not null auto_increment comment '事务ID', + transaction_type varchar(64) not null comment '事务类型', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + batch_code varchar(255) comment '入库批次号', + warehouse_id bigint(20) not null comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + pakcage_id bigint(20) comment '容器ID', + package_code varchar(64) comment '容器编号', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编号', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(64) comment '供应商简称', + source_doc_type varchar(64) comment '单据类型', + source_doc_id bigint(20) comment '单据ID', + source_doc_code varchar(64) comment '单据编号', + source_doc_line_id bigint(20) comment '单据行ID', + material_stock_id bigint(20) not null comment '库存记录ID', + transaction_flag int(1) default 1 comment '库存方向', + transaction_quantity double(12,2) comment '事务数量', + transaction_date datetime comment '事务日期', + related_transaction_id bigint(20) comment '关联的事务ID', + erp_date datetime comment 'ERP账期', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + recpt_date datetime comment '接收日期', + expire_date datetime comment '库存有效期', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (transaction_id) +) engine=innodb auto_increment=200 comment = '库存事务表'; + + + +-- ---------------------------- +-- 5、库存记录表 +-- ---------------------------- +drop table if exists wm_material_stock; +create table wm_material_stock ( + material_stock_id bigint(20) not null auto_increment comment '事务ID', + item_type_id bigint(20) comment '物料类型ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + batch_code varchar(255) comment '批次号', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编号', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(64) comment '供应商简称', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + client_nick varchar(255) comment '客户简称', + warehouse_id bigint(20) not null comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + package_id bigint(20) comment '容器ID', + package_code varchar(64) comment '容器编号', + quantity_onhand double(12,2) comment '在库数量', + quantity_reserved double(12,2) comment '保留数量', + recpt_date datetime comment '入库时间', + expire_date datetime comment '库存有效期', + frozen_flag char(1) default 'N' not null comment '是否冻结', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (material_stock_id) +) engine=innodb auto_increment=200 comment = '库存记录表'; + + + +-- ---------------------------- +-- 6、物料入库单表 +-- ---------------------------- +drop table if exists wm_item_recpt; +create table wm_item_recpt ( + recpt_id bigint(20) not null auto_increment comment '入库单ID', + recpt_code varchar(64) not null comment '入库单编号', + recpt_name varchar(255) not null comment '入库单名称', + iqc_id bigint(20) comment '来料检验单ID', + iqc_code varchar(64) comment '来料检验单编号', + po_code varchar(64) comment '采购订单编号', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编码', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + recpt_date datetime comment '入库日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (recpt_id) +) engine=innodb auto_increment=200 comment = '物料入库单表'; + + +-- ---------------------------- +-- 7、物料入库单行表 +-- ---------------------------- +drop table if exists wm_item_recpt_line; +create table wm_item_recpt_line ( + line_id bigint(20) not null auto_increment comment '行ID', + recpt_id bigint(20) comment '入库单ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_recived double(12,2) not null comment '入库数量', + batch_code varchar(255) comment '入库批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + expire_date datetime comment '有效期', + iqc_check char(1) comment '是否来料检验', + iqc_id bigint(20) comment '来料检验单ID', + iqc_code varchar(64) comment '来料检验单编号', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '物料入库单行表'; + + + +-- ---------------------------- +-- 8、供应商退货表 +-- ---------------------------- +drop table if exists wm_rt_vendor; +create table wm_rt_vendor ( + rt_id bigint(20) not null auto_increment comment '退货单ID', + rt_code varchar(64) not null comment '退货单编号', + rt_name varchar(255) not null comment '退货单名称', + po_code varchar(64) comment '采购订单编号', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编码', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + batch_code varchar(255) comment '批次号', + rt_date datetime comment '退货日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (rt_id) +) engine=innodb auto_increment=200 comment = '供应商退货表'; + + +-- ---------------------------- +-- 9、供应商退货行表 +-- ---------------------------- +drop table if exists wm_rt_vendor_line; +create table wm_rt_vendor_line ( + line_id bigint(20) not null auto_increment comment '行ID', + rt_id bigint(20) comment '退货单ID', + material_stock_id bigint(20) comment '库存记录ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_rted double(12,2) not null comment '退货数量', + batch_code varchar(255) comment '批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '供应商退货行表'; + + + +-- ---------------------------- +-- 10、生产领料单头表 +-- ---------------------------- +drop table if exists wm_issue_header; +create table wm_issue_header ( + issue_id bigint(20) not null auto_increment comment '领料单ID', + issue_code varchar(64) not null comment '领料单编号', + issue_name varchar(255) not null comment '领料单名称', + workstation_id bigint(20) comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(255) comment '工作站名称', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + task_id bigint(20) comment '生产任务ID', + task_code varchar(64) comment '生产任务编码', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + client_nick varchar(255) comment '客户简称', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + issue_date datetime comment '领料日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (issue_id) +) engine=innodb auto_increment=200 comment = '生产领料单头表'; + + + +-- ---------------------------- +-- 11、生产领料单行表 +-- ---------------------------- +drop table if exists wm_issue_line; +create table wm_issue_line ( + line_id bigint(20) not null auto_increment comment '行ID', + issue_id bigint(20) comment '领料单ID', + material_stock_id bigint(20) comment '库存ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_issued double(12,2) not null comment '领料数量', + batch_code varchar(255) comment '领料批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '生产领料单行表'; + + + + + +-- ---------------------------- +-- 10、生产退料单头表 +-- ---------------------------- +drop table if exists wm_rt_issue; +create table wm_rt_issue ( + rt_id bigint(20) not null auto_increment comment '退料单ID', + rt_code varchar(64) not null comment '退料单编号', + rt_name varchar(255) comment '退料单名称', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + rt_date datetime comment '退料日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (rt_id) +) engine=innodb auto_increment=200 comment = '生产退料单头表'; + + + +-- ---------------------------- +-- 11、生产领料单行表 +-- ---------------------------- +drop table if exists wm_rt_issue_line; +create table wm_rt_issue_line ( + line_id bigint(20) not null auto_increment comment '行ID', + rt_id bigint(20) comment '退料单ID', + material_stock_id bigint(20) comment '库存ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_rt double(12,2) not null comment '退料数量', + batch_code varchar(255) comment '领料批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '生产退料单行表'; + + + + +-- ---------------------------- +-- 10、物料消耗记录表 +-- ---------------------------- +drop table if exists wm_item_consume; +create table wm_item_consume ( + record_id bigint(20) not null auto_increment comment '记录ID', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + workorder_name varchar(255) comment '生产工单名称', + task_id bigint(20) comment '生产任务ID', + task_code varchar(64) comment '生产任务编号', + task_name varchar(255) comment '生产任务名称', + workstation_id bigint(20) comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(255) comment '工作站名称', + process_id bigint(20) comment '工序ID', + process_code varchar(64) comment '工序编号', + process_name varchar(255) comment '工序名称', + consume_date datetime comment '消耗日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '物料消耗记录表'; + + +-- ---------------------------- +-- 11、物料消耗记录行表 +-- ---------------------------- +drop table if exists wm_item_consume_line; +create table wm_item_consume_line ( + line_id bigint(20) not null auto_increment comment '行ID', + record_id bigint(20) comment '消耗记录ID', + material_stock_id bigint(20) comment '库存ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_consume double(12,2) not null comment '消耗数量', + batch_code varchar(255) comment '领料批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '物料消耗记录行表'; + + + +-- ---------------------------- +-- 8、产品产出记录表(入线边库) +-- ---------------------------- +drop table if exists wm_product_produce; +create table wm_product_produce ( + record_id bigint(20) not null auto_increment comment '入库单ID', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + workorder_name varchar(255) comment '生产工单名称', + task_id bigint(20) comment '生产任务ID', + task_code varchar(64) comment '生产任务编号', + task_name varchar(255) comment '生产任务名称', + workstation_id bigint(20) comment '工作站ID', + workstation_code varchar(64) comment '工作站编号', + workstation_name varchar(255) comment '工作站名称', + process_id bigint(20) comment '工序ID', + process_code varchar(64) comment '工序编号', + process_name varchar(255) comment '工序名称', + produce_date datetime comment '生产日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (record_id) +) engine=innodb auto_increment=200 comment = '产品产出记录表'; + + + + +-- ---------------------------- +-- 11、产品产出记录表行表 +-- ---------------------------- +drop table if exists wm_product_produce_line; +create table wm_product_produce_line ( + line_id bigint(20) not null auto_increment comment '行ID', + record_id bigint(20) comment '产出记录ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_produce double(12,2) not null comment '产出数量', + batch_code varchar(255) comment '批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '产品产出记录表行表'; + + + + +-- ---------------------------- +-- 12、产品入库录表(线边库入正式库) +-- ---------------------------- +drop table if exists wm_product_recpt; +create table wm_product_recpt ( + recpt_id bigint(20) not null auto_increment comment '入库单ID', + recpt_code varchar(64) not null comment '入库单编号', + recpt_name varchar(255) comment '入库单名称', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + workorder_name varchar(255) comment '生产工单名称', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + recpt_date datetime comment '入库日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (recpt_id) +) engine=innodb auto_increment=200 comment = '产品入库录表'; + + + +-- ---------------------------- +-- 13、产品入库记录表行表 +-- ---------------------------- +drop table if exists wm_product_recpt_line; +create table wm_product_recpt_line ( + line_id bigint(20) not null auto_increment comment '行ID', + recpt_id bigint(20) comment '入库记录ID', + material_stock_id bigint(20) comment '库存记录ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_recived double(12,2) not null comment '入库数量', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + workorder_name varchar(255) comment '生产工单名称', + batch_code varchar(255) comment '批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + expire_date datetime comment '有效期', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '产品入库记录表行表'; + + + + +-- ---------------------------- +-- 14、产品销售出库单表 +-- ---------------------------- +drop table if exists wm_product_salse; +create table wm_product_salse ( + salse_id bigint(20) not null auto_increment comment '出库单ID', + salse_code varchar(64) not null comment '出库单编号', + salse_name varchar(255) not null comment '出库单名称', + oqc_id bigint(20) comment '出货检验单ID', + oqc_code varchar(64) comment '出货检验单编号', + so_code varchar(64) comment '销售订单编号', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + client_nick varchar(255) comment '客户简称', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + salse_date datetime comment '出库日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (salse_id) +) engine=innodb auto_increment=200 comment = '销售出库单表'; + + +-- ---------------------------- +-- 15、产品销售出库行表 +-- ---------------------------- +drop table if exists wm_product_salse_line; +create table wm_product_salse_line ( + line_id bigint(20) not null auto_increment comment '行ID', + salse_id bigint(20) comment '出库记录ID', + material_stock_id bigint(20) comment '库存记录ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_salse double(12,2) not null comment '出库数量', + batch_code varchar(255) comment '批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + oqc_check char(1) comment '是否出货检验', + oqc_id bigint(20) comment '出货检验单ID', + oqc_code varchar(64) comment '出货检验单编号', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '产品销售出库行表'; + + + +-- ---------------------------- +-- 16、产品销售退货单表 +-- ---------------------------- +drop table if exists wm_rt_salse; +create table wm_rt_salse ( + rt_id bigint(20) not null auto_increment comment '退货单ID', + rt_code varchar(64) not null comment '退货单编号', + rt_name varchar(255) not null comment '退货单名称', + so_code varchar(64) comment '销售订单编号', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + client_nick varchar(255) comment '客户简称', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + rt_date datetime comment '退货日期', + rt_reason varchar(255) comment '退货原因', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (rt_id) +) engine=innodb auto_increment=200 comment = '产品销售退货单表'; + + + +-- ---------------------------- +-- 17、产品销售退货行表 +-- ---------------------------- +drop table if exists wm_rt_salse_line; +create table wm_rt_salse_line ( + line_id bigint(20) not null auto_increment comment '行ID', + rt_id bigint(20) comment '退货单ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_rted double(12,2) not null comment '退货数量', + batch_code varchar(255) comment '批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + expire_date datetime comment '有效期', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '产品销售退货行表'; + + + +-- ---------------------------- +-- 18、条码清单表 +-- ---------------------------- +drop table if exists wm_barcode; +create table wm_barcode ( + barcode_id bigint(20) not null auto_increment comment '条码ID', + barcode_formart varchar(64) not null comment '条码格式', + barcode_type varchar(64) not null comment '条码类型', + barcode_content varchar(255) not null comment '条码内容', + bussiness_id bigint(20) not null comment '业务ID', + bussiness_code varchar(64) comment '业务编码', + bussiness_name varchar(255) comment '业务名称', + barcode_url varchar(255) comment '条码地址', + enable_flag char(1) default 'Y' comment '是否生效', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (barcode_id) +) engine=innodb auto_increment=200 comment = '条码清单表'; + + + + +-- ---------------------------- +-- 18、条码配置 +-- ---------------------------- +drop table if exists wm_barcode_config; +create table wm_barcode_config ( + config_id bigint(20) not null auto_increment comment '配置ID', + barcode_formart varchar(64) not null comment '条码格式', + barcode_type varchar(64) not null comment '条码类型', + content_formart varchar(255) not null comment '内容格式', + content_example varchar(255) comment '内容样例', + auto_gen_flag char(1) default 'Y' comment '是否自动生成', + default_template varchar(255) comment '默认的打印模板', + enable_flag char(1) default 'Y' comment '是否生效', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (config_id) +) engine=innodb auto_increment=200 comment = '条码配置'; + + + +-- ---------------------------- +-- 19、装箱单表 +-- ---------------------------- +drop table if exists wm_package; +create table wm_package ( + package_id bigint(20) not null auto_increment comment '装箱单ID', + parent_id bigint(20) not null default 0 comment '父箱ID', + ancestors varchar(255) not null default 0 comment '所有父节点ID', + package_code varchar(64) comment '装箱单编号', + barcode_id bigint(20) comment '条码ID', + barcode_content varchar(255) comment '条码内容', + barcode_url varchar(255) comment '条码地址', + package_date datetime not null comment '装箱日期', + so_code varchar(64) comment '销售订单编号', + invoice_code varchar(255) comment '发票编号', + client_id bigint(20) comment '客户ID', + client_code varchar(64) comment '客户编码', + client_name varchar(255) comment '客户名称', + client_nick varchar(255) comment '客户简称', + package_length double(12,4) comment '箱长度', + package_width double(12,4) comment '箱宽度', + package_height double(12,4) comment '箱高度', + size_unit varchar(64) comment '尺寸单位', + net_weight double(12,4) comment '净重', + cross_weight double(12,4) comment '毛重', + weight_unit varchar(64) comment '重量单位', + inspector varchar(64) comment '检查员用户名', + inspector_name varchar(64) comment '检查员名称', + status varchar(64) default 'PREPARE' comment '状态', + enable_flag char(1) default 'Y' comment '是否生效', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (package_id) +) engine=innodb auto_increment=200 comment = '装箱单表'; + + + +-- ---------------------------- +-- 20、装箱明细表 +-- ---------------------------- +drop table if exists wm_package_line; +create table wm_package_line ( + line_id bigint(20) not null auto_increment comment '明细行ID', + package_id bigint(20) not null comment '装箱单ID', + material_stock_id bigint(20) comment '库存记录ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_package double(12,2) not null comment '装箱数量', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + batch_code varchar(255) comment '批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + expire_date datetime comment '有效期', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '装箱明细表'; + + + +-- ---------------------------- +-- 21、转移单表 +-- ---------------------------- +drop table if exists wm_transfer; +create table wm_transfer ( + transfer_id bigint(20) not null auto_increment comment '转移单ID', + transfer_code varchar(64) not null comment '转移单编号', + transfer_name varchar(255) comment '转移单名称', + transfer_type varchar(64) not null comment '转移单类型', + destination varchar(255) comment '目的地', + carrier varchar(64) comment '承运商', + booking_note varchar(64) comment '托运单号', + receiver varchar(64) comment '收货人', + receiver_nick varchar(64) comment '收货人名称', + from_warehouse_id bigint(20) comment '移出仓库ID', + from_warehouse_code varchar(64) comment '移出仓库编码', + from_warehouse_name varchar(255) comment '移出仓库名称', + to_warehouse_id bigint(20) comment '移入仓库ID', + to_warehouse_code varchar(64) comment '移入仓库编码', + to_warehouse_name varchar(255) comment '移入仓库名称', + transfer_date datetime comment '转移日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (transfer_id) +) engine=innodb auto_increment=200 comment = '转移单表'; + + +-- ---------------------------- +-- 22、转移单行表 +-- ---------------------------- +drop table if exists wm_transfer_line; +create table wm_transfer_line ( + line_id bigint(20) not null auto_increment comment '明细行ID', + transfer_id bigint(20) not null comment '装箱单ID', + material_stock_id bigint(20) not null comment '库存记录ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_transfer double(12,2) not null comment '装箱数量', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编号', + batch_code varchar(255) comment '批次号', + from_warehouse_id bigint(20) comment '移出仓库ID', + from_warehouse_code varchar(64) comment '移出仓库编码', + from_warehouse_name varchar(255) comment '移出仓库名称', + from_location_id bigint(20) comment '移出库区ID', + from_location_code varchar(64) comment '移出库区编码', + from_location_name varchar(255) comment '移出库区名称', + from_area_id bigint(20) comment '移出库位ID', + from_area_code varchar(64) comment '移出库位编码', + from_area_name varchar(255) comment '移出库位名称', + to_warehouse_id bigint(20) comment '移入仓库ID', + to_warehouse_code varchar(64) comment '移入仓库编码', + to_warehouse_name varchar(255) comment '移入仓库名称', + to_location_id bigint(20) comment '移入库区ID', + to_location_code varchar(64) comment '移入库区编码', + to_location_name varchar(255) comment '移入库区名称', + to_area_id bigint(20) comment '移入库位ID', + to_area_code varchar(64) comment '移入库位编码', + to_area_name varchar(255) comment '移入库位名称', + expire_date datetime comment '有效期', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编码', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '转移单行表'; + + + + +-- ---------------------------- +-- 23、SN码表 +-- ---------------------------- +drop table if exists wm_sn; +create table wm_sn ( + sn_id bigint(20) not null auto_increment comment 'SN码ID', + sn_code varchar(64) not null comment 'SN码', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + batch_code varchar(255) comment '批次号', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (sn_id) +) engine=innodb auto_increment=200 comment = 'SN码表'; + + + +-- ---------------------------- +-- 24、库存盘点记录表 +-- ---------------------------- +drop table if exists wm_stock_taking; +create table wm_stock_taking ( + taking_id bigint(20) not null auto_increment comment '盘点单ID', + taking_code varchar(64) not null comment '盘点单编号', + taking_name varchar(255) comment '盘点单名称', + taking_date datetime not null comment '盘点日期', + user_name varchar(64) comment '盘点人用户名', + nick_name varchar(64) comment '盘点人', + taking_type varchar(64) not null comment '盘点类型', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (taking_id) +) engine=innodb auto_increment=200 comment = '库存盘点记录表'; + + + +-- ---------------------------- +-- 25、库存盘点明细表 +-- ---------------------------- +drop table if exists wm_stock_taking_line; +create table wm_stock_taking_line ( + line_id bigint(20) not null auto_increment comment '行ID', + taking_id bigint(20) comment '报废单ID', + material_stock_id bigint(20) comment '库存ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + unit_name varchar(64) comment '单位名称', + quantity int(11) not null default 1 comment '数量', + taking_quantity int(11) comment '盘点数量', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + taking_status varchar(64) not null default 'LOSS' comment '盘点状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '库存盘点明细表'; + + +-- ---------------------------- +-- 26、库存盘点结果表 +-- ---------------------------- +drop table if exists wm_stock_taking_result; +create table wm_stock_taking_result ( + result_id bigint(20) not null auto_increment comment '结果ID', + taking_id bigint(20) comment '盘点单ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + unit_name varchar(64) comment '单位名称', + quantity int(11) not null default 1 comment '数量', + taking_quantity int(11) comment '盘点数量', + taking_status varchar(64) not null default 'LOSS' comment '盘点状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (result_id) +) engine=innodb auto_increment=200 comment = '库存盘点结果表'; + + + +-- ---------------------------- +-- 27、外协领料单头表 +-- ---------------------------- +drop table if exists wm_outsource_issue; +create table wm_outsource_issue ( + issue_id bigint(20) not null auto_increment comment '领料单ID', + issue_code varchar(64) not null comment '领料单编号', + issue_name varchar(255) not null comment '领料单名称', + workorder_id bigint(20) comment '生产工单ID', + workorder_code varchar(64) comment '生产工单编码', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编码', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + issue_date datetime comment '领料日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (issue_id) +) engine=innodb auto_increment=200 comment = '外协领料单头表'; + + +-- ---------------------------- +-- 28、外协领料单行表 +-- ---------------------------- +drop table if exists wm_outsource_issue_line; +create table wm_outsource_issue_line ( + line_id bigint(20) not null auto_increment comment '行ID', + issue_id bigint(20) comment '领料单ID', + material_stock_id bigint(20) comment '库存ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_issued double(12,2) not null comment '领料数量', + batch_code varchar(255) comment '领料批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '外协领料单行表'; + + + +-- ---------------------------- +-- 29、外协入库单表 +-- ---------------------------- +drop table if exists wm_outsource_recpt; +create table wm_outsource_recpt ( + recpt_id bigint(20) not null auto_increment comment '入库单ID', + recpt_code varchar(64) not null comment '入库单编号', + recpt_name varchar(255) not null comment '入库单名称', + iqc_id bigint(20) comment '来料检验单ID', + iqc_code varchar(64) comment '来料检验单编号', + workorder_id bigint(20) comment '外协工单ID', + workorder_code varchar(64) comment '外协工单编号', + vendor_id bigint(20) comment '供应商ID', + vendor_code varchar(64) comment '供应商编码', + vendor_name varchar(255) comment '供应商名称', + vendor_nick varchar(255) comment '供应商简称', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + recpt_date datetime comment '入库日期', + status varchar(64) default 'PREPARE' comment '单据状态', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (recpt_id) +) engine=innodb auto_increment=200 comment = '外协入库单表'; + + +-- ---------------------------- +-- 30、外协入库单行表 +-- ---------------------------- +drop table if exists wm_outsource_recpt_line; +create table wm_outsource_recpt_line ( + line_id bigint(20) not null auto_increment comment '行ID', + recpt_id bigint(20) comment '入库单ID', + item_id bigint(20) not null comment '产品物料ID', + item_code varchar(64) comment '产品物料编码', + item_name varchar(255) comment '产品物料名称', + specification varchar(500) comment '规格型号', + unit_of_measure varchar(64) comment '单位', + quantity_recived double(12,2) not null comment '入库数量', + batch_code varchar(255) comment '入库批次号', + warehouse_id bigint(20) comment '仓库ID', + warehouse_code varchar(64) comment '仓库编码', + warehouse_name varchar(255) comment '仓库名称', + location_id bigint(20) comment '库区ID', + location_code varchar(64) comment '库区编码', + location_name varchar(255) comment '库区名称', + area_id bigint(20) comment '库位ID', + area_code varchar(64) comment '库位编码', + area_name varchar(255) comment '库位名称', + expire_date datetime comment '有效期', + iqc_check char(1) comment '是否来料检验', + iqc_id bigint(20) comment '来料检验单ID', + iqc_code varchar(64) comment '来料检验单编号', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (line_id) +) engine=innodb auto_increment=200 comment = '外协入库单行表'; + + diff --git a/doc/设计文档/数据库设计/mes_sys.sql b/doc/设计文档/数据库设计/mes_sys.sql new file mode 100644 index 0000000..da8429b --- /dev/null +++ b/doc/设计文档/数据库设计/mes_sys.sql @@ -0,0 +1,143 @@ +-- ---------------------------- +-- 1、编码生成规则表 +-- ---------------------------- +drop table if exists sys_auto_code_rule; +create table sys_auto_code_rule ( + rule_id bigint(20) not null auto_increment comment '规则ID', + rule_code varchar(64) not null comment '规则编码', + rule_name varchar(255) not null comment '规则名称', + rule_desc varchar(500) default null comment '描述', + max_length int(11) comment '最大长度', + is_padded char(1) not null comment '是否补齐', + padded_char varchar(20) comment '补齐字符', + padded_method char(1) default 'L' comment '补齐方式', + enable_flag char(1) default 'Y' not null comment '是否启用', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (rule_id) +) engine=innodb auto_increment=200 comment = '编码生成规则表'; + + +-- ---------------------------- +-- 2、编码生成规则组成表 +-- ---------------------------- +drop table if exists sys_auto_code_part; +create table sys_auto_code_part ( + part_id bigint(20) not null auto_increment comment '分段ID', + rule_id bigint(20) not null comment '规则ID', + part_index int(11) not null comment '分段序号', + part_type varchar(20) not null comment '分段类型,INPUTCHAR:输入字符,NOWDATE:当前日期时间,FIXCHAR:固定字符,SERIALNO:流水号', + part_code varchar(64) comment '分段编号', + part_name varchar(255) comment '分段名称', + part_length int(11) not null comment '分段长度', + date_format varchar(20) comment '日期时间格式', + input_character varchar(64) comment '输入字符', + fix_character varchar(64) comment '固定字符', + seria_start_no int(11) comment '流水号起始值', + seria_step int(11) comment '流水号步长', + seria_now_no int(11) comment '流水号当前值', + cycle_flag char(1) comment '流水号是否循环', + cycle_method varchar(20) comment '循环方式,YEAR:按年,MONTH:按月,DAY:按天,HOUR:按小时,MINITE:按分钟,OTHER:按传入字符变', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (part_id) +) engine=innodb auto_increment=200 comment = '编码生成规则组成表'; + + +-- ---------------------------- +-- 3、编码生成记录表 +-- ---------------------------- +drop table if exists sys_auto_code_result; +create table sys_auto_code_result ( + code_id bigint(20) not null auto_increment comment '记录ID', + rule_id bigint(20) not null comment '规则ID', + gen_date varchar(20) not null comment '生成日期时间', + gen_index int(11) comment '最后产生的序号', + last_result varchar(64) comment '最后产生的值', + last_serial_no int(11) comment '最后产生的流水号', + last_input_char varchar(64) comment '最后传入的参数', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (code_id) +) engine=innodb auto_increment=200 comment = '编码生成记录表'; + + +-- ---------------------------- +-- 4、附件表 +-- ---------------------------- +drop table if exists sys_attachment; +create table sys_attachment ( + attachment_id bigint(20) not null auto_increment comment '附件ID', + source_doc_id bigint(20) comment '关联的业务单据ID', + source_doc_type varchar(64) comment '业务单据类型', + file_url varchar(255) not null comment '访问URL', + base_path varchar(64) comment '域名', + file_name varchar(255) comment '文件名', + orignal_name varchar(255) comment '原来的文件名', + file_type varchar(64) comment '文件类型', + file_size double(12,2) comment '文件大小', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (attachment_id) +) engine=innodb auto_increment=200 comment = '附件表'; + + +-- ---------------------------- +-- 5、消息表 +-- ---------------------------- +drop table if exists sys_messsage; +create table sys_message ( + message_id bigint(20) not null auto_increment comment '附件ID', + message_type varchar(64) not null comment '消息类型', + message_level varchar(64) not null comment '消息级别', + message_title varchar(64) comment '标题', + message_content longblob comment '内容', + sender_id bigint(20) comment '发送人ID', + sender_name varchar(64) comment '发送人名称', + sender_nick varchar(64) comment '发送人昵称', + recipient_id bigint(20) not null comment '接收人ID', + recipient_name varchar(64) comment '接收人名称', + recipient_nick varchar(64) comment '接收人昵称', + process_time datetime comment '处理时间', + call_back varchar(255) comment '回调地址', + status varchar(64) not null default 'UNREAD' comment '状态', + deleted_flag char(1) not null default 'N' comment '是否删除', + remark varchar(500) default '' comment '备注', + attr1 varchar(64) default null comment '预留字段1', + attr2 varchar(255) default null comment '预留字段2', + attr3 int(11) default 0 comment '预留字段3', + attr4 int(11) default 0 comment '预留字段4', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (message_id) +) engine=innodb auto_increment=200 comment = '消息表'; diff --git a/doc/设计文档/数据库设计/ureport_file_tbl.sql b/doc/设计文档/数据库设计/ureport_file_tbl.sql new file mode 100644 index 0000000..e354221 --- /dev/null +++ b/doc/设计文档/数据库设计/ureport_file_tbl.sql @@ -0,0 +1,17 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for ureport_file_tbl +-- ---------------------------- +DROP TABLE IF EXISTS `ureport_file_tbl`; +CREATE TABLE `ureport_file_tbl` ( + `id_` int(11) NOT NULL AUTO_INCREMENT, + `name_` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `content_` mediumblob NULL, + `create_time_` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `update_time_` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id_`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/设计文档/数据库设计/数据库设计.xlsx b/doc/设计文档/数据库设计/数据库设计.xlsx new file mode 100644 index 0000000..1bfccfa Binary files /dev/null and b/doc/设计文档/数据库设计/数据库设计.xlsx differ diff --git a/hkg-docker/docker-compose.yaml b/hkg-docker/docker-compose.yaml new file mode 100644 index 0000000..bb2995d --- /dev/null +++ b/hkg-docker/docker-compose.yaml @@ -0,0 +1,39 @@ +services: + hkg-mysql: + image: mysql:5.7.44 + hostname: hkg-mysql + container_name: hkg-mysql + restart: unless-stopped + ports: + - "3306:3306" + environment: + LANG: C.UTF-8 + TZ: Asia/Shanghai + MYSQL_ROOT_PASSWORD: 123456 + volumes: + - ./mysql-data:/var/lib/mysql + hkg-redis: + image: redis:6.2.16 + hostname: hkg-redis + container_name: hkg-redis + restart: unless-stopped + ports: + - "6379:6379" + volumes: + - ./redis-data:/data + command: redis-server --bind 0.0.0.0 --daemonize NO --protected-mode NO --databases 1 --dir /data --appendonly yes --requirepass 123456 + hkg-minio: + image: minio/minio + hostname: hkg-minio + container_name: hkg-minio + restart: unless-stopped + ports: + - "9000:9000" + - "9001:9001" + environment: + TZ: Asia/Shanghai + MINIO_ROOT_USER: minioadmin + MINIO_ROOT_PASSWORD: minioadmin + volumes: + - ./minio-data:/data + command: server /data --console-address ":9001" diff --git a/ktg-admin/pom.xml b/ktg-admin/pom.xml new file mode 100644 index 0000000..e108f1a --- /dev/null +++ b/ktg-admin/pom.xml @@ -0,0 +1,102 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + jar + ktg-admin + + + web服务入口 + + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + io.springfox + springfox-boot-starter + + + + + io.swagger + swagger-models + 1.6.2 + + + + + mysql + mysql-connector-java + + + + + com.ktg + ktg-framework + + + + + com.ktg + ktg-quartz + + + + + com.ktg + ktg-generator + + + + + com.ktg + ktg-mes + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.1.1.RELEASE + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + ${project.artifactId} + + + + ${project.artifactId} + + + \ No newline at end of file diff --git a/ktg-admin/src/main/java/com/ktg/RuoYiApplication.java b/ktg-admin/src/main/java/com/ktg/RuoYiApplication.java new file mode 100644 index 0000000..f1cb13c --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/RuoYiApplication.java @@ -0,0 +1,35 @@ +package com.ktg; + +import com.bstek.ureport.console.UReportServlet; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ImportResource; +import org.springframework.scheduling.annotation.EnableAsync; + +/** + * 启动程序 + * + * @author ruoyi + */ +@EnableAsync +@ImportResource("classpath:ureport-console-context.xml") +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +public class RuoYiApplication +{ + public static void main(String[] args) + { + // System.setProperty("spring.devtools.restart.enabled", "false"); + SpringApplication.run(RuoYiApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ KTM-MES启动成功 ლ(´ڡ`ლ)゙ \n"); + } + + @Bean + public ServletRegistrationBean urportServlet(){ + ServletRegistrationBean bean = new ServletRegistrationBean(new UReportServlet()); + bean.addUrlMappings("/ureport/*"); + return bean; + } +} diff --git a/ktg-admin/src/main/java/com/ktg/RuoYiServletInitializer.java b/ktg-admin/src/main/java/com/ktg/RuoYiServletInitializer.java new file mode 100644 index 0000000..0e81ce2 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/RuoYiServletInitializer.java @@ -0,0 +1,18 @@ +package com.ktg; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * web容器中进行部署 + * + * @author ruoyi + */ +public class RuoYiServletInitializer extends SpringBootServletInitializer +{ + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) + { + return application.sources(RuoYiApplication.class); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/common/CaptchaController.java b/ktg-admin/src/main/java/com/ktg/web/controller/common/CaptchaController.java new file mode 100644 index 0000000..e18bd36 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/common/CaptchaController.java @@ -0,0 +1,94 @@ +package com.ktg.web.controller.common; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.config.RuoYiConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import com.google.code.kaptcha.Producer; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.utils.sign.Base64; +import com.ktg.common.utils.uuid.IdUtils; +import com.ktg.system.service.ISysConfigService; + +/** + * 验证码操作处理 + * + * @author ruoyi + */ +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysConfigService configService; + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public AjaxResult getCode(HttpServletResponse response) throws IOException + { + AjaxResult ajax = AjaxResult.success(); + boolean captchaOnOff = configService.selectCaptchaOnOff(); + ajax.put("captchaOnOff", captchaOnOff); + if (!captchaOnOff) + { + return ajax; + } + + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; + + String capStr = null, code = null; + BufferedImage image = null; + + // 生成验证码 + String captchaType = RuoYiConfig.getCaptchaType(); + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + + redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try + { + ImageIO.write(image, "jpg", os); + } + catch (IOException e) + { + return AjaxResult.error(e.getMessage()); + } + + ajax.put("uuid", uuid); + ajax.put("img", Base64.encode(os.toByteArray())); + return ajax; + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/common/CommonController.java b/ktg-admin/src/main/java/com/ktg/web/controller/common/CommonController.java new file mode 100644 index 0000000..dffb970 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/common/CommonController.java @@ -0,0 +1,180 @@ +package com.ktg.web.controller.common; + +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.config.RuoYiConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.file.FileUploadUtils; +import com.ktg.common.utils.file.FileUtils; +import com.ktg.framework.config.ServerConfig; + +/** + * 通用请求处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/common") +public class CommonController +{ + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private ServerConfig serverConfig; + + private static final String FILE_DELIMETER = ","; + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + * @param delete 是否删除 + */ + @GetMapping("/download") + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) + { + try + { + if (!FileUtils.checkAllowDownload(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = RuoYiConfig.getDownloadPath() + fileName; + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + if (delete) + { + FileUtils.deleteFile(filePath); + } + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + /** + * 通用上传请求(单个) + */ + @PostMapping("/upload") + public AjaxResult uploadFile(MultipartFile file) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 通用上传请求(多个) + */ + @PostMapping("/uploads") + public AjaxResult uploadFiles(List files) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + List urls = new ArrayList(); + List fileNames = new ArrayList(); + List newFileNames = new ArrayList(); + List originalFilenames = new ArrayList(); + for (MultipartFile file : files) + { + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + urls.add(url); + fileNames.add(fileName); + newFileNames.add(FileUtils.getName(fileName)); + originalFilenames.add(file.getOriginalFilename()); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); + ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); + ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); + ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 本地资源通用下载 + */ + @GetMapping("/download/resource") + public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) + throws Exception + { + try + { + if (!FileUtils.checkAllowDownload(resource)) + { + throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); + } + // 本地资源路径 + String localPath = RuoYiConfig.getProfile(); + // 数据库资源地址 + String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); + // 下载名称 + String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, downloadName); + FileUtils.writeBytes(downloadPath, response.getOutputStream()); + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + @PostMapping("/uploadMinio") + public AjaxResult uploadFileMinio(MultipartFile file) throws Exception{ + try{ + String fileName = FileUploadUtils.uploadMinio(file); + AjaxResult rt = AjaxResult.success(); + rt.put("url",fileName); + rt.put("fileName",fileName); + rt.put("newFileName",FileUtils.getName(fileName)); + rt.put("originalFileName",file.getOriginalFilename()); + return rt; + }catch (Exception e){ + return AjaxResult.error(e.getMessage()); + } + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/monitor/CacheController.java b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/CacheController.java new file mode 100644 index 0000000..3979475 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/CacheController.java @@ -0,0 +1,53 @@ +package com.ktg.web.controller.monitor; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.StringUtils; + +/** + * 缓存监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/cache") +public class CacheController +{ + @Autowired + private RedisTemplate redisTemplate; + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping() + public AjaxResult getInfo() throws Exception + { + Properties info = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info()); + Properties commandStats = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info("commandstats")); + Object dbSize = redisTemplate.execute((RedisCallback) connection -> connection.dbSize()); + + Map result = new HashMap<>(3); + result.put("info", info); + result.put("dbSize", dbSize); + + List> pieList = new ArrayList<>(); + commandStats.stringPropertyNames().forEach(key -> { + Map data = new HashMap<>(2); + String property = commandStats.getProperty(key); + data.put("name", StringUtils.removeStart(key, "cmdstat_")); + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); + pieList.add(data); + }); + result.put("commandStats", pieList); + return AjaxResult.success(result); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/monitor/ServerController.java b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/ServerController.java new file mode 100644 index 0000000..0144651 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/ServerController.java @@ -0,0 +1,27 @@ +package com.ktg.web.controller.monitor; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.framework.web.domain.Server; + +/** + * 服务器监控 + * + * @author ktg + */ +@RestController +@RequestMapping("/monitor/server") +public class ServerController +{ + @PreAuthorize("@ss.hasPermi('monitor:server:list')") + @GetMapping() + public AjaxResult getInfo() throws Exception + { + Server server = new Server(); + server.copyTo(); + return AjaxResult.success(server); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysLogininforController.java b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysLogininforController.java new file mode 100644 index 0000000..b477ed5 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysLogininforController.java @@ -0,0 +1,69 @@ +package com.ktg.web.controller.monitor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.domain.SysLogininfor; +import com.ktg.system.service.ISysLogininforService; + +/** + * 系统访问记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/logininfor") +public class SysLogininforController extends BaseController +{ + @Autowired + private ISysLogininforService logininforService; + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") + @GetMapping("/list") + public TableDataInfo list(SysLogininfor logininfor) + { + startPage(); + List list = logininforService.selectLogininforList(logininfor); + return getDataTable(list); + } + + @Log(title = "登录日志", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysLogininfor logininfor) + { + List list = logininforService.selectLogininforList(logininfor); + ExcelUtil util = new ExcelUtil(SysLogininfor.class); + util.exportExcel(response, list, "登录日志"); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") + @Log(title = "登录日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{infoIds}") + public AjaxResult remove(@PathVariable Long[] infoIds) + { + return toAjax(logininforService.deleteLogininforByIds(infoIds)); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") + @Log(title = "登录日志", businessType = BusinessType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() + { + logininforService.cleanLogininfor(); + return AjaxResult.success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysOperlogController.java b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysOperlogController.java new file mode 100644 index 0000000..c701c52 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysOperlogController.java @@ -0,0 +1,69 @@ +package com.ktg.web.controller.monitor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.domain.SysOperLog; +import com.ktg.system.service.ISysOperLogService; + +/** + * 操作日志记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/operlog") +public class SysOperlogController extends BaseController +{ + @Autowired + private ISysOperLogService operLogService; + + @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") + @GetMapping("/list") + public TableDataInfo list(SysOperLog operLog) + { + startPage(); + List list = operLogService.selectOperLogList(operLog); + return getDataTable(list); + } + + @Log(title = "操作日志", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysOperLog operLog) + { + List list = operLogService.selectOperLogList(operLog); + ExcelUtil util = new ExcelUtil(SysOperLog.class); + util.exportExcel(response, list, "操作日志"); + } + + @Log(title = "操作日志", businessType = BusinessType.DELETE) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/{operIds}") + public AjaxResult remove(@PathVariable Long[] operIds) + { + return toAjax(operLogService.deleteOperLogByIds(operIds)); + } + + @Log(title = "操作日志", businessType = BusinessType.CLEAN) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/clean") + public AjaxResult clean() + { + operLogService.cleanOperLog(); + return AjaxResult.success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysUserOnlineController.java b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysUserOnlineController.java new file mode 100644 index 0000000..4986e30 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/monitor/SysUserOnlineController.java @@ -0,0 +1,92 @@ +package com.ktg.web.controller.monitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.domain.SysUserOnline; +import com.ktg.system.service.ISysUserOnlineService; + +/** + * 在线用户监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/online") +public class SysUserOnlineController extends BaseController +{ + @Autowired + private ISysUserOnlineService userOnlineService; + + @Autowired + private RedisCache redisCache; + + @PreAuthorize("@ss.hasPermi('monitor:online:list')") + @GetMapping("/list") + public TableDataInfo list(String ipaddr, String userName) + { + Collection keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*"); + List userOnlineList = new ArrayList(); + for (String key : keys) + { + LoginUser user = redisCache.getCacheObject(key); + if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) + { + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) + { + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); + } + } + else if (StringUtils.isNotEmpty(ipaddr)) + { + if (StringUtils.equals(ipaddr, user.getIpaddr())) + { + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); + } + } + else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) + { + if (StringUtils.equals(userName, user.getUsername())) + { + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); + } + } + else + { + userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); + } + } + Collections.reverse(userOnlineList); + userOnlineList.removeAll(Collections.singleton(null)); + return getDataTable(userOnlineList); + } + + /** + * 强退用户 + */ + @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @DeleteMapping("/{tokenId}") + public AjaxResult forceLogout(@PathVariable String tokenId) + { + redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId); + return AjaxResult.success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/LoginController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/LoginController.java new file mode 100644 index 0000000..103d7b6 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/LoginController.java @@ -0,0 +1,78 @@ +package com.ktg.web.controller.system; + + +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.framework.web.service.MobileLoginService; +import com.ktg.framework.web.service.TokenService; +import com.ktg.system.domain.LoginParams; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 登录控制器 + * + * @author SK + * @since 2018/6/13 + */ +@RestController +@RequestMapping("/mobile/login") +public class LoginController{ + + @Autowired(required = false) + private TokenService tokenService; + + @Autowired(required = false) + private MobileLoginService loginService; + + + + /** + * 会员登录 + * @return -1 用户名或密码错误 -2 账号冻结 -3 账号锁定 1 成功 -4 验证码错误 + */ + @PostMapping("/loginByPassword") + @ResponseBody + public AjaxResult loginByPassword(HttpServletRequest request) { + String username = request.getParameter("username"); + String password = request.getParameter("password"); + String phoneNo = request.getParameter("phoneNo"); + String validCode = request.getParameter("validCode"); + String loginType = request.getParameter("loginType"); + // 登录结果 + LoginParams loginParams = new LoginParams(); + loginParams.setUsername(username); + loginParams.setPassword(password); + loginParams.setPhoneNo(phoneNo); + loginParams.setValidCode(validCode); + loginParams.setLoginType(loginType); + return loginService.login(loginParams); + } + /** + * 发送验证码 + */ + @PostMapping("/sendCode") + @ResponseBody + public AjaxResult sendRegisterCode(HttpServletRequest request) { + String phoneNo = request.getParameter("phoneNo"); + String validCodeType = request.getParameter("validCodeType"); + // 登录结果 + LoginParams loginParams = new LoginParams(); + loginParams.setPhoneNo(phoneNo); + loginParams.setValidCodeType(validCodeType); + return loginService.sendCode(loginParams); + } + + @GetMapping("/logout") + @ResponseBody + public AjaxResult logout(HttpServletRequest request) { + LoginUser loginUser = tokenService.getLoginUser(request); + if(null != loginUser){ + tokenService.delLoginUser(loginUser.getToken()); + } + return AjaxResult.success("退出成功!"); + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAttachmentController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAttachmentController.java new file mode 100644 index 0000000..d19b5ae --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAttachmentController.java @@ -0,0 +1,104 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.system.domain.SysAttachment; +import com.ktg.system.service.ISysAttachmentService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 附件Controller + * + * @author yinjinlu + * @date 2022-07-26 + */ +@RestController +@RequestMapping("/system/attachment") +public class SysAttachmentController extends BaseController +{ + @Autowired + private ISysAttachmentService sysAttachmentService; + + /** + * 查询附件列表 + */ + @PreAuthorize("@ss.hasPermi('system:attachment:list')") + @GetMapping("/list") + public TableDataInfo list(SysAttachment sysAttachment) + { + startPage(); + List list = sysAttachmentService.selectSysAttachmentList(sysAttachment); + return getDataTable(list); + } + + /** + * 导出附件列表 + */ + @PreAuthorize("@ss.hasPermi('system:attachment:export')") + @Log(title = "附件", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysAttachment sysAttachment) + { + List list = sysAttachmentService.selectSysAttachmentList(sysAttachment); + ExcelUtil util = new ExcelUtil(SysAttachment.class); + util.exportExcel(response, list, "附件数据"); + } + + /** + * 获取附件详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:attachment:query')") + @GetMapping(value = "/{attachmentId}") + public AjaxResult getInfo(@PathVariable("attachmentId") Long attachmentId) + { + return AjaxResult.success(sysAttachmentService.selectSysAttachmentByAttachmentId(attachmentId)); + } + + /** + * 新增附件 + */ + @PreAuthorize("@ss.hasPermi('system:attachment:add')") + @Log(title = "附件", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysAttachment sysAttachment) + { + return toAjax(sysAttachmentService.insertSysAttachment(sysAttachment)); + } + + /** + * 修改附件 + */ + @PreAuthorize("@ss.hasPermi('system:attachment:edit')") + @Log(title = "附件", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysAttachment sysAttachment) + { + return toAjax(sysAttachmentService.updateSysAttachment(sysAttachment)); + } + + /** + * 删除附件 + */ + @PreAuthorize("@ss.hasPermi('system:attachment:remove')") + @Log(title = "附件", businessType = BusinessType.DELETE) + @DeleteMapping("/{attachmentIds}") + public AjaxResult remove(@PathVariable Long[] attachmentIds) + { + return toAjax(sysAttachmentService.deleteSysAttachmentByAttachmentIds(attachmentIds)); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodeController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodeController.java new file mode 100644 index 0000000..5ae3338 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodeController.java @@ -0,0 +1,32 @@ +package com.ktg.web.controller.system; + +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api("用户信息管理") +@RestController +@RequestMapping("/system/autocode") +public class SysAutoCodeController { + + @Autowired + private AutoCodeUtil autoCodeUtil; + + @ApiOperation("获取一个自动生成的编码") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ruleCode", value = "规则编码", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class), + @ApiImplicitParam(name = "inputCharacter", value = "输入字符", required = false,dataType = "String", paramType = "path", dataTypeClass = String.class) + }) + @GetMapping(value = {"/get/{ruleCode}/{inputCharacter}","/get/{ruleCode}"}) + public String getAutoCode(@PathVariable String ruleCode,@PathVariable(required = false) String inputCharacter){ + return autoCodeUtil.genSerialCode(ruleCode,inputCharacter); + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodePartController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodePartController.java new file mode 100644 index 0000000..7760ff4 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodePartController.java @@ -0,0 +1,70 @@ +package com.ktg.web.controller.system; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.system.service.IAutoCodePartService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/system/autocode/part") +public class SysAutoCodePartController extends BaseController { + + @Autowired + private IAutoCodePartService iAutoCodePartService; + + @PreAuthorize("@ss.hasPermi('system:autocode:part:list')") + @GetMapping("/list") + public TableDataInfo list(SysAutoCodePart sysAutoCodePart){ + startPage(); + List parts = iAutoCodePartService.listPart(sysAutoCodePart); + return getDataTable(parts); + } + + @PreAuthorize("@ss.hasPermi('system:autocode:part:query')") + @GetMapping("/{partId}") + public AjaxResult getInfo(@PathVariable Long partId){ + return AjaxResult.success(iAutoCodePartService.findById(partId)); + } + + + @PreAuthorize("@ss.hasPermi('system:autocode:part:insert')") + @Log(title = "新增编码生产规则组成部分",businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysAutoCodePart part){ + if(UserConstants.NOT_UNIQUE.equals(iAutoCodePartService.checkPartUnique(part))){ + return AjaxResult.error("规则组成不唯一,清检查组成编码、组成名称、组成序号"); + } + part.setCreateBy(getUsername()); + return toAjax(iAutoCodePartService.insertPart(part)); + } + + @PreAuthorize("@ss.hasPermi('system:autocode:part:update')") + @Log(title = "更新物料编码",businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult update(@Validated @RequestBody SysAutoCodePart sysAutoCodePart){ + if(UserConstants.NOT_UNIQUE.equals(iAutoCodePartService.checkPartUnique(sysAutoCodePart))){ + return AjaxResult.error("规则组成不唯一,清检查组成编码、组成名称、组成序号"); + } + sysAutoCodePart.setUpdateBy(getUsername()); + return toAjax(iAutoCodePartService.updatePart(sysAutoCodePart)); + } + + + @PreAuthorize("@ss.hasPermi('system:autocode:part:remove')") + @Log(title = "删除物料编码",businessType = BusinessType.DELETE) + @DeleteMapping("/{partIds}") + public AjaxResult delete(@PathVariable Long[] partIds){ + return toAjax(iAutoCodePartService.deleteByIds(partIds)); + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodeRuleController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodeRuleController.java new file mode 100644 index 0000000..62a3c67 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysAutoCodeRuleController.java @@ -0,0 +1,79 @@ +package com.ktg.web.controller.system; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysAutoCodeRule; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.system.service.IAutoCodeRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/system/autocode/rule") +public class SysAutoCodeRuleController extends BaseController { + + @Autowired + private IAutoCodeRuleService iAutoCodeRuleService; + + @PreAuthorize("@ss.hasPermi('system:autocode:rule:list')") + @GetMapping("/list") + public TableDataInfo list(SysAutoCodeRule sysAutoCodeRule){ + startPage(); + List rules = iAutoCodeRuleService.selectAutoCodeList(sysAutoCodeRule); + return getDataTable(rules); + } + + @PreAuthorize("@ss.hasPermi('system:autocode:rule:query')") + @GetMapping("/{ruleId}") + public AjaxResult getInfo(@PathVariable Long ruleId){ + return AjaxResult.success(iAutoCodeRuleService.findById(ruleId)); + } + + @PreAuthorize("@ss.hasPermi('system:autocode:rule:add')") + @Log(title = "新增自动编码规则",businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysAutoCodeRule sysAutoCodeRule){ + if(UserConstants.NOT_UNIQUE.equals(iAutoCodeRuleService.checkRuleCodeUnique(sysAutoCodeRule))){ + return AjaxResult.error("自动编码规则的编号重复"); + } + if(UserConstants.NOT_UNIQUE.equals(iAutoCodeRuleService.checkRuleNameUnique(sysAutoCodeRule))){ + return AjaxResult.error("自动编码规则的名称重复"); + } + if("N".equals(sysAutoCodeRule.getIsPadded())){ + sysAutoCodeRule.setPaddedChar(null); + sysAutoCodeRule.setPaddedMethod(null); + } + sysAutoCodeRule.setCreateBy(getUsername()); + return toAjax(iAutoCodeRuleService.insertInfo(sysAutoCodeRule)); + } + + @PreAuthorize("@ss.hasPermi('system:autocode:rule:edit')") + @Log(title = "更新自动编码规则",businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult updateInfo(@Validated @RequestBody SysAutoCodeRule sysAutoCodeRule){ + if(UserConstants.NOT_UNIQUE.equals(iAutoCodeRuleService.checkRuleCodeUnique(sysAutoCodeRule))){ + return AjaxResult.error("自动编码规则的编号重复"); + } + if(UserConstants.NOT_UNIQUE.equals(iAutoCodeRuleService.checkRuleNameUnique(sysAutoCodeRule))){ + return AjaxResult.error("自动编码规则的名称重复"); + } + sysAutoCodeRule.setUpdateBy(getUsername()); + return toAjax(iAutoCodeRuleService.updateInfo(sysAutoCodeRule)); + } + + @PreAuthorize("@ss.hasPermi('system:autocode:rule:remove')") + @Log(title = "删除自动编码规则",businessType = BusinessType.DELETE) + @DeleteMapping("/{ruleIds}") + public AjaxResult remove(@PathVariable Long[] ruleIds){ + + return toAjax(iAutoCodeRuleService.deleteByIds(ruleIds)); + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysConfigController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysConfigController.java new file mode 100644 index 0000000..c308e30 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysConfigController.java @@ -0,0 +1,134 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.domain.SysConfig; +import com.ktg.system.service.ISysConfigService; + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/config") +public class SysConfigController extends BaseController +{ + @Autowired + private ISysConfigService configService; + + /** + * 获取参数配置列表 + */ + @PreAuthorize("@ss.hasPermi('system:config:list')") + @GetMapping("/list") + public TableDataInfo list(SysConfig config) + { + startPage(); + List list = configService.selectConfigList(config); + return getDataTable(list); + } + + @Log(title = "参数管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:config:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysConfig config) + { + List list = configService.selectConfigList(config); + ExcelUtil util = new ExcelUtil(SysConfig.class); + util.exportExcel(response, list, "参数数据"); + } + + /** + * 根据参数编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long configId) + { + return AjaxResult.success(configService.selectConfigById(configId)); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey/{configKey}") + public AjaxResult getConfigKey(@PathVariable String configKey) + { + return AjaxResult.success(configService.selectConfigByKey(configKey)); + } + + /** + * 新增参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:add')") + @Log(title = "参数管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setCreateBy(getUsername()); + return toAjax(configService.insertConfig(config)); + } + + /** + * 修改参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:edit')") + @Log(title = "参数管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setUpdateBy(getUsername()); + return toAjax(configService.updateConfig(config)); + } + + /** + * 删除参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "参数管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{configIds}") + public AjaxResult remove(@PathVariable Long[] configIds) + { + configService.deleteConfigByIds(configIds); + return success(); + } + + /** + * 刷新参数缓存 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "参数管理", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + configService.resetConfigCache(); + return AjaxResult.success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDeptController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDeptController.java new file mode 100644 index 0000000..d7d566c --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDeptController.java @@ -0,0 +1,163 @@ +package com.ktg.web.controller.system; + +import java.util.Iterator; +import java.util.List; +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysDept; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.service.ISysDeptService; + +/** + * 部门信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dept") +public class SysDeptController extends BaseController +{ + @Autowired + private ISysDeptService deptService; + + /** + * 获取部门列表 + */ + @GetMapping("/list") + public AjaxResult list(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + return AjaxResult.success(depts); + } + + /** + * 查询部门列表(排除节点) + */ + @GetMapping("/list/exclude/{deptId}") + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) + { + List depts = deptService.selectDeptList(new SysDept()); + Iterator it = depts.iterator(); + while (it.hasNext()) + { + SysDept d = (SysDept) it.next(); + if (d.getDeptId().intValue() == deptId + || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) + { + it.remove(); + } + } + return AjaxResult.success(depts); + } + + /** + * 根据部门编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:dept:query')") + @GetMapping(value = "/{deptId}") + public AjaxResult getInfo(@PathVariable Long deptId) + { + deptService.checkDeptDataScope(deptId); + return AjaxResult.success(deptService.selectDeptById(deptId)); + } + + /** + * 获取部门下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); + } + + /** + * 加载对应角色部门列表树 + */ + @GetMapping(value = "/roleDeptTreeselect/{roleId}") + public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) + { + List depts = deptService.selectDeptList(new SysDept()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); + ajax.put("depts", deptService.buildDeptTreeSelect(depts)); + return ajax; + } + + /** + * 新增部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:add')") + @Log(title = "部门管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDept dept) + { + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + dept.setCreateBy(getUsername()); + return toAjax(deptService.insertDept(dept)); + } + + /** + * 修改部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:edit')") + @Log(title = "部门管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDept dept) + { + Long deptId = dept.getDeptId(); + deptService.checkDeptDataScope(deptId); + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + else if (dept.getParentId().equals(deptId)) + { + return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); + } + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) + { + return AjaxResult.error("该部门包含未停用的子部门!"); + } + dept.setUpdateBy(getUsername()); + return toAjax(deptService.updateDept(dept)); + } + + /** + * 删除部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:remove')") + @Log(title = "部门管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{deptId}") + public AjaxResult remove(@PathVariable Long deptId) + { + if (deptService.hasChildByDeptId(deptId)) + { + return AjaxResult.error("存在下级部门,不允许删除"); + } + if (deptService.checkDeptExistUser(deptId)) + { + return AjaxResult.error("部门存在用户,不允许删除"); + } + deptService.checkDeptDataScope(deptId); + return toAjax(deptService.deleteDeptById(deptId)); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDictDataController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDictDataController.java new file mode 100644 index 0000000..8d90166 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDictDataController.java @@ -0,0 +1,121 @@ +package com.ktg.web.controller.system; + +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysDictData; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.service.ISysDictDataService; +import com.ktg.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dict/data") +public class SysDictDataController extends BaseController +{ + @Autowired + private ISysDictDataService dictDataService; + + @Autowired + private ISysDictTypeService dictTypeService; + + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") + public TableDataInfo list(SysDictData dictData) + { + startPage(); + List list = dictDataService.selectDictDataList(dictData); + return getDataTable(list); + } + + @Log(title = "字典数据", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysDictData dictData) + { + List list = dictDataService.selectDictDataList(dictData); + ExcelUtil util = new ExcelUtil(SysDictData.class); + util.exportExcel(response, list, "字典数据"); + } + + /** + * 查询字典数据详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictCode}") + public AjaxResult getInfo(@PathVariable Long dictCode) + { + return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); + } + + /** + * 根据字典类型查询字典数据信息 + */ + @GetMapping(value = "/type/{dictType}") + public AjaxResult dictType(@PathVariable String dictType) + { + List data = dictTypeService.selectDictDataByType(dictType); + if (StringUtils.isNull(data)) + { + data = new ArrayList(); + } + return AjaxResult.success(data); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典数据", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictData dict) + { + dict.setCreateBy(getUsername()); + return toAjax(dictDataService.insertDictData(dict)); + } + + /** + * 修改保存字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @Log(title = "字典数据", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictData dict) + { + dict.setUpdateBy(getUsername()); + return toAjax(dictDataService.updateDictData(dict)); + } + + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictCodes}") + public AjaxResult remove(@PathVariable Long[] dictCodes) + { + dictDataService.deleteDictDataByIds(dictCodes); + return success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDictTypeController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDictTypeController.java new file mode 100644 index 0000000..01ff441 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysDictTypeController.java @@ -0,0 +1,132 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysDictType; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dict/type") +public class SysDictTypeController extends BaseController +{ + @Autowired + private ISysDictTypeService dictTypeService; + + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") + public TableDataInfo list(SysDictType dictType) + { + startPage(); + List list = dictTypeService.selectDictTypeList(dictType); + return getDataTable(list); + } + + @Log(title = "字典类型", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysDictType dictType) + { + List list = dictTypeService.selectDictTypeList(dictType); + ExcelUtil util = new ExcelUtil(SysDictType.class); + util.exportExcel(response, list, "字典类型"); + } + + /** + * 查询字典类型详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictId}") + public AjaxResult getInfo(@PathVariable Long dictId) + { + return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictType dict) + { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setCreateBy(getUsername()); + return toAjax(dictTypeService.insertDictType(dict)); + } + + /** + * 修改字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @Log(title = "字典类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictType dict) + { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setUpdateBy(getUsername()); + return toAjax(dictTypeService.updateDictType(dict)); + } + + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictIds}") + public AjaxResult remove(@PathVariable Long[] dictIds) + { + dictTypeService.deleteDictTypeByIds(dictIds); + return success(); + } + + /** + * 刷新字典缓存 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + dictTypeService.resetDictCache(); + return AjaxResult.success(); + } + + /** + * 获取字典选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List dictTypes = dictTypeService.selectDictTypeAll(); + return AjaxResult.success(dictTypes); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysIndexController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysIndexController.java new file mode 100644 index 0000000..6818c3e --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysIndexController.java @@ -0,0 +1,29 @@ +package com.ktg.web.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.utils.StringUtils; + +/** + * 首页 + * + * @author ruoyi + */ +@RestController +public class SysIndexController +{ + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + + /** + * 访问首页,提示语 + */ + @RequestMapping("/") + public String index() + { + return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysLoginController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysLoginController.java new file mode 100644 index 0000000..502e26f --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysLoginController.java @@ -0,0 +1,86 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysMenu; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginBody; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.framework.web.service.SysLoginService; +import com.ktg.framework.web.service.SysPermissionService; +import com.ktg.system.service.ISysMenuService; + +/** + * 登录验证 + * + * @author ruoyi + */ +@RestController +public class SysLoginController +{ + @Autowired + private SysLoginService loginService; + + @Autowired + private ISysMenuService menuService; + + @Autowired + private SysPermissionService permissionService; + + /** + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ + @PostMapping("/login") + public AjaxResult login(@RequestBody LoginBody loginBody) + { + AjaxResult ajax = AjaxResult.success(); + // 生成令牌 + String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), + loginBody.getUuid()); + ajax.put(Constants.TOKEN, token); + return ajax; + } + + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @GetMapping("getInfo") + public AjaxResult getInfo() + { + SysUser user = SecurityUtils.getLoginUser().getUser(); + // 角色集合 + Set roles = permissionService.getRolePermission(user); + // 权限集合 + Set permissions = permissionService.getMenuPermission(user); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + return ajax; + } + + /** + * 获取路由信息 + * + * @return 路由信息 + */ + @GetMapping("getRouters") + public AjaxResult getRouters() + { + Long userId = SecurityUtils.getUserId(); + List menus = menuService.selectMenuTreeByUserId(userId); + return AjaxResult.success(menuService.buildMenus(menus)); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMenuController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMenuController.java new file mode 100644 index 0000000..a27ca72 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMenuController.java @@ -0,0 +1,142 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysMenu; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.service.ISysMenuService; + +/** + * 菜单信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/menu") +public class SysMenuController extends BaseController +{ + @Autowired + private ISysMenuService menuService; + + /** + * 获取菜单列表 + */ + @PreAuthorize("@ss.hasPermi('system:menu:list')") + @GetMapping("/list") + public AjaxResult list(SysMenu menu) + { + List menus = menuService.selectMenuList(menu, getUserId()); + return AjaxResult.success(menus); + } + + /** + * 根据菜单编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:menu:query')") + @GetMapping(value = "/{menuId}") + public AjaxResult getInfo(@PathVariable Long menuId) + { + return AjaxResult.success(menuService.selectMenuById(menuId)); + } + + /** + * 获取菜单下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysMenu menu) + { + List menus = menuService.selectMenuList(menu, getUserId()); + return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); + } + + /** + * 加载对应角色菜单列表树 + */ + @GetMapping(value = "/roleMenuTreeselect/{roleId}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) + { + List menus = menuService.selectMenuList(getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); + ajax.put("menus", menuService.buildMenuTreeSelect(menus)); + return ajax; + } + + /** + * 新增菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:add')") + @Log(title = "菜单管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysMenu menu) + { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) + { + return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) + { + return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + menu.setCreateBy(getUsername()); + return toAjax(menuService.insertMenu(menu)); + } + + /** + * 修改菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:edit')") + @Log(title = "菜单管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysMenu menu) + { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) + { + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) + { + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + else if (menu.getMenuId().equals(menu.getParentId())) + { + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); + } + menu.setUpdateBy(getUsername()); + return toAjax(menuService.updateMenu(menu)); + } + + /** + * 删除菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:remove')") + @Log(title = "菜单管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{menuId}") + public AjaxResult remove(@PathVariable("menuId") Long menuId) + { + if (menuService.hasChildByMenuId(menuId)) + { + return AjaxResult.error("存在子菜单,不允许删除"); + } + if (menuService.checkMenuExistRole(menuId)) + { + return AjaxResult.error("菜单已分配,不允许删除"); + } + return toAjax(menuService.deleteMenuById(menuId)); + } +} \ No newline at end of file diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMessageController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMessageController.java new file mode 100644 index 0000000..71219f9 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMessageController.java @@ -0,0 +1,121 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.message.MessageProvider; +import com.ktg.system.service.ISysUserService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.system.domain.SysMessage; +import com.ktg.system.service.ISysMessageService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 消息Controller + * + * @author yinjinlu + * @date 2023-03-06 + */ +@RestController +@RequestMapping("/system/message") +public class SysMessageController extends BaseController +{ + @Autowired + private ISysMessageService sysMessageService; + @Autowired + private ISysUserService sysUserService; + @Autowired + private MessageProvider messageProvider; + + /** + * 查询消息列表 + */ + @PreAuthorize("@ss.hasPermi('system:message:list')") + @GetMapping("/list") + public TableDataInfo list(SysMessage sysMessage) + { + startPage(); + List list = sysMessageService.selectSysMessageList(sysMessage); + return getDataTable(list); + } + + /** + * 导出消息列表 + */ + @PreAuthorize("@ss.hasPermi('system:message:export')") + @Log(title = "消息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysMessage sysMessage) + { + List list = sysMessageService.selectSysMessageList(sysMessage); + ExcelUtil util = new ExcelUtil(SysMessage.class); + util.exportExcel(response, list, "消息数据"); + } + + /** + * 获取消息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:message:query')") + @GetMapping(value = "/{messageId}") + public AjaxResult getInfo(@PathVariable("messageId") Long messageId) + { + return AjaxResult.success(sysMessageService.selectSysMessageByMessageId(messageId)); + } + + /** + * 新增消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:add')") + @Log(title = "消息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysMessage sysMessage) + { + messageProvider.sendMessage(sysMessage); + return AjaxResult.success(); + } + + /** + * 修改消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:edit')") + @Log(title = "消息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysMessage sysMessage) + { + return toAjax(sysMessageService.updateSysMessage(sysMessage)); + } + + /** + * 删除消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:remove')") + @Log(title = "消息", businessType = BusinessType.DELETE) + @DeleteMapping("/{messageIds}") + public AjaxResult remove(@PathVariable Long[] messageIds) + { + for (Long messageId: messageIds + ) { + SysMessage sysMessage = sysMessageService.selectSysMessageByMessageId(messageId); + sysMessage.setDeletedFlag(UserConstants.YES); + sysMessageService.updateSysMessage(sysMessage); + } + return AjaxResult.success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMessageMobController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMessageMobController.java new file mode 100644 index 0000000..134dd8b --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysMessageMobController.java @@ -0,0 +1,38 @@ +package com.ktg.web.controller.system; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.system.domain.SysMessage; +import com.ktg.system.service.ISysMessageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/mobile/system/message") +public class SysMessageMobController extends BaseController { + + @Autowired + private ISysMessageService sysMessageService; + + /** + * 查询当前人的消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:list')") + @GetMapping("/getMyMessage") + public TableDataInfo list(SysMessage sysMessage) + { + SysUser user = SecurityUtils.getLoginUser().getUser(); + startPage(); + sysMessage.setRecipientId(user.getUserId()); + List list = sysMessageService.selectSysMessageList(sysMessage); + return getDataTable(list); + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysNoticeController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysNoticeController.java new file mode 100644 index 0000000..47f766c --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysNoticeController.java @@ -0,0 +1,91 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.system.domain.SysNotice; +import com.ktg.system.service.ISysNoticeService; + +/** + * 公告 信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/notice") +public class SysNoticeController extends BaseController +{ + @Autowired + private ISysNoticeService noticeService; + + /** + * 获取通知公告列表 + */ + @PreAuthorize("@ss.hasPermi('system:notice:list')") + @GetMapping("/list") + public TableDataInfo list(SysNotice notice) + { + startPage(); + List list = noticeService.selectNoticeList(notice); + return getDataTable(list); + } + + /** + * 根据通知公告编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:notice:query')") + @GetMapping(value = "/{noticeId}") + public AjaxResult getInfo(@PathVariable Long noticeId) + { + return AjaxResult.success(noticeService.selectNoticeById(noticeId)); + } + + /** + * 新增通知公告 + */ + @PreAuthorize("@ss.hasPermi('system:notice:add')") + @Log(title = "通知公告", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysNotice notice) + { + notice.setCreateBy(getUsername()); + return toAjax(noticeService.insertNotice(notice)); + } + + /** + * 修改通知公告 + */ + @PreAuthorize("@ss.hasPermi('system:notice:edit')") + @Log(title = "通知公告", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysNotice notice) + { + notice.setUpdateBy(getUsername()); + return toAjax(noticeService.updateNotice(notice)); + } + + /** + * 删除通知公告 + */ + @PreAuthorize("@ss.hasPermi('system:notice:remove')") + @Log(title = "通知公告", businessType = BusinessType.DELETE) + @DeleteMapping("/{noticeIds}") + public AjaxResult remove(@PathVariable Long[] noticeIds) + { + return toAjax(noticeService.deleteNoticeByIds(noticeIds)); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysPostController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysPostController.java new file mode 100644 index 0000000..7d52e18 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysPostController.java @@ -0,0 +1,141 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.domain.SysPost; +import com.ktg.system.service.ISysPostService; + +/** + * 岗位信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/post") +public class SysPostController extends BaseController +{ + @Autowired + private ISysPostService postService; + + /** + * 获取岗位列表 + */ + @GetMapping("/list") + public TableDataInfo list(SysPost post) + { + startPage(); + List list = postService.selectPostList(post); + return getDataTable(list); + } + + /** + * 查询所有有效岗位信息以List方式返回 + * @return + */ + @GetMapping("/listAll") + public AjaxResult listAll(){ + SysPost post = new SysPost(); + post.setStatus("0"); + List list = postService.selectPostList(post); + return AjaxResult.success(list); + } + + @Log(title = "岗位管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:post:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysPost post) + { + List list = postService.selectPostList(post); + ExcelUtil util = new ExcelUtil(SysPost.class); + util.exportExcel(response, list, "岗位数据"); + } + + /** + * 根据岗位编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:post:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable Long postId) + { + return AjaxResult.success(postService.selectPostById(postId)); + } + + /** + * 新增岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:add')") + @Log(title = "岗位管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysPost post) + { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setCreateBy(getUsername()); + return toAjax(postService.insertPost(post)); + } + + /** + * 修改岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:edit')") + @Log(title = "岗位管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysPost post) + { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setUpdateBy(getUsername()); + return toAjax(postService.updatePost(post)); + } + + /** + * 删除岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:remove')") + @Log(title = "岗位管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{postIds}") + public AjaxResult remove(@PathVariable Long[] postIds) + { + return toAjax(postService.deletePostByIds(postIds)); + } + + /** + * 获取岗位选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List posts = postService.selectPostAll(); + return AjaxResult.success(posts); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysProfileController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysProfileController.java new file mode 100644 index 0000000..502b004 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysProfileController.java @@ -0,0 +1,142 @@ +package com.ktg.web.controller.system; + +import java.io.IOException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.ktg.common.annotation.Log; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.file.FileUploadUtils; +import com.ktg.framework.web.service.TokenService; +import com.ktg.system.service.ISysUserService; + +/** + * 个人信息 业务处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/user/profile") +public class SysProfileController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private TokenService tokenService; + + /** + * 个人信息 + */ + @GetMapping + public AjaxResult profile() + { + LoginUser loginUser = getLoginUser(); + SysUser user = loginUser.getUser(); + AjaxResult ajax = AjaxResult.success(user); + ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); + ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); + return ajax; + } + + /** + * 修改用户 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult updateProfile(@RequestBody SysUser user) + { + LoginUser loginUser = getLoginUser(); + SysUser sysUser = loginUser.getUser(); + user.setUserName(sysUser.getUserName()); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUserId(sysUser.getUserId()); + user.setPassword(null); + if (userService.updateUserProfile(user) > 0) + { + // 更新缓存用户信息 + sysUser.setNickName(user.getNickName()); + sysUser.setPhonenumber(user.getPhonenumber()); + sysUser.setEmail(user.getEmail()); + sysUser.setSex(user.getSex()); + tokenService.setLoginUser(loginUser); + return AjaxResult.success(); + } + return AjaxResult.error("修改个人信息异常,请联系管理员"); + } + + /** + * 重置密码 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping("/updatePwd") + public AjaxResult updatePwd(String oldPassword, String newPassword) + { + LoginUser loginUser = getLoginUser(); + String userName = loginUser.getUsername(); + String password = loginUser.getPassword(); + if (!SecurityUtils.matchesPassword(oldPassword, password)) + { + return AjaxResult.error("修改密码失败,旧密码错误"); + } + if (SecurityUtils.matchesPassword(newPassword, password)) + { + return AjaxResult.error("新密码不能与旧密码相同"); + } + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) + { + // 更新缓存用户密码 + loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); + tokenService.setLoginUser(loginUser); + return AjaxResult.success(); + } + return AjaxResult.error("修改密码异常,请联系管理员"); + } + + /** + * 头像上传 + */ + @Log(title = "用户头像", businessType = BusinessType.UPDATE) + @PostMapping("/avatar") + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException + { + if (!file.isEmpty()) + { + LoginUser loginUser = getLoginUser(); + String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + // 更新缓存用户头像 + loginUser.getUser().setAvatar(avatar); + tokenService.setLoginUser(loginUser); + return ajax; + } + } + return AjaxResult.error("上传图片异常,请联系管理员"); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysRegisterController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysRegisterController.java new file mode 100644 index 0000000..0c376c4 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysRegisterController.java @@ -0,0 +1,38 @@ +package com.ktg.web.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.model.RegisterBody; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.web.service.SysRegisterService; +import com.ktg.system.service.ISysConfigService; + +/** + * 注册验证 + * + * @author ruoyi + */ +@RestController +public class SysRegisterController extends BaseController +{ + @Autowired + private SysRegisterService registerService; + + @Autowired + private ISysConfigService configService; + + @PostMapping("/register") + public AjaxResult register(@RequestBody RegisterBody user) + { + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) + { + return error("当前系统没有开启注册功能!"); + } + String msg = registerService.register(user); + return StringUtils.isEmpty(msg) ? success() : error(msg); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysRoleController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysRoleController.java new file mode 100644 index 0000000..8377fd2 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysRoleController.java @@ -0,0 +1,245 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.framework.web.service.SysPermissionService; +import com.ktg.framework.web.service.TokenService; +import com.ktg.system.domain.SysUserRole; +import com.ktg.system.service.ISysRoleService; +import com.ktg.system.service.ISysUserService; + +/** + * 角色信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/role") +public class SysRoleController extends BaseController +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private TokenService tokenService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private ISysUserService userService; + + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/list") + public TableDataInfo list(SysRole role) + { + startPage(); + List list = roleService.selectRoleList(role); + return getDataTable(list); + } + + @Log(title = "角色管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:role:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysRole role) + { + List list = roleService.selectRoleList(role); + ExcelUtil util = new ExcelUtil(SysRole.class); + util.exportExcel(response, list, "角色数据"); + } + + /** + * 根据角色编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/{roleId}") + public AjaxResult getInfo(@PathVariable Long roleId) + { + roleService.checkRoleDataScope(roleId); + return AjaxResult.success(roleService.selectRoleById(roleId)); + } + + /** + * 新增角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:add')") + @Log(title = "角色管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysRole role) + { + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setCreateBy(getUsername()); + return toAjax(roleService.insertRole(role)); + + } + + /** + * 修改保存角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setUpdateBy(getUsername()); + + if (roleService.updateRole(role) > 0) + { + // 更新缓存用户权限 + LoginUser loginUser = getLoginUser(); + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) + { + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + tokenService.setLoginUser(loginUser); + } + return AjaxResult.success(); + } + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); + } + + /** + * 修改保存数据权限 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/dataScope") + public AjaxResult dataScope(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + return toAjax(roleService.authDataScope(role)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + role.setUpdateBy(getUsername()); + return toAjax(roleService.updateRoleStatus(role)); + } + + /** + * 删除角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:remove')") + @Log(title = "角色管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{roleIds}") + public AjaxResult remove(@PathVariable Long[] roleIds) + { + return toAjax(roleService.deleteRoleByIds(roleIds)); + } + + /** + * 获取角色选择框列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + return AjaxResult.success(roleService.selectRoleAll()); + } + + /** + * 查询已分配用户角色列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/allocatedList") + public TableDataInfo allocatedList(SysUser user) + { + startPage(); + List list = userService.selectAllocatedList(user); + return getDataTable(list); + } + + /** + * 查询未分配用户角色列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/unallocatedList") + public TableDataInfo unallocatedList(SysUser user) + { + startPage(); + List list = userService.selectUnallocatedList(user); + return getDataTable(list); + } + + /** + * 取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancel") + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) + { + return toAjax(roleService.deleteAuthUser(userRole)); + } + + /** + * 批量取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancelAll") + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) + { + return toAjax(roleService.deleteAuthUsers(roleId, userIds)); + } + + /** + * 批量选择用户授权 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/selectAll") + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) + { + roleService.checkRoleDataScope(roleId); + return toAjax(roleService.insertAuthUsers(roleId, userIds)); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/SysUserController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysUserController.java new file mode 100644 index 0000000..20799c1 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/SysUserController.java @@ -0,0 +1,236 @@ +package com.ktg.web.controller.system; + +import java.util.List; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.system.service.ISysPostService; +import com.ktg.system.service.ISysRoleService; +import com.ktg.system.service.ISysUserService; + +/** + * 用户信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/user") +public class SysUserController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysPostService postService; + + /** + * 获取用户列表 + */ + @GetMapping("/list") + public TableDataInfo list(SysUser user) + { + startPage(); + List list = userService.selectUserList(user); + return getDataTable(list); + } + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:user:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysUser user) + { + List list = userService.selectUserList(user); + ExcelUtil util = new ExcelUtil(SysUser.class); + util.exportExcel(response, list, "用户数据"); + } + + @Log(title = "用户管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('system:user:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return AjaxResult.success(message); + } + + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) + { + ExcelUtil util = new ExcelUtil(SysUser.class); + util.importTemplateExcel(response, "用户数据"); + } + + /** + * 根据用户编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping(value = { "/", "/{userId}" }) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) + { + userService.checkUserDataScope(userId); + AjaxResult ajax = AjaxResult.success(); + List roles = roleService.selectRoleAll(); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + ajax.put("posts", postService.selectPostAll()); + if (StringUtils.isNotNull(userId)) + { + SysUser sysUser = userService.selectUserById(userId); + ajax.put(AjaxResult.DATA_TAG, sysUser); + ajax.put("postIds", postService.selectPostListByUserId(userId)); + ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); + } + return ajax; + } + + /** + * 新增用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:add')") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysUser user) + { + if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); + } + else if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setCreateBy(getUsername()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + return toAjax(userService.insertUser(user)); + } + + /** + * 修改用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(getUsername()); + return toAjax(userService.updateUser(user)); + } + + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:remove')") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) + { + if (ArrayUtils.contains(userIds, getUserId())) + { + return error("当前用户不能删除"); + } + return toAjax(userService.deleteUserByIds(userIds)); + } + + /** + * 重置密码 + */ + @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/resetPwd") + public AjaxResult resetPwd(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setUpdateBy(getUsername()); + return toAjax(userService.resetPwd(user)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setUpdateBy(getUsername()); + return toAjax(userService.updateUserStatus(user)); + } + + /** + * 根据用户编号获取授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping("/authRole/{userId}") + public AjaxResult authRole(@PathVariable("userId") Long userId) + { + AjaxResult ajax = AjaxResult.success(); + SysUser user = userService.selectUserById(userId); + List roles = roleService.selectRolesByUserId(userId); + ajax.put("user", user); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + return ajax; + } + + /** + * 用户授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.GRANT) + @PutMapping("/authRole") + public AjaxResult insertAuthRole(Long userId, Long[] roleIds) + { + userService.checkUserDataScope(userId); + userService.insertUserAuth(userId, roleIds); + return success(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/UserController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/UserController.java new file mode 100644 index 0000000..31b373a --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/UserController.java @@ -0,0 +1,103 @@ +package com.ktg.web.controller.system; + + +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.web.service.MobileLoginService; +import com.ktg.framework.web.service.TokenService; +import com.ktg.system.domain.LoginParams; +import com.ktg.system.service.ISysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 登录控制器 + * + * @author SK + * @since 2018/6/13 + */ +@Api("用户信息") +@RestController +@RequestMapping("/mobile/user") +public class UserController { + + @Autowired + private ISysUserService sysUserService; + + + @Autowired + private TokenService tokenService; + + @Autowired + private MobileLoginService loginService; + + /** + * 注册用户 + * + * @return -1 用户名或密码错误 -2 账号冻结 -3 账号锁定 1 成功 -4 验证码错误 + */ + @PostMapping("/registerUser") + @ResponseBody + public AjaxResult registerUser(HttpServletRequest request) { + String phoneNo = request.getParameter("phoneNo"); + String validCode = request.getParameter("validCode"); + // 登录结果 + LoginParams loginParams = new LoginParams(); + loginParams.setPhoneNo(phoneNo); + loginParams.setValidCode(validCode); + return loginService.registerUser(loginParams); + } + + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @ApiOperation("获取用户信息") + @ApiResponses({ + @ApiResponse(code = 200,message = "查询成功",response = AjaxResult.class), + }) + @GetMapping("getUserInfo") + public AjaxResult getUserInfo(HttpServletRequest request) { + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser user = sysUserService.selectUserById(loginUser.getUser().getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + return ajax; + } + + @PostMapping({"saveUserInfo"}) + @ResponseBody + public AjaxResult saveUserInfo(SysUser user, HttpServletRequest request) { + AjaxResult ajax = AjaxResult.success("个人信息修改成功!"); + SysUser currentUser = SecurityUtils.getLoginUser().getUser(); + currentUser = sysUserService.selectUserById(currentUser.getUserId()); + if (StringUtils.isNotBlank(user.getNickName())) { + currentUser.setNickName(user.getNickName()); + } + if (StringUtils.isNotBlank(user.getEmail())) { + currentUser.setEmail(user.getEmail()); + } else { + currentUser.setEmail(""); + } + if (StringUtils.isNotBlank(user.getPhonenumber())) { + currentUser.setPhonenumber(user.getPhonenumber()); + } else { + currentUser.setPhonenumber(""); + } + if (StringUtils.isNotBlank(user.getSex())) { + currentUser.setSex(user.getSex()); + } + sysUserService.updateUser(currentUser); + return ajax; + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/system/UserTaskController.java b/ktg-admin/src/main/java/com/ktg/web/controller/system/UserTaskController.java new file mode 100644 index 0000000..a02ecf6 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/system/UserTaskController.java @@ -0,0 +1,52 @@ +package com.ktg.web.controller.system; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.system.domain.UserTask; +import com.ktg.system.service.IUserTaskService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("用户的代办已办任务") +@RestController +@RequestMapping("/mobile/usertask") +public class UserTaskController extends BaseController { + + @Autowired + private IUserTaskService userTaskService; + + /** + * 查询待处理的任务和单据 + * 1.所有自己起草的,草稿状态的单据(目前阶段只实现此条) + * 2.根据具体的业务审批流程配置,需要自己审批的单据 + */ + @ApiOperation("查询待处理的任务和单据(分页)") + @GetMapping("/listTodo") + public TableDataInfo listTodoList(String userName) + { + startPage(); + List list = userTaskService.listTodoList(userName); + return getDataTable(list); + } + + /** + * 查询已处理的任务和单据 + * 1.所有自己起草,非草稿状态的单据(目前阶段只实现此条) + * 2.根据具体的业务审批流程配置,流经自己的单据 + */ + @ApiOperation("查询已处理的任务和单据(分页)") + @GetMapping("/listFinished") + public TableDataInfo listFinishedList(String userName) + { + startPage(); + List list = userTaskService.listFinishedList(userName); + return getDataTable(list); + } + +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/tool/SwaggerController.java b/ktg-admin/src/main/java/com/ktg/web/controller/tool/SwaggerController.java new file mode 100644 index 0000000..bcc4cbf --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/tool/SwaggerController.java @@ -0,0 +1,25 @@ +package com.ktg.web.controller.tool; + +import com.ktg.common.core.controller.BaseController; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + + +/** + * swagger 接口 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/tool/swagger") +public class SwaggerController extends BaseController +{ + @PreAuthorize("@ss.hasPermi('tool:swagger:view')") + @GetMapping() + public String index() + { + return redirect("/swagger-ui.html"); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/controller/tool/TestController.java b/ktg-admin/src/main/java/com/ktg/web/controller/tool/TestController.java new file mode 100644 index 0000000..6711ac2 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/controller/tool/TestController.java @@ -0,0 +1,181 @@ +package com.ktg.web.controller.tool; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; + +/** + * swagger 用户测试方法 + * + * @author ruoyi + */ +@Api("用户信息管理") +@RestController +@RequestMapping("/test/user") +public class TestController extends BaseController +{ + private final static Map users = new LinkedHashMap(); + { + users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); + users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); + } + + @ApiOperation("获取用户列表") + @GetMapping("/list") + public AjaxResult userList() + { + List userList = new ArrayList(users.values()); + return AjaxResult.success(userList); + } + + @ApiOperation("获取用户详细") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) + @GetMapping("/{userId}") + public AjaxResult getUser(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + return AjaxResult.success(users.get(userId)); + } + else + { + return error("用户不存在"); + } + } + + @ApiOperation("新增用户") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), + @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), + @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), + @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) + }) + @PostMapping("/save") + public AjaxResult save(UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return error("用户ID不能为空"); + } + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + @ApiOperation("更新用户") + @PutMapping("/update") + public AjaxResult update(@RequestBody UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return error("用户ID不能为空"); + } + if (users.isEmpty() || !users.containsKey(user.getUserId())) + { + return error("用户不存在"); + } + users.remove(user.getUserId()); + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + @ApiOperation("删除用户信息") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) + @DeleteMapping("/{userId}") + public AjaxResult delete(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + users.remove(userId); + return success(); + } + else + { + return error("用户不存在"); + } + } +} + +@ApiModel(value = "UserEntity", description = "用户实体") +class UserEntity +{ + @ApiModelProperty("用户ID") + private Integer userId; + + @ApiModelProperty("用户名称") + private String username; + + @ApiModelProperty("用户密码") + private String password; + + @ApiModelProperty("用户手机") + private String mobile; + + public UserEntity() + { + + } + + public UserEntity(Integer userId, String username, String password, String mobile) + { + this.userId = userId; + this.username = username; + this.password = password; + this.mobile = mobile; + } + + public Integer getUserId() + { + return userId; + } + + public void setUserId(Integer userId) + { + this.userId = userId; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getMobile() + { + return mobile; + } + + public void setMobile(String mobile) + { + this.mobile = mobile; + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/core/config/SwaggerConfig.java b/ktg-admin/src/main/java/com/ktg/web/core/config/SwaggerConfig.java new file mode 100644 index 0000000..43cd7a6 --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/core/config/SwaggerConfig.java @@ -0,0 +1,126 @@ +package com.ktg.web.core.config; + +import java.util.ArrayList; +import java.util.List; + +import com.ktg.common.config.RuoYiConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.Contact; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; + +/** + * Swagger2的接口配置 + * + * @author ruoyi + */ +@Configuration +public class SwaggerConfig +{ + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + + /** 是否开启swagger */ + @Value("${swagger.enabled}") + private boolean enabled; + + /** 设置请求的统一前缀 */ + @Value("${swagger.pathMapping}") + private String pathMapping; + + /** + * 创建API + */ + @Bean + public Docket createRestApi() + { + return new Docket(DocumentationType.OAS_30) + // 是否启用Swagger + .enable(enabled) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + // .apis(RequestHandlerSelectors.basePackage("com.ktg.project.tool.swagger")) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build() + /* 设置安全模式,swagger可以设置访问token */ + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()) + .pathMapping(pathMapping); + } + + /** + * 安全模式,这里指定token通过Authorization头请求头传递 + */ + private List securitySchemes() + { + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); + return apiKeyList; + } + + /** + * 安全上下文 + */ + private List securityContexts() + { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) + .build()); + return securityContexts; + } + + /** + * 默认的安全上引用 + */ + private List defaultAuth() + { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; + } + + /** + * 添加摘要信息 + */ + private ApiInfo apiInfo() + { + // 用ApiInfoBuilder进行定制 + return new ApiInfoBuilder() + // 设置标题 + .title("标题:若依管理系统_接口文档") + // 描述 + .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + // 作者信息 + .contact(new Contact(ruoyiConfig.getName(), null, null)) + // 版本 + .version("版本号:" + ruoyiConfig.getVersion()) + .build(); + } +} diff --git a/ktg-admin/src/main/java/com/ktg/web/core/config/UReportConfig.java b/ktg-admin/src/main/java/com/ktg/web/core/config/UReportConfig.java new file mode 100644 index 0000000..a7abcce --- /dev/null +++ b/ktg-admin/src/main/java/com/ktg/web/core/config/UReportConfig.java @@ -0,0 +1,39 @@ +package com.ktg.web.core.config; + +import com.bstek.ureport.definition.datasource.BuildinDatasource; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.Resource; +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.SQLException; + +@EnableAutoConfiguration +@Configuration +public class UReportConfig implements BuildinDatasource { + + @Resource + DataSource dataSource; + + /** + * 返回数据源的名称 + * @return + */ + @Override + public String name() { + return "内置数据源"; + } + + @Override + public Connection getConnection() { + try { + return dataSource.getConnection(); + } catch (SQLException e) { + e.printStackTrace(); + System.out.println("连接数据源失败!"); + } + return null; + } +} + diff --git a/ktg-admin/src/main/resources/META-INF/spring-devtools.properties b/ktg-admin/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 0000000..2b23f85 --- /dev/null +++ b/ktg-admin/src/main/resources/META-INF/spring-devtools.properties @@ -0,0 +1 @@ +restart.include.json=/com.alibaba.fastjson.*.jar \ No newline at end of file diff --git a/ktg-admin/src/main/resources/application.yml b/ktg-admin/src/main/resources/application.yml new file mode 100644 index 0000000..9275608 --- /dev/null +++ b/ktg-admin/src/main/resources/application.yml @@ -0,0 +1,132 @@ +# 项目相关配置 +ktg-mes: + # 名称 + name: ktg + # 版本 + version: 3.8.2 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ktg/uploadPath,Linux配置 /home/ktg/uploadPath) + profile: D:/source_code/j2eeworkspace/ktg-mes/upload + #profile: /home/www/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 开发环境配置 +server: + # 服务器的HTTP端口,默认为8080 + port: 8080 + servlet: + # 应用的访问路径 + context-path: / + tomcat: + # tomcat的URI编码 + uri-encoding: UTF-8 + # 连接数满后的排队数,默认为100 + accept-count: 1000 + threads: + # tomcat最大线程数,默认为200 + max: 800 + # Tomcat启动初始化的线程数,默认值10 + min-spare: 100 + +# 日志配置 +logging: + level: + com.ktg: debug + org.springframework: warn + +# Spring配置 +spring: + # 资源信息 + messages: + # 国际化资源文件路径 + basename: i18n/messages + profiles: + active: druid + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + # redis 配置 + redis: + # 地址 + host: 192.168.176.55 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: 123456 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 30 + +# MyBatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.ktg.**.domain + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 加载全局的配置文件 + configLocation: classpath:mybatis/mybatis-config.xml + +# PageHelper分页插件 +pagehelper: + helperDialect: mysql + supportMethodsArguments: true + params: count=countSql + +# Swagger配置 +swagger: + # 是否开启swagger + enabled: true + # 请求前缀 + #pathMapping: /prod-api + pathMapping: /dev-api + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/* + +#Mino配置 +minio: + url: http://192.168.176.55:9000 + accessKey: mi80JZXet0K0v8sSHzOm + secretKey: 2BaCUhfkFStLHdUfkBRwhshLyKFfbOBG366uakzx + bucketName: ktg-mes diff --git a/ktg-admin/src/main/resources/banner.txt b/ktg-admin/src/main/resources/banner.txt new file mode 100644 index 0000000..f3a6fe0 --- /dev/null +++ b/ktg-admin/src/main/resources/banner.txt @@ -0,0 +1,24 @@ +Application Version: ${ktg.version} +Spring Boot Version: ${spring-boot.version} +//////////////////////////////////////////////////////////////////// +// _ooOoo_ // +// o8888888o // +// 88" . "88 // +// (| ^_^ |) // +// O\ = /O // +// ____/`---'\____ // +// .' \\| |// `. // +// / \\||| : |||// \ // +// / _||||| -:- |||||- \ // +// | | \\\ - /// | | // +// | \_| ''\---/'' | | // +// \ .-\__ `-` ___/-. / // +// ___`. .' /--.--\ `. . ___ // +// ."" '< `.___\_<|>_/___.' >'"". // +// | | : `- \`.;`\ _ /`;.`/ - ` : | | // +// \ \ `-. \_ __\ /__ _/ .-` / / // +// ========`-.____`-.___\_____/___.-`____.-'======== // +// `=---=' // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// 佛祖保佑 永不宕机 永无BUG // +//////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/ktg-admin/src/main/resources/i18n/messages.properties b/ktg-admin/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..71cf52d --- /dev/null +++ b/ktg-admin/src/main/resources/i18n/messages.properties @@ -0,0 +1,37 @@ +#错误消息 +not.null=* 必须填写 +user.jcaptcha.error=验证码错误 +user.jcaptcha.expire=验证码已失效 +user.not.exists=用户不存在/密码错误 +user.password.not.match=用户不存在/密码错误 +user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟 +user.password.delete=对不起,您的账号已被删除 +user.blocked=用户已封禁,请联系管理员 +role.blocked=角色已封禁,请联系管理员 +user.logout.success=退出成功 + +length.not.valid=长度必须在{min}到{max}个字符之间 + +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 +user.password.not.valid=* 5-50个字符 + +user.email.not.valid=邮箱格式错误 +user.mobile.phone.number.not.valid=手机号格式错误 +user.login.success=登录成功 +user.register.success=注册成功 +user.notfound=请重新登录 +user.forcelogout=管理员强制退出,请重新登录 +user.unknown.error=未知错误,请重新登录 + +##文件上传消息 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! +upload.filename.exceed.length=上传的文件名最长{0}个字符 + +##权限 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] diff --git a/ktg-admin/src/main/resources/logback.xml b/ktg-admin/src/main/resources/logback.xml new file mode 100644 index 0000000..fbedcc3 --- /dev/null +++ b/ktg-admin/src/main/resources/logback.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ktg-admin/src/main/resources/mybatis/mybatis-config.xml b/ktg-admin/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..ac47c03 --- /dev/null +++ b/ktg-admin/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/ktg-common/pom.xml b/ktg-common/pom.xml new file mode 100644 index 0000000..68aa372 --- /dev/null +++ b/ktg-common/pom.xml @@ -0,0 +1,162 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-common + + + common通用工具 + + + + + + + org.springframework + spring-context-support + + + + + org.springframework + spring-web + + + + + org.springframework.boot + spring-boot-starter-security + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + org.apache.commons + commons-lang3 + + + + + com.fasterxml.jackson.core + jackson-databind + + + + + com.alibaba + fastjson + + + + + commons-io + commons-io + + + + + commons-fileupload + commons-fileupload + + + + + org.apache.poi + poi-ooxml + + + + + org.yaml + snakeyaml + + + + + io.jsonwebtoken + jjwt + + + + + javax.xml.bind + jaxb-api + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.apache.commons + commons-pool2 + + + + + eu.bitwalker + UserAgentUtils + + + + + javax.servlet + javax.servlet-api + + + + cn.hutool + hutool-all + 5.8.0.M3 + + + + io.minio + minio + 8.2.1 + + + + + net.sf.barcode4j + barcode4j-light + 2.0 + + + + + com.google.zxing + core + 3.3.3 + + + + com.bstek.ureport + ureport2-console + 2.2.9 + + + + + \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/DataScope.java b/ktg-common/src/main/java/com/ktg/common/annotation/DataScope.java new file mode 100644 index 0000000..f2cb0fe --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/DataScope.java @@ -0,0 +1,28 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 数据权限过滤注解 + * + * @author ruoyi + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataScope +{ + /** + * 部门表的别名 + */ + public String deptAlias() default ""; + + /** + * 用户表的别名 + */ + public String userAlias() default ""; +} diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/DataSource.java b/ktg-common/src/main/java/com/ktg/common/annotation/DataSource.java new file mode 100644 index 0000000..a2a5b09 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/DataSource.java @@ -0,0 +1,28 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.ktg.common.enums.DataSourceType; + +/** + * 自定义多数据源切换注解 + * + * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 + * + * @author ruoyi + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface DataSource +{ + /** + * 切换数据源名称 + */ + public DataSourceType value() default DataSourceType.MASTER; +} diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/Excel.java b/ktg-common/src/main/java/com/ktg/common/annotation/Excel.java new file mode 100644 index 0000000..34ebcf9 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/Excel.java @@ -0,0 +1,176 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.math.BigDecimal; +import com.ktg.common.utils.poi.ExcelHandlerAdapter; + +/** + * 自定义导出Excel数据注解 + * + * @author ruoyi + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Excel +{ + /** + * 导出时在excel中排序 + */ + public int sort() default Integer.MAX_VALUE; + + /** + * 导出到Excel中的名字. + */ + public String name() default ""; + + /** + * 日期格式, 如: yyyy-MM-dd + */ + public String dateFormat() default ""; + + /** + * 如果是字典类型,请设置字典的type值 (如: sys_user_sex) + */ + public String dictType() default ""; + + /** + * 读取内容转表达式 (如: 0=男,1=女,2=未知) + */ + public String readConverterExp() default ""; + + /** + * 分隔符,读取字符串组内容 + */ + public String separator() default ","; + + /** + * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) + */ + public int scale() default -1; + + /** + * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN + */ + public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; + + /** + * 导出类型(0数字 1字符串) + */ + public ColumnType cellType() default ColumnType.STRING; + + /** + * 导出时在excel中每个列的高度 单位为字符 + */ + public double height() default 14; + + /** + * 导出时在excel中每个列的宽 单位为字符 + */ + public double width() default 16; + + /** + * 文字后缀,如% 90 变成90% + */ + public String suffix() default ""; + + /** + * 当值为空时,字段的默认值 + */ + public String defaultValue() default ""; + + /** + * 提示信息 + */ + public String prompt() default ""; + + /** + * 设置只能选择不能输入的列内容. + */ + public String[] combo() default {}; + + /** + * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. + */ + public boolean isExport() default true; + + /** + * 另一个类中的属性名称,支持多级获取,以小数点隔开 + */ + public String targetAttr() default ""; + + /** + * 是否自动统计数据,在最后追加一行统计数据总和 + */ + public boolean isStatistics() default false; + + /** + * 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右) + */ + public Align align() default Align.AUTO; + + /** + * 自定义数据处理器 + */ + public Class handler() default ExcelHandlerAdapter.class; + + /** + * 自定义数据处理器参数 + */ + public String[] args() default {}; + + public enum Align + { + AUTO(0), LEFT(1), CENTER(2), RIGHT(3); + private final int value; + + Align(int value) + { + this.value = value; + } + + public int value() + { + return this.value; + } + } + + /** + * 字段类型(0:导出导入;1:仅导出;2:仅导入) + */ + Type type() default Type.ALL; + + public enum Type + { + ALL(0), EXPORT(1), IMPORT(2); + private final int value; + + Type(int value) + { + this.value = value; + } + + public int value() + { + return this.value; + } + } + + public enum ColumnType + { + NUMERIC(0), STRING(1), IMAGE(2); + private final int value; + + ColumnType(int value) + { + this.value = value; + } + + public int value() + { + return this.value; + } + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/Excels.java b/ktg-common/src/main/java/com/ktg/common/annotation/Excels.java new file mode 100644 index 0000000..35375d2 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/Excels.java @@ -0,0 +1,18 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Excel注解集 + * + * @author ruoyi + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Excels +{ + public Excel[] value(); +} diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/Log.java b/ktg-common/src/main/java/com/ktg/common/annotation/Log.java new file mode 100644 index 0000000..4f5a7e9 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/Log.java @@ -0,0 +1,46 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.enums.OperatorType; + +/** + * 自定义操作日志记录注解 + * + * @author ruoyi + * + */ +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Log +{ + /** + * 模块 + */ + public String title() default ""; + + /** + * 功能 + */ + public BusinessType businessType() default BusinessType.OTHER; + + /** + * 操作人类别 + */ + public OperatorType operatorType() default OperatorType.MANAGE; + + /** + * 是否保存请求的参数 + */ + public boolean isSaveRequestData() default true; + + /** + * 是否保存响应的参数 + */ + public boolean isSaveResponseData() default true; +} diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/RateLimiter.java b/ktg-common/src/main/java/com/ktg/common/annotation/RateLimiter.java new file mode 100644 index 0000000..ddff2cf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/RateLimiter.java @@ -0,0 +1,40 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.ktg.common.constant.Constants; +import com.ktg.common.enums.LimitType; + +/** + * 限流注解 + * + * @author ruoyi + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RateLimiter +{ + /** + * 限流key + */ + public String key() default Constants.RATE_LIMIT_KEY; + + /** + * 限流时间,单位秒 + */ + public int time() default 60; + + /** + * 限流次数 + */ + public int count() default 100; + + /** + * 限流类型 + */ + public LimitType limitType() default LimitType.DEFAULT; +} diff --git a/ktg-common/src/main/java/com/ktg/common/annotation/RepeatSubmit.java b/ktg-common/src/main/java/com/ktg/common/annotation/RepeatSubmit.java new file mode 100644 index 0000000..6e65408 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/annotation/RepeatSubmit.java @@ -0,0 +1,31 @@ +package com.ktg.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 自定义注解防止表单重复提交 + * + * @author ruoyi + * + */ +@Inherited +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RepeatSubmit +{ + /** + * 间隔时间(ms),小于此时间视为重复提交 + */ + public int interval() default 5000; + + /** + * 提示消息 + */ + public String message() default "不允许重复提交,请稍候再试"; +} diff --git a/ktg-common/src/main/java/com/ktg/common/config/MinioConfig.java b/ktg-common/src/main/java/com/ktg/common/config/MinioConfig.java new file mode 100644 index 0000000..8bd046b --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/config/MinioConfig.java @@ -0,0 +1,80 @@ +package com.ktg.common.config; + +import io.minio.MinioClient; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Minio 配置信息 + * + */ +@Configuration +@ConfigurationProperties(prefix = "minio") +public class MinioConfig { + /** + * 服务地址 + */ + private static String url; + + /** + * 用户名 + */ + private static String accessKey; + + /** + * 密码 + */ + private static String secretKey; + + /** + * 存储桶名称 + */ + private static String bucketName; + + public static String getUrl() + { + return url; + } + + public void setUrl(String url) + { + MinioConfig.url = url; + } + + public static String getAccessKey() + { + return accessKey; + } + + public void setAccessKey(String accessKey) + { + MinioConfig.accessKey = accessKey; + } + + public static String getSecretKey() + { + return secretKey; + } + + public void setSecretKey(String secretKey) + { + MinioConfig.secretKey = secretKey; + } + + public static String getBucketName() + { + return bucketName; + } + + public void setBucketName(String bucketName) + { + MinioConfig.bucketName = bucketName; + } + + @Bean + public MinioClient getMinioClient() + { + return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/config/RuoYiConfig.java b/ktg-common/src/main/java/com/ktg/common/config/RuoYiConfig.java new file mode 100644 index 0000000..4d5af15 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/config/RuoYiConfig.java @@ -0,0 +1,135 @@ +package com.ktg.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 读取项目相关配置 + * + * @author ruoyi + */ +@Component +@ConfigurationProperties(prefix = "ktg-mes") +public class RuoYiConfig +{ + /** 项目名称 */ + private String name; + + /** 版本 */ + private String version; + + /** 版权年份 */ + private String copyrightYear; + + /** 实例演示开关 */ + private boolean demoEnabled; + + /** 上传路径 */ + private static String profile; + + /** 获取地址开关 */ + private static boolean addressEnabled; + + /** 验证码类型 */ + private static String captchaType; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getCopyrightYear() + { + return copyrightYear; + } + + public void setCopyrightYear(String copyrightYear) + { + this.copyrightYear = copyrightYear; + } + + public boolean isDemoEnabled() + { + return demoEnabled; + } + + public void setDemoEnabled(boolean demoEnabled) + { + this.demoEnabled = demoEnabled; + } + + public static String getProfile() + { + return profile; + } + + public void setProfile(String profile) + { + RuoYiConfig.profile = profile; + } + + public static boolean isAddressEnabled() + { + return addressEnabled; + } + + public void setAddressEnabled(boolean addressEnabled) + { + RuoYiConfig.addressEnabled = addressEnabled; + } + + public static String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + RuoYiConfig.captchaType = captchaType; + } + + /** + * 获取导入上传路径 + */ + public static String getImportPath() + { + return getProfile() + "/import"; + } + + /** + * 获取头像上传路径 + */ + public static String getAvatarPath() + { + return getProfile() + "/avatar"; + } + + /** + * 获取下载路径 + */ + public static String getDownloadPath() + { + return getProfile() + "/download/"; + } + + /** + * 获取上传路径 + */ + public static String getUploadPath() + { + return getProfile() + "/upload"; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/constant/Constants.java b/ktg-common/src/main/java/com/ktg/common/constant/Constants.java new file mode 100644 index 0000000..1c23189 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/constant/Constants.java @@ -0,0 +1,167 @@ +package com.ktg.common.constant; + +import io.jsonwebtoken.Claims; + +/** + * 通用常量信息 + * + * @author ruoyi + */ +public class Constants +{ + /** + * UTF-8 字符集 + */ + public static final String UTF8 = "UTF-8"; + + /** + * GBK 字符集 + */ + public static final String GBK = "GBK"; + + /** + * http请求 + */ + public static final String HTTP = "http://"; + + /** + * https请求 + */ + public static final String HTTPS = "https://"; + + /** + * 通用成功标识 + */ + public static final String SUCCESS = "0"; + + /** + * 通用失败标识 + */ + public static final String FAIL = "1"; + + /** + * 登录成功 + */ + public static final String LOGIN_SUCCESS = "Success"; + + /** + * 注销 + */ + public static final String LOGOUT = "Logout"; + + /** + * 注册 + */ + public static final String REGISTER = "Register"; + + /** + * 登录失败 + */ + public static final String LOGIN_FAIL = "Error"; + + /** + * 验证码 redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 登录用户 redis key + */ + public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 防重提交 redis key + */ + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; + + /** + * 限流 redis key + */ + public static final String RATE_LIMIT_KEY = "rate_limit:"; + + /** + * 验证码有效期(分钟) + */ + public static final Integer CAPTCHA_EXPIRATION = 2; + + /** + * 令牌 + */ + public static final String TOKEN = "token"; + + /** + * 令牌前缀 + */ + public static final String TOKEN_PREFIX = "Bearer "; + + /** + * 令牌前缀 + */ + public static final String LOGIN_USER_KEY = "login_user_key"; + + /** + * 用户ID + */ + public static final String JWT_USERID = "userid"; + + /** + * 用户名称 + */ + public static final String JWT_USERNAME = Claims.SUBJECT; + + /** + * 用户头像 + */ + public static final String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + public static final String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + public static final String JWT_AUTHORITIES = "authorities"; + + /** + * 参数管理 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 字典管理 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 资源映射路径 前缀 + */ + public static final String RESOURCE_PREFIX = "/profile"; + + /** + * RMI 远程方法调用 + */ + public static final String LOOKUP_RMI = "rmi:"; + + /** + * LDAP 远程方法调用 + */ + public static final String LOOKUP_LDAP = "ldap:"; + + /** + * LDAPS 远程方法调用 + */ + public static final String LOOKUP_LDAPS = "ldaps:"; + + /** + * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) + */ + public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; + + /** + * 定时任务违规的字符 + */ + public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", + "org.springframework", "org.apache", "com.ruoyi.common.utils.file" }; +} diff --git a/ktg-common/src/main/java/com/ktg/common/constant/GenConstants.java b/ktg-common/src/main/java/com/ktg/common/constant/GenConstants.java new file mode 100644 index 0000000..7f43b5f --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/constant/GenConstants.java @@ -0,0 +1,117 @@ +package com.ktg.common.constant; + +/** + * 代码生成通用常量 + * + * @author ruoyi + */ +public class GenConstants +{ + /** 单表(增删改查) */ + public static final String TPL_CRUD = "crud"; + + /** 树表(增删改查) */ + public static final String TPL_TREE = "tree"; + + /** 主子表(增删改查) */ + public static final String TPL_SUB = "sub"; + + /** 树编码字段 */ + public static final String TREE_CODE = "treeCode"; + + /** 树父编码字段 */ + public static final String TREE_PARENT_CODE = "treeParentCode"; + + /** 树名称字段 */ + public static final String TREE_NAME = "treeName"; + + /** 上级菜单ID字段 */ + public static final String PARENT_MENU_ID = "parentMenuId"; + + /** 上级菜单名称字段 */ + public static final String PARENT_MENU_NAME = "parentMenuName"; + + /** 数据库字符串类型 */ + public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; + + /** 数据库文本类型 */ + public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; + + /** 数据库时间类型 */ + public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; + + /** 数据库数字类型 */ + public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", + "bit", "bigint", "float", "double", "decimal" }; + + /** 页面不需要编辑字段 */ + public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; + + /** 页面不需要显示的列表字段 */ + public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", + "update_time" }; + + /** 页面不需要查询字段 */ + public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", + "update_time", "remark" }; + + /** Entity基类字段 */ + public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; + + /** Tree基类字段 */ + public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; + + /** 文本框 */ + public static final String HTML_INPUT = "input"; + + /** 文本域 */ + public static final String HTML_TEXTAREA = "textarea"; + + /** 下拉框 */ + public static final String HTML_SELECT = "select"; + + /** 单选框 */ + public static final String HTML_RADIO = "radio"; + + /** 复选框 */ + public static final String HTML_CHECKBOX = "checkbox"; + + /** 日期控件 */ + public static final String HTML_DATETIME = "datetime"; + + /** 图片上传控件 */ + public static final String HTML_IMAGE_UPLOAD = "imageUpload"; + + /** 文件上传控件 */ + public static final String HTML_FILE_UPLOAD = "fileUpload"; + + /** 富文本控件 */ + public static final String HTML_EDITOR = "editor"; + + /** 字符串类型 */ + public static final String TYPE_STRING = "String"; + + /** 整型 */ + public static final String TYPE_INTEGER = "Integer"; + + /** 长整型 */ + public static final String TYPE_LONG = "Long"; + + /** 浮点型 */ + public static final String TYPE_DOUBLE = "Double"; + + /** 高精度计算类型 */ + public static final String TYPE_BIGDECIMAL = "BigDecimal"; + + /** 时间类型 */ + public static final String TYPE_DATE = "Date"; + + /** 模糊查询 */ + public static final String QUERY_LIKE = "LIKE"; + + /** 相等查询 */ + public static final String QUERY_EQ = "EQ"; + + /** 需要 */ + public static final String REQUIRE = "1"; +} diff --git a/ktg-common/src/main/java/com/ktg/common/constant/HttpStatus.java b/ktg-common/src/main/java/com/ktg/common/constant/HttpStatus.java new file mode 100644 index 0000000..db2d110 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/constant/HttpStatus.java @@ -0,0 +1,89 @@ +package com.ktg.common.constant; + +/** + * 返回状态码 + * + * @author ruoyi + */ +public class HttpStatus +{ + /** + * 操作成功 + */ + public static final int SUCCESS = 200; + + /** + * 对象创建成功 + */ + public static final int CREATED = 201; + + /** + * 请求已经被接受 + */ + public static final int ACCEPTED = 202; + + /** + * 操作已经执行成功,但是没有返回数据 + */ + public static final int NO_CONTENT = 204; + + /** + * 资源已被移除 + */ + public static final int MOVED_PERM = 301; + + /** + * 重定向 + */ + public static final int SEE_OTHER = 303; + + /** + * 资源没有被修改 + */ + public static final int NOT_MODIFIED = 304; + + /** + * 参数列表错误(缺少,格式不匹配) + */ + public static final int BAD_REQUEST = 400; + + /** + * 未授权 + */ + public static final int UNAUTHORIZED = 401; + + /** + * 访问受限,授权过期 + */ + public static final int FORBIDDEN = 403; + + /** + * 资源,服务未找到 + */ + public static final int NOT_FOUND = 404; + + /** + * 不允许的http方法 + */ + public static final int BAD_METHOD = 405; + + /** + * 资源冲突,或者资源被锁 + */ + public static final int CONFLICT = 409; + + /** + * 不支持的数据,媒体类型 + */ + public static final int UNSUPPORTED_TYPE = 415; + + /** + * 系统内部错误 + */ + public static final int ERROR = 500; + + /** + * 接口未实现 + */ + public static final int NOT_IMPLEMENTED = 501; +} diff --git a/ktg-common/src/main/java/com/ktg/common/constant/ScheduleConstants.java b/ktg-common/src/main/java/com/ktg/common/constant/ScheduleConstants.java new file mode 100644 index 0000000..6d16219 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/constant/ScheduleConstants.java @@ -0,0 +1,50 @@ +package com.ktg.common.constant; + +/** + * 任务调度通用常量 + * + * @author ruoyi + */ +public class ScheduleConstants +{ + public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; + + /** 执行目标key */ + public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; + + /** 默认 */ + public static final String MISFIRE_DEFAULT = "0"; + + /** 立即触发执行 */ + public static final String MISFIRE_IGNORE_MISFIRES = "1"; + + /** 触发一次执行 */ + public static final String MISFIRE_FIRE_AND_PROCEED = "2"; + + /** 不触发立即执行 */ + public static final String MISFIRE_DO_NOTHING = "3"; + + public enum Status + { + /** + * 正常 + */ + NORMAL("0"), + /** + * 暂停 + */ + PAUSE("1"); + + private String value; + + private Status(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java b/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java new file mode 100644 index 0000000..436b411 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java @@ -0,0 +1,253 @@ +package com.ktg.common.constant; + +import org.omg.CORBA.PUBLIC_MEMBER; + +/** + * 用户常量信息 + * + * @author ruoyi + */ +public class UserConstants +{ + /** + * 平台内系统用户的唯一标志 + */ + public static final String SYS_USER = "SYS_USER"; + + /** 正常状态 */ + public static final String NORMAL = "0"; + + /** 异常状态 */ + public static final String EXCEPTION = "1"; + + /** 用户封禁状态 */ + public static final String USER_DISABLE = "1"; + + /** 角色封禁状态 */ + public static final String ROLE_DISABLE = "1"; + + /** 部门正常状态 */ + public static final String DEPT_NORMAL = "0"; + + /** 部门停用状态 */ + public static final String DEPT_DISABLE = "1"; + + /** 字典正常状态 */ + public static final String DICT_NORMAL = "0"; + + /** 是否为系统默认(是) */ + public static final String YES = "Y"; + + public static final String NO = "N"; + + /** 是否菜单外链(是) */ + public static final String YES_FRAME = "0"; + + /** 是否菜单外链(否) */ + public static final String NO_FRAME = "1"; + + /** 菜单类型(目录) */ + public static final String TYPE_DIR = "M"; + + /** 菜单类型(菜单) */ + public static final String TYPE_MENU = "C"; + + /** 菜单类型(按钮) */ + public static final String TYPE_BUTTON = "F"; + + /** Layout组件标识 */ + public final static String LAYOUT = "Layout"; + + /** ParentView组件标识 */ + public final static String PARENT_VIEW = "ParentView"; + + /** InnerLink组件标识 */ + public final static String INNER_LINK = "InnerLink"; + + public final static String WEBSOCKET_HEARTBEAT = "-heartbeat-"; + + /** 校验返回结果码 */ + public final static String UNIQUE = "0"; + public final static String NOT_UNIQUE = "1"; + + /** + * 用户名长度限制 + */ + public static final int USERNAME_MIN_LENGTH = 2; + public static final int USERNAME_MAX_LENGTH = 20; + + /** + * 密码长度限制 + */ + public static final int PASSWORD_MIN_LENGTH = 5; + public static final int PASSWORD_MAX_LENGTH = 20; + + /** + * 各种业务单据的内定自动编码规则标识 + */ + public static final String VENDOR_CODE = "VENDOR_CODE"; + public static final String CLIENT_CODE = "CLIENT_CODE"; + public static final String ITEM_TYPE_CODE ="ITEM_TYPE_CODE"; + public static final String ITEM_CODE ="ITEM_CODE"; + public static final String MACHINERY_TYPE_CODE="MACHINERY_TYPE_CODE"; + public static final String TASK_CODE="TASK_CODE"; + public static final String DEFECT_CODE = "DEFECT_CODE"; + public static final String SN_CODE = "SN_CODE"; + public static final String TRANS_ORDER_CODE ="TRANS_ORDER_CODE"; + public static final String ITEMRECPT_CODE ="ITEMRECPT_CODE"; //物料采购入库 + public static final String WM_RTVENDOR_CODE ="WM_RTVENDOR_CODE";//退回供应商 + public static final String ISSUE_CODE ="ISSUE_CODE"; //生产领料 + public static final String RTISSUE_CODE ="RTISSUE_CODE"; //生产退料 + public static final String PRODUCTRECPT_CODE ="PRODUCTRECPT_CODE"; //产品入库 + public static final String PRODUCTSALSE_CODE ="PRODUCTSALSE_CODE"; //销售出库 + public static final String RTSALSE_CODE ="RTSALSE_CODE"; //销售退货 + public static final String TRANSFER_CODE ="TRANSFER_CODE"; //移库 + public static final String STOCKTAKING_CODE ="STOCKTAKING_CODE"; //盘库单 + public static final String FEEDBACK_CODE ="FEEDBACK_CODE"; //报工单 + + /** + * 单据的状态类型 + */ + public static final String ORDER_STATUS_PREPARE="PREPARE"; + public static final String ORDER_STATUS_CONFIRMED="CONFIRMED"; + public static final String ORDER_STATUS_APPROVING="APPROVING"; + public static final String ORDER_STATUS_APPROVED="APPROVED"; + public static final String ORDER_STATUS_FINISHED="FINISHED"; + + /** + * 维护类型 + */ + public static final String MAINTEN_TYPE_REGULAR="REGULAR"; + public static final String MAINTEN_TYPE_USAGE="USAGE"; + + /** + * 甘特图中的TASK类型 + */ + public static final String GANTT_TASK_TYPE_TASK="task"; + public static final String GANTT_TASK_TYPE_PROJECT="project"; + + + /** + * 报表相关 + */ + public static final String REPORT_PRINT_TYPE ="print"; + public static final String REPORT_PDF_TYPE ="pdf"; + public static final String REPORT_EXCEL_TYPE ="excel"; + public static final String REPORT_WORD_TYPE ="word"; + public static final String REPORT_JASPER_PATH="reports/jasper/"; + + + /** + * 库存事务类型 + */ + public static final String TRANSACTION_TYPE_ITEM_RECPT = "ITEM_RECPT"; //原材料接收入库 + public static final String TRANSACTION_TYPE_ITEM_RTV = "ITEM_RTV"; //原材料退回供应商 + + public static final String TRANSACTION_TYPE_ITEM_ISSUE_OUT = "ITEM_ISSUE_OUT"; //生产领用-出库事务 + public static final String TRANSACTION_TYPE_ITEM_ISSUE_IN = "ITEM_ISSUE_IN"; //生产领用-入库事务 + + public static final String TRANSACTION_TYPE_OUTSOURCE_ISSUE_OUT ="OUTSOURCE_ISSUE_OUT"; //外协领用-出库事务 + public static final String TRANSACTION_TYPE_OUTSOURCE_RECPT_IN ="OUTSOURCE_RECPT_IN"; //外协入库-入库事务 + + public static final String TRANSACTION_TYPE_ITEM_RT_ISSUE_OUT = "ITEM_RT_ISSUE_OUT"; //生产退料-出库事务 + public static final String TRANSACTION_TYPE_ITEM_RT_ISSUE_IN = "ITEM_RT_ISSUE_IN"; //生产退料-入库事务 + + public static final String TRANSACTION_TYPE_WAREHOUSE_TRANS_OUT = "TRANS_OUT"; //移库,移出 + public static final String TRANSACTION_TYPE_WAREHOUSE_TRANS_IN = "TRANS_IN"; //移库,移入 + + public static final String TRANSACTION_TYPE_ITEM_CONSUME = "ITEM_CONSUME";//物料生产消耗 + public static final String TRANSACTION_TYPE_PRODUCT_PRODUCE = "PRODUCT_PRODUCE";//产品生产 + + public static final String TRANSACTION_TYPE_PRODUCT_RECPT_OUT = "PRODUCT_RECPT_OUT"; //产品入库-出库事务 + public static final String TRANSACTION_TYPE_PRODUCT_RECPT_IN = "PRODUCT_RECPT_IN"; //产品入库-入库事务 + + public static final String TRANSACTION_TYPE_PRODUCT_ISSUE = "PRODUCT_SALSE"; //销售出库 + public static final String TRANSACTION_TYPE_PRODUCT_RS = "PRODUCT_RT"; //销售退货 + + + /** + * 轮班方式 + */ + public static final String CAL_SHIFT_TYPE_SINGLE="SINGLE"; + public static final String CAL_SHIFT_TYPE_TWO="SHIFT_TWO"; + public static final String CAL_SHIFT_TYPE_THREE="SHIFT_THREE"; + public static final String CAL_SHIFT_NAME_DAY="白班"; + public static final String CAL_SHIFT_NAME_NIGHT="夜班"; + public static final String CAL_SHIFT_NAME_MID="中班"; + public static final String CAL_SHIFT_METHOD_QUARTER="QUARTER"; + public static final String CAL_SHIFT_METHOD_MONTH="MONTH"; + public static final String CAL_SHIFT_METHOD_WEEK="WEEK"; + public static final String CAL_SHIFT_METHOD_DAY="DAY"; + + /** + * 排班日历的查询方式 + */ + public static final String CAL_QUERY_BY_TYPE="TYPE"; + public static final String CAL_QUERY_BY_TEAM="TEAM"; + public static final String CAL_QUERY_BY_USER="USER"; + + /** + * 生产投料单据的类型 + */ + public static final String TASK_ISSUE_DOC_TYPE_ISSUE="ISSUE"; //领料单 + public static final String TASK_ISSUE_DOC_TYPE_TRANS="TRANS"; //流转单 + + /** + * 检测单类型,这里的类型是大类 + * 首检、末检等等是过程检验中的子分类 + */ + public static final String QC_TYPE_IQC = "IQC"; //来料检验单 + public static final String QC_TYPE_IPQC = "IPQC"; //过程检验单 + public static final String QC_TYPE_OQC = "OQC"; //出货检验 + + /** + * 默认线边库对应的仓库、库区、库位编码 + */ + public static final String VIRTUAL_WH ="XBK_VIRTUAL"; + public static final String VIRTUAL_WS ="XBKKQ_VIRTUAL"; + public static final String VIRTUAL_WA ="XBKKW_VIRTUAL"; + + /** + * 条码格式 + */ + public static final String QR_CODE = "QR_CODE"; + public static final String EAN_CODE = "EAN_CODE"; + public static final String UPC_CODE = "UPC_CODE"; + public static final String CODE39_CODE = "CODE39_CODE"; + + /** + * 条码类型 + */ + public static final String BARCODE_TYPE_ITEM = "ITEM"; //物料 + public static final String BARCODE_TYPE_PACKAGE = "PACKAGE"; //装箱单 + public static final String BARCODE_TYPE_STOCK = "STOCK"; //库存 + public static final String BARCODE_TYPE_MACHINERY = "MACHINERY"; //设备 + public static final String BARCODE_TYPE_WORKSTATION = "WORKSTATION"; //工作站 + public static final String BARCODE_TYPE_WAREHOUSE = "WAREHOUSE"; //仓库 + public static final String BARCODE_TYPE_STORAGELOCATION = "LOCATION"; //库区 + public static final String BARCODE_TYPE_STORAGEAREA = "AREA"; //库位 + public static final String BARCODE_TYPE_TRANSORDER = "TRANSORDER"; //流转单 + public static final String BARCODE_TYPE_CLIENT = "CLIENT"; //客户 + public static final String BARCODE_TYPE_VENDOR = "VENDOR"; //供应商 + public static final String BARCODE_TYPE_SN = "SN"; + + /** + * 消息状态 + */ + public static final String MESSAGE_STATUS_UNREAD = "UNREAD"; //未读 + public static final String MESSAGE_STATUS_READ = "READ";//已读 + public static final String MESSAGE_STATUS_PROCEED = "PROCEED";//已处理 + + /** + * 库存盘点方式 + */ + public static final String WM_STOCK_TAKING_TYPE_BLIND = "BLIND"; //盲盘 + public static final String WM_STOCK_TAKING_TYPE_OPEN = "OPEN"; //明盘 + + /** + * 库存盘点结果 + */ + public static final String WM_STOCK_TAKING_STATUS_LOSS = "LOSS";// 盘亏 + public static final String WM_STOCK_TAKING_STATUS_PROFIT = "PROFIT"; //盘盈 + public static final String WM_STOCK_TAKING_STATUS_NORMAL = "NORMAL"; //正常 +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/controller/BaseController.java b/ktg-common/src/main/java/com/ktg/common/core/controller/BaseController.java new file mode 100644 index 0000000..0da9dcf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/controller/BaseController.java @@ -0,0 +1,186 @@ +package com.ktg.common.core.controller; + +import java.beans.PropertyEditorSupport; +import java.util.Date; +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ktg.common.constant.HttpStatus; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.core.page.PageDomain; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.core.page.TableSupport; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.PageUtils; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.sql.SqlUtil; + +/** + * web层通用数据处理 + * + * @author ruoyi + */ +public class BaseController +{ + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 将前台传递过来的日期格式的字符串,自动转化为Date类型 + */ + @InitBinder + public void initBinder(WebDataBinder binder) + { + // Date 类型转换 + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() + { + @Override + public void setAsText(String text) + { + setValue(DateUtils.parseDate(text)); + } + }); + } + + /** + * 设置请求分页数据 + */ + protected void startPage() + { + PageUtils.startPage(); + } + + /** + * 设置请求排序数据 + */ + protected void startOrderBy() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) + { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + PageHelper.orderBy(orderBy); + } + } + + /** + * 清理分页的线程变量 + */ + protected void clearPage() + { + PageUtils.clearPage(); + } + + /** + * 响应请求分页数据 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected TableDataInfo getDataTable(List list) + { + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(list); + rspData.setTotal(new PageInfo(list).getTotal()); + return rspData; + } + + /** + * 返回成功 + */ + public AjaxResult success() + { + return AjaxResult.success(); + } + + /** + * 返回失败消息 + */ + public AjaxResult error() + { + return AjaxResult.error(); + } + + /** + * 返回成功消息 + */ + public AjaxResult success(String message) + { + return AjaxResult.success(message); + } + + /** + * 返回失败消息 + */ + public AjaxResult error(String message) + { + return AjaxResult.error(message); + } + + /** + * 响应返回结果 + * + * @param rows 影响行数 + * @return 操作结果 + */ + protected AjaxResult toAjax(int rows) + { + return rows > 0 ? AjaxResult.success() : AjaxResult.error(); + } + + /** + * 响应返回结果 + * + * @param result 结果 + * @return 操作结果 + */ + protected AjaxResult toAjax(boolean result) + { + return result ? success() : error(); + } + + /** + * 页面跳转 + */ + public String redirect(String url) + { + return StringUtils.format("redirect:{}", url); + } + + /** + * 获取用户缓存信息 + */ + public LoginUser getLoginUser() + { + return SecurityUtils.getLoginUser(); + } + + /** + * 获取登录用户id + */ + public Long getUserId() + { + return getLoginUser().getUserId(); + } + + /** + * 获取登录部门id + */ + public Long getDeptId() + { + return getLoginUser().getDeptId(); + } + + /** + * 获取登录用户名 + */ + public String getUsername() + { + return getLoginUser().getUsername(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/AjaxResult.java b/ktg-common/src/main/java/com/ktg/common/core/domain/AjaxResult.java new file mode 100644 index 0000000..0429b20 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/AjaxResult.java @@ -0,0 +1,162 @@ +package com.ktg.common.core.domain; + +import java.util.HashMap; +import com.ktg.common.constant.HttpStatus; +import com.ktg.common.utils.StringUtils; + +/** + * 操作消息提醒 + * + * @author ruoyi + */ +public class AjaxResult extends HashMap +{ + private static final long serialVersionUID = 1L; + + /** 状态码 */ + public static final String CODE_TAG = "code"; + + /** 返回内容 */ + public static final String MSG_TAG = "msg"; + + /** 数据对象 */ + public static final String DATA_TAG = "data"; + + /** + * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 + */ + public AjaxResult() + { + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 数据对象 + */ + public AjaxResult(int code, String msg, Object data) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + if (StringUtils.isNotNull(data)) + { + super.put(DATA_TAG, data); + } + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() + { + return AjaxResult.success("操作成功"); + } + + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(Object data) + { + return AjaxResult.success("操作成功", data); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) + { + return AjaxResult.success(msg, null); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, Object data) + { + return new AjaxResult(HttpStatus.SUCCESS, msg, data); + } + + /** + * 返回错误消息 + * + * @return + */ + public static AjaxResult error() + { + return AjaxResult.error("操作失败"); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(String msg) + { + return AjaxResult.error(msg, null); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult error(String msg, Object data) + { + return new AjaxResult(HttpStatus.ERROR, msg, data); + } + + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(int code, String msg) + { + return new AjaxResult(code, msg, null); + } + + /** + * 方便链式调用 + * + * @param key 键 + * @param value 值 + * @return 数据对象 + */ + @Override + public AjaxResult put(String key, Object value) + { + super.put(key, value); + return this; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/BaseEntity.java b/ktg-common/src/main/java/com/ktg/common/core/domain/BaseEntity.java new file mode 100644 index 0000000..0184eea --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/BaseEntity.java @@ -0,0 +1,114 @@ +package com.ktg.common.core.domain; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * Entity基类 + * + * @author ruoyi + */ +public class BaseEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 搜索值 */ + private String searchValue; + + /** 创建者 */ + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** 更新者 */ + private String updateBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** 备注 */ + private String remark; + + /** 请求参数 */ + private Map params; + + public String getSearchValue() + { + return searchValue; + } + + public void setSearchValue(String searchValue) + { + this.searchValue = searchValue; + } + + public String getCreateBy() + { + return createBy; + } + + public void setCreateBy(String createBy) + { + this.createBy = createBy; + } + + public Date getCreateTime() + { + return createTime; + } + + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } + + public String getUpdateBy() + { + return updateBy; + } + + public void setUpdateBy(String updateBy) + { + this.updateBy = updateBy; + } + + public Date getUpdateTime() + { + return updateTime; + } + + public void setUpdateTime(Date updateTime) + { + this.updateTime = updateTime; + } + + public String getRemark() + { + return remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } + + public Map getParams() + { + if (params == null) + { + params = new HashMap<>(); + } + return params; + } + + public void setParams(Map params) + { + this.params = params; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/TreeEntity.java b/ktg-common/src/main/java/com/ktg/common/core/domain/TreeEntity.java new file mode 100644 index 0000000..48aaa73 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/TreeEntity.java @@ -0,0 +1,79 @@ +package com.ktg.common.core.domain; + +import java.util.ArrayList; +import java.util.List; + +/** + * Tree基类 + * + * @author ruoyi + */ +public class TreeEntity extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 父菜单名称 */ + private String parentName; + + /** 父菜单ID */ + private Long parentId; + + /** 显示顺序 */ + private Integer orderNum; + + /** 祖级列表 */ + private String ancestors; + + /** 子部门 */ + private List children = new ArrayList<>(); + + public String getParentName() + { + return parentName; + } + + public void setParentName(String parentName) + { + this.parentName = parentName; + } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Integer getOrderNum() + { + return orderNum; + } + + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public String getAncestors() + { + return ancestors; + } + + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/TreeSelect.java b/ktg-common/src/main/java/com/ktg/common/core/domain/TreeSelect.java new file mode 100644 index 0000000..9482bea --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/TreeSelect.java @@ -0,0 +1,86 @@ +package com.ktg.common.core.domain; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ktg.common.core.domain.entity.ItemType; +import com.ktg.common.core.domain.entity.SysDept; +import com.ktg.common.core.domain.entity.SysMenu; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class TreeSelect implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 节点ID */ + private Long id; + + /** 节点名称 */ + private String label; + + /** 子节点 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelect() + { + + } + + public TreeSelect(SysDept dept) + { + this.id = dept.getDeptId(); + this.label = dept.getDeptName(); + this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public TreeSelect(ItemType dept) + { + this.id = dept.getItemTypeId(); + this.label = dept.getItemTypeName(); + this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public TreeSelect(SysMenu menu) + { + this.id = menu.getMenuId(); + this.label = menu.getMenuName(); + this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getLabel() + { + return label; + } + + public void setLabel(String label) + { + this.label = label; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/ItemType.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/ItemType.java new file mode 100644 index 0000000..12bf39c --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/ItemType.java @@ -0,0 +1,154 @@ +package com.ktg.common.core.domain.entity; + +import com.ktg.common.core.domain.BaseEntity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +public class ItemType extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long itemTypeId; + private String itemTypeCode; + private String itemTypeName; + private Long parentTypeId; + private String ancestors; + private String itemOrProduct; + private Integer orderNum; + private String enableFlag; + private String attr1; + private String attr2; + private Integer attr3; + private Integer attr4; + private List children = new ArrayList(); + + + public Long getItemTypeId() { + return itemTypeId; + } + + public void setItemTypeId(Long itemTypeId) { + this.itemTypeId = itemTypeId; + } + + @Size(min = 0,max = 64,message = "物料分类编码长度不能超过64个字符") + public String getItemTypeCode() { + return itemTypeCode; + } + + public void setItemTypeCode(String itemTypeCode) { + this.itemTypeCode = itemTypeCode; + } + + @NotBlank(message = "物料分类名称不能为空") + @Size(min = 0,max = 255,message = "物料分类名称长度不能超过255个字符") + public String getItemTypeName() { + return itemTypeName; + } + + public void setItemTypeName(String itemTypeName) { + this.itemTypeName = itemTypeName; + } + + public Long getParentTypeId() { + return parentTypeId; + } + + public void setParentTypeId(Long parentTypeId) { + this.parentTypeId = parentTypeId; + } + + public String getAncestors() { + return ancestors; + } + + public void setAncestors(String ancestors) { + this.ancestors = ancestors; + } + + @NotBlank(message = "请指定是物料分类还是产品分类") + public String getItemOrProduct() { + return itemOrProduct; + } + + public void setItemOrProduct(String itemOrProduct) { + this.itemOrProduct = itemOrProduct; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + @NotBlank(message = "请设置是否启用") + public String getEnableFlag() { + return enableFlag; + } + + public void setEnableFlag(String enableFlag) { + this.enableFlag = enableFlag; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public Integer getAttr3() { + return attr3; + } + + public void setAttr3(Integer attr3) { + this.attr3 = attr3; + } + + public Integer getAttr4() { + return attr4; + } + + public void setAttr4(Integer attr4) { + this.attr4 = attr4; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return "ItemType{" + + "itemTypeId=" + itemTypeId + + ", itemTypeCode='" + itemTypeCode + '\'' + + ", itemTypeName='" + itemTypeName + '\'' + + ", parentTypeId=" + parentTypeId + + ", itemOrProduct='" + itemOrProduct + '\'' + + ", orderNum=" + orderNum + + ", enableFlag='" + enableFlag + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodePart.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodePart.java new file mode 100644 index 0000000..86212c3 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodePart.java @@ -0,0 +1,180 @@ +package com.ktg.common.core.domain.entity; + +import com.ktg.common.core.domain.BaseEntity; + +public class SysAutoCodePart extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long partId; + + private Long ruleId; + + private Integer partIndex; + + private String partType; + + private String partCode; + + private String partName; + + private Integer partLength; + + private String dateFormat; + + private String inputCharacter; + + private String fixCharacter; + + private Integer seriaStartNo; + + private Integer seriaStep; + + private Integer seriaNowNo; + + private String cycleFlag; + + private String cycleMethod; + + + public Long getPartId() { + return partId; + } + + public void setPartId(Long partId) { + this.partId = partId; + } + + public Long getRuleId() { + return ruleId; + } + + public void setRuleId(Long ruleId) { + this.ruleId = ruleId; + } + + public Integer getPartIndex() { + return partIndex; + } + + public void setPartIndex(Integer partIndex) { + this.partIndex = partIndex; + } + + public String getPartType() { + return partType; + } + + public void setPartType(String partType) { + this.partType = partType; + } + + public String getPartCode() { + return partCode; + } + + public void setPartCode(String partCode) { + this.partCode = partCode; + } + + public String getPartName() { + return partName; + } + + public void setPartName(String partName) { + this.partName = partName; + } + + public Integer getPartLength() { + return partLength; + } + + public void setPartLength(Integer partLength) { + this.partLength = partLength; + } + + public String getDateFormat() { + return dateFormat; + } + + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + public String getInputCharacter() { + return inputCharacter; + } + + public void setInputCharacter(String inputCharacter) { + this.inputCharacter = inputCharacter; + } + + public String getFixCharacter() { + return fixCharacter; + } + + public void setFixCharacter(String fixCharacter) { + this.fixCharacter = fixCharacter; + } + + public Integer getSeriaStartNo() { + return seriaStartNo; + } + + public void setSeriaStartNo(Integer seriaStartNo) { + this.seriaStartNo = seriaStartNo; + } + + public Integer getSeriaStep() { + return seriaStep; + } + + public void setSeriaStep(Integer seriaStep) { + this.seriaStep = seriaStep; + } + + public Integer getSeriaNowNo() { + return seriaNowNo; + } + + public void setSeriaNowNo(Integer seriaNowNo) { + this.seriaNowNo = seriaNowNo; + } + + public String getCycleFlag() { + return cycleFlag; + } + + public void setCycleFlag(String cycleFlag) { + this.cycleFlag = cycleFlag; + } + + public String getCycleMethod() { + return cycleMethod; + } + + public void setCycleMethod(String cycleMethod) { + this.cycleMethod = cycleMethod; + } + + @Override + public String toString() { + return "SysAutoCodePart{" + + "partId=" + partId + + ", ruleId=" + ruleId + + ", partIndex=" + partIndex + + ", partType='" + partType + '\'' + + ", partCode='" + partCode + '\'' + + ", partName='" + partName + '\'' + + ", partLength=" + partLength + + ", dateFormat='" + dateFormat + '\'' + + ", inputCharacter='" + inputCharacter + '\'' + + ", fixCharacter='" + fixCharacter + '\'' + + ", seriaStartNo=" + seriaStartNo + + ", seriaStep=" + seriaStep + + ", seriaNowNo=" + seriaNowNo + + ", cycleFlag='" + cycleFlag + '\'' + + ", cycleMethod='" + cycleMethod + '\'' + + '}'; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodeResult.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodeResult.java new file mode 100644 index 0000000..cb7dfd2 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodeResult.java @@ -0,0 +1,91 @@ +package com.ktg.common.core.domain.entity; + +import com.ktg.common.core.domain.BaseEntity; + +public class SysAutoCodeResult extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long codeId; + + private Long ruleId; + + private String genDate; + + private int genIndex; + + private String lastResult; + + private int lastSerialNo; + + private String lastInputChar; + + public Long getCodeId() { + return codeId; + } + + public void setCodeId(Long codeId) { + this.codeId = codeId; + } + + public Long getRuleId() { + return ruleId; + } + + public void setRuleId(Long ruleId) { + this.ruleId = ruleId; + } + + public String getGenDate() { + return genDate; + } + + public void setGenDate(String genDate) { + this.genDate = genDate; + } + + public int getGenIndex() { + return genIndex; + } + + public void setGenIndex(int genIndex) { + this.genIndex = genIndex; + } + + public String getLastResult() { + return lastResult; + } + + public void setLastResult(String lastResult) { + this.lastResult = lastResult; + } + + public int getLastSerialNo() { + return lastSerialNo; + } + + public void setLastSerialNo(int lastSerialNo) { + this.lastSerialNo = lastSerialNo; + } + + public String getLastInputChar() { + return lastInputChar; + } + + public void setLastInputChar(String lastInputChar) { + this.lastInputChar = lastInputChar; + } + + @Override + public String toString() { + return "SysAutoCodeResult{" + + "codeId=" + codeId + + ", ruleId=" + ruleId + + ", genDate='" + genDate + '\'' + + ", genIndex=" + genIndex + + ", lastResult='" + lastResult + '\'' + + ", lastSerialNo=" + lastSerialNo + + ", lastInputChar='" + lastInputChar + '\'' + + '}'; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodeRule.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodeRule.java new file mode 100644 index 0000000..112c3fd --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysAutoCodeRule.java @@ -0,0 +1,114 @@ +package com.ktg.common.core.domain.entity; + +import com.ktg.common.core.domain.BaseEntity; + +public class SysAutoCodeRule extends BaseEntity { + + + private static final long serialVersionUID = 1L; + + private Long ruleId; + + private String ruleCode; + + private String ruleName; + + private String ruleDesc; + + private Integer maxLength; + + private String isPadded; + + private String paddedChar; + + private String paddedMethod; + + private String enableFlag; + + public Long getRuleId() { + return ruleId; + } + + public void setRuleId(Long ruleId) { + this.ruleId = ruleId; + } + + public String getRuleCode() { + return ruleCode; + } + + public void setRuleCode(String ruleCode) { + this.ruleCode = ruleCode; + } + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + + public String getRuleDesc() { + return ruleDesc; + } + + public void setRuleDesc(String ruleDesc) { + this.ruleDesc = ruleDesc; + } + + public Integer getMaxLength() { + return maxLength; + } + + public void setMaxLength(Integer maxLength) { + this.maxLength = maxLength; + } + + public String getIsPadded() { + return isPadded; + } + + public void setIsPadded(String isPadded) { + this.isPadded = isPadded; + } + + public String getPaddedChar() { + return paddedChar; + } + + public void setPaddedChar(String paddedChar) { + this.paddedChar = paddedChar; + } + + public String getPaddedMethod() { + return paddedMethod; + } + + public void setPaddedMethod(String paddedMethod) { + this.paddedMethod = paddedMethod; + } + + public String getEnableFlag() { + return enableFlag; + } + + public void setEnableFlag(String enableFlag) { + this.enableFlag = enableFlag; + } + + @Override + public String toString() { + return "SysAutoCodeRule{" + + "ruleId=" + ruleId + + ", ruleCode='" + ruleCode + '\'' + + ", ruleName='" + ruleName + '\'' + + ", ruleDesc='" + ruleDesc + '\'' + + ", maxLength=" + maxLength + + ", isPadded='" + isPadded + '\'' + + ", paddedChar='" + paddedChar + '\'' + + ", paddedMethod='" + paddedMethod + '\'' + + ", enableFlag='" + enableFlag + '\'' + + '}'; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDept.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDept.java new file mode 100644 index 0000000..dbcfcd9 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDept.java @@ -0,0 +1,202 @@ +package com.ktg.common.core.domain.entity; + +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 部门表 sys_dept + * + * @author ruoyi + */ +public class SysDept extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 部门ID */ + private Long deptId; + + /** 父部门ID */ + private Long parentId; + + /** 祖级列表 */ + private String ancestors; + + /** 部门名称 */ + private String deptName; + + /** 显示顺序 */ + private String orderNum; + + /** 负责人 */ + private String leader; + + /** 联系电话 */ + private String phone; + + /** 邮箱 */ + private String email; + + /** 部门状态:0正常,1停用 */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 父部门名称 */ + private String parentName; + + /** 子部门 */ + private List children = new ArrayList(); + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public String getAncestors() + { + return ancestors; + } + + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + @NotBlank(message = "部门名称不能为空") + @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") + public String getDeptName() + { + return deptName; + } + + public void setDeptName(String deptName) + { + this.deptName = deptName; + } + + @NotBlank(message = "显示顺序不能为空") + public String getOrderNum() + { + return orderNum; + } + + public void setOrderNum(String orderNum) + { + this.orderNum = orderNum; + } + + public String getLeader() + { + return leader; + } + + public void setLeader(String leader) + { + this.leader = leader; + } + + @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") + public String getPhone() + { + return phone; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getParentName() + { + return parentName; + } + + public void setParentName(String parentName) + { + this.parentName = parentName; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("deptId", getDeptId()) + .append("parentId", getParentId()) + .append("ancestors", getAncestors()) + .append("deptName", getDeptName()) + .append("orderNum", getOrderNum()) + .append("leader", getLeader()) + .append("phone", getPhone()) + .append("email", getEmail()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDictData.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDictData.java new file mode 100644 index 0000000..da5312e --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDictData.java @@ -0,0 +1,176 @@ +package com.ktg.common.core.domain.entity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 字典数据表 sys_dict_data + * + * @author ruoyi + */ +public class SysDictData extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 字典编码 */ + @Excel(name = "字典编码", cellType = ColumnType.NUMERIC) + private Long dictCode; + + /** 字典排序 */ + @Excel(name = "字典排序", cellType = ColumnType.NUMERIC) + private Long dictSort; + + /** 字典标签 */ + @Excel(name = "字典标签") + private String dictLabel; + + /** 字典键值 */ + @Excel(name = "字典键值") + private String dictValue; + + /** 字典类型 */ + @Excel(name = "字典类型") + private String dictType; + + /** 样式属性(其他样式扩展) */ + private String cssClass; + + /** 表格字典样式 */ + private String listClass; + + /** 是否默认(Y是 N否) */ + @Excel(name = "是否默认", readConverterExp = "Y=是,N=否") + private String isDefault; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + public Long getDictCode() + { + return dictCode; + } + + public void setDictCode(Long dictCode) + { + this.dictCode = dictCode; + } + + public Long getDictSort() + { + return dictSort; + } + + public void setDictSort(Long dictSort) + { + this.dictSort = dictSort; + } + + @NotBlank(message = "字典标签不能为空") + @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") + public String getDictLabel() + { + return dictLabel; + } + + public void setDictLabel(String dictLabel) + { + this.dictLabel = dictLabel; + } + + @NotBlank(message = "字典键值不能为空") + @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") + public String getDictValue() + { + return dictValue; + } + + public void setDictValue(String dictValue) + { + this.dictValue = dictValue; + } + + @NotBlank(message = "字典类型不能为空") + @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") + public String getDictType() + { + return dictType; + } + + public void setDictType(String dictType) + { + this.dictType = dictType; + } + + @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") + public String getCssClass() + { + return cssClass; + } + + public void setCssClass(String cssClass) + { + this.cssClass = cssClass; + } + + public String getListClass() + { + return listClass; + } + + public void setListClass(String listClass) + { + this.listClass = listClass; + } + + public boolean getDefault() + { + return UserConstants.YES.equals(this.isDefault) ? true : false; + } + + public String getIsDefault() + { + return isDefault; + } + + public void setIsDefault(String isDefault) + { + this.isDefault = isDefault; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("dictCode", getDictCode()) + .append("dictSort", getDictSort()) + .append("dictLabel", getDictLabel()) + .append("dictValue", getDictValue()) + .append("dictType", getDictType()) + .append("cssClass", getCssClass()) + .append("listClass", getListClass()) + .append("isDefault", getIsDefault()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDictType.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDictType.java new file mode 100644 index 0000000..6aede80 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysDictType.java @@ -0,0 +1,94 @@ +package com.ktg.common.core.domain.entity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 字典类型表 sys_dict_type + * + * @author ruoyi + */ +public class SysDictType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 字典主键 */ + @Excel(name = "字典主键", cellType = ColumnType.NUMERIC) + private Long dictId; + + /** 字典名称 */ + @Excel(name = "字典名称") + private String dictName; + + /** 字典类型 */ + @Excel(name = "字典类型") + private String dictType; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + public Long getDictId() + { + return dictId; + } + + public void setDictId(Long dictId) + { + this.dictId = dictId; + } + + @NotBlank(message = "字典名称不能为空") + @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") + public String getDictName() + { + return dictName; + } + + public void setDictName(String dictName) + { + this.dictName = dictName; + } + + @NotBlank(message = "字典类型不能为空") + @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") + public String getDictType() + { + return dictType; + } + + public void setDictType(String dictType) + { + this.dictType = dictType; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("dictId", getDictId()) + .append("dictName", getDictName()) + .append("dictType", getDictType()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysMenu.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysMenu.java new file mode 100644 index 0000000..da135b8 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysMenu.java @@ -0,0 +1,259 @@ +package com.ktg.common.core.domain.entity; + +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 菜单权限表 sys_menu + * + * @author ruoyi + */ +public class SysMenu extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 菜单ID */ + private Long menuId; + + /** 菜单名称 */ + private String menuName; + + /** 父菜单名称 */ + private String parentName; + + /** 父菜单ID */ + private Long parentId; + + /** 显示顺序 */ + private Integer orderNum; + + /** 路由地址 */ + private String path; + + /** 组件路径 */ + private String component; + + /** 路由参数 */ + private String query; + + /** 是否为外链(0是 1否) */ + private String isFrame; + + /** 是否缓存(0缓存 1不缓存) */ + private String isCache; + + /** 类型(M目录 C菜单 F按钮) */ + private String menuType; + + /** 显示状态(0显示 1隐藏) */ + private String visible; + + /** 菜单状态(0显示 1隐藏) */ + private String status; + + /** 权限字符串 */ + private String perms; + + /** 菜单图标 */ + private String icon; + + /** 子菜单 */ + private List children = new ArrayList(); + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @NotBlank(message = "菜单名称不能为空") + @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") + public String getMenuName() + { + return menuName; + } + + public void setMenuName(String menuName) + { + this.menuName = menuName; + } + + public String getParentName() + { + return parentName; + } + + public void setParentName(String parentName) + { + this.parentName = parentName; + } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + @NotNull(message = "显示顺序不能为空") + public Integer getOrderNum() + { + return orderNum; + } + + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") + public String getPath() + { + return path; + } + + public void setPath(String path) + { + this.path = path; + } + + @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") + public String getComponent() + { + return component; + } + + public void setComponent(String component) + { + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public String getIsFrame() + { + return isFrame; + } + + public void setIsFrame(String isFrame) + { + this.isFrame = isFrame; + } + + public String getIsCache() + { + return isCache; + } + + public void setIsCache(String isCache) + { + this.isCache = isCache; + } + + @NotBlank(message = "菜单类型不能为空") + public String getMenuType() + { + return menuType; + } + + public void setMenuType(String menuType) + { + this.menuType = menuType; + } + + public String getVisible() + { + return visible; + } + + public void setVisible(String visible) + { + this.visible = visible; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") + public String getPerms() + { + return perms; + } + + public void setPerms(String perms) + { + this.perms = perms; + } + + public String getIcon() + { + return icon; + } + + public void setIcon(String icon) + { + this.icon = icon; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("menuId", getMenuId()) + .append("menuName", getMenuName()) + .append("parentId", getParentId()) + .append("orderNum", getOrderNum()) + .append("path", getPath()) + .append("component", getComponent()) + .append("isFrame", getIsFrame()) + .append("IsCache", getIsCache()) + .append("menuType", getMenuType()) + .append("visible", getVisible()) + .append("status ", getStatus()) + .append("perms", getPerms()) + .append("icon", getIcon()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysRole.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysRole.java new file mode 100644 index 0000000..c8912ec --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysRole.java @@ -0,0 +1,226 @@ +package com.ktg.common.core.domain.entity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 角色表 sys_role + * + * @author ruoyi + */ +public class SysRole extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 角色ID */ + @Excel(name = "角色序号", cellType = ColumnType.NUMERIC) + private Long roleId; + + /** 角色名称 */ + @Excel(name = "角色名称") + private String roleName; + + /** 角色权限 */ + @Excel(name = "角色权限") + private String roleKey; + + /** 角色排序 */ + @Excel(name = "角色排序") + private String roleSort; + + /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ + @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") + private String dataScope; + + /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ + private boolean menuCheckStrictly; + + /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */ + private boolean deptCheckStrictly; + + /** 角色状态(0正常 1停用) */ + @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 用户是否存在此角色标识 默认不存在 */ + private boolean flag = false; + + /** 菜单组 */ + private Long[] menuIds; + + /** 部门组(数据权限) */ + private Long[] deptIds; + + public SysRole() + { + + } + + public SysRole(Long roleId) + { + this.roleId = roleId; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public boolean isAdmin() + { + return isAdmin(this.roleId); + } + + public static boolean isAdmin(Long roleId) + { + return roleId != null && 1L == roleId; + } + + @NotBlank(message = "角色名称不能为空") + @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") + public String getRoleName() + { + return roleName; + } + + public void setRoleName(String roleName) + { + this.roleName = roleName; + } + + @NotBlank(message = "权限字符不能为空") + @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") + public String getRoleKey() + { + return roleKey; + } + + public void setRoleKey(String roleKey) + { + this.roleKey = roleKey; + } + + @NotBlank(message = "显示顺序不能为空") + public String getRoleSort() + { + return roleSort; + } + + public void setRoleSort(String roleSort) + { + this.roleSort = roleSort; + } + + public String getDataScope() + { + return dataScope; + } + + public void setDataScope(String dataScope) + { + this.dataScope = dataScope; + } + + public boolean isMenuCheckStrictly() + { + return menuCheckStrictly; + } + + public void setMenuCheckStrictly(boolean menuCheckStrictly) + { + this.menuCheckStrictly = menuCheckStrictly; + } + + public boolean isDeptCheckStrictly() + { + return deptCheckStrictly; + } + + public void setDeptCheckStrictly(boolean deptCheckStrictly) + { + this.deptCheckStrictly = deptCheckStrictly; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public boolean isFlag() + { + return flag; + } + + public void setFlag(boolean flag) + { + this.flag = flag; + } + + public Long[] getMenuIds() + { + return menuIds; + } + + public void setMenuIds(Long[] menuIds) + { + this.menuIds = menuIds; + } + + public Long[] getDeptIds() + { + return deptIds; + } + + public void setDeptIds(Long[] deptIds) + { + this.deptIds = deptIds; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("roleName", getRoleName()) + .append("roleKey", getRoleKey()) + .append("roleSort", getRoleSort()) + .append("dataScope", getDataScope()) + .append("menuCheckStrictly", isMenuCheckStrictly()) + .append("deptCheckStrictly", isDeptCheckStrictly()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysUser.java b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysUser.java new file mode 100644 index 0000000..2e77207 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/entity/SysUser.java @@ -0,0 +1,345 @@ +package com.ktg.common.core.domain.entity; + +import java.util.Date; +import java.util.List; +import javax.validation.constraints.*; + +import com.ktg.common.core.domain.entity.SysDept; +import com.ktg.common.core.domain.entity.SysRole; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.annotation.Excel.Type; +import com.ktg.common.annotation.Excels; +import com.ktg.common.core.domain.BaseEntity; +import com.ktg.common.xss.Xss; + +/** + * 用户对象 sys_user + * + * @author ktg + */ +public class SysUser extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 用户ID */ + @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") + private Long userId; + + /** 部门ID */ + @Excel(name = "部门编号", type = Type.IMPORT) + private Long deptId; + + /** 用户账号 */ + @Excel(name = "登录名称") + private String userName; + + /** 用户昵称 */ + @Excel(name = "用户名称") + private String nickName; + + /** 用户邮箱 */ + @Excel(name = "用户邮箱") + private String email; + + /** 手机号码 */ + @Excel(name = "手机号码") + private String phonenumber; + + /** 用户性别 */ + @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") + private String sex; + + /** 用户头像 */ + private String avatar; + + /** 密码 */ + private String password; + + /** 盐加密 */ + private String salt; + + /** 帐号状态(0正常 1停用) */ + @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 最后登录IP */ + @Excel(name = "最后登录IP", type = Type.EXPORT) + private String loginIp; + + /** 最后登录时间 */ + @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) + private Date loginDate; + + /** 部门对象 */ + @Excels({ + @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), + @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) + }) + private SysDept dept; + + /** 角色对象 */ + private List roles; + + /** 角色组 */ + private Long[] roleIds; + + /** 岗位组 */ + private Long[] postIds; + + /** 角色ID */ + private Long roleId; + + public SysUser() + { + + } + + public SysUser(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public boolean isAdmin() + { + return isAdmin(this.userId); + } + + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + @Xss(message = "用户昵称不能包含脚本字符") + @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") + public String getNickName() + { + return nickName; + } + + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + @Xss(message = "用户账号不能包含脚本字符") + @NotBlank(message = "用户账号不能为空") + @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") + public String getPhonenumber() + { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) + { + this.phonenumber = phonenumber; + } + + public String getSex() + { + return sex; + } + + public void setSex(String sex) + { + this.sex = sex; + } + + public String getAvatar() + { + return avatar; + } + + public void setAvatar(String avatar) + { + this.avatar = avatar; + } + + @JsonIgnore + @JsonProperty + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getSalt() + { + return salt; + } + + public void setSalt(String salt) + { + this.salt = salt; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getLoginIp() + { + return loginIp; + } + + public void setLoginIp(String loginIp) + { + this.loginIp = loginIp; + } + + public Date getLoginDate() + { + return loginDate; + } + + public void setLoginDate(Date loginDate) + { + this.loginDate = loginDate; + } + + public SysDept getDept() + { + return dept; + } + + public void setDept(SysDept dept) + { + this.dept = dept; + } + + public List getRoles() + { + return roles; + } + + public void setRoles(List roles) + { + this.roles = roles; + } + + public Long[] getRoleIds() + { + return roleIds; + } + + public void setRoleIds(Long[] roleIds) + { + this.roleIds = roleIds; + } + + public Long[] getPostIds() + { + return postIds; + } + + public void setPostIds(Long[] postIds) + { + this.postIds = postIds; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("deptId", getDeptId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("email", getEmail()) + .append("phonenumber", getPhonenumber()) + .append("sex", getSex()) + .append("avatar", getAvatar()) + .append("password", getPassword()) + .append("salt", getSalt()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("loginIp", getLoginIp()) + .append("loginDate", getLoginDate()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("dept", getDept()) + .toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/model/LoginBody.java b/ktg-common/src/main/java/com/ktg/common/core/domain/model/LoginBody.java new file mode 100644 index 0000000..5576f54 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/model/LoginBody.java @@ -0,0 +1,69 @@ +package com.ktg.common.core.domain.model; + +/** + * 用户登录对象 + * + * @author ruoyi + */ +public class LoginBody +{ + /** + * 用户名 + */ + private String username; + + /** + * 用户密码 + */ + private String password; + + /** + * 验证码 + */ + private String code; + + /** + * 唯一标识 + */ + private String uuid; + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getCode() + { + return code; + } + + public void setCode(String code) + { + this.code = code; + } + + public String getUuid() + { + return uuid; + } + + public void setUuid(String uuid) + { + this.uuid = uuid; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/model/LoginUser.java b/ktg-common/src/main/java/com/ktg/common/core/domain/model/LoginUser.java new file mode 100644 index 0000000..5b2f8d5 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/model/LoginUser.java @@ -0,0 +1,266 @@ +package com.ktg.common.core.domain.model; + +import java.util.Collection; +import java.util.Set; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import com.alibaba.fastjson.annotation.JSONField; +import com.ktg.common.core.domain.entity.SysUser; + +/** + * 登录用户身份权限 + * + * @author ruoyi + */ +public class LoginUser implements UserDetails +{ + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 用户唯一标识 + */ + private String token; + + /** + * 登录时间 + */ + private Long loginTime; + + /** + * 过期时间 + */ + private Long expireTime; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地点 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 用户信息 + */ + private SysUser user; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public String getToken() + { + return token; + } + + public void setToken(String token) + { + this.token = token; + } + + public LoginUser() + { + } + + public LoginUser(SysUser user, Set permissions) + { + this.user = user; + this.permissions = permissions; + } + + public LoginUser(Long userId, Long deptId, SysUser user, Set permissions) + { + this.userId = userId; + this.deptId = deptId; + this.user = user; + this.permissions = permissions; + } + + @JSONField(serialize = false) + @Override + public String getPassword() + { + return user.getPassword(); + } + + @Override + public String getUsername() + { + return user.getUserName(); + } + + /** + * 账户是否未过期,过期无法验证 + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonExpired() + { + return true; + } + + /** + * 指定用户是否解锁,锁定的用户无法进行身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonLocked() + { + return true; + } + + /** + * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isCredentialsNonExpired() + { + return true; + } + + /** + * 是否可用 ,禁用的用户不能身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isEnabled() + { + return true; + } + + public Long getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Long loginTime) + { + this.loginTime = loginTime; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public Long getExpireTime() + { + return expireTime; + } + + public void setExpireTime(Long expireTime) + { + this.expireTime = expireTime; + } + + public Set getPermissions() + { + return permissions; + } + + public void setPermissions(Set permissions) + { + this.permissions = permissions; + } + + public SysUser getUser() + { + return user; + } + + public void setUser(SysUser user) + { + this.user = user; + } + + @Override + public Collection getAuthorities() + { + return null; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/domain/model/RegisterBody.java b/ktg-common/src/main/java/com/ktg/common/core/domain/model/RegisterBody.java new file mode 100644 index 0000000..762d181 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/domain/model/RegisterBody.java @@ -0,0 +1,11 @@ +package com.ktg.common.core.domain.model; + +/** + * 用户注册对象 + * + * @author ruoyi + */ +public class RegisterBody extends LoginBody +{ + +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/page/PageDomain.java b/ktg-common/src/main/java/com/ktg/common/core/page/PageDomain.java new file mode 100644 index 0000000..eb8dbcf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/page/PageDomain.java @@ -0,0 +1,101 @@ +package com.ktg.common.core.page; + +import com.ktg.common.utils.StringUtils; + +/** + * 分页数据 + * + * @author ruoyi + */ +public class PageDomain +{ + /** 当前记录起始索引 */ + private Integer pageNum; + + /** 每页显示记录数 */ + private Integer pageSize; + + /** 排序列 */ + private String orderByColumn; + + /** 排序的方向desc或者asc */ + private String isAsc = "asc"; + + /** 分页参数合理化 */ + private Boolean reasonable = true; + + public String getOrderBy() + { + if (StringUtils.isEmpty(orderByColumn)) + { + return ""; + } + return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; + } + + public Integer getPageNum() + { + return pageNum; + } + + public void setPageNum(Integer pageNum) + { + this.pageNum = pageNum; + } + + public Integer getPageSize() + { + return pageSize; + } + + public void setPageSize(Integer pageSize) + { + this.pageSize = pageSize; + } + + public String getOrderByColumn() + { + return orderByColumn; + } + + public void setOrderByColumn(String orderByColumn) + { + this.orderByColumn = orderByColumn; + } + + public String getIsAsc() + { + return isAsc; + } + + public void setIsAsc(String isAsc) + { + if (StringUtils.isNotEmpty(isAsc)) + { + // 兼容前端排序类型 + if ("ascending".equals(isAsc)) + { + isAsc = "asc"; + } + else if ("descending".equals(isAsc)) + { + isAsc = "desc"; + } + this.isAsc = isAsc; + } + } + + public Boolean getReasonable() + { + if (StringUtils.isNull(reasonable)) + { + return Boolean.TRUE; + } + return reasonable; + } + + public void setReasonable(Boolean reasonable) + { + this.reasonable = reasonable; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/page/TableDataInfo.java b/ktg-common/src/main/java/com/ktg/common/core/page/TableDataInfo.java new file mode 100644 index 0000000..42f9954 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/page/TableDataInfo.java @@ -0,0 +1,85 @@ +package com.ktg.common.core.page; + +import java.io.Serializable; +import java.util.List; + +/** + * 表格分页数据对象 + * + * @author ruoyi + */ +public class TableDataInfo implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 总记录数 */ + private long total; + + /** 列表数据 */ + private List rows; + + /** 消息状态码 */ + private int code; + + /** 消息内容 */ + private String msg; + + /** + * 表格数据对象 + */ + public TableDataInfo() + { + } + + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, int total) + { + this.rows = list; + this.total = total; + } + + public long getTotal() + { + return total; + } + + public void setTotal(long total) + { + this.total = total; + } + + public List getRows() + { + return rows; + } + + public void setRows(List rows) + { + this.rows = rows; + } + + public int getCode() + { + return code; + } + + public void setCode(int code) + { + this.code = code; + } + + public String getMsg() + { + return msg; + } + + public void setMsg(String msg) + { + this.msg = msg; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/page/TableSupport.java b/ktg-common/src/main/java/com/ktg/common/core/page/TableSupport.java new file mode 100644 index 0000000..6a7e882 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/page/TableSupport.java @@ -0,0 +1,55 @@ +package com.ktg.common.core.page; + +import com.ktg.common.utils.ServletUtils; + +/** + * 表格数据处理 + * + * @author ruoyi + */ +public class TableSupport +{ + /** + * 当前记录起始索引 + */ + public static final String PAGE_NUM = "pageNum"; + + /** + * 每页显示记录数 + */ + public static final String PAGE_SIZE = "pageSize"; + + /** + * 排序列 + */ + public static final String ORDER_BY_COLUMN = "orderByColumn"; + + /** + * 排序的方向 "desc" 或者 "asc". + */ + public static final String IS_ASC = "isAsc"; + + /** + * 分页参数合理化 + */ + public static final String REASONABLE = "reasonable"; + + /** + * 封装分页对象 + */ + public static PageDomain getPageDomain() + { + PageDomain pageDomain = new PageDomain(); + pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); + pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); + pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); + pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); + pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); + return pageDomain; + } + + public static PageDomain buildPageRequest() + { + return getPageDomain(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/redis/RedisCache.java b/ktg-common/src/main/java/com/ktg/common/core/redis/RedisCache.java new file mode 100644 index 0000000..5fa0148 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/redis/RedisCache.java @@ -0,0 +1,246 @@ +package com.ktg.common.core.redis; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.BoundSetOperations; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Component; + +/** + * spring redis 工具类 + * + * @author ruoyi + **/ +@SuppressWarnings(value = { "unchecked", "rawtypes" }) +@Component +public class RedisCache +{ + @Autowired + public RedisTemplate redisTemplate; + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + */ + public void setCacheObject(final String key, final T value) + { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + */ + public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout) + { + return expire(key, timeout, TimeUnit.SECONDS); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @param unit 时间单位 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) + { + return redisTemplate.expire(key, timeout, unit); + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(final String key) + { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public boolean deleteObject(final String key) + { + return redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection 多个对象 + * @return + */ + public long deleteObject(final Collection collection) + { + return redisTemplate.delete(collection); + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public long setCacheList(final String key, final List dataList) + { + Long count = redisTemplate.opsForList().rightPushAll(key, dataList); + return count == null ? 0 : count; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(final String key) + { + return redisTemplate.opsForList().range(key, 0, -1); + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(final String key, final Set dataSet) + { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) + { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(final String key) + { + return redisTemplate.opsForSet().members(key); + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + */ + public void setCacheMap(final String key, final Map dataMap) + { + if (dataMap != null) { + redisTemplate.opsForHash().putAll(key, dataMap); + } + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(final String key) + { + return redisTemplate.opsForHash().entries(key); + } + + /** + * 往Hash中存入数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + */ + public void setCacheMapValue(final String key, final String hKey, final T value) + { + redisTemplate.opsForHash().put(key, hKey, value); + } + + /** + * 获取Hash中的数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return Hash中的对象 + */ + public T getCacheMapValue(final String key, final String hKey) + { + HashOperations opsForHash = redisTemplate.opsForHash(); + return opsForHash.get(key, hKey); + } + + /** + * 删除Hash中的数据 + * + * @param key + * @param hKey + */ + public void delCacheMapValue(final String key, final String hKey) + { + HashOperations hashOperations = redisTemplate.opsForHash(); + hashOperations.delete(key, hKey); + } + + /** + * 获取多个Hash中的数据 + * + * @param key Redis键 + * @param hKeys Hash键集合 + * @return Hash对象集合 + */ + public List getMultiCacheMapValue(final String key, final Collection hKeys) + { + return redisTemplate.opsForHash().multiGet(key, hKeys); + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(final String pattern) + { + return redisTemplate.keys(pattern); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/text/CharsetKit.java b/ktg-common/src/main/java/com/ktg/common/core/text/CharsetKit.java new file mode 100644 index 0000000..a8d70b2 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/text/CharsetKit.java @@ -0,0 +1,86 @@ +package com.ktg.common.core.text; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import com.ktg.common.utils.StringUtils; + +/** + * 字符集工具类 + * + * @author ruoyi + */ +public class CharsetKit +{ + /** ISO-8859-1 */ + public static final String ISO_8859_1 = "ISO-8859-1"; + /** UTF-8 */ + public static final String UTF_8 = "UTF-8"; + /** GBK */ + public static final String GBK = "GBK"; + + /** ISO-8859-1 */ + public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); + /** UTF-8 */ + public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); + /** GBK */ + public static final Charset CHARSET_GBK = Charset.forName(GBK); + + /** + * 转换为Charset对象 + * + * @param charset 字符集,为空则返回默认字符集 + * @return Charset + */ + public static Charset charset(String charset) + { + return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, String srcCharset, String destCharset) + { + return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, Charset srcCharset, Charset destCharset) + { + if (null == srcCharset) + { + srcCharset = StandardCharsets.ISO_8859_1; + } + + if (null == destCharset) + { + destCharset = StandardCharsets.UTF_8; + } + + if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) + { + return source; + } + return new String(source.getBytes(srcCharset), destCharset); + } + + /** + * @return 系统字符集编码 + */ + public static String systemCharset() + { + return Charset.defaultCharset().name(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/text/Convert.java b/ktg-common/src/main/java/com/ktg/common/core/text/Convert.java new file mode 100644 index 0000000..1c18b26 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/text/Convert.java @@ -0,0 +1,1005 @@ +package com.ktg.common.core.text; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Set; +import com.ktg.common.utils.StringUtils; +import org.apache.commons.lang3.ArrayUtils; + +/** + * 类型转换器 + * + * @author ruoyi + */ +public class Convert +{ + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof String) + { + return (String) value; + } + return value.toString(); + } + + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) + { + return toStr(value, null); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof Character) + { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) + { + return toChar(value, null); + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Byte) + { + return (Byte) value; + } + if (value instanceof Number) + { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Byte.parseByte(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) + { + return toByte(value, null); + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Short) + { + return (Short) value; + } + if (value instanceof Number) + { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Short.parseShort(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) + { + return toShort(value, null); + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Number) + { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return NumberFormat.getInstance().parse(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) + { + return toNumber(value, null); + } + + /** + * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Integer) + { + return (Integer) value; + } + if (value instanceof Number) + { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Integer.parseInt(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为int
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) + { + return toInt(value, null); + } + + /** + * 转换为Integer数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) + { + return toIntArray(",", str); + } + + /** + * 转换为Long数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String str) + { + return toLongArray(",", str); + } + + /** + * 转换为Integer数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Integer[] {}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为Long数组
+ * + * @param split 分隔符 + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Long[] {}; + } + String[] arr = str.split(split); + final Long[] longs = new Long[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Long v = toLong(arr[i], null); + longs[i] = v; + } + return longs; + } + + /** + * 转换为String数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) + { + return toStrArray(",", str); + } + + /** + * 转换为String数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) + { + return str.split(split); + } + + /** + * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Long toLong(Object value, Long defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Long) + { + return (Long) value; + } + if (value instanceof Number) + { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为long
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) + { + return toLong(value, null); + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Double) + { + return (Double) value; + } + if (value instanceof Number) + { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) + { + return toDouble(value, null); + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Float) + { + return (Float) value; + } + if (value instanceof Number) + { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Float.parseFloat(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) + { + return toFloat(value, null); + } + + /** + * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Boolean) + { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) + { + case "true": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) + { + return toBool(value, null); + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value, E defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) + { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Enum.valueOf(clazz, valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value) + { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigInteger) + { + return (BigInteger) value; + } + if (value instanceof Long) + { + return BigInteger.valueOf((Long) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigInteger(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) + { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigDecimal) + { + return (BigDecimal) value; + } + if (value instanceof Long) + { + return new BigDecimal((Long) value); + } + if (value instanceof Double) + { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) + { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigDecimal(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) + { + return toBigDecimal(value, null); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @return 字符串 + */ + public static String utf8Str(Object obj) + { + return str(obj, CharsetKit.CHARSET_UTF_8); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charsetName 字符集 + * @return 字符串 + */ + public static String str(Object obj, String charsetName) + { + return str(obj, Charset.forName(charsetName)); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(Object obj, Charset charset) + { + if (null == obj) + { + return null; + } + + if (obj instanceof String) + { + return (String) obj; + } + else if (obj instanceof byte[]) + { + return str((byte[]) obj, charset); + } + else if (obj instanceof Byte[]) + { + byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); + return str(bytes, charset); + } + else if (obj instanceof ByteBuffer) + { + return str((ByteBuffer) obj, charset); + } + return obj.toString(); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) + { + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) + { + if (data == null) + { + return null; + } + + if (null == charset) + { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset) + { + if (data == null) + { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset) + { + if (null == charset) + { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + // ----------------------------------------------------------------------- 全角半角转换 + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) + { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set notConvertSet) + { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') + { + c[i] = '\u3000'; + } + else if (c[i] < '\177') + { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) + { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set notConvertSet) + { + char c[] = text.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') + { + c[i] = ' '; + } + else if (c[i] > '\uFF00' && c[i] < '\uFF5F') + { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) + { + String[] fraction = { "角", "分" }; + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) + { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) + { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) + { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) + { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/core/text/StrFormatter.java b/ktg-common/src/main/java/com/ktg/common/core/text/StrFormatter.java new file mode 100644 index 0000000..24004d4 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/core/text/StrFormatter.java @@ -0,0 +1,92 @@ +package com.ktg.common.core.text; + +import com.ktg.common.utils.StringUtils; + +/** + * 字符串格式化 + * + * @author ruoyi + */ +public class StrFormatter +{ + public static final String EMPTY_JSON = "{}"; + public static final char C_BACKSLASH = '\\'; + public static final char C_DELIM_START = '{'; + public static final char C_DELIM_END = '}'; + + /** + * 格式化字符串
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param strPattern 字符串模板 + * @param argArray 参数列表 + * @return 结果 + */ + public static String format(final String strPattern, final Object... argArray) + { + if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) + { + return strPattern; + } + final int strPatternLength = strPattern.length(); + + // 初始化定义好的长度以获得更好的性能 + StringBuilder sbuf = new StringBuilder(strPatternLength + 50); + + int handledPosition = 0; + int delimIndex;// 占位符所在位置 + for (int argIndex = 0; argIndex < argArray.length; argIndex++) + { + delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); + if (delimIndex == -1) + { + if (handledPosition == 0) + { + return strPattern; + } + else + { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 + sbuf.append(strPattern, handledPosition, strPatternLength); + return sbuf.toString(); + } + } + else + { + if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) + { + if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) + { + // 转义符之前还有一个转义符,占位符依旧有效 + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + else + { + // 占位符被转义 + argIndex--; + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(C_DELIM_START); + handledPosition = delimIndex + 1; + } + } + else + { + // 正常占位符 + sbuf.append(strPattern, handledPosition, delimIndex); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + } + } + // 加入最后一个占位符后所有的字符 + sbuf.append(strPattern, handledPosition, strPattern.length()); + + return sbuf.toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/BusinessStatus.java b/ktg-common/src/main/java/com/ktg/common/enums/BusinessStatus.java new file mode 100644 index 0000000..1518d21 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/BusinessStatus.java @@ -0,0 +1,20 @@ +package com.ktg.common.enums; + +/** + * 操作状态 + * + * @author ruoyi + * + */ +public enum BusinessStatus +{ + /** + * 成功 + */ + SUCCESS, + + /** + * 失败 + */ + FAIL, +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/BusinessType.java b/ktg-common/src/main/java/com/ktg/common/enums/BusinessType.java new file mode 100644 index 0000000..7636d65 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/BusinessType.java @@ -0,0 +1,59 @@ +package com.ktg.common.enums; + +/** + * 业务操作类型 + * + * @author ruoyi + */ +public enum BusinessType +{ + /** + * 其它 + */ + OTHER, + + /** + * 新增 + */ + INSERT, + + /** + * 修改 + */ + UPDATE, + + /** + * 删除 + */ + DELETE, + + /** + * 授权 + */ + GRANT, + + /** + * 导出 + */ + EXPORT, + + /** + * 导入 + */ + IMPORT, + + /** + * 强退 + */ + FORCE, + + /** + * 生成代码 + */ + GENCODE, + + /** + * 清空数据 + */ + CLEAN, +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/CycleMethodMnum.java b/ktg-common/src/main/java/com/ktg/common/enums/CycleMethodMnum.java new file mode 100644 index 0000000..00fa53e --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/CycleMethodMnum.java @@ -0,0 +1,44 @@ +package com.ktg.common.enums; + +public enum CycleMethodMnum { + + CYCLE_METHOD_YEAR("YEAR","按年"), + CYCLE_METHOD_MONTH("MONTH","按月"), + CYCLE_METHOD_DAY("DAY","按日"), + CYCLE_METHOD_HOUR("HOUR","按小时"), + CYCLE_METHOD_MINUTE("MINUTE","按分钟"), + CYCLE_METHOD_OTHER("OTHER","其他"); + + private String code; + private String name; + + CycleMethodMnum(String code,String name){ + this.code=code; + this.name=name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public static CycleMethodMnum getByCode(String code){ + for(CycleMethodMnum value : CycleMethodMnum.values()){ + if(value.getCode().equals(code)){ + return value; + } + } + return CYCLE_METHOD_OTHER; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/DataSourceType.java b/ktg-common/src/main/java/com/ktg/common/enums/DataSourceType.java new file mode 100644 index 0000000..ef3089e --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/DataSourceType.java @@ -0,0 +1,19 @@ +package com.ktg.common.enums; + +/** + * 数据源 + * + * @author ruoyi + */ +public enum DataSourceType +{ + /** + * 主库 + */ + MASTER, + + /** + * 从库 + */ + SLAVE +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/HttpMethod.java b/ktg-common/src/main/java/com/ktg/common/enums/HttpMethod.java new file mode 100644 index 0000000..bce13c4 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/HttpMethod.java @@ -0,0 +1,36 @@ +package com.ktg.common.enums; + +import java.util.HashMap; +import java.util.Map; +import org.springframework.lang.Nullable; + +/** + * 请求方式 + * + * @author ruoyi + */ +public enum HttpMethod +{ + GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; + + private static final Map mappings = new HashMap<>(16); + + static + { + for (HttpMethod httpMethod : values()) + { + mappings.put(httpMethod.name(), httpMethod); + } + } + + @Nullable + public static HttpMethod resolve(@Nullable String method) + { + return (method != null ? mappings.get(method) : null); + } + + public boolean matches(String method) + { + return (this == resolve(method)); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/LimitType.java b/ktg-common/src/main/java/com/ktg/common/enums/LimitType.java new file mode 100644 index 0000000..76358af --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/LimitType.java @@ -0,0 +1,20 @@ +package com.ktg.common.enums; + +/** + * 限流类型 + * + * @author ruoyi + */ + +public enum LimitType +{ + /** + * 默认策略全局限流 + */ + DEFAULT, + + /** + * 根据请求者IP进行限流 + */ + IP +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/OperatorType.java b/ktg-common/src/main/java/com/ktg/common/enums/OperatorType.java new file mode 100644 index 0000000..3e2ddc3 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/OperatorType.java @@ -0,0 +1,24 @@ +package com.ktg.common.enums; + +/** + * 操作人类别 + * + * @author ruoyi + */ +public enum OperatorType +{ + /** + * 其它 + */ + OTHER, + + /** + * 后台用户 + */ + MANAGE, + + /** + * 手机端用户 + */ + MOBILE +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/PartTypeEnum.java b/ktg-common/src/main/java/com/ktg/common/enums/PartTypeEnum.java new file mode 100644 index 0000000..455c0cf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/PartTypeEnum.java @@ -0,0 +1,42 @@ +package com.ktg.common.enums; + +public enum PartTypeEnum { + + PART_TYPE_INPUTCHAR("INPUTCHAR","传入字符",0), + PART_TYPE_NOWDATE("NOWDATE","当前日期",1), + PART_TYPE_FIXCHAR("FIXCHAR","固定字符",2), + PART_TYPE_SERIALNO("SERIALNO","流水号",3), + PART_TYPE_OTHER("OTHER","其他",99); + + private final String code; + private final String name; + private final Integer beanIndex; + + PartTypeEnum(String code,String name,Integer beanIndex){ + this.code = code; + this.name = name; + this.beanIndex = beanIndex; + } + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + + public Integer getBeanIndex() { + return beanIndex; + } + + public static PartTypeEnum getByCode(String code){ + for(PartTypeEnum value: PartTypeEnum.values()){ + if(value.getCode().equals(code)){ + return value; + } + } + return PART_TYPE_OTHER; + } + +} diff --git a/ktg-common/src/main/java/com/ktg/common/enums/UserStatus.java b/ktg-common/src/main/java/com/ktg/common/enums/UserStatus.java new file mode 100644 index 0000000..692f4bf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/enums/UserStatus.java @@ -0,0 +1,30 @@ +package com.ktg.common.enums; + +/** + * 用户状态 + * + * @author ruoyi + */ +public enum UserStatus +{ + OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); + + private final String code; + private final String info; + + UserStatus(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/BussinessException.java b/ktg-common/src/main/java/com/ktg/common/exception/BussinessException.java new file mode 100644 index 0000000..ac2cc72 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/BussinessException.java @@ -0,0 +1,23 @@ +package com.ktg.common.exception; + +public class BussinessException extends RuntimeException { + private static final long serialVersionUID = -1L; + + public BussinessException(){ + super(); + } + + + public BussinessException(String msg){ + super(msg); + } + + public BussinessException(String msg,Throwable cause){ + super(msg,cause); + } + + public BussinessException(Throwable cause){ + super(cause); + } + +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/DemoModeException.java b/ktg-common/src/main/java/com/ktg/common/exception/DemoModeException.java new file mode 100644 index 0000000..2450e17 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/DemoModeException.java @@ -0,0 +1,15 @@ +package com.ktg.common.exception; + +/** + * 演示模式异常 + * + * @author ruoyi + */ +public class DemoModeException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public DemoModeException() + { + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/GlobalException.java b/ktg-common/src/main/java/com/ktg/common/exception/GlobalException.java new file mode 100644 index 0000000..eda9682 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/GlobalException.java @@ -0,0 +1,58 @@ +package com.ktg.common.exception; + +/** + * 全局异常 + * + * @author ruoyi + */ +public class GlobalException extends RuntimeException +{ + + private static final long serialVersionUID = 1L; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + * + * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public GlobalException() + { + } + + public GlobalException(String message) + { + this.message = message; + } + + public String getDetailMessage() + { + return detailMessage; + } + + public GlobalException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } + + public String getMessage() + { + return message; + } + + public GlobalException setMessage(String message) + { + this.message = message; + return this; + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/exception/ServiceException.java b/ktg-common/src/main/java/com/ktg/common/exception/ServiceException.java new file mode 100644 index 0000000..b6f4927 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/ServiceException.java @@ -0,0 +1,73 @@ +package com.ktg.common.exception; + +/** + * 业务异常 + * + * @author ruoyi + */ +public final class ServiceException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 错误码 + */ + private Integer code; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + * + * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public ServiceException() + { + } + + public ServiceException(String message) + { + this.message = message; + } + + public ServiceException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public String getDetailMessage() + { + return detailMessage; + } + + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } + + public ServiceException setMessage(String message) + { + this.message = message; + return this; + } + + public ServiceException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/exception/UtilException.java b/ktg-common/src/main/java/com/ktg/common/exception/UtilException.java new file mode 100644 index 0000000..3b8d227 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/UtilException.java @@ -0,0 +1,26 @@ +package com.ktg.common.exception; + +/** + * 工具类异常 + * + * @author ruoyi + */ +public class UtilException extends RuntimeException +{ + private static final long serialVersionUID = 8247610319171014183L; + + public UtilException(Throwable e) + { + super(e.getMessage(), e); + } + + public UtilException(String message) + { + super(message); + } + + public UtilException(String message, Throwable throwable) + { + super(message, throwable); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/base/BaseException.java b/ktg-common/src/main/java/com/ktg/common/exception/base/BaseException.java new file mode 100644 index 0000000..678c92f --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/base/BaseException.java @@ -0,0 +1,97 @@ +package com.ktg.common.exception.base; + +import com.ktg.common.utils.MessageUtils; +import com.ktg.common.utils.StringUtils; + +/** + * 基础异常 + * + * @author ktg + */ +public class BaseException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 所属模块 + */ + private String module; + + /** + * 错误码 + */ + private String code; + + /** + * 错误码对应的参数 + */ + private Object[] args; + + /** + * 错误消息 + */ + private String defaultMessage; + + public BaseException(String module, String code, Object[] args, String defaultMessage) + { + this.module = module; + this.code = code; + this.args = args; + this.defaultMessage = defaultMessage; + } + + public BaseException(String module, String code, Object[] args) + { + this(module, code, args, null); + } + + public BaseException(String module, String defaultMessage) + { + this(module, null, null, defaultMessage); + } + + public BaseException(String code, Object[] args) + { + this(null, code, args, null); + } + + public BaseException(String defaultMessage) + { + this(null, null, null, defaultMessage); + } + + @Override + public String getMessage() + { + String message = null; + if (!StringUtils.isEmpty(code)) + { + message = MessageUtils.message(code, args); + } + if (message == null) + { + message = defaultMessage; + } + return message; + } + + public String getModule() + { + return module; + } + + public String getCode() + { + return code; + } + + public Object[] getArgs() + { + return args; + } + + public String getDefaultMessage() + { + return defaultMessage; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/file/FileException.java b/ktg-common/src/main/java/com/ktg/common/exception/file/FileException.java new file mode 100644 index 0000000..fe966d5 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/file/FileException.java @@ -0,0 +1,19 @@ +package com.ktg.common.exception.file; + +import com.ktg.common.exception.base.BaseException; + +/** + * 文件信息异常类 + * + * @author ruoyi + */ +public class FileException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public FileException(String code, Object[] args) + { + super("file", code, args, null); + } + +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/file/FileNameLengthLimitExceededException.java b/ktg-common/src/main/java/com/ktg/common/exception/file/FileNameLengthLimitExceededException.java new file mode 100644 index 0000000..121f4b7 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/file/FileNameLengthLimitExceededException.java @@ -0,0 +1,16 @@ +package com.ktg.common.exception.file; + +/** + * 文件名称超长限制异常类 + * + * @author ruoyi + */ +public class FileNameLengthLimitExceededException extends FileException +{ + private static final long serialVersionUID = 1L; + + public FileNameLengthLimitExceededException(int defaultFileNameLength) + { + super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/file/FileSizeLimitExceededException.java b/ktg-common/src/main/java/com/ktg/common/exception/file/FileSizeLimitExceededException.java new file mode 100644 index 0000000..bd9c0cb --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/file/FileSizeLimitExceededException.java @@ -0,0 +1,16 @@ +package com.ktg.common.exception.file; + +/** + * 文件名大小限制异常类 + * + * @author ktg + */ +public class FileSizeLimitExceededException extends FileException +{ + private static final long serialVersionUID = 1L; + + public FileSizeLimitExceededException(long defaultMaxSize) + { + super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/file/InvalidExtensionException.java b/ktg-common/src/main/java/com/ktg/common/exception/file/InvalidExtensionException.java new file mode 100644 index 0000000..f1fd299 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/file/InvalidExtensionException.java @@ -0,0 +1,81 @@ +package com.ktg.common.exception.file; + +import java.util.Arrays; +import org.apache.commons.fileupload.FileUploadException; + +/** + * 文件上传 误异常类 + * + * @author ktg + */ +public class InvalidExtensionException extends FileUploadException +{ + private static final long serialVersionUID = 1L; + + private String[] allowedExtension; + private String extension; + private String filename; + + public InvalidExtensionException(String[] allowedExtension, String extension, String filename) + { + super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]"); + this.allowedExtension = allowedExtension; + this.extension = extension; + this.filename = filename; + } + + public String[] getAllowedExtension() + { + return allowedExtension; + } + + public String getExtension() + { + return extension; + } + + public String getFilename() + { + return filename; + } + + public static class InvalidImageExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidFlashExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidMediaExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidVideoExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/job/TaskException.java b/ktg-common/src/main/java/com/ktg/common/exception/job/TaskException.java new file mode 100644 index 0000000..09e7309 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/job/TaskException.java @@ -0,0 +1,34 @@ +package com.ktg.common.exception.job; + +/** + * 计划策略异常 + * + * @author ruoyi + */ +public class TaskException extends Exception +{ + private static final long serialVersionUID = 1L; + + private Code code; + + public TaskException(String msg, Code code) + { + this(msg, code, null); + } + + public TaskException(String msg, Code code, Exception nestedEx) + { + super(msg, nestedEx); + this.code = code; + } + + public Code getCode() + { + return code; + } + + public enum Code + { + TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/exception/user/CaptchaException.java b/ktg-common/src/main/java/com/ktg/common/exception/user/CaptchaException.java new file mode 100644 index 0000000..9aefddf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/user/CaptchaException.java @@ -0,0 +1,16 @@ +package com.ktg.common.exception.user; + +/** + * 验证码错误异常类 + * + * @author ktg + */ +public class CaptchaException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaException() + { + super("user.jcaptcha.error", null); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/user/CaptchaExpireException.java b/ktg-common/src/main/java/com/ktg/common/exception/user/CaptchaExpireException.java new file mode 100644 index 0000000..7d9e074 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/user/CaptchaExpireException.java @@ -0,0 +1,16 @@ +package com.ktg.common.exception.user; + +/** + * 验证码失效异常类 + * + * @author ktg + */ +public class CaptchaExpireException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaExpireException() + { + super("user.jcaptcha.expire", null); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/user/UserException.java b/ktg-common/src/main/java/com/ktg/common/exception/user/UserException.java new file mode 100644 index 0000000..d56da97 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/user/UserException.java @@ -0,0 +1,18 @@ +package com.ktg.common.exception.user; + +import com.ktg.common.exception.base.BaseException; + +/** + * 用户信息异常类 + * + * @author ruoyi + */ +public class UserException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public UserException(String code, Object[] args) + { + super("user", code, args, null); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/exception/user/UserPasswordNotMatchException.java b/ktg-common/src/main/java/com/ktg/common/exception/user/UserPasswordNotMatchException.java new file mode 100644 index 0000000..8373300 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/exception/user/UserPasswordNotMatchException.java @@ -0,0 +1,16 @@ +package com.ktg.common.exception.user; + +/** + * 用户密码不正确或不符合规范异常类 + * + * @author ktg + */ +public class UserPasswordNotMatchException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserPasswordNotMatchException() + { + super("user.password.not.match", null); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/filter/RepeatableFilter.java b/ktg-common/src/main/java/com/ktg/common/filter/RepeatableFilter.java new file mode 100644 index 0000000..588322a --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/filter/RepeatableFilter.java @@ -0,0 +1,52 @@ +package com.ktg.common.filter; + +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import org.springframework.http.MediaType; +import com.ktg.common.utils.StringUtils; + +/** + * Repeatable 过滤器 + * + * @author ruoyi + */ +public class RepeatableFilter implements Filter +{ + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + ServletRequest requestWrapper = null; + if (request instanceof HttpServletRequest + && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) + { + requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); + } + if (null == requestWrapper) + { + chain.doFilter(request, response); + } + else + { + chain.doFilter(requestWrapper, response); + } + } + + @Override + public void destroy() + { + + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/filter/RepeatedlyRequestWrapper.java b/ktg-common/src/main/java/com/ktg/common/filter/RepeatedlyRequestWrapper.java new file mode 100644 index 0000000..4bf358f --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/filter/RepeatedlyRequestWrapper.java @@ -0,0 +1,75 @@ +package com.ktg.common.filter; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import com.ktg.common.utils.http.HttpHelper; + +/** + * 构建可重复读取inputStream的request + * + * @author ruoyi + */ +public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper +{ + private final byte[] body; + + public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException + { + super(request); + request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding("UTF-8"); + + body = HttpHelper.getBodyString(request).getBytes("UTF-8"); + } + + @Override + public BufferedReader getReader() throws IOException + { + return new BufferedReader(new InputStreamReader(getInputStream())); + } + + @Override + public ServletInputStream getInputStream() throws IOException + { + final ByteArrayInputStream bais = new ByteArrayInputStream(body); + return new ServletInputStream() + { + @Override + public int read() throws IOException + { + return bais.read(); + } + + @Override + public int available() throws IOException + { + return body.length; + } + + @Override + public boolean isFinished() + { + return false; + } + + @Override + public boolean isReady() + { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) + { + + } + }; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/filter/XssFilter.java b/ktg-common/src/main/java/com/ktg/common/filter/XssFilter.java new file mode 100644 index 0000000..380a5cb --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/filter/XssFilter.java @@ -0,0 +1,74 @@ +package com.ktg.common.filter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import com.ktg.common.utils.StringUtils; + +/** + * 防止XSS攻击的过滤器 + * + * @author ruoyi + */ +public class XssFilter implements Filter +{ + /** + * 排除链接 + */ + public List excludes = new ArrayList<>(); + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + String tempExcludes = filterConfig.getInitParameter("excludes"); + if (StringUtils.isNotEmpty(tempExcludes)) + { + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + excludes.add(url[i]); + } + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse resp = (HttpServletResponse) response; + if (handleExcludeURL(req, resp)) + { + chain.doFilter(request, response); + return; + } + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); + chain.doFilter(xssRequest, response); + } + + private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) + { + String url = request.getServletPath(); + String method = request.getMethod(); + // GET DELETE 不过滤 + if (method == null || method.matches("GET") || method.matches("DELETE")) + { + return true; + } + return StringUtils.matches(url, excludes); + } + + @Override + public void destroy() + { + + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/filter/XssHttpServletRequestWrapper.java b/ktg-common/src/main/java/com/ktg/common/filter/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000..153f112 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/filter/XssHttpServletRequestWrapper.java @@ -0,0 +1,111 @@ +package com.ktg.common.filter; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import org.apache.commons.io.IOUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.html.EscapeUtil; + +/** + * XSS过滤处理 + * + * @author ruoyi + */ +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper +{ + /** + * @param request + */ + public XssHttpServletRequestWrapper(HttpServletRequest request) + { + super(request); + } + + @Override + public String[] getParameterValues(String name) + { + String[] values = super.getParameterValues(name); + if (values != null) + { + int length = values.length; + String[] escapseValues = new String[length]; + for (int i = 0; i < length; i++) + { + // 防xss攻击和过滤前后空格 + escapseValues[i] = EscapeUtil.clean(values[i]).trim(); + } + return escapseValues; + } + return super.getParameterValues(name); + } + + @Override + public ServletInputStream getInputStream() throws IOException + { + // 非json类型,直接返回 + if (!isJsonRequest()) + { + return super.getInputStream(); + } + + // 为空,直接返回 + String json = IOUtils.toString(super.getInputStream(), "utf-8"); + if (StringUtils.isEmpty(json)) + { + return super.getInputStream(); + } + + // xss过滤 + json = EscapeUtil.clean(json).trim(); + byte[] jsonBytes = json.getBytes("utf-8"); + final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes); + return new ServletInputStream() + { + @Override + public boolean isFinished() + { + return true; + } + + @Override + public boolean isReady() + { + return true; + } + + @Override + public int available() throws IOException + { + return jsonBytes.length; + } + + @Override + public void setReadListener(ReadListener readListener) + { + } + + @Override + public int read() throws IOException + { + return bis.read(); + } + }; + } + + /** + * 是否是Json请求 + * + * @param request + */ + public boolean isJsonRequest() + { + String header = super.getHeader(HttpHeaders.CONTENT_TYPE); + return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/utils/Arith.java b/ktg-common/src/main/java/com/ktg/common/utils/Arith.java new file mode 100644 index 0000000..6681aba --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/Arith.java @@ -0,0 +1,114 @@ +package com.ktg.common.utils; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 精确的浮点数运算 + * + * @author ruoyi + */ +public class Arith +{ + + /** 默认除法运算精度 */ + private static final int DEF_DIV_SCALE = 10; + + /** 这个类不能实例化 */ + private Arith() + { + } + + /** + * 提供精确的加法运算。 + * @param v1 被加数 + * @param v2 加数 + * @return 两个参数的和 + */ + public static double add(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.add(b2).doubleValue(); + } + + /** + * 提供精确的减法运算。 + * @param v1 被减数 + * @param v2 减数 + * @return 两个参数的差 + */ + public static double sub(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.subtract(b2).doubleValue(); + } + + /** + * 提供精确的乘法运算。 + * @param v1 被乘数 + * @param v2 乘数 + * @return 两个参数的积 + */ + public static double mul(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.multiply(b2).doubleValue(); + } + + /** + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 + * 小数点以后10位,以后的数字四舍五入。 + * @param v1 被除数 + * @param v2 除数 + * @return 两个参数的商 + */ + public static double div(double v1, double v2) + { + return div(v1, v2, DEF_DIV_SCALE); + } + + /** + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 + * 定精度,以后的数字四舍五入。 + * @param v1 被除数 + * @param v2 除数 + * @param scale 表示表示需要精确到小数点以后几位。 + * @return 两个参数的商 + */ + public static double div(double v1, double v2, int scale) + { + if (scale < 0) + { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + if (b1.compareTo(BigDecimal.ZERO) == 0) + { + return BigDecimal.ZERO.doubleValue(); + } + return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); + } + + /** + * 提供精确的小数位四舍五入处理。 + * @param v 需要四舍五入的数字 + * @param scale 小数点后保留几位 + * @return 四舍五入后的结果 + */ + public static double round(double v, int scale) + { + if (scale < 0) + { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b = new BigDecimal(Double.toString(v)); + BigDecimal one = BigDecimal.ONE; + return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/DateUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/DateUtils.java new file mode 100644 index 0000000..176b3e9 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/DateUtils.java @@ -0,0 +1,187 @@ +package com.ktg.common.utils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.Date; +import org.apache.commons.lang3.time.DateFormatUtils; + +/** + * 时间工具类 + * + * @author ruoyi + */ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils +{ + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + private static String[] parsePatterns = { + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; + + /** + * 获取当前Date型日期 + * + * @return Date() 当前日期 + */ + public static Date getNowDate() + { + return new Date(); + } + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() + { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() + { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + + public static final String dateTimeNow() + { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) + { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) + { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String parseDateToStr(final String format, final Date date) + { + return new SimpleDateFormat(format).format(date); + } + + public static final Date dateTime(final String format, final String ts) + { + try + { + return new SimpleDateFormat(format).parse(ts); + } + catch (ParseException e) + { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateTime() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) + { + if (str == null) + { + return null; + } + try + { + return parseDate(str.toString(), parsePatterns); + } + catch (ParseException e) + { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() + { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算相差天数 + */ + public static int differentDaysByMillisecond(Date date1, Date date2) + { + return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); + } + + /** + * 计算两个时间差 + */ + public static String getDatePoor(Date endDate, Date nowDate) + { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 增加 LocalDateTime ==> Date + */ + public static Date toDate(LocalDateTime temporalAccessor) + { + ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); + return Date.from(zdt.toInstant()); + } + + /** + * 增加 LocalDate ==> Date + */ + public static Date toDate(LocalDate temporalAccessor) + { + LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); + ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); + return Date.from(zdt.toInstant()); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/DictUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/DictUtils.java new file mode 100644 index 0000000..ffe8759 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/DictUtils.java @@ -0,0 +1,182 @@ +package com.ktg.common.utils; + +import java.util.Collection; +import java.util.List; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.entity.SysDictData; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.utils.spring.SpringUtils; + +/** + * 字典工具类 + * + * @author ruoyi + */ +public class DictUtils +{ + /** + * 分隔符 + */ + public static final String SEPARATOR = ","; + + /** + * 设置字典缓存 + * + * @param key 参数键 + * @param dictDatas 字典数据列表 + */ + public static void setDictCache(String key, List dictDatas) + { + SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas); + } + + /** + * 获取字典缓存 + * + * @param key 参数键 + * @return dictDatas 字典数据列表 + */ + public static List getDictCache(String key) + { + Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); + if (StringUtils.isNotNull(cacheObj)) + { + return StringUtils.cast(cacheObj); + } + return null; + } + + /** + * 根据字典类型和字典值获取字典标签 + * + * @param dictType 字典类型 + * @param dictValue 字典值 + * @return 字典标签 + */ + public static String getDictLabel(String dictType, String dictValue) + { + return getDictLabel(dictType, dictValue, SEPARATOR); + } + + /** + * 根据字典类型和字典标签获取字典值 + * + * @param dictType 字典类型 + * @param dictLabel 字典标签 + * @return 字典值 + */ + public static String getDictValue(String dictType, String dictLabel) + { + return getDictValue(dictType, dictLabel, SEPARATOR); + } + + /** + * 根据字典类型和字典值获取字典标签 + * + * @param dictType 字典类型 + * @param dictValue 字典值 + * @param separator 分隔符 + * @return 字典标签 + */ + public static String getDictLabel(String dictType, String dictValue, String separator) + { + StringBuilder propertyString = new StringBuilder(); + List datas = getDictCache(dictType); + + if (StringUtils.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas)) + { + for (SysDictData dict : datas) + { + for (String value : dictValue.split(separator)) + { + if (value.equals(dict.getDictValue())) + { + propertyString.append(dict.getDictLabel()).append(separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictValue.equals(dict.getDictValue())) + { + return dict.getDictLabel(); + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 根据字典类型和字典标签获取字典值 + * + * @param dictType 字典类型 + * @param dictLabel 字典标签 + * @param separator 分隔符 + * @return 字典值 + */ + public static String getDictValue(String dictType, String dictLabel, String separator) + { + StringBuilder propertyString = new StringBuilder(); + List datas = getDictCache(dictType); + + if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) + { + for (SysDictData dict : datas) + { + for (String label : dictLabel.split(separator)) + { + if (label.equals(dict.getDictLabel())) + { + propertyString.append(dict.getDictValue()).append(separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictLabel.equals(dict.getDictLabel())) + { + return dict.getDictValue(); + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 删除指定字典缓存 + * + * @param key 字典键 + */ + public static void removeDictCache(String key) + { + SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key)); + } + + /** + * 清空字典缓存 + */ + public static void clearDictCache() + { + Collection keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_DICT_KEY + "*"); + SpringUtils.getBean(RedisCache.class).deleteObject(keys); + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + public static String getCacheKey(String configKey) + { + return Constants.SYS_DICT_KEY + configKey; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/ExceptionUtil.java b/ktg-common/src/main/java/com/ktg/common/utils/ExceptionUtil.java new file mode 100644 index 0000000..a6928c6 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/ExceptionUtil.java @@ -0,0 +1,39 @@ +package com.ktg.common.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; +import org.apache.commons.lang3.exception.ExceptionUtils; + +/** + * 错误信息处理类。 + * + * @author ruoyi + */ +public class ExceptionUtil +{ + /** + * 获取exception的详细错误信息。 + */ + public static String getExceptionMessage(Throwable e) + { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + return sw.toString(); + } + + public static String getRootErrorMessage(Exception e) + { + Throwable root = ExceptionUtils.getRootCause(e); + root = (root == null ? e : root); + if (root == null) + { + return ""; + } + String msg = root.getMessage(); + if (msg == null) + { + return "null"; + } + return StringUtils.defaultString(msg); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/LogUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/LogUtils.java new file mode 100644 index 0000000..da44ed8 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/LogUtils.java @@ -0,0 +1,18 @@ +package com.ktg.common.utils; + +/** + * 处理并记录日志文件 + * + * @author ruoyi + */ +public class LogUtils +{ + public static String getBlock(Object msg) + { + if (msg == null) + { + msg = ""; + } + return "[" + msg.toString() + "]"; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/MessageUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/MessageUtils.java new file mode 100644 index 0000000..92a6198 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/MessageUtils.java @@ -0,0 +1,26 @@ +package com.ktg.common.utils; + +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; +import com.ktg.common.utils.spring.SpringUtils; + +/** + * 获取i18n资源文件 + * + * @author ruoyi + */ +public class MessageUtils +{ + /** + * 根据消息键和参数 获取消息 委托给spring messageSource + * + * @param code 消息键 + * @param args 参数 + * @return 获取国际化翻译值 + */ + public static String message(String code, Object... args) + { + MessageSource messageSource = SpringUtils.getBean(MessageSource.class); + return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/PageUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/PageUtils.java new file mode 100644 index 0000000..4b7031f --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/PageUtils.java @@ -0,0 +1,38 @@ +package com.ktg.common.utils; + +import com.github.pagehelper.PageHelper; +import com.ktg.common.core.page.PageDomain; +import com.ktg.common.core.page.TableSupport; +import com.ktg.common.utils.sql.SqlUtil; + +/** + * 分页工具类 + * + * @author ruoyi + */ +public class PageUtils extends PageHelper +{ + /** + * 设置请求分页数据 + */ + public static void startPage() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) + { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + Boolean reasonable = pageDomain.getReasonable(); + PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); + } + } + + /** + * 清理分页的线程变量 + */ + public static void clearPage() + { + PageHelper.clearPage(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/SecurityUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/SecurityUtils.java new file mode 100644 index 0000000..3caac18 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/SecurityUtils.java @@ -0,0 +1,120 @@ +package com.ktg.common.utils; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import com.ktg.common.constant.HttpStatus; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.exception.ServiceException; + +/** + * 安全服务工具类 + * + * @author ruoyi + */ +public class SecurityUtils +{ + /** + * 用户ID + **/ + public static Long getUserId() + { + try + { + return getLoginUser().getUserId(); + } + catch (Exception e) + { + throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取部门ID + **/ + public static Long getDeptId() + { + try + { + return getLoginUser().getDeptId(); + } + catch (Exception e) + { + throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static LoginUser getLoginUser() + { + try + { + return (LoginUser) getAuthentication().getPrincipal(); + } + catch (Exception e) + { + throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取Authentication + */ + public static Authentication getAuthentication() + { + return SecurityContextHolder.getContext().getAuthentication(); + } + + /** + * 生成BCryptPasswordEncoder密码 + * + * @param password 密码 + * @return 加密字符串 + */ + public static String encryptPassword(String password) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); + } + + /** + * 判断密码是否相同 + * + * @param rawPassword 真实密码 + * @param encodedPassword 加密后字符 + * @return 结果 + */ + public static boolean matchesPassword(String rawPassword, String encodedPassword) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.matches(rawPassword, encodedPassword); + } + + /** + * 是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/ServletUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/ServletUtils.java new file mode 100644 index 0000000..30d6ea6 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/ServletUtils.java @@ -0,0 +1,188 @@ +package com.ktg.common.utils; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.ktg.common.constant.Constants; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import com.ktg.common.core.text.Convert; + +/** + * 客户端工具类 + * + * @author ruoyi + */ +public class ServletUtils +{ + /** + * 获取String参数 + */ + public static String getParameter(String name) + { + return getRequest().getParameter(name); + } + + /** + * 获取String参数 + */ + public static String getParameter(String name, String defaultValue) + { + return Convert.toStr(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name) + { + return Convert.toInt(getRequest().getParameter(name)); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name, Integer defaultValue) + { + return Convert.toInt(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Boolean参数 + */ + public static Boolean getParameterToBool(String name) + { + return Convert.toBool(getRequest().getParameter(name)); + } + + /** + * 获取Boolean参数 + */ + public static Boolean getParameterToBool(String name, Boolean defaultValue) + { + return Convert.toBool(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取request + */ + public static HttpServletRequest getRequest() + { + return getRequestAttributes().getRequest(); + } + + /** + * 获取response + */ + public static HttpServletResponse getResponse() + { + return getRequestAttributes().getResponse(); + } + + /** + * 获取session + */ + public static HttpSession getSession() + { + return getRequest().getSession(); + } + + public static ServletRequestAttributes getRequestAttributes() + { + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); + return (ServletRequestAttributes) attributes; + } + + /** + * 将字符串渲染到客户端 + * + * @param response 渲染对象 + * @param string 待渲染的字符串 + */ + public static void renderString(HttpServletResponse response, String string) + { + try + { + response.setStatus(200); + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + response.getWriter().print(string); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) + { + String accept = request.getHeader("accept"); + if (accept != null && accept.contains("application/json")) + { + return true; + } + + String xRequestedWith = request.getHeader("X-Requested-With"); + if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) + { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) + { + return true; + } + + String ajax = request.getParameter("__ajax"); + return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); + } + + /** + * 内容编码 + * + * @param str 内容 + * @return 编码后的内容 + */ + public static String urlEncode(String str) + { + try + { + return URLEncoder.encode(str, Constants.UTF8); + } + catch (UnsupportedEncodingException e) + { + return StringUtils.EMPTY; + } + } + + /** + * 内容解码 + * + * @param str 内容 + * @return 解码后的内容 + */ + public static String urlDecode(String str) + { + try + { + return URLDecoder.decode(str, Constants.UTF8); + } + catch (UnsupportedEncodingException e) + { + return StringUtils.EMPTY; + } + } + +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/StringUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/StringUtils.java new file mode 100644 index 0000000..82ba1d9 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/StringUtils.java @@ -0,0 +1,583 @@ +package com.ktg.common.utils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.springframework.util.AntPathMatcher; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.text.StrFormatter; + +/** + * 字符串工具类 + * + * @author ruoyi + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils +{ + /** 空字符串 */ + private static final String NULLSTR = ""; + + /** 下划线 */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) + { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) + { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) + { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + ** @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) + { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) + { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) + { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) + { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) + { + return isNull(str) || NULLSTR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) + { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) + { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) + { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) + { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) + { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) + { + if (str == null) + { + return NULLSTR; + } + + if (start < 0) + { + start = str.length() + start; + } + + if (start < 0) + { + start = 0; + } + if (start > str.length()) + { + return NULLSTR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) + { + if (str == null) + { + return NULLSTR; + } + + if (end < 0) + { + end = str.length() + end; + } + if (start < 0) + { + start = str.length() + start; + } + + if (end > str.length()) + { + end = str.length(); + } + + if (start > end) + { + return NULLSTR; + } + + if (start < 0) + { + start = 0; + } + if (end < 0) + { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) + { + if (isEmpty(params) || isEmpty(template)) + { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 是否为http(s)://开头 + * + * @param link 链接 + * @return 结果 + */ + public static boolean ishttp(String link) + { + return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS); + } + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static final Set str2Set(String str, String sep) + { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) + { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) + { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) + { + return list; + } + String[] split = str.split(sep); + for (String string : split) + { + if (filterBlank && StringUtils.isBlank(string)) + { + continue; + } + if (trim) + { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写 + * + * @param cs 指定字符串 + * @param searchCharSequences 需要检查的字符串数组 + * @return 是否包含任意一个字符串 + */ + public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) + { + if (isEmpty(cs) || isEmpty(searchCharSequences)) + { + return false; + } + for (CharSequence testStr : searchCharSequences) + { + if (containsIgnoreCase(cs, testStr)) + { + return true; + } + } + return false; + } + + /** + * 驼峰转下划线命名 + */ + public static String toUnderScoreCase(String str) + { + if (str == null) + { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) + { + char c = str.charAt(i); + if (i > 0) + { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } + else + { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) + { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) + { + sb.append(SEPARATOR); + } + else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) + { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) + { + if (str != null && strs != null) + { + for (String s : strs) + { + if (str.equalsIgnoreCase(trim(s))) + { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) + { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) + { + // 没必要转换 + return ""; + } + else if (!name.contains("_")) + { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) + { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) + { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) + { + if (s == null) + { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) + { + char c = s.charAt(i); + + if (c == SEPARATOR) + { + upperCase = true; + } + else if (upperCase) + { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } + else + { + sb.append(c); + } + } + return sb.toString(); + } + + /** + * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 + * + * @param str 指定字符串 + * @param strs 需要检查的字符串数组 + * @return 是否匹配 + */ + public static boolean matches(String str, List strs) + { + if (isEmpty(str) || isEmpty(strs)) + { + return false; + } + for (String pattern : strs) + { + if (isMatch(pattern, str)) + { + return true; + } + } + return false; + } + + /** + * 判断url是否与规则配置: + * ? 表示单个字符; + * * 表示一层路径内的任意字符串,不可跨层级; + * ** 表示任意层路径; + * + * @param pattern 匹配规则 + * @param url 需要匹配的url + * @return + */ + public static boolean isMatch(String pattern, String url) + { + AntPathMatcher matcher = new AntPathMatcher(); + return matcher.match(pattern, url); + } + + @SuppressWarnings("unchecked") + public static T cast(Object obj) + { + return (T) obj; + } + + /** + * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。 + * + * @param num 数字对象 + * @param size 字符串指定长度 + * @return 返回数字的字符串格式,该字符串为指定长度。 + */ + public static final String padl(final Number num, final int size) + { + return padl(num.toString(), size, '0'); + } + + /** + * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。 + * + * @param s 原始字符串 + * @param size 字符串指定长度 + * @param c 用于补齐的字符 + * @return 返回指定长度的字符串,由原字符串左补齐或截取得到。 + */ + public static final String padl(final String s, final int size, final char c) + { + final StringBuilder sb = new StringBuilder(size); + if (s != null) + { + final int len = s.length(); + if (s.length() <= size) + { + for (int i = size - len; i > 0; i--) + { + sb.append(c); + } + sb.append(s); + } + else + { + return s.substring(len - size, len); + } + } + else + { + for (int i = size; i > 0; i--) + { + sb.append(c); + } + } + return sb.toString(); + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/utils/Threads.java b/ktg-common/src/main/java/com/ktg/common/utils/Threads.java new file mode 100644 index 0000000..25f68a1 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/Threads.java @@ -0,0 +1,99 @@ +package com.ktg.common.utils; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 线程相关工具类. + * + * @author ruoyi + */ +public class Threads +{ + private static final Logger logger = LoggerFactory.getLogger(Threads.class); + + /** + * sleep等待,单位为毫秒 + */ + public static void sleep(long milliseconds) + { + try + { + Thread.sleep(milliseconds); + } + catch (InterruptedException e) + { + return; + } + } + + /** + * 停止线程池 + * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. + * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. + * 如果仍然超時,則強制退出. + * 另对在shutdown时线程本身被调用中断做了处理. + */ + public static void shutdownAndAwaitTermination(ExecutorService pool) + { + if (pool != null && !pool.isShutdown()) + { + pool.shutdown(); + try + { + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + pool.shutdownNow(); + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + logger.info("Pool did not terminate"); + } + } + } + catch (InterruptedException ie) + { + pool.shutdownNow(); + Thread.currentThread().interrupt(); + } + } + } + + /** + * 打印线程异常信息 + */ + public static void printException(Runnable r, Throwable t) + { + if (t == null && r instanceof Future) + { + try + { + Future future = (Future) r; + if (future.isDone()) + { + future.get(); + } + } + catch (CancellationException ce) + { + t = ce; + } + catch (ExecutionException ee) + { + t = ee.getCause(); + } + catch (InterruptedException ie) + { + Thread.currentThread().interrupt(); + } + } + if (t != null) + { + logger.error(t.getMessage(), t); + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/barcode/BarcodeUtil.java b/ktg-common/src/main/java/com/ktg/common/utils/barcode/BarcodeUtil.java new file mode 100644 index 0000000..16e11a4 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/barcode/BarcodeUtil.java @@ -0,0 +1,217 @@ +package com.ktg.common.utils.barcode; + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import org.krysalis.barcode4j.impl.AbstractBarcodeBean; +import org.krysalis.barcode4j.impl.code39.Code39Bean; +import org.krysalis.barcode4j.impl.upcean.EAN13Bean; +import org.krysalis.barcode4j.impl.upcean.UPCABean; +import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider; +import org.krysalis.barcode4j.tools.UnitConv; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.geom.RoundRectangle2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +public class BarcodeUtil { + private static final String CHARSET = "utf-8"; + private static final String FORMAT_NAME = "PNG"; + // 二维码尺寸,长宽尺寸一致 + private static final int QRCODE_SIZE = 300; + // 二维码内部logo的宽和高 + private static final int WIDTH = 60; + private static final int HEIGHT = 60; + + public static File generateBarCode(String msg, String barCodeFormat, String path) { + File file = new File(path); + try { + if(StringUtils.isEmpty(msg)){ + throw new RuntimeException("条码内容不能为空!"); + } + //检查父级目录是否存在,不存在先新建 + File parentFile = file.getParentFile(); + if(!parentFile.exists()){ + parentFile.mkdirs(); + } + /* + * 生成条码 + */ + if(UserConstants.QR_CODE.equals(barCodeFormat)){ + //生成二维码 + generateQRCode(msg, null, file.getAbsolutePath(), false); + }else{ + //生成一维码 + generateLineCode(msg, barCodeFormat, file.getAbsolutePath()); + } + }catch (Exception e) { + throw new RuntimeException("生成条码发生错误:"+e.getMessage()); + } + return file; + } + /** + * 生成一维条形码 + * @param msg 条形码的内容 + * @param barCodeFormat 条形码格式 see {@link UserConstants} + * @param destFilePath 条形码存储的路径 + * @throws Exception + */ + public static void generateLineCode(String msg,String barCodeFormat,String destFilePath) throws Exception { + AbstractBarcodeBean bean = null; + if(UserConstants.EAN_CODE.equals(barCodeFormat)){ + bean = new EAN13Bean(); + }else if(UserConstants.CODE39_CODE.equals(barCodeFormat)){ + bean = new Code39Bean(); + }else if(UserConstants.UPC_CODE.equals(barCodeFormat)){ + bean = new UPCABean(); + }else{ + throw new Exception("不支持的条码类型!"); + } + // 精细度 + final int dpi = 150; + if (bean instanceof Code39Bean) { + Code39Bean codeBean = (Code39Bean) bean; + // module宽度 + final double moduleWidth = UnitConv.in2mm(1.0f / dpi); + + // 配置对象 + bean.setModuleWidth(moduleWidth); + codeBean.setWideFactor(3); + bean.doQuietZone(false); + } + + String format = "image/png"; + try { + + // 输出到流 + BitmapCanvasProvider canvas = new BitmapCanvasProvider(new FileOutputStream(destFilePath), format, dpi, + BufferedImage.TYPE_BYTE_BINARY, false, 0); + + // 生成条形码 + bean.generateBarcode(canvas, msg); + + // 结束绘制 + canvas.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + /** + * 生成带logo二维码,并保存到磁盘 + * + * @param content 二维码的内容 + * @param imgPath 二维码内部插入的图片路径,如果不需要可以传空 + * @param destFilePath 整个二维码存储的路径 + * @param needCompress 二维码内部插入的图片是否需要压缩的标识 + * @throws Exception 异常 + */ + public static void generateQRCode(String content, String imgPath, String destFilePath, boolean needCompress) throws Exception { + BufferedImage image = createQrCode(content, imgPath, needCompress); + ImageIO.write(image, FORMAT_NAME, new File(destFilePath)); + } + + /** + * 生成二维码图片 + * + * @param content 二维码内容 + * @param imagePath 二维码内部图片路径,如果不需要可以传空 + * @param needCompress 二维码内部图片是否需要压缩标识 + * @return 二维码图片 + * @throws WriterException 异常 + */ + private static BufferedImage createQrCode(String content,String imagePath,boolean needCompress) throws WriterException, IOException { + /** + * EncodeHintType 编码提示类型 枚举类型: + * CHARACTER_SET: 设置字符编码类型 "UTF-8" QR_CODE类型默认的编码格式 "ISO-8859-1" + * MARGIN: 设置二维码边距,单位像素,值越小,二维码距离四周越近 + * ERROR_CORRECTION: 设置误差校正 + * ErrorCorrectionLevel:误差校正等级,L = ~7% correction、M = ~15% correction、Q = ~25% correction、H = ~30% correction + * 不设置时,默认为 L 等级,等级不一样,生成的图案不同,但扫描的结果是一样的 + */ + Map hints = new ConcurrentHashMap<>(3); + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); + hints.put(EncodeHintType.CHARACTER_SET, CHARSET); + hints.put(EncodeHintType.MARGIN, 1); + //加密生成二维码的矩阵对象 二维的0 1 然后根据特定的值选择属性 + BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints); + int width = bitMatrix.getWidth(); + int height = bitMatrix.getHeight(); + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + //设置二维码的黑色0xFF000000 和白色0xFFFFFFFF + image.setRGB(i, j, bitMatrix.get(i, j) ? 0xFF000000 : 0xFFFFFFFF); + } + } + if (StringUtils.isBlank(imagePath)) { + return image; + } + //插入小图标 logo + insertImage(image, imagePath, needCompress); + return image; + } + /** + * 将logo插入二维码中间 + * + * @param source 生成的二位码存储对象 + * @param imagePath 二维码内部图片的路径 + * 一般的业务场景会把插入的小logo放到oss生成url + * @param needCompress 二维码内部图片是否需要压缩 + * @throws IOException 异常 + */ + private static void insertImage(BufferedImage source, String imagePath, boolean needCompress) throws IOException { + File file = new File(imagePath); + if (!file.exists()) { + //可以自定义抛出异常 + throw new RuntimeException("文件路径不存在:" + imagePath); + } + //这里修改ImageIO.read() 内可以接受Url InputStream File ImageInputStream + Image src = ImageIO.read(file); + int width = src.getWidth(null); + int height = src.getHeight(null); + //是否压缩 + if (needCompress) { + if (width > WIDTH) { + width = WIDTH; + } + if (height > HEIGHT) { + height = HEIGHT; + } + Image image = src.getScaledInstance(width, height, Image.SCALE_SMOOTH); + BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics g = tag.getGraphics(); + g.drawImage(image, 0, 0, null); + g.dispose(); + src = image; + } + Graphics2D graphics = source.createGraphics(); + int x = (QRCODE_SIZE - width) / 2; + int y = (QRCODE_SIZE - height) / 2; + graphics.drawImage(src,x,y,width,height,null); + Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6); + graphics.setStroke(new BasicStroke(3f)); + graphics.draw(shape); + graphics.dispose(); + } + + + public static void main(String[] args) { + String msg="item12345678"; + String EANmsg="012345678901"; + String UPCmsg="12345678901"; + String path = "D:/test/barcode/"+UUID.randomUUID()+".png"; + generateBarCode(msg, UserConstants.QR_CODE, path); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/bean/BeanUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/bean/BeanUtils.java new file mode 100644 index 0000000..efb5daf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/bean/BeanUtils.java @@ -0,0 +1,110 @@ +package com.ktg.common.utils.bean; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Bean 工具类 + * + * @author ruoyi + */ +public class BeanUtils extends org.springframework.beans.BeanUtils +{ + /** Bean方法名中属性名开始的下标 */ + private static final int BEAN_METHOD_PROP_INDEX = 3; + + /** * 匹配getter方法的正则表达式 */ + private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); + + /** * 匹配setter方法的正则表达式 */ + private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); + + /** + * Bean属性复制工具方法。 + * + * @param dest 目标对象 + * @param src 源对象 + */ + public static void copyBeanProp(Object dest, Object src) + { + try + { + copyProperties(src, dest); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * 获取对象的setter方法。 + * + * @param obj 对象 + * @return 对象的setter方法列表 + */ + public static List getSetterMethods(Object obj) + { + // setter方法列表 + List setterMethods = new ArrayList(); + + // 获取所有方法 + Method[] methods = obj.getClass().getMethods(); + + // 查找setter方法 + + for (Method method : methods) + { + Matcher m = SET_PATTERN.matcher(method.getName()); + if (m.matches() && (method.getParameterTypes().length == 1)) + { + setterMethods.add(method); + } + } + // 返回setter方法列表 + return setterMethods; + } + + /** + * 获取对象的getter方法。 + * + * @param obj 对象 + * @return 对象的getter方法列表 + */ + + public static List getGetterMethods(Object obj) + { + // getter方法列表 + List getterMethods = new ArrayList(); + // 获取所有方法 + Method[] methods = obj.getClass().getMethods(); + // 查找getter方法 + for (Method method : methods) + { + Matcher m = GET_PATTERN.matcher(method.getName()); + if (m.matches() && (method.getParameterTypes().length == 0)) + { + getterMethods.add(method); + } + } + // 返回getter方法列表 + return getterMethods; + } + + /** + * 检查Bean方法名中的属性名是否相等。
+ * 如getName()和setName()属性名一样,getName()和setAge()属性名不一样。 + * + * @param m1 方法名1 + * @param m2 方法名2 + * @return 属性名一样返回true,否则返回false + */ + + public static boolean isMethodPropEquals(String m1, String m2) + { + return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/bean/BeanValidators.java b/ktg-common/src/main/java/com/ktg/common/utils/bean/BeanValidators.java new file mode 100644 index 0000000..44e3abf --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/bean/BeanValidators.java @@ -0,0 +1,24 @@ +package com.ktg.common.utils.bean; + +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validator; + +/** + * bean对象属性验证 + * + * @author ruoyi + */ +public class BeanValidators +{ + public static void validateWithException(Validator validator, Object object, Class... groups) + throws ConstraintViolationException + { + Set> constraintViolations = validator.validate(object, groups); + if (!constraintViolations.isEmpty()) + { + throw new ConstraintViolationException(constraintViolations); + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/file/FileTypeUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/file/FileTypeUtils.java new file mode 100644 index 0000000..7b2689e --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/file/FileTypeUtils.java @@ -0,0 +1,76 @@ +package com.ktg.common.utils.file; + +import java.io.File; +import org.apache.commons.lang3.StringUtils; + +/** + * 文件类型工具类 + * + * @author ruoyi + */ +public class FileTypeUtils +{ + /** + * 获取文件类型 + *

+ * 例如: ruoyi.txt, 返回: txt + * + * @param file 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(File file) + { + if (null == file) + { + return StringUtils.EMPTY; + } + return getFileType(file.getName()); + } + + /** + * 获取文件类型 + *

+ * 例如: ruoyi.txt, 返回: txt + * + * @param fileName 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(String fileName) + { + int separatorIndex = fileName.lastIndexOf("."); + if (separatorIndex < 0) + { + return ""; + } + return fileName.substring(separatorIndex + 1).toLowerCase(); + } + + /** + * 获取文件类型 + * + * @param photoByte 文件字节码 + * @return 后缀(不含".") + */ + public static String getFileExtendName(byte[] photoByte) + { + String strFileExtendName = "JPG"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) + { + strFileExtendName = "GIF"; + } + else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) + { + strFileExtendName = "JPG"; + } + else if ((photoByte[0] == 66) && (photoByte[1] == 77)) + { + strFileExtendName = "BMP"; + } + else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) + { + strFileExtendName = "PNG"; + } + return strFileExtendName; + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/utils/file/FileUploadUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/file/FileUploadUtils.java new file mode 100644 index 0000000..f4bcbd0 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/file/FileUploadUtils.java @@ -0,0 +1,307 @@ +package com.ktg.common.utils.file; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Objects; + +import com.ktg.common.config.MinioConfig; +import com.ktg.common.config.RuoYiConfig; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; +import com.ktg.common.constant.Constants; +import com.ktg.common.exception.file.FileNameLengthLimitExceededException; +import com.ktg.common.exception.file.FileSizeLimitExceededException; +import com.ktg.common.exception.file.InvalidExtensionException; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.uuid.Seq; + +/** + * 文件上传工具类 + * + * @author ruoyi + */ +public class FileUploadUtils +{ + /** + * 默认大小 50M + */ + public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + + /** + * 默认的文件名最大长度 100 + */ + public static final int DEFAULT_FILE_NAME_LENGTH = 100; + + /** + * 默认上传的地址 + */ + private static String defaultBaseDir = RuoYiConfig.getProfile(); + + public static void setDefaultBaseDir(String defaultBaseDir) + { + FileUploadUtils.defaultBaseDir = defaultBaseDir; + } + + public static String getDefaultBaseDir() + { + return defaultBaseDir; + } + + + /** + * Minio默认上传的地址 + */ + private static String bucketName = MinioConfig.getBucketName(); + + public static String getBucketName() + { + return bucketName; + } + + /** + * 以默认配置进行文件上传 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String upload(MultipartFile file) throws IOException + { + try + { + return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 根据文件路径上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @return 文件名称 + * @throws IOException + */ + public static final String upload(String baseDir, MultipartFile file) throws IOException + { + try + { + return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 文件上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @param allowedExtension 上传文件类型 + * @return 返回上传成功的文件名 + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws FileNameLengthLimitExceededException 文件名太长 + * @throws IOException 比如读写文件出错时 + * @throws InvalidExtensionException 文件校验异常 + */ + public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, + InvalidExtensionException + { + int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + + assertAllowed(file, allowedExtension); + + String fileName = extractFilename(file); + + String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); + file.transferTo(Paths.get(absPath)); + return getPathFileName(baseDir, fileName); + } + + /** + * 以默认BucketName配置上传到Minio服务器 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String uploadMinio(MultipartFile file) throws IOException + { + try + { + return uploadMinino(getBucketName(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 自定义bucketName配置上传到Minio服务器 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String uploadMinio(MultipartFile file, String bucketName) throws IOException + { + try + { + return uploadMinino(bucketName, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + private static final String uploadMinino(String bucketName, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, + InvalidExtensionException + { + int fileNamelength = file.getOriginalFilename().length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + assertAllowed(file, allowedExtension); + try + { + String fileName = extractFilename(file); + String pathFileName = MinioUtil.uploadFile(bucketName, fileName, file); + return pathFileName; + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + + /** + * 编码文件名 + */ + public static final String extractFilename(MultipartFile file) + { + return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), + FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); + } + + public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException + { + File desc = new File(uploadDir + File.separator + fileName); + + if (!desc.exists()) + { + if (!desc.getParentFile().exists()) + { + desc.getParentFile().mkdirs(); + } + } + return desc; + } + + public static final String getPathFileName(String uploadDir, String fileName) throws IOException + { + int dirLastIndex = RuoYiConfig.getProfile().length() + 1; + String currentDir = StringUtils.substring(uploadDir, dirLastIndex); + return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; + } + + /** + * 文件大小校验 + * + * @param file 上传的文件 + * @return + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws InvalidExtensionException + */ + public static final void assertAllowed(MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, InvalidExtensionException + { + long size = file.getSize(); + if (size > DEFAULT_MAX_SIZE) + { + throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); + } + + String fileName = file.getOriginalFilename(); + String extension = getExtension(file); + if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) + { + if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) + { + throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) + { + throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) + { + throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) + { + throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, + fileName); + } + else + { + throw new InvalidExtensionException(allowedExtension, extension, fileName); + } + } + + } + + /** + * 判断MIME类型是否是允许的MIME类型 + * + * @param extension + * @param allowedExtension + * @return + */ + public static final boolean isAllowedExtension(String extension, String[] allowedExtension) + { + for (String str : allowedExtension) + { + if (str.equalsIgnoreCase(extension)) + { + return true; + } + } + return false; + } + + /** + * 获取文件名的后缀 + * + * @param file 表单文件 + * @return 后缀名 + */ + public static final String getExtension(MultipartFile file) + { + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (StringUtils.isEmpty(extension)) + { + extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType())); + } + return extension; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/file/FileUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/file/FileUtils.java new file mode 100644 index 0000000..3f72c4e --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/file/FileUtils.java @@ -0,0 +1,291 @@ +package com.ktg.common.utils.file; + +import java.io.*; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.ArrayUtils; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.uuid.IdUtils; +import org.springframework.http.MediaType; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +/** + * 文件处理工具类 + * + * @author ruoyi + */ +public class FileUtils +{ + public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; + + /** + * 输出指定文件的byte数组 + * + * @param filePath 文件路径 + * @param os 输出流 + * @return + */ + public static void writeBytes(String filePath, OutputStream os) throws IOException + { + FileInputStream fis = null; + try + { + File file = new File(filePath); + if (!file.exists()) + { + throw new FileNotFoundException(filePath); + } + fis = new FileInputStream(file); + byte[] b = new byte[1024]; + int length; + while ((length = fis.read(b)) > 0) + { + os.write(b, 0, length); + } + } + catch (IOException e) + { + throw e; + } + finally + { + IOUtils.close(os); + IOUtils.close(fis); + } + } + + /** + * 写数据到文件中 + * + * @param data 数据 + * @return 目标文件 + * @throws IOException IO异常 + */ + public static String writeImportBytes(byte[] data) throws IOException + { + return writeBytes(data, RuoYiConfig.getImportPath()); + } + + /** + * 写数据到文件中 + * + * @param data 数据 + * @param uploadDir 目标文件 + * @return 目标文件 + * @throws IOException IO异常 + */ + public static String writeBytes(byte[] data, String uploadDir) throws IOException + { + FileOutputStream fos = null; + String pathName = ""; + try + { + String extension = getFileExtendName(data); + pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; + File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName); + fos = new FileOutputStream(file); + fos.write(data); + } + finally + { + IOUtils.close(fos); + } + return FileUploadUtils.getPathFileName(uploadDir, pathName); + } + + /** + * 删除文件 + * + * @param filePath 文件 + * @return + */ + public static boolean deleteFile(String filePath) + { + boolean flag = false; + File file = new File(filePath); + // 路径为文件且不为空则进行删除 + if (file.isFile() && file.exists()) + { + file.delete(); + flag = true; + } + return flag; + } + + /** + * 文件名称验证 + * + * @param filename 文件名称 + * @return true 正常 false 非法 + */ + public static boolean isValidFilename(String filename) + { + return filename.matches(FILENAME_PATTERN); + } + + /** + * 检查文件是否可下载 + * + * @param resource 需要下载的文件 + * @return true 正常 false 非法 + */ + public static boolean checkAllowDownload(String resource) + { + // 禁止目录上跳级别 + if (StringUtils.contains(resource, "..")) + { + return false; + } + + // 检查允许下载的文件规则 + if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) + { + return true; + } + + // 不在允许下载的文件规则 + return false; + } + + /** + * 下载文件名重新编码 + * + * @param request 请求对象 + * @param fileName 文件名 + * @return 编码后的文件名 + */ + public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException + { + final String agent = request.getHeader("USER-AGENT"); + String filename = fileName; + if (agent.contains("MSIE")) + { + // IE浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + filename = filename.replace("+", " "); + } + else if (agent.contains("Firefox")) + { + // 火狐浏览器 + filename = new String(fileName.getBytes(), "ISO8859-1"); + } + else if (agent.contains("Chrome")) + { + // google浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + else + { + // 其它浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + return filename; + } + + /** + * 下载文件名重新编码 + * + * @param response 响应对象 + * @param realFileName 真实文件名 + */ + public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException + { + String percentEncodedFileName = percentEncode(realFileName); + + StringBuilder contentDispositionValue = new StringBuilder(); + contentDispositionValue.append("attachment; filename=") + .append(percentEncodedFileName) + .append(";") + .append("filename*=") + .append("utf-8''") + .append(percentEncodedFileName); + + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); + response.setHeader("Content-disposition", contentDispositionValue.toString()); + response.setHeader("download-filename", percentEncodedFileName); + } + + /** + * 百分号编码工具方法 + * + * @param s 需要百分号编码的字符串 + * @return 百分号编码后的字符串 + */ + public static String percentEncode(String s) throws UnsupportedEncodingException + { + String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); + return encode.replaceAll("\\+", "%20"); + } + + /** + * 获取图像后缀 + * + * @param photoByte 图像数据 + * @return 后缀名 + */ + public static String getFileExtendName(byte[] photoByte) + { + String strFileExtendName = "jpg"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) + { + strFileExtendName = "gif"; + } + else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) + { + strFileExtendName = "jpg"; + } + else if ((photoByte[0] == 66) && (photoByte[1] == 77)) + { + strFileExtendName = "bmp"; + } + else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) + { + strFileExtendName = "png"; + } + return strFileExtendName; + } + + /** + * 获取名称 + * + * @param fileName 路径名称 + * @return 没有文件路径的名称 + */ + public static String getName(String fileName) + { + if (fileName == null) + { + return null; + } + int lastUnixPos = fileName.lastIndexOf('/'); + int lastWindowsPos = fileName.lastIndexOf('\\'); + int index = Math.max(lastUnixPos, lastWindowsPos); + return fileName.substring(index + 1); + } + + public static MultipartFile getMultipartFile(File file) { + FileItem item = new DiskFileItemFactory().createItem("file" + , MediaType.MULTIPART_FORM_DATA_VALUE + , true + , file.getName()); + try (InputStream input = new FileInputStream(file); + OutputStream os = item.getOutputStream()) { + // 流转移 + IOUtils.copy(input, os); + } catch (Exception e) { + throw new IllegalArgumentException("Invalid file: " + e, e); + } + + return new CommonsMultipartFile(item); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/file/ImageUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/file/ImageUtils.java new file mode 100644 index 0000000..694e062 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/file/ImageUtils.java @@ -0,0 +1,98 @@ +package com.ktg.common.utils.file; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Arrays; +import org.apache.poi.util.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.constant.Constants; +import com.ktg.common.utils.StringUtils; + +/** + * 图片处理工具类 + * + * @author ruoyi + */ +public class ImageUtils +{ + private static final Logger log = LoggerFactory.getLogger(ImageUtils.class); + + public static byte[] getImage(String imagePath) + { + InputStream is = getFile(imagePath); + try + { + return IOUtils.toByteArray(is); + } + catch (Exception e) + { + log.error("图片加载异常 {}", e); + return null; + } + finally + { + IOUtils.closeQuietly(is); + } + } + + public static InputStream getFile(String imagePath) + { + try + { + byte[] result = readFile(imagePath); + result = Arrays.copyOf(result, result.length); + return new ByteArrayInputStream(result); + } + catch (Exception e) + { + log.error("获取图片异常 {}", e); + } + return null; + } + + /** + * 读取文件为字节数据 + * + * @param url 地址 + * @return 字节数据 + */ + public static byte[] readFile(String url) + { + InputStream in = null; + try + { + if (url.startsWith("http")) + { + // 网络地址 + URL urlObj = new URL(url); + URLConnection urlConnection = urlObj.openConnection(); + urlConnection.setConnectTimeout(30 * 1000); + urlConnection.setReadTimeout(60 * 1000); + urlConnection.setDoInput(true); + in = urlConnection.getInputStream(); + } + else + { + // 本机地址 + String localPath = RuoYiConfig.getProfile(); + String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX); + in = new FileInputStream(downloadPath); + } + return IOUtils.toByteArray(in); + } + catch (Exception e) + { + log.error("获取文件路径异常 {}", e); + return null; + } + finally + { + IOUtils.closeQuietly(in); + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/file/MimeTypeUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/file/MimeTypeUtils.java new file mode 100644 index 0000000..47a7149 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/file/MimeTypeUtils.java @@ -0,0 +1,59 @@ +package com.ktg.common.utils.file; + +/** + * 媒体类型工具类 + * + * @author ruoyi + */ +public class MimeTypeUtils +{ + public static final String IMAGE_PNG = "image/png"; + + public static final String IMAGE_JPG = "image/jpg"; + + public static final String IMAGE_JPEG = "image/jpeg"; + + public static final String IMAGE_BMP = "image/bmp"; + + public static final String IMAGE_GIF = "image/gif"; + + public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; + + public static final String[] FLASH_EXTENSION = { "swf", "flv" }; + + public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", + "asf", "rm", "rmvb" }; + + public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + + public static final String[] DEFAULT_ALLOWED_EXTENSION = { + // 图片 + "bmp", "gif", "jpg", "jpeg", "png", + // word excel powerpoint + "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", + // 压缩文件 + "rar", "zip", "gz", "bz2", + // 视频格式 + "mp4", "avi", "rmvb", + // pdf + "pdf" }; + + public static String getExtension(String prefix) + { + switch (prefix) + { + case IMAGE_PNG: + return "png"; + case IMAGE_JPG: + return "jpg"; + case IMAGE_JPEG: + return "jpeg"; + case IMAGE_BMP: + return "bmp"; + case IMAGE_GIF: + return "gif"; + default: + return ""; + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/file/MinioUtil.java b/ktg-common/src/main/java/com/ktg/common/utils/file/MinioUtil.java new file mode 100644 index 0000000..e537a9f --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/file/MinioUtil.java @@ -0,0 +1,38 @@ +package com.ktg.common.utils.file; + +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.spring.SpringUtils; +import io.minio.GetPresignedObjectUrlArgs; +import io.minio.MinioClient; +import io.minio.PutObjectArgs; +import io.minio.http.Method; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.InputStream; + +public class MinioUtil { + /** + * 上传文件 + * + * @param bucketName 桶名称 + * @param fileName + * @throws IOException + */ + public static String uploadFile(String bucketName, String fileName, MultipartFile multipartFile) throws IOException + { + String url = ""; + MinioClient minioClient = SpringUtils.getBean(MinioClient.class); + try (InputStream inputStream = multipartFile.getInputStream()) + { + minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(inputStream, multipartFile.getSize(), -1).contentType(multipartFile.getContentType()).build()); + url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(fileName).method(Method.GET).build()); + url = url.substring(0, url.indexOf('?')); + return ServletUtils.urlDecode(url); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/html/EscapeUtil.java b/ktg-common/src/main/java/com/ktg/common/utils/html/EscapeUtil.java new file mode 100644 index 0000000..7b39af9 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/html/EscapeUtil.java @@ -0,0 +1,167 @@ +package com.ktg.common.utils.html; + +import com.ktg.common.utils.StringUtils; + +/** + * 转义和反转义工具类 + * + * @author ruoyi + */ +public class EscapeUtil +{ + public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; + + private static final char[][] TEXT = new char[64][]; + + static + { + for (int i = 0; i < 64; i++) + { + TEXT[i] = new char[] { (char) i }; + } + + // special HTML characters + TEXT['\''] = "'".toCharArray(); // 单引号 + TEXT['"'] = """.toCharArray(); // 双引号 + TEXT['&'] = "&".toCharArray(); // &符 + TEXT['<'] = "<".toCharArray(); // 小于号 + TEXT['>'] = ">".toCharArray(); // 大于号 + } + + /** + * 转义文本中的HTML字符为安全的字符 + * + * @param text 被转义的文本 + * @return 转义后的文本 + */ + public static String escape(String text) + { + return encode(text); + } + + /** + * 还原被转义的HTML特殊字符 + * + * @param content 包含转义符的HTML内容 + * @return 转换后的字符串 + */ + public static String unescape(String content) + { + return decode(content); + } + + /** + * 清除所有HTML标签,但是不删除标签内的内容 + * + * @param content 文本 + * @return 清除标签后的文本 + */ + public static String clean(String content) + { + return new HTMLFilter().filter(content); + } + + /** + * Escape编码 + * + * @param text 被编码的文本 + * @return 编码后的字符 + */ + private static String encode(String text) + { + if (StringUtils.isEmpty(text)) + { + return StringUtils.EMPTY; + } + + final StringBuilder tmp = new StringBuilder(text.length() * 6); + char c; + for (int i = 0; i < text.length(); i++) + { + c = text.charAt(i); + if (c < 256) + { + tmp.append("%"); + if (c < 16) + { + tmp.append("0"); + } + tmp.append(Integer.toString(c, 16)); + } + else + { + tmp.append("%u"); + if (c <= 0xfff) + { + // issue#I49JU8@Gitee + tmp.append("0"); + } + tmp.append(Integer.toString(c, 16)); + } + } + return tmp.toString(); + } + + /** + * Escape解码 + * + * @param content 被转义的内容 + * @return 解码后的字符串 + */ + public static String decode(String content) + { + if (StringUtils.isEmpty(content)) + { + return content; + } + + StringBuilder tmp = new StringBuilder(content.length()); + int lastPos = 0, pos = 0; + char ch; + while (lastPos < content.length()) + { + pos = content.indexOf("%", lastPos); + if (pos == lastPos) + { + if (content.charAt(pos + 1) == 'u') + { + ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); + tmp.append(ch); + lastPos = pos + 6; + } + else + { + ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); + tmp.append(ch); + lastPos = pos + 3; + } + } + else + { + if (pos == -1) + { + tmp.append(content.substring(lastPos)); + lastPos = content.length(); + } + else + { + tmp.append(content.substring(lastPos, pos)); + lastPos = pos; + } + } + } + return tmp.toString(); + } + + public static void main(String[] args) + { + String html = ""; + String escape = EscapeUtil.escape(html); + // String html = "ipt>alert(\"XSS\")ipt>"; + // String html = "<123"; + // String html = "123>"; + System.out.println("clean: " + EscapeUtil.clean(html)); + System.out.println("escape: " + escape); + System.out.println("unescape: " + EscapeUtil.unescape(escape)); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/html/HTMLFilter.java b/ktg-common/src/main/java/com/ktg/common/utils/html/HTMLFilter.java new file mode 100644 index 0000000..3c59150 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/html/HTMLFilter.java @@ -0,0 +1,570 @@ +package com.ktg.common.utils.html; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * HTML过滤器,用于去除XSS漏洞隐患。 + * + * @author ruoyi + */ +public final class HTMLFilter +{ + /** + * regex flag union representing /si modifiers in php + **/ + private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; + private static final Pattern P_COMMENTS = Pattern.compile("", Pattern.DOTALL); + private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); + private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); + private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); + private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); + private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); + private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); + private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); + private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); + private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); + private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); + private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); + private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); + private static final Pattern P_END_ARROW = Pattern.compile("^>"); + private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_AMP = Pattern.compile("&"); + private static final Pattern P_QUOTE = Pattern.compile("\""); + private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); + private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); + private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); + + // @xxx could grow large... maybe use sesat's ReferenceMap + private static final ConcurrentMap P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); + private static final ConcurrentMap P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); + + /** + * set of allowed html elements, along with allowed attributes for each element + **/ + private final Map> vAllowed; + /** + * counts of open tags for each (allowable) html element + **/ + private final Map vTagCounts = new HashMap<>(); + + /** + * html elements which must always be self-closing (e.g. "") + **/ + private final String[] vSelfClosingTags; + /** + * html elements which must always have separate opening and closing tags (e.g. "") + **/ + private final String[] vNeedClosingTags; + /** + * set of disallowed html elements + **/ + private final String[] vDisallowed; + /** + * attributes which should be checked for valid protocols + **/ + private final String[] vProtocolAtts; + /** + * allowed protocols + **/ + private final String[] vAllowedProtocols; + /** + * tags which should be removed if they contain no content (e.g. "" or "") + **/ + private final String[] vRemoveBlanks; + /** + * entities allowed within html markup + **/ + private final String[] vAllowedEntities; + /** + * flag determining whether comments are allowed in input String. + */ + private final boolean stripComment; + private final boolean encodeQuotes; + /** + * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "" + * becomes " text "). If set to false, unbalanced angle brackets will be html escaped. + */ + private final boolean alwaysMakeTags; + + /** + * Default constructor. + */ + public HTMLFilter() + { + vAllowed = new HashMap<>(); + + final ArrayList a_atts = new ArrayList<>(); + a_atts.add("href"); + a_atts.add("target"); + vAllowed.put("a", a_atts); + + final ArrayList img_atts = new ArrayList<>(); + img_atts.add("src"); + img_atts.add("width"); + img_atts.add("height"); + img_atts.add("alt"); + vAllowed.put("img", img_atts); + + final ArrayList no_atts = new ArrayList<>(); + vAllowed.put("b", no_atts); + vAllowed.put("strong", no_atts); + vAllowed.put("i", no_atts); + vAllowed.put("em", no_atts); + + vSelfClosingTags = new String[] { "img" }; + vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; + vDisallowed = new String[] {}; + vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. + vProtocolAtts = new String[] { "src", "href" }; + vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; + vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; + stripComment = true; + encodeQuotes = true; + alwaysMakeTags = false; + } + + /** + * Map-parameter configurable constructor. + * + * @param conf map containing configuration. keys match field names. + */ + @SuppressWarnings("unchecked") + public HTMLFilter(final Map conf) + { + + assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; + assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; + assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; + assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; + assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; + assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; + assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; + assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; + + vAllowed = Collections.unmodifiableMap((HashMap>) conf.get("vAllowed")); + vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); + vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); + vDisallowed = (String[]) conf.get("vDisallowed"); + vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); + vProtocolAtts = (String[]) conf.get("vProtocolAtts"); + vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); + vAllowedEntities = (String[]) conf.get("vAllowedEntities"); + stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; + encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; + alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; + } + + private void reset() + { + vTagCounts.clear(); + } + + // --------------------------------------------------------------- + // my versions of some PHP library functions + public static String chr(final int decimal) + { + return String.valueOf((char) decimal); + } + + public static String htmlSpecialChars(final String s) + { + String result = s; + result = regexReplace(P_AMP, "&", result); + result = regexReplace(P_QUOTE, """, result); + result = regexReplace(P_LEFT_ARROW, "<", result); + result = regexReplace(P_RIGHT_ARROW, ">", result); + return result; + } + + // --------------------------------------------------------------- + + /** + * given a user submitted input String, filter out any invalid or restricted html. + * + * @param input text (i.e. submitted by a user) than may contain html + * @return "clean" version of input, with only valid, whitelisted html elements allowed + */ + public String filter(final String input) + { + reset(); + String s = input; + + s = escapeComments(s); + + s = balanceHTML(s); + + s = checkTags(s); + + s = processRemoveBlanks(s); + + // s = validateEntities(s); + + return s; + } + + public boolean isAlwaysMakeTags() + { + return alwaysMakeTags; + } + + public boolean isStripComments() + { + return stripComment; + } + + private String escapeComments(final String s) + { + final Matcher m = P_COMMENTS.matcher(s); + final StringBuffer buf = new StringBuffer(); + if (m.find()) + { + final String match = m.group(1); // (.*?) + m.appendReplacement(buf, Matcher.quoteReplacement("")); + } + m.appendTail(buf); + + return buf.toString(); + } + + private String balanceHTML(String s) + { + if (alwaysMakeTags) + { + // + // try and form html + // + s = regexReplace(P_END_ARROW, "", s); + // 不追加结束标签 + s = regexReplace(P_BODY_TO_END, "<$1>", s); + s = regexReplace(P_XML_CONTENT, "$1<$2", s); + + } + else + { + // + // escape stray brackets + // + s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); + s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); + + // + // the last regexp causes '<>' entities to appear + // (we need to do a lookahead assertion so that the last bracket can + // be used in the next pass of the regexp) + // + s = regexReplace(P_BOTH_ARROWS, "", s); + } + + return s; + } + + private String checkTags(String s) + { + Matcher m = P_TAGS.matcher(s); + + final StringBuffer buf = new StringBuffer(); + while (m.find()) + { + String replaceStr = m.group(1); + replaceStr = processTag(replaceStr); + m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); + } + m.appendTail(buf); + + // these get tallied in processTag + // (remember to reset before subsequent calls to filter method) + final StringBuilder sBuilder = new StringBuilder(buf.toString()); + for (String key : vTagCounts.keySet()) + { + for (int ii = 0; ii < vTagCounts.get(key); ii++) + { + sBuilder.append(""); + } + } + s = sBuilder.toString(); + + return s; + } + + private String processRemoveBlanks(final String s) + { + String result = s; + for (String tag : vRemoveBlanks) + { + if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) + { + P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?>")); + } + result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); + if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) + { + P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); + } + result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); + } + + return result; + } + + private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) + { + Matcher m = regex_pattern.matcher(s); + return m.replaceAll(replacement); + } + + private String processTag(final String s) + { + // ending tags + Matcher m = P_END_TAG.matcher(s); + if (m.find()) + { + final String name = m.group(1).toLowerCase(); + if (allowed(name)) + { + if (!inArray(name, vSelfClosingTags)) + { + if (vTagCounts.containsKey(name)) + { + vTagCounts.put(name, vTagCounts.get(name) - 1); + return ""; + } + } + } + } + + // starting tags + m = P_START_TAG.matcher(s); + if (m.find()) + { + final String name = m.group(1).toLowerCase(); + final String body = m.group(2); + String ending = m.group(3); + + // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); + if (allowed(name)) + { + final StringBuilder params = new StringBuilder(); + + final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); + final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); + final List paramNames = new ArrayList<>(); + final List paramValues = new ArrayList<>(); + while (m2.find()) + { + paramNames.add(m2.group(1)); // ([a-z0-9]+) + paramValues.add(m2.group(3)); // (.*?) + } + while (m3.find()) + { + paramNames.add(m3.group(1)); // ([a-z0-9]+) + paramValues.add(m3.group(3)); // ([^\"\\s']+) + } + + String paramName, paramValue; + for (int ii = 0; ii < paramNames.size(); ii++) + { + paramName = paramNames.get(ii).toLowerCase(); + paramValue = paramValues.get(ii); + + // debug( "paramName='" + paramName + "'" ); + // debug( "paramValue='" + paramValue + "'" ); + // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); + + if (allowedAttribute(name, paramName)) + { + if (inArray(paramName, vProtocolAtts)) + { + paramValue = processParamProtocol(paramValue); + } + params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\""); + } + } + + if (inArray(name, vSelfClosingTags)) + { + ending = " /"; + } + + if (inArray(name, vNeedClosingTags)) + { + ending = ""; + } + + if (ending == null || ending.length() < 1) + { + if (vTagCounts.containsKey(name)) + { + vTagCounts.put(name, vTagCounts.get(name) + 1); + } + else + { + vTagCounts.put(name, 1); + } + } + else + { + ending = " /"; + } + return "<" + name + params + ending + ">"; + } + else + { + return ""; + } + } + + // comments + m = P_COMMENT.matcher(s); + if (!stripComment && m.find()) + { + return "<" + m.group() + ">"; + } + + return ""; + } + + private String processParamProtocol(String s) + { + s = decodeEntities(s); + final Matcher m = P_PROTOCOL.matcher(s); + if (m.find()) + { + final String protocol = m.group(1); + if (!inArray(protocol, vAllowedProtocols)) + { + // bad protocol, turn into local anchor link instead + s = "#" + s.substring(protocol.length() + 1); + if (s.startsWith("#//")) + { + s = "#" + s.substring(3); + } + } + } + + return s; + } + + private String decodeEntities(String s) + { + StringBuffer buf = new StringBuffer(); + + Matcher m = P_ENTITY.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.decode(match).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENTITY_UNICODE.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENCODE.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + s = validateEntities(s); + return s; + } + + private String validateEntities(final String s) + { + StringBuffer buf = new StringBuffer(); + + // validate entities throughout the string + Matcher m = P_VALID_ENTITIES.matcher(s); + while (m.find()) + { + final String one = m.group(1); // ([^&;]*) + final String two = m.group(2); // (?=(;|&|$)) + m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); + } + m.appendTail(buf); + + return encodeQuotes(buf.toString()); + } + + private String encodeQuotes(final String s) + { + if (encodeQuotes) + { + StringBuffer buf = new StringBuffer(); + Matcher m = P_VALID_QUOTES.matcher(s); + while (m.find()) + { + final String one = m.group(1); // (>|^) + final String two = m.group(2); // ([^<]+?) + final String three = m.group(3); // (<|$) + // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) + m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); + } + m.appendTail(buf); + return buf.toString(); + } + else + { + return s; + } + } + + private String checkEntity(final String preamble, final String term) + { + + return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; + } + + private boolean isValidEntity(final String entity) + { + return inArray(entity, vAllowedEntities); + } + + private static boolean inArray(final String s, final String[] array) + { + for (String item : array) + { + if (item != null && item.equals(s)) + { + return true; + } + } + return false; + } + + private boolean allowed(final String name) + { + return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); + } + + private boolean allowedAttribute(final String name, final String paramName) + { + return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/utils/http/HttpHelper.java b/ktg-common/src/main/java/com/ktg/common/utils/http/HttpHelper.java new file mode 100644 index 0000000..319ac76 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/http/HttpHelper.java @@ -0,0 +1,55 @@ +package com.ktg.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import javax.servlet.ServletRequest; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 通用http工具封装 + * + * @author ruoyi + */ +public class HttpHelper +{ + private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); + + public static String getBodyString(ServletRequest request) + { + StringBuilder sb = new StringBuilder(); + BufferedReader reader = null; + try (InputStream inputStream = request.getInputStream()) + { + reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); + String line = ""; + while ((line = reader.readLine()) != null) + { + sb.append(line); + } + } + catch (IOException e) + { + LOGGER.warn("getBodyString出现问题!"); + } + finally + { + if (reader != null) + { + try + { + reader.close(); + } + catch (IOException e) + { + LOGGER.error(ExceptionUtils.getMessage(e)); + } + } + } + return sb.toString(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/http/HttpUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/http/HttpUtils.java new file mode 100644 index 0000000..329eadc --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/http/HttpUtils.java @@ -0,0 +1,274 @@ +package com.ktg.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.security.cert.X509Certificate; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ktg.common.constant.Constants; +import com.ktg.common.utils.StringUtils; + +/** + * 通用http发送方法 + * + * @author ruoyi + */ +public class HttpUtils +{ + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url) + { + return sendGet(url, StringUtils.EMPTY); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param) + { + return sendGet(url, param, Constants.UTF8); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @param contentType 编码类型 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param, String contentType) + { + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try + { + String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; + log.info("sendGet - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (in != null) + { + in.close(); + } + } + catch (Exception ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param) + { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try + { + log.info("sendPost - {}", url); + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (out != null) + { + out.close(); + } + if (in != null) + { + in.close(); + } + } + catch (IOException ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + public static String sendSSLPost(String url, String param) + { + StringBuilder result = new StringBuilder(); + String urlNameString = url + "?" + param; + try + { + log.info("sendSSLPost - {}", urlNameString); + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); + URL console = new URL(urlNameString); + HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + + conn.setSSLSocketFactory(sc.getSocketFactory()); + conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); + conn.connect(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String ret = ""; + while ((ret = br.readLine()) != null) + { + if (ret != null && !"".equals(ret.trim())) + { + result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); + } + } + log.info("recv - {}", result); + conn.disconnect(); + br.close(); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); + } + return result.toString(); + } + + private static class TrustAnyTrustManager implements X509TrustManager + { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + { + } + + @Override + public X509Certificate[] getAcceptedIssuers() + { + return new X509Certificate[] {}; + } + } + + private static class TrustAnyHostnameVerifier implements HostnameVerifier + { + @Override + public boolean verify(String hostname, SSLSession session) + { + return true; + } + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/utils/ip/AddressUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/ip/AddressUtils.java new file mode 100644 index 0000000..8367f05 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/ip/AddressUtils.java @@ -0,0 +1,55 @@ +package com.ktg.common.utils.ip; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.alibaba.fastjson.JSONObject; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.constant.Constants; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.http.HttpUtils; + +/** + * 获取地址类 + * + * @author ruoyi + */ +public class AddressUtils +{ + private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); + + // IP地址查询 + public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; + + // 未知地址 + public static final String UNKNOWN = "XX XX"; + + public static String getRealAddressByIP(String ip) + { + // 内网不查询 + if (IpUtils.internalIp(ip)) + { + return "内网IP"; + } + if (RuoYiConfig.isAddressEnabled()) + { + try + { + String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); + if (StringUtils.isEmpty(rspStr)) + { + log.error("获取地理位置异常 {}", ip); + return UNKNOWN; + } + JSONObject obj = JSONObject.parseObject(rspStr); + String region = obj.getString("pro"); + String city = obj.getString("city"); + return String.format("%s %s", region, city); + } + catch (Exception e) + { + log.error("获取地理位置异常 {}", ip); + } + } + return UNKNOWN; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/ip/IpUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/ip/IpUtils.java new file mode 100644 index 0000000..6b44e88 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/ip/IpUtils.java @@ -0,0 +1,264 @@ +package com.ktg.common.utils.ip; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import javax.servlet.http.HttpServletRequest; +import com.ktg.common.utils.StringUtils; + +/** + * 获取IP方法 + * + * @author ruoyi + */ +public class IpUtils +{ + /** + * 获取客户端IP + * + * @param request 请求对象 + * @return IP地址 + */ + public static String getIpAddr(HttpServletRequest request) + { + if (request == null) + { + return "unknown"; + } + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Forwarded-For"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Real-IP"); + } + + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getRemoteAddr(); + } + + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); + } + + /** + * 检查是否为内部IP地址 + * + * @param ip IP地址 + * @return 结果 + */ + public static boolean internalIp(String ip) + { + byte[] addr = textToNumericFormatV4(ip); + return internalIp(addr) || "127.0.0.1".equals(ip); + } + + /** + * 检查是否为内部IP地址 + * + * @param addr byte地址 + * @return 结果 + */ + private static boolean internalIp(byte[] addr) + { + if (StringUtils.isNull(addr) || addr.length < 2) + { + return true; + } + final byte b0 = addr[0]; + final byte b1 = addr[1]; + // 10.x.x.x/8 + final byte SECTION_1 = 0x0A; + // 172.16.x.x/12 + final byte SECTION_2 = (byte) 0xAC; + final byte SECTION_3 = (byte) 0x10; + final byte SECTION_4 = (byte) 0x1F; + // 192.168.x.x/16 + final byte SECTION_5 = (byte) 0xC0; + final byte SECTION_6 = (byte) 0xA8; + switch (b0) + { + case SECTION_1: + return true; + case SECTION_2: + if (b1 >= SECTION_3 && b1 <= SECTION_4) + { + return true; + } + case SECTION_5: + switch (b1) + { + case SECTION_6: + return true; + } + default: + return false; + } + } + + /** + * 将IPv4地址转换成字节 + * + * @param text IPv4地址 + * @return byte 字节 + */ + public static byte[] textToNumericFormatV4(String text) + { + if (text.length() == 0) + { + return null; + } + + byte[] bytes = new byte[4]; + String[] elements = text.split("\\.", -1); + try + { + long l; + int i; + switch (elements.length) + { + case 1: + l = Long.parseLong(elements[0]); + if ((l < 0L) || (l > 4294967295L)) + { + return null; + } + bytes[0] = (byte) (int) (l >> 24 & 0xFF); + bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 2: + l = Integer.parseInt(elements[0]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[0] = (byte) (int) (l & 0xFF); + l = Integer.parseInt(elements[1]); + if ((l < 0L) || (l > 16777215L)) + { + return null; + } + bytes[1] = (byte) (int) (l >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 3: + for (i = 0; i < 2; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + l = Integer.parseInt(elements[2]); + if ((l < 0L) || (l > 65535L)) + { + return null; + } + bytes[2] = (byte) (int) (l >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 4: + for (i = 0; i < 4; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + break; + default: + return null; + } + } + catch (NumberFormatException e) + { + return null; + } + return bytes; + } + + /** + * 获取IP地址 + * + * @return 本地IP地址 + */ + public static String getHostIp() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + } + return "127.0.0.1"; + } + + /** + * 获取主机名 + * + * @return 本地主机名 + */ + public static String getHostName() + { + try + { + return InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + } + return "未知"; + } + + /** + * 从多级反向代理中获得第一个非unknown IP地址 + * + * @param ip 获得的IP地址 + * @return 第一个非unknown IP地址 + */ + public static String getMultistageReverseProxyIp(String ip) + { + // 多级反向代理检测 + if (ip != null && ip.indexOf(",") > 0) + { + final String[] ips = ip.trim().split(","); + for (String subIp : ips) + { + if (false == isUnknown(subIp)) + { + ip = subIp; + break; + } + } + } + return ip; + } + + /** + * 检测给定字符串是否为未知,多用于检测HTTP请求相关 + * + * @param checkString 被检测的字符串 + * @return 是否未知 + */ + public static boolean isUnknown(String checkString) + { + return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); + } +} \ No newline at end of file diff --git a/ktg-common/src/main/java/com/ktg/common/utils/poi/ExcelHandlerAdapter.java b/ktg-common/src/main/java/com/ktg/common/utils/poi/ExcelHandlerAdapter.java new file mode 100644 index 0000000..4bc0537 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/poi/ExcelHandlerAdapter.java @@ -0,0 +1,19 @@ +package com.ktg.common.utils.poi; + +/** + * Excel数据格式处理适配器 + * + * @author ruoyi + */ +public interface ExcelHandlerAdapter +{ + /** + * 格式化 + * + * @param value 单元格数据值 + * @param args excel注解args参数组 + * + * @return 处理后的值 + */ + Object format(Object value, String[] args); +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/poi/ExcelUtil.java b/ktg-common/src/main/java/com/ktg/common/utils/poi/ExcelUtil.java new file mode 100644 index 0000000..1d577e7 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/poi/ExcelUtil.java @@ -0,0 +1,1408 @@ +package com.ktg.common.utils.poi; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang3.RegExUtils; +import org.apache.poi.hssf.usermodel.HSSFClientAnchor; +import org.apache.poi.hssf.usermodel.HSSFPicture; +import org.apache.poi.hssf.usermodel.HSSFPictureData; +import org.apache.poi.hssf.usermodel.HSSFShape; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ooxml.POIXMLDocumentPart; +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.apache.poi.ss.usermodel.DataValidation; +import org.apache.poi.ss.usermodel.DataValidationConstraint; +import org.apache.poi.ss.usermodel.DataValidationHelper; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.PictureData; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.util.IOUtils; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; +import org.apache.poi.xssf.usermodel.XSSFDataValidation; +import org.apache.poi.xssf.usermodel.XSSFDrawing; +import org.apache.poi.xssf.usermodel.XSSFPicture; +import org.apache.poi.xssf.usermodel.XSSFShape; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.annotation.Excel.Type; +import com.ktg.common.annotation.Excels; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.text.Convert; +import com.ktg.common.exception.UtilException; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.DictUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.file.FileTypeUtils; +import com.ktg.common.utils.file.FileUtils; +import com.ktg.common.utils.file.ImageUtils; +import com.ktg.common.utils.reflect.ReflectUtils; + +/** + * Excel相关处理 + * + * @author ruoyi + */ +public class ExcelUtil +{ + private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); + + public static final String FORMULA_REGEX_STR = "=|-|\\+|@"; + + public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; + + /** + * Excel sheet最大行数,默认65536 + */ + public static final int sheetSize = 65536; + + /** + * 工作表名称 + */ + private String sheetName; + + /** + * 导出类型(EXPORT:导出数据;IMPORT:导入模板) + */ + private Type type; + + /** + * 工作薄对象 + */ + private Workbook wb; + + /** + * 工作表对象 + */ + private Sheet sheet; + + /** + * 样式列表 + */ + private Map styles; + + /** + * 导入导出数据列表 + */ + private List list; + + /** + * 注解列表 + */ + private List fields; + + /** + * 当前行号 + */ + private int rownum; + + /** + * 标题 + */ + private String title; + + /** + * 最大高度 + */ + private short maxHeight; + + /** + * 统计列表 + */ + private Map statistics = new HashMap(); + + /** + * 数字格式 + */ + private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00"); + + /** + * 实体对象 + */ + public Class clazz; + + public ExcelUtil(Class clazz) + { + this.clazz = clazz; + } + + public void init(List list, String sheetName, String title, Type type) + { + if (list == null) + { + list = new ArrayList(); + } + this.list = list; + this.sheetName = sheetName; + this.type = type; + this.title = title; + createExcelField(); + createWorkbook(); + createTitle(); + } + + /** + * 创建excel第一行标题 + */ + public void createTitle() + { + if (StringUtils.isNotEmpty(title)) + { + Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0); + titleRow.setHeightInPoints(30); + Cell titleCell = titleRow.createCell(0); + titleCell.setCellStyle(styles.get("title")); + titleCell.setCellValue(title); + sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(), + this.fields.size() - 1)); + } + } + + /** + * 对excel表单默认第一个索引名转换成list + * + * @param is 输入流 + * @return 转换后集合 + */ + public List importExcel(InputStream is) throws Exception + { + return importExcel(is, 0); + } + + /** + * 对excel表单默认第一个索引名转换成list + * + * @param is 输入流 + * @param titleNum 标题占用行数 + * @return 转换后集合 + */ + public List importExcel(InputStream is, int titleNum) throws Exception + { + return importExcel(StringUtils.EMPTY, is, titleNum); + } + + /** + * 对excel表单指定表格索引名转换成list + * + * @param sheetName 表格索引名 + * @param titleNum 标题占用行数 + * @param is 输入流 + * @return 转换后集合 + */ + public List importExcel(String sheetName, InputStream is, int titleNum) throws Exception + { + this.type = Type.IMPORT; + this.wb = WorkbookFactory.create(is); + List list = new ArrayList(); + // 如果指定sheet名,则取指定sheet中的内容 否则默认指向第1个sheet + Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0); + if (sheet == null) + { + throw new IOException("文件sheet不存在"); + } + boolean isXSSFWorkbook = !(wb instanceof HSSFWorkbook); + Map pictures; + if (isXSSFWorkbook) + { + pictures = getSheetPictures07((XSSFSheet) sheet, (XSSFWorkbook) wb); + } + else + { + pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb); + } + // 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1 + int rows = sheet.getLastRowNum(); + + if (rows > 0) + { + // 定义一个map用于存放excel列的序号和field. + Map cellMap = new HashMap(); + // 获取表头 + Row heard = sheet.getRow(titleNum); + for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) + { + Cell cell = heard.getCell(i); + if (StringUtils.isNotNull(cell)) + { + String value = this.getCellValue(heard, i).toString(); + cellMap.put(value, i); + } + else + { + cellMap.put(null, i); + } + } + // 有数据时才处理 得到类的所有field. + List fields = this.getFields(); + Map fieldsMap = new HashMap(); + for (Object[] objects : fields) + { + Excel attr = (Excel) objects[1]; + Integer column = cellMap.get(attr.name()); + if (column != null) + { + fieldsMap.put(column, objects); + } + } + for (int i = titleNum + 1; i <= rows; i++) + { + // 从第2行开始取数据,默认第一行是表头. + Row row = sheet.getRow(i); + // 判断当前行是否是空行 + if (isRowEmpty(row)) + { + continue; + } + T entity = null; + for (Map.Entry entry : fieldsMap.entrySet()) + { + Object val = this.getCellValue(row, entry.getKey()); + + // 如果不存在实例则新建. + entity = (entity == null ? clazz.newInstance() : entity); + // 从map中得到对应列的field. + Field field = (Field) entry.getValue()[0]; + Excel attr = (Excel) entry.getValue()[1]; + // 取得类型,并根据对象类型设置值. + Class fieldType = field.getType(); + if (String.class == fieldType) + { + String s = Convert.toStr(val); + if (StringUtils.endsWith(s, ".0")) + { + val = StringUtils.substringBefore(s, ".0"); + } + else + { + String dateFormat = field.getAnnotation(Excel.class).dateFormat(); + if (StringUtils.isNotEmpty(dateFormat)) + { + val = parseDateToStr(dateFormat, val); + } + else + { + val = Convert.toStr(val); + } + } + } + else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) + { + val = Convert.toInt(val); + } + else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) + { + val = Convert.toLong(val); + } + else if (Double.TYPE == fieldType || Double.class == fieldType) + { + val = Convert.toDouble(val); + } + else if (Float.TYPE == fieldType || Float.class == fieldType) + { + val = Convert.toFloat(val); + } + else if (BigDecimal.class == fieldType) + { + val = Convert.toBigDecimal(val); + } + else if (Date.class == fieldType) + { + if (val instanceof String) + { + val = DateUtils.parseDate(val); + } + else if (val instanceof Double) + { + val = DateUtil.getJavaDate((Double) val); + } + } + else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) + { + val = Convert.toBool(val, false); + } + if (StringUtils.isNotNull(fieldType)) + { + String propertyName = field.getName(); + if (StringUtils.isNotEmpty(attr.targetAttr())) + { + propertyName = field.getName() + "." + attr.targetAttr(); + } + else if (StringUtils.isNotEmpty(attr.readConverterExp())) + { + val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); + } + else if (StringUtils.isNotEmpty(attr.dictType())) + { + val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator()); + } + else if (!attr.handler().equals(ExcelHandlerAdapter.class)) + { + val = dataFormatHandlerAdapter(val, attr); + } + else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures)) + { + PictureData image = pictures.get(row.getRowNum() + "_" + entry.getKey()); + if (image == null) + { + val = ""; + } + else + { + byte[] data = image.getData(); + val = FileUtils.writeImportBytes(data); + } + } + ReflectUtils.invokeSetter(entity, propertyName, val); + } + } + list.add(entity); + } + } + return list; + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @return 结果 + */ + public AjaxResult exportExcel(List list, String sheetName) + { + return exportExcel(list, sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public AjaxResult exportExcel(List list, String sheetName, String title) + { + this.init(list, sheetName, title, Type.EXPORT); + return exportExcel(); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param response 返回数据 + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @return 结果 + */ + public void exportExcel(HttpServletResponse response, List list, String sheetName) + { + exportExcel(response, list, sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param response 返回数据 + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public void exportExcel(HttpServletResponse response, List list, String sheetName, String title) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + this.init(list, sheetName, title, Type.EXPORT); + exportExcel(response); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @return 结果 + */ + public AjaxResult importTemplateExcel(String sheetName) + { + return importTemplateExcel(sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public AjaxResult importTemplateExcel(String sheetName, String title) + { + this.init(null, sheetName, title, Type.IMPORT); + return exportExcel(); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @return 结果 + */ + public void importTemplateExcel(HttpServletResponse response, String sheetName) + { + importTemplateExcel(response, sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + this.init(null, sheetName, title, Type.IMPORT); + exportExcel(response); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @return 结果 + */ + public void exportExcel(HttpServletResponse response) + { + try + { + writeSheet(); + wb.write(response.getOutputStream()); + } + catch (Exception e) + { + log.error("导出Excel异常{}", e.getMessage()); + } + finally + { + IOUtils.closeQuietly(wb); + } + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @return 结果 + */ + public AjaxResult exportExcel() + { + OutputStream out = null; + try + { + writeSheet(); + String filename = encodingFilename(sheetName); + out = new FileOutputStream(getAbsoluteFile(filename)); + wb.write(out); + return AjaxResult.success(filename); + } + catch (Exception e) + { + log.error("导出Excel异常{}", e.getMessage()); + throw new UtilException("导出Excel失败,请联系网站管理员!"); + } + finally + { + IOUtils.closeQuietly(wb); + IOUtils.closeQuietly(out); + } + } + + /** + * 创建写入数据到Sheet + */ + public void writeSheet() + { + // 取出一共有多少个sheet. + int sheetNo = Math.max(1, (int) Math.ceil(list.size() * 1.0 / sheetSize)); + for (int index = 0; index < sheetNo; index++) + { + createSheet(sheetNo, index); + + // 产生一行 + Row row = sheet.createRow(rownum); + int column = 0; + // 写入各个字段的列头名称 + for (Object[] os : fields) + { + Excel excel = (Excel) os[1]; + this.createCell(excel, row, column++); + } + if (Type.EXPORT.equals(type)) + { + fillExcelData(index, row); + addStatisticsRow(); + } + } + } + + /** + * 填充excel数据 + * + * @param index 序号 + * @param row 单元格行 + */ + public void fillExcelData(int index, Row row) + { + int startNo = index * sheetSize; + int endNo = Math.min(startNo + sheetSize, list.size()); + for (int i = startNo; i < endNo; i++) + { + row = sheet.createRow(i + 1 + rownum - startNo); + // 得到导出对象. + T vo = (T) list.get(i); + int column = 0; + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + this.addCell(excel, row, vo, field, column++); + } + } + } + + /** + * 创建表格样式 + * + * @param wb 工作薄对象 + * @return 样式列表 + */ + private Map createStyles(Workbook wb) + { + // 写入各条记录,每条记录对应excel表中的一行 + Map styles = new HashMap(); + CellStyle style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font titleFont = wb.createFont(); + titleFont.setFontName("Arial"); + titleFont.setFontHeightInPoints((short) 16); + titleFont.setBold(true); + style.setFont(titleFont); + styles.put("title", style); + + style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setBorderRight(BorderStyle.THIN); + style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderLeft(BorderStyle.THIN); + style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderTop(BorderStyle.THIN); + style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderBottom(BorderStyle.THIN); + style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + Font dataFont = wb.createFont(); + dataFont.setFontName("Arial"); + dataFont.setFontHeightInPoints((short) 10); + style.setFont(dataFont); + styles.put("data", style); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + Font headerFont = wb.createFont(); + headerFont.setFontName("Arial"); + headerFont.setFontHeightInPoints((short) 10); + headerFont.setBold(true); + headerFont.setColor(IndexedColors.WHITE.getIndex()); + style.setFont(headerFont); + styles.put("header", style); + + style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font totalFont = wb.createFont(); + totalFont.setFontName("Arial"); + totalFont.setFontHeightInPoints((short) 10); + style.setFont(totalFont); + styles.put("total", style); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.LEFT); + styles.put("data1", style); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.CENTER); + styles.put("data2", style); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.RIGHT); + styles.put("data3", style); + + return styles; + } + + /** + * 创建单元格 + */ + public Cell createCell(Excel attr, Row row, int column) + { + // 创建列 + Cell cell = row.createCell(column); + // 写入列信息 + cell.setCellValue(attr.name()); + setDataValidation(attr, row, column); + cell.setCellStyle(styles.get("header")); + return cell; + } + + /** + * 设置单元格信息 + * + * @param value 单元格值 + * @param attr 注解相关 + * @param cell 单元格信息 + */ + public void setCellVo(Object value, Excel attr, Cell cell) + { + if (ColumnType.STRING == attr.cellType()) + { + String cellValue = Convert.toStr(value); + // 对于任何以表达式触发字符 =-+@开头的单元格,直接使用tab字符作为前缀,防止CSV注入。 + if (StringUtils.startsWithAny(cellValue, FORMULA_STR)) + { + cellValue = RegExUtils.replaceFirst(cellValue, FORMULA_REGEX_STR, "\t$0"); + } + cell.setCellValue(StringUtils.isNull(cellValue) ? attr.defaultValue() : cellValue + attr.suffix()); + } + else if (ColumnType.NUMERIC == attr.cellType()) + { + if (StringUtils.isNotNull(value)) + { + cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); + } + } + else if (ColumnType.IMAGE == attr.cellType()) + { + ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1); + String imagePath = Convert.toStr(value); + if (StringUtils.isNotEmpty(imagePath)) + { + byte[] data = ImageUtils.getImage(imagePath); + getDrawingPatriarch(cell.getSheet()).createPicture(anchor, + cell.getSheet().getWorkbook().addPicture(data, getImageType(data))); + } + } + } + + /** + * 获取画布 + */ + public static Drawing getDrawingPatriarch(Sheet sheet) + { + if (sheet.getDrawingPatriarch() == null) + { + sheet.createDrawingPatriarch(); + } + return sheet.getDrawingPatriarch(); + } + + /** + * 获取图片类型,设置图片插入类型 + */ + public int getImageType(byte[] value) + { + String type = FileTypeUtils.getFileExtendName(value); + if ("JPG".equalsIgnoreCase(type)) + { + return Workbook.PICTURE_TYPE_JPEG; + } + else if ("PNG".equalsIgnoreCase(type)) + { + return Workbook.PICTURE_TYPE_PNG; + } + return Workbook.PICTURE_TYPE_JPEG; + } + + /** + * 创建表格样式 + */ + public void setDataValidation(Excel attr, Row row, int column) + { + if (attr.name().indexOf("注:") >= 0) + { + sheet.setColumnWidth(column, 6000); + } + else + { + // 设置列宽 + sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); + } + if (StringUtils.isNotEmpty(attr.prompt()) || attr.combo().length > 0) + { + // 提示信息或只能选择不能输入的列内容. + setPromptOrValidation(sheet, attr.combo(), attr.prompt(), 1, 100, column, column); + } + } + + /** + * 添加单元格 + */ + public Cell addCell(Excel attr, Row row, T vo, Field field, int column) + { + Cell cell = null; + try + { + // 设置行高 + row.setHeight(maxHeight); + // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. + if (attr.isExport()) + { + // 创建cell + cell = row.createCell(column); + int align = attr.align().value(); + cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : ""))); + + // 用于读取对象中的属性 + Object value = getTargetValue(vo, field, attr); + String dateFormat = attr.dateFormat(); + String readConverterExp = attr.readConverterExp(); + String separator = attr.separator(); + String dictType = attr.dictType(); + if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) + { + cell.setCellValue(parseDateToStr(dateFormat, value)); + } + else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) + { + cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); + } + else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) + { + cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator)); + } + else if (value instanceof BigDecimal && -1 != attr.scale()) + { + cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString()); + } + else if (!attr.handler().equals(ExcelHandlerAdapter.class)) + { + cell.setCellValue(dataFormatHandlerAdapter(value, attr)); + } + else + { + // 设置列类型 + setCellVo(value, attr, cell); + } + addStatisticsData(column, Convert.toStr(value), attr); + } + } + catch (Exception e) + { + log.error("导出Excel失败{}", e); + } + return cell; + } + + /** + * 设置 POI XSSFSheet 单元格提示或选择框 + * + * @param sheet 表单 + * @param textlist 下拉框显示的内容 + * @param promptContent 提示内容 + * @param firstRow 开始行 + * @param endRow 结束行 + * @param firstCol 开始列 + * @param endCol 结束列 + */ + public void setPromptOrValidation(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, + int firstCol, int endCol) + { + DataValidationHelper helper = sheet.getDataValidationHelper(); + DataValidationConstraint constraint = textlist.length > 0 ? helper.createExplicitListConstraint(textlist) : helper.createCustomConstraint("DD1"); + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + DataValidation dataValidation = helper.createValidation(constraint, regions); + if (StringUtils.isNotEmpty(promptContent)) + { + // 如果设置了提示信息则鼠标放上去提示 + dataValidation.createPromptBox("", promptContent); + dataValidation.setShowPromptBox(true); + } + // 处理Excel兼容性问题 + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + sheet.addValidationData(dataValidation); + } + + /** + * 解析导出值 0=男,1=女,2=未知 + * + * @param propertyValue 参数值 + * @param converterExp 翻译注解 + * @param separator 分隔符 + * @return 解析后值 + */ + public static String convertByExp(String propertyValue, String converterExp, String separator) + { + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) + { + String[] itemArray = item.split("="); + if (StringUtils.containsAny(separator, propertyValue)) + { + for (String value : propertyValue.split(separator)) + { + if (itemArray[0].equals(value)) + { + propertyString.append(itemArray[1] + separator); + break; + } + } + } + else + { + if (itemArray[0].equals(propertyValue)) + { + return itemArray[1]; + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 反向解析值 男=0,女=1,未知=2 + * + * @param propertyValue 参数值 + * @param converterExp 翻译注解 + * @param separator 分隔符 + * @return 解析后值 + */ + public static String reverseByExp(String propertyValue, String converterExp, String separator) + { + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) + { + String[] itemArray = item.split("="); + if (StringUtils.containsAny(separator, propertyValue)) + { + for (String value : propertyValue.split(separator)) + { + if (itemArray[1].equals(value)) + { + propertyString.append(itemArray[0] + separator); + break; + } + } + } + else + { + if (itemArray[1].equals(propertyValue)) + { + return itemArray[0]; + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 解析字典值 + * + * @param dictValue 字典值 + * @param dictType 字典类型 + * @param separator 分隔符 + * @return 字典标签 + */ + public static String convertDictByExp(String dictValue, String dictType, String separator) + { + return DictUtils.getDictLabel(dictType, dictValue, separator); + } + + /** + * 反向解析值字典值 + * + * @param dictLabel 字典标签 + * @param dictType 字典类型 + * @param separator 分隔符 + * @return 字典值 + */ + public static String reverseDictByExp(String dictLabel, String dictType, String separator) + { + return DictUtils.getDictValue(dictType, dictLabel, separator); + } + + /** + * 数据处理器 + * + * @param value 数据值 + * @param excel 数据注解 + * @return + */ + public String dataFormatHandlerAdapter(Object value, Excel excel) + { + try + { + Object instance = excel.handler().newInstance(); + Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class }); + value = formatMethod.invoke(instance, value, excel.args()); + } + catch (Exception e) + { + log.error("不能格式化数据 " + excel.handler(), e.getMessage()); + } + return Convert.toStr(value); + } + + /** + * 合计统计信息 + */ + private void addStatisticsData(Integer index, String text, Excel entity) + { + if (entity != null && entity.isStatistics()) + { + Double temp = 0D; + if (!statistics.containsKey(index)) + { + statistics.put(index, temp); + } + try + { + temp = Double.valueOf(text); + } + catch (NumberFormatException e) + { + } + statistics.put(index, statistics.get(index) + temp); + } + } + + /** + * 创建统计行 + */ + public void addStatisticsRow() + { + if (statistics.size() > 0) + { + Row row = sheet.createRow(sheet.getLastRowNum() + 1); + Set keys = statistics.keySet(); + Cell cell = row.createCell(0); + cell.setCellStyle(styles.get("total")); + cell.setCellValue("合计"); + + for (Integer key : keys) + { + cell = row.createCell(key); + cell.setCellStyle(styles.get("total")); + cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key))); + } + statistics.clear(); + } + } + + /** + * 编码文件名 + */ + public String encodingFilename(String filename) + { + filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; + return filename; + } + + /** + * 获取下载路径 + * + * @param filename 文件名称 + */ + public String getAbsoluteFile(String filename) + { + String downloadPath = RuoYiConfig.getDownloadPath() + filename; + File desc = new File(downloadPath); + if (!desc.getParentFile().exists()) + { + desc.getParentFile().mkdirs(); + } + return downloadPath; + } + + /** + * 获取bean中的属性值 + * + * @param vo 实体对象 + * @param field 字段 + * @param excel 注解 + * @return 最终的属性值 + * @throws Exception + */ + private Object getTargetValue(T vo, Field field, Excel excel) throws Exception + { + Object o = field.get(vo); + if (StringUtils.isNotEmpty(excel.targetAttr())) + { + String target = excel.targetAttr(); + if (target.contains(".")) + { + String[] targets = target.split("[.]"); + for (String name : targets) + { + o = getValue(o, name); + } + } + else + { + o = getValue(o, target); + } + } + return o; + } + + /** + * 以类的属性的get方法方法形式获取值 + * + * @param o + * @param name + * @return value + * @throws Exception + */ + private Object getValue(Object o, String name) throws Exception + { + if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) + { + Class clazz = o.getClass(); + Field field = clazz.getDeclaredField(name); + field.setAccessible(true); + o = field.get(o); + } + return o; + } + + /** + * 得到所有定义字段 + */ + private void createExcelField() + { + this.fields = getFields(); + this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); + this.maxHeight = getRowHeight(); + } + + /** + * 获取字段注解信息 + */ + public List getFields() + { + List fields = new ArrayList(); + List tempFields = new ArrayList<>(); + tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); + tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); + for (Field field : tempFields) + { + // 单注解 + if (field.isAnnotationPresent(Excel.class)) + { + Excel attr = field.getAnnotation(Excel.class); + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) + { + field.setAccessible(true); + fields.add(new Object[] { field, attr }); + } + } + + // 多注解 + if (field.isAnnotationPresent(Excels.class)) + { + Excels attrs = field.getAnnotation(Excels.class); + Excel[] excels = attrs.value(); + for (Excel attr : excels) + { + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) + { + field.setAccessible(true); + fields.add(new Object[] { field, attr }); + } + } + } + } + return fields; + } + + /** + * 根据注解获取最大行高 + */ + public short getRowHeight() + { + double maxHeight = 0; + for (Object[] os : this.fields) + { + Excel excel = (Excel) os[1]; + maxHeight = Math.max(maxHeight, excel.height()); + } + return (short) (maxHeight * 20); + } + + /** + * 创建一个工作簿 + */ + public void createWorkbook() + { + this.wb = new SXSSFWorkbook(500); + this.sheet = wb.createSheet(); + wb.setSheetName(0, sheetName); + this.styles = createStyles(wb); + } + + /** + * 创建工作表 + * + * @param sheetNo sheet数量 + * @param index 序号 + */ + public void createSheet(int sheetNo, int index) + { + // 设置工作表的名称. + if (sheetNo > 1 && index > 0) + { + this.sheet = wb.createSheet(); + this.createTitle(); + wb.setSheetName(index, sheetName + index); + } + } + + /** + * 获取单元格值 + * + * @param row 获取的行 + * @param column 获取单元格列号 + * @return 单元格值 + */ + public Object getCellValue(Row row, int column) + { + if (row == null) + { + return row; + } + Object val = ""; + try + { + Cell cell = row.getCell(column); + if (StringUtils.isNotNull(cell)) + { + if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) + { + val = cell.getNumericCellValue(); + if (DateUtil.isCellDateFormatted(cell)) + { + val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 + } + else + { + if ((Double) val % 1 != 0) + { + val = new BigDecimal(val.toString()); + } + else + { + val = new DecimalFormat("0").format(val); + } + } + } + else if (cell.getCellType() == CellType.STRING) + { + val = cell.getStringCellValue(); + } + else if (cell.getCellType() == CellType.BOOLEAN) + { + val = cell.getBooleanCellValue(); + } + else if (cell.getCellType() == CellType.ERROR) + { + val = cell.getErrorCellValue(); + } + + } + } + catch (Exception e) + { + return val; + } + return val; + } + + /** + * 判断是否是空行 + * + * @param row 判断的行 + * @return + */ + private boolean isRowEmpty(Row row) + { + if (row == null) + { + return true; + } + for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) + { + Cell cell = row.getCell(i); + if (cell != null && cell.getCellType() != CellType.BLANK) + { + return false; + } + } + return true; + } + + /** + * 获取Excel2003图片 + * + * @param sheet 当前sheet对象 + * @param workbook 工作簿对象 + * @return Map key:图片单元格索引(1_1)String,value:图片流PictureData + */ + public static Map getSheetPictures03(HSSFSheet sheet, HSSFWorkbook workbook) + { + Map sheetIndexPicMap = new HashMap(); + List pictures = workbook.getAllPictures(); + if (!pictures.isEmpty()) + { + for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) + { + HSSFClientAnchor anchor = (HSSFClientAnchor) shape.getAnchor(); + if (shape instanceof HSSFPicture) + { + HSSFPicture pic = (HSSFPicture) shape; + int pictureIndex = pic.getPictureIndex() - 1; + HSSFPictureData picData = pictures.get(pictureIndex); + String picIndex = String.valueOf(anchor.getRow1()) + "_" + String.valueOf(anchor.getCol1()); + sheetIndexPicMap.put(picIndex, picData); + } + } + return sheetIndexPicMap; + } + else + { + return sheetIndexPicMap; + } + } + + /** + * 获取Excel2007图片 + * + * @param sheet 当前sheet对象 + * @param workbook 工作簿对象 + * @return Map key:图片单元格索引(1_1)String,value:图片流PictureData + */ + public static Map getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook) + { + Map sheetIndexPicMap = new HashMap(); + for (POIXMLDocumentPart dr : sheet.getRelations()) + { + if (dr instanceof XSSFDrawing) + { + XSSFDrawing drawing = (XSSFDrawing) dr; + List shapes = drawing.getShapes(); + for (XSSFShape shape : shapes) + { + if (shape instanceof XSSFPicture) + { + XSSFPicture pic = (XSSFPicture) shape; + XSSFClientAnchor anchor = pic.getPreferredSize(); + CTMarker ctMarker = anchor.getFrom(); + String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol(); + sheetIndexPicMap.put(picIndex, pic.getPictureData()); + } + } + } + } + return sheetIndexPicMap; + } + + /** + * 格式化不同类型的日期对象 + * + * @param dateFormat 日期格式 + * @param val 被格式化的日期对象 + * @return 格式化后的日期字符 + */ + public String parseDateToStr(String dateFormat, Object val) + { + if (val == null) + { + return ""; + } + String str; + if (val instanceof Date) + { + str = DateUtils.parseDateToStr(dateFormat, (Date) val); + } + else if (val instanceof LocalDateTime) + { + str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val)); + } + else if (val instanceof LocalDate) + { + str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val)); + } + else + { + str = val.toString(); + } + return str; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/reflect/ReflectUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/reflect/ReflectUtils.java new file mode 100644 index 0000000..3dfa3da --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/reflect/ReflectUtils.java @@ -0,0 +1,410 @@ +package com.ktg.common.utils.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Date; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.usermodel.DateUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ktg.common.core.text.Convert; +import com.ktg.common.utils.DateUtils; + +/** + * 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数. + * + * @author ruoyi + */ +@SuppressWarnings("rawtypes") +public class ReflectUtils +{ + private static final String SETTER_PREFIX = "set"; + + private static final String GETTER_PREFIX = "get"; + + private static final String CGLIB_CLASS_SEPARATOR = "$$"; + + private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); + + /** + * 调用Getter方法. + * 支持多级,如:对象名.对象名.方法 + */ + @SuppressWarnings("unchecked") + public static E invokeGetter(Object obj, String propertyName) + { + Object object = obj; + for (String name : StringUtils.split(propertyName, ".")) + { + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); + } + return (E) object; + } + + /** + * 调用Setter方法, 仅匹配方法名。 + * 支持多级,如:对象名.对象名.方法 + */ + public static void invokeSetter(Object obj, String propertyName, E value) + { + Object object = obj; + String[] names = StringUtils.split(propertyName, "."); + for (int i = 0; i < names.length; i++) + { + if (i < names.length - 1) + { + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); + } + else + { + String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); + invokeMethodByName(object, setterMethodName, new Object[] { value }); + } + } + } + + /** + * 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数. + */ + @SuppressWarnings("unchecked") + public static E getFieldValue(final Object obj, final String fieldName) + { + Field field = getAccessibleField(obj, fieldName); + if (field == null) + { + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); + return null; + } + E result = null; + try + { + result = (E) field.get(obj); + } + catch (IllegalAccessException e) + { + logger.error("不可能抛出的异常{}", e.getMessage()); + } + return result; + } + + /** + * 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数. + */ + public static void setFieldValue(final Object obj, final String fieldName, final E value) + { + Field field = getAccessibleField(obj, fieldName); + if (field == null) + { + // throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); + return; + } + try + { + field.set(obj, value); + } + catch (IllegalAccessException e) + { + logger.error("不可能抛出的异常: {}", e.getMessage()); + } + } + + /** + * 直接调用对象方法, 无视private/protected修饰符. + * 用于一次性调用的情况,否则应使用getAccessibleMethod()函数获得Method后反复调用. + * 同时匹配方法名+参数类型, + */ + @SuppressWarnings("unchecked") + public static E invokeMethod(final Object obj, final String methodName, final Class[] parameterTypes, + final Object[] args) + { + if (obj == null || methodName == null) + { + return null; + } + Method method = getAccessibleMethod(obj, methodName, parameterTypes); + if (method == null) + { + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); + return null; + } + try + { + return (E) method.invoke(obj, args); + } + catch (Exception e) + { + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; + throw convertReflectionExceptionToUnchecked(msg, e); + } + } + + /** + * 直接调用对象方法, 无视private/protected修饰符, + * 用于一次性调用的情况,否则应使用getAccessibleMethodByName()函数获得Method后反复调用. + * 只匹配函数名,如果有多个同名函数调用第一个。 + */ + @SuppressWarnings("unchecked") + public static E invokeMethodByName(final Object obj, final String methodName, final Object[] args) + { + Method method = getAccessibleMethodByName(obj, methodName, args.length); + if (method == null) + { + // 如果为空不报错,直接返回空。 + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); + return null; + } + try + { + // 类型转换(将参数数据类型转换为目标方法参数类型) + Class[] cs = method.getParameterTypes(); + for (int i = 0; i < cs.length; i++) + { + if (args[i] != null && !args[i].getClass().equals(cs[i])) + { + if (cs[i] == String.class) + { + args[i] = Convert.toStr(args[i]); + if (StringUtils.endsWith((String) args[i], ".0")) + { + args[i] = StringUtils.substringBefore((String) args[i], ".0"); + } + } + else if (cs[i] == Integer.class) + { + args[i] = Convert.toInt(args[i]); + } + else if (cs[i] == Long.class) + { + args[i] = Convert.toLong(args[i]); + } + else if (cs[i] == Double.class) + { + args[i] = Convert.toDouble(args[i]); + } + else if (cs[i] == Float.class) + { + args[i] = Convert.toFloat(args[i]); + } + else if (cs[i] == Date.class) + { + if (args[i] instanceof String) + { + args[i] = DateUtils.parseDate(args[i]); + } + else + { + args[i] = DateUtil.getJavaDate((Double) args[i]); + } + } + else if (cs[i] == boolean.class || cs[i] == Boolean.class) + { + args[i] = Convert.toBool(args[i]); + } + } + } + return (E) method.invoke(obj, args); + } + catch (Exception e) + { + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; + throw convertReflectionExceptionToUnchecked(msg, e); + } + } + + /** + * 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问. + * 如向上转型到Object仍无法找到, 返回null. + */ + public static Field getAccessibleField(final Object obj, final String fieldName) + { + // 为空不报错。直接返回 null + if (obj == null) + { + return null; + } + Validate.notBlank(fieldName, "fieldName can't be blank"); + for (Class superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) + { + try + { + Field field = superClass.getDeclaredField(fieldName); + makeAccessible(field); + return field; + } + catch (NoSuchFieldException e) + { + continue; + } + } + return null; + } + + /** + * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. + * 如向上转型到Object仍无法找到, 返回null. + * 匹配函数名+参数类型。 + * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) + */ + public static Method getAccessibleMethod(final Object obj, final String methodName, + final Class... parameterTypes) + { + // 为空不报错。直接返回 null + if (obj == null) + { + return null; + } + Validate.notBlank(methodName, "methodName can't be blank"); + for (Class searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) + { + try + { + Method method = searchType.getDeclaredMethod(methodName, parameterTypes); + makeAccessible(method); + return method; + } + catch (NoSuchMethodException e) + { + continue; + } + } + return null; + } + + /** + * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. + * 如向上转型到Object仍无法找到, 返回null. + * 只匹配函数名。 + * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) + */ + public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) + { + // 为空不报错。直接返回 null + if (obj == null) + { + return null; + } + Validate.notBlank(methodName, "methodName can't be blank"); + for (Class searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) + { + Method[] methods = searchType.getDeclaredMethods(); + for (Method method : methods) + { + if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) + { + makeAccessible(method); + return method; + } + } + } + return null; + } + + /** + * 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 + */ + public static void makeAccessible(Method method) + { + if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) + && !method.isAccessible()) + { + method.setAccessible(true); + } + } + + /** + * 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 + */ + public static void makeAccessible(Field field) + { + if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) + || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) + { + field.setAccessible(true); + } + } + + /** + * 通过反射, 获得Class定义中声明的泛型参数的类型, 注意泛型必须定义在父类处 + * 如无法找到, 返回Object.class. + */ + @SuppressWarnings("unchecked") + public static Class getClassGenricType(final Class clazz) + { + return getClassGenricType(clazz, 0); + } + + /** + * 通过反射, 获得Class定义中声明的父类的泛型参数的类型. + * 如无法找到, 返回Object.class. + */ + public static Class getClassGenricType(final Class clazz, final int index) + { + Type genType = clazz.getGenericSuperclass(); + + if (!(genType instanceof ParameterizedType)) + { + logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType"); + return Object.class; + } + + Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); + + if (index >= params.length || index < 0) + { + logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + + params.length); + return Object.class; + } + if (!(params[index] instanceof Class)) + { + logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); + return Object.class; + } + + return (Class) params[index]; + } + + public static Class getUserClass(Object instance) + { + if (instance == null) + { + throw new RuntimeException("Instance must not be null"); + } + Class clazz = instance.getClass(); + if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) + { + Class superClass = clazz.getSuperclass(); + if (superClass != null && !Object.class.equals(superClass)) + { + return superClass; + } + } + return clazz; + + } + + /** + * 将反射时的checked exception转换为unchecked exception. + */ + public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) + { + if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException + || e instanceof NoSuchMethodException) + { + return new IllegalArgumentException(msg, e); + } + else if (e instanceof InvocationTargetException) + { + return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException()); + } + return new RuntimeException(msg, e); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/sign/Base64.java b/ktg-common/src/main/java/com/ktg/common/utils/sign/Base64.java new file mode 100644 index 0000000..97514da --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/sign/Base64.java @@ -0,0 +1,291 @@ +package com.ktg.common.utils.sign; + +/** + * Base64工具类 + * + * @author ruoyi + */ +public final class Base64 +{ + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static + { + for (int i = 0; i < BASELENGTH; ++i) + { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) + { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) + { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) + { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) + { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + } + + private static boolean isWhiteSpace(char octect) + { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) + { + return (octect == PAD); + } + + private static boolean isData(char octect) + { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) + { + if (binaryData == null) + { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) + { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + + for (int i = 0; i < numberTriplets; i++) + { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) + { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } + else if (fewerThan24bits == SIXTEENBIT) + { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) + { + if (encoded == null) + { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) + { + return null;// should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) + { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) + { + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) + { + return null; + } // if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) + { + return null;// if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) + {// Check if they are PAD characters + if (isPad(d3) && isPad(d4)) + { + if ((b2 & 0xf) != 0)// last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } + else if (!isPad(d3) && isPad(d4)) + { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)// last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } + else + { + return null; + } + } + else + { // No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) + { + if (data == null) + { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) + { + if (!isWhiteSpace(data[i])) + { + data[newSize++] = data[i]; + } + } + return newSize; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/sign/Md5Utils.java b/ktg-common/src/main/java/com/ktg/common/utils/sign/Md5Utils.java new file mode 100644 index 0000000..1933926 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/sign/Md5Utils.java @@ -0,0 +1,67 @@ +package com.ktg.common.utils.sign; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Md5加密方法 + * + * @author ruoyi + */ +public class Md5Utils +{ + private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); + + private static byte[] md5(String s) + { + MessageDigest algorithm; + try + { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } + catch (Exception e) + { + log.error("MD5 Error...", e); + } + return null; + } + + private static final String toHex(byte hash[]) + { + if (hash == null) + { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + + for (i = 0; i < hash.length; i++) + { + if ((hash[i] & 0xff) < 0x10) + { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) + { + try + { + return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/spring/SpringUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/spring/SpringUtils.java new file mode 100644 index 0000000..6f7a7fc --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/spring/SpringUtils.java @@ -0,0 +1,146 @@ +package com.ktg.common.utils.spring; + +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; +import com.ktg.common.utils.StringUtils; + +/** + * spring工具类 方便在非spring管理环境中获取bean + * + * @author ruoyi + */ +@Component +public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware +{ + /** Spring应用上下文环境 */ + private static ConfigurableListableBeanFactory beanFactory; + + private static ApplicationContext applicationContext; + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException + { + SpringUtils.beanFactory = beanFactory; + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + { + SpringUtils.applicationContext = applicationContext; + } + + /** + * 获取对象 + * + * @param name + * @return Object 一个以所给名字注册的bean的实例 + * @throws org.springframework.beans.BeansException + * + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) throws BeansException + { + return (T) beanFactory.getBean(name); + } + + /** + * 获取类型为requiredType的对象 + * + * @param clz + * @return + * @throws org.springframework.beans.BeansException + * + */ + public static T getBean(Class clz) throws BeansException + { + T result = (T) beanFactory.getBean(clz); + return result; + } + + /** + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true + * + * @param name + * @return boolean + */ + public static boolean containsBean(String name) + { + return beanFactory.containsBean(name); + } + + /** + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) + * + * @param name + * @return boolean + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + * + */ + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.isSingleton(name); + } + + /** + * @param name + * @return Class 注册对象的类型 + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + * + */ + public static Class getType(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getType(name); + } + + /** + * 如果给定的bean名字在bean定义中有别名,则返回这些别名 + * + * @param name + * @return + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + * + */ + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getAliases(name); + } + + /** + * 获取aop代理对象 + * + * @param invoker + * @return + */ + @SuppressWarnings("unchecked") + public static T getAopProxy(T invoker) + { + return (T) AopContext.currentProxy(); + } + + /** + * 获取当前的环境配置,无配置返回null + * + * @return 当前的环境配置 + */ + public static String[] getActiveProfiles() + { + return applicationContext.getEnvironment().getActiveProfiles(); + } + + /** + * 获取当前的环境配置,当有多个环境配置时,只获取第一个 + * + * @return 当前的环境配置 + */ + public static String getActiveProfile() + { + final String[] activeProfiles = getActiveProfiles(); + return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null; + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/sql/SqlUtil.java b/ktg-common/src/main/java/com/ktg/common/utils/sql/SqlUtil.java new file mode 100644 index 0000000..4564a24 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/sql/SqlUtil.java @@ -0,0 +1,61 @@ +package com.ktg.common.utils.sql; + +import com.ktg.common.exception.UtilException; +import com.ktg.common.utils.StringUtils; + +/** + * sql操作工具类 + * + * @author ruoyi + */ +public class SqlUtil +{ + /** + * 定义常用的 sql关键字 + */ + public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare "; + + /** + * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) + */ + public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; + + /** + * 检查字符,防止注入绕过 + */ + public static String escapeOrderBySql(String value) + { + if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) + { + throw new UtilException("参数不符合规范,不能进行查询"); + } + return value; + } + + /** + * 验证 order by 语法是否符合规范 + */ + public static boolean isValidOrderBySql(String value) + { + return value.matches(SQL_PATTERN); + } + + /** + * SQL关键字检查 + */ + public static void filterKeyword(String value) + { + if (StringUtils.isEmpty(value)) + { + return; + } + String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|"); + for (String sqlKeyword : sqlKeywords) + { + if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) + { + throw new UtilException("参数存在SQL注入风险"); + } + } + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/uuid/IdUtils.java b/ktg-common/src/main/java/com/ktg/common/utils/uuid/IdUtils.java new file mode 100644 index 0000000..c85910b --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/uuid/IdUtils.java @@ -0,0 +1,49 @@ +package com.ktg.common.utils.uuid; + +/** + * ID生成器工具类 + * + * @author ruoyi + */ +public class IdUtils +{ + /** + * 获取随机UUID + * + * @return 随机UUID + */ + public static String randomUUID() + { + return UUID.randomUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线 + * + * @return 简化的UUID,去掉了横线 + */ + public static String simpleUUID() + { + return UUID.randomUUID().toString(true); + } + + /** + * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 随机UUID + */ + public static String fastUUID() + { + return UUID.fastUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 简化的UUID,去掉了横线 + */ + public static String fastSimpleUUID() + { + return UUID.fastUUID().toString(true); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/uuid/Seq.java b/ktg-common/src/main/java/com/ktg/common/utils/uuid/Seq.java new file mode 100644 index 0000000..2be5d00 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/uuid/Seq.java @@ -0,0 +1,86 @@ +package com.ktg.common.utils.uuid; + +import java.util.concurrent.atomic.AtomicInteger; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; + +/** + * @author ruoyi 序列生成类 + */ +public class Seq +{ + // 通用序列类型 + public static final String commSeqType = "COMMON"; + + // 上传序列类型 + public static final String uploadSeqType = "UPLOAD"; + + // 通用接口序列数 + private static AtomicInteger commSeq = new AtomicInteger(1); + + // 上传接口序列数 + private static AtomicInteger uploadSeq = new AtomicInteger(1); + + // 机器标识 + private static String machineCode = "A"; + + /** + * 获取通用序列号 + * + * @return 序列值 + */ + public static String getId() + { + return getId(commSeqType); + } + + /** + * 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串 + * + * @return 序列值 + */ + public static String getId(String type) + { + AtomicInteger atomicInt = commSeq; + if (uploadSeqType.equals(type)) + { + atomicInt = uploadSeq; + } + return getId(atomicInt, 3); + } + + /** + * 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串 + * + * @param atomicInt 序列数 + * @param length 数值长度 + * @return 序列值 + */ + public static String getId(AtomicInteger atomicInt, int length) + { + String result = DateUtils.dateTimeNow(); + result += machineCode; + result += getSeq(atomicInt, length); + return result; + } + + /** + * 序列循环递增字符串[1, 10 的 (length)幂次方), 用0左补齐length位数 + * + * @return 序列值 + */ + private synchronized static String getSeq(AtomicInteger atomicInt, int length) + { + // 先取值再+1 + int value = atomicInt.getAndIncrement(); + + // 如果更新后值>=10 的 (length)幂次方则重置为1 + int maxSeq = (int) Math.pow(10, length); + if (atomicInt.get() >= maxSeq) + { + atomicInt.set(1); + } + // 转字符串,用0左补齐 + return StringUtils.padl(value, length); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/utils/uuid/UUID.java b/ktg-common/src/main/java/com/ktg/common/utils/uuid/UUID.java new file mode 100644 index 0000000..96b82d6 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/utils/uuid/UUID.java @@ -0,0 +1,484 @@ +package com.ktg.common.utils.uuid; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; +import com.ktg.common.exception.UtilException; + +/** + * 提供通用唯一识别码(universally unique identifier)(UUID)实现 + * + * @author ruoyi + */ +public final class UUID implements java.io.Serializable, Comparable +{ + private static final long serialVersionUID = -1185015143654744140L; + + /** + * SecureRandom 的单例 + * + */ + private static class Holder + { + static final SecureRandom numberGenerator = getSecureRandom(); + } + + /** 此UUID的最高64有效位 */ + private final long mostSigBits; + + /** 此UUID的最低64有效位 */ + private final long leastSigBits; + + /** + * 私有构造 + * + * @param data 数据 + */ + private UUID(byte[] data) + { + long msb = 0; + long lsb = 0; + assert data.length == 16 : "data must be 16 bytes in length"; + for (int i = 0; i < 8; i++) + { + msb = (msb << 8) | (data[i] & 0xff); + } + for (int i = 8; i < 16; i++) + { + lsb = (lsb << 8) | (data[i] & 0xff); + } + this.mostSigBits = msb; + this.leastSigBits = lsb; + } + + /** + * 使用指定的数据构造新的 UUID。 + * + * @param mostSigBits 用于 {@code UUID} 的最高有效 64 位 + * @param leastSigBits 用于 {@code UUID} 的最低有效 64 位 + */ + public UUID(long mostSigBits, long leastSigBits) + { + this.mostSigBits = mostSigBits; + this.leastSigBits = leastSigBits; + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的本地线程伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID fastUUID() + { + return randomUUID(false); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID() + { + return randomUUID(true); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @param isSecure 是否使用{@link SecureRandom}如果是可以获得更安全的随机码,否则可以得到更好的性能 + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID(boolean isSecure) + { + final Random ng = isSecure ? Holder.numberGenerator : getRandom(); + + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + randomBytes[6] &= 0x0f; /* clear version */ + randomBytes[6] |= 0x40; /* set to version 4 */ + randomBytes[8] &= 0x3f; /* clear variant */ + randomBytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(randomBytes); + } + + /** + * 根据指定的字节数组获取类型 3(基于名称的)UUID 的静态工厂。 + * + * @param name 用于构造 UUID 的字节数组。 + * + * @return 根据指定数组生成的 {@code UUID} + */ + public static UUID nameUUIDFromBytes(byte[] name) + { + MessageDigest md; + try + { + md = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException nsae) + { + throw new InternalError("MD5 not supported"); + } + byte[] md5Bytes = md.digest(name); + md5Bytes[6] &= 0x0f; /* clear version */ + md5Bytes[6] |= 0x30; /* set to version 3 */ + md5Bytes[8] &= 0x3f; /* clear variant */ + md5Bytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(md5Bytes); + } + + /** + * 根据 {@link #toString()} 方法中描述的字符串标准表示形式创建{@code UUID}。 + * + * @param name 指定 {@code UUID} 字符串 + * @return 具有指定值的 {@code UUID} + * @throws IllegalArgumentException 如果 name 与 {@link #toString} 中描述的字符串表示形式不符抛出此异常 + * + */ + public static UUID fromString(String name) + { + String[] components = name.split("-"); + if (components.length != 5) + { + throw new IllegalArgumentException("Invalid UUID string: " + name); + } + for (int i = 0; i < 5; i++) + { + components[i] = "0x" + components[i]; + } + + long mostSigBits = Long.decode(components[0]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[1]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[2]).longValue(); + + long leastSigBits = Long.decode(components[3]).longValue(); + leastSigBits <<= 48; + leastSigBits |= Long.decode(components[4]).longValue(); + + return new UUID(mostSigBits, leastSigBits); + } + + /** + * 返回此 UUID 的 128 位值中的最低有效 64 位。 + * + * @return 此 UUID 的 128 位值中的最低有效 64 位。 + */ + public long getLeastSignificantBits() + { + return leastSigBits; + } + + /** + * 返回此 UUID 的 128 位值中的最高有效 64 位。 + * + * @return 此 UUID 的 128 位值中最高有效 64 位。 + */ + public long getMostSignificantBits() + { + return mostSigBits; + } + + /** + * 与此 {@code UUID} 相关联的版本号. 版本号描述此 {@code UUID} 是如何生成的。 + *

+ * 版本号具有以下含意: + *

    + *
  • 1 基于时间的 UUID + *
  • 2 DCE 安全 UUID + *
  • 3 基于名称的 UUID + *
  • 4 随机生成的 UUID + *
+ * + * @return 此 {@code UUID} 的版本号 + */ + public int version() + { + // Version is bits masked by 0x000000000000F000 in MS long + return (int) ((mostSigBits >> 12) & 0x0f); + } + + /** + * 与此 {@code UUID} 相关联的变体号。变体号描述 {@code UUID} 的布局。 + *

+ * 变体号具有以下含意: + *

    + *
  • 0 为 NCS 向后兼容保留 + *
  • 2 IETF RFC 4122(Leach-Salz), 用于此类 + *
  • 6 保留,微软向后兼容 + *
  • 7 保留供以后定义使用 + *
+ * + * @return 此 {@code UUID} 相关联的变体号 + */ + public int variant() + { + // This field is composed of a varying number of bits. + // 0 - - Reserved for NCS backward compatibility + // 1 0 - The IETF aka Leach-Salz variant (used by this class) + // 1 1 0 Reserved, Microsoft backward compatibility + // 1 1 1 Reserved for future definition. + return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63)); + } + + /** + * 与此 UUID 相关联的时间戳值。 + * + *

+ * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
+ * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。 + * + *

+ * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。 + */ + public long timestamp() throws UnsupportedOperationException + { + checkTimeBase(); + return (mostSigBits & 0x0FFFL) << 48// + | ((mostSigBits >> 16) & 0x0FFFFL) << 32// + | mostSigBits >>> 32; + } + + /** + * 与此 UUID 相关联的时钟序列值。 + * + *

+ * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。 + *

+ * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 UUID,则此方法抛出 + * UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的时钟序列 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public int clockSequence() throws UnsupportedOperationException + { + checkTimeBase(); + return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); + } + + /** + * 与此 UUID 相关的节点值。 + * + *

+ * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。 + *

+ * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的节点值 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public long node() throws UnsupportedOperationException + { + checkTimeBase(); + return leastSigBits & 0x0000FFFFFFFFFFFFL; + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+     * {@code
+     * UUID                   = ----
+     * time_low               = 4*
+     * time_mid               = 2*
+     * time_high_and_version  = 2*
+     * variant_and_sequence   = 2*
+     * node                   = 6*
+     * hexOctet               = 
+     * hexDigit               = [0-9a-fA-F]
+     * }
+     * 
+ * + * + * + * @return 此{@code UUID} 的字符串表现形式 + * @see #toString(boolean) + */ + @Override + public String toString() + { + return toString(false); + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+     * {@code
+     * UUID                   = ----
+     * time_low               = 4*
+     * time_mid               = 2*
+     * time_high_and_version  = 2*
+     * variant_and_sequence   = 2*
+     * node                   = 6*
+     * hexOctet               = 
+     * hexDigit               = [0-9a-fA-F]
+     * }
+     * 
+ * + * + * + * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串 + * @return 此{@code UUID} 的字符串表现形式 + */ + public String toString(boolean isSimple) + { + final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); + // time_low + builder.append(digits(mostSigBits >> 32, 8)); + if (!isSimple) + { + builder.append('-'); + } + // time_mid + builder.append(digits(mostSigBits >> 16, 4)); + if (!isSimple) + { + builder.append('-'); + } + // time_high_and_version + builder.append(digits(mostSigBits, 4)); + if (!isSimple) + { + builder.append('-'); + } + // variant_and_sequence + builder.append(digits(leastSigBits >> 48, 4)); + if (!isSimple) + { + builder.append('-'); + } + // node + builder.append(digits(leastSigBits, 12)); + + return builder.toString(); + } + + /** + * 返回此 UUID 的哈希码。 + * + * @return UUID 的哈希码值。 + */ + @Override + public int hashCode() + { + long hilo = mostSigBits ^ leastSigBits; + return ((int) (hilo >> 32)) ^ (int) hilo; + } + + /** + * 将此对象与指定对象比较。 + *

+ * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。 + * + * @param obj 要与之比较的对象 + * + * @return 如果对象相同,则返回 {@code true};否则返回 {@code false} + */ + @Override + public boolean equals(Object obj) + { + if ((null == obj) || (obj.getClass() != UUID.class)) + { + return false; + } + UUID id = (UUID) obj; + return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); + } + + // Comparison Operations + + /** + * 将此 UUID 与指定的 UUID 比较。 + * + *

+ * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。 + * + * @param val 与此 UUID 比较的 UUID + * + * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。 + * + */ + @Override + public int compareTo(UUID val) + { + // The ordering is intentionally set up so that the UUIDs + // can simply be numerically compared as two numbers + return (this.mostSigBits < val.mostSigBits ? -1 : // + (this.mostSigBits > val.mostSigBits ? 1 : // + (this.leastSigBits < val.leastSigBits ? -1 : // + (this.leastSigBits > val.leastSigBits ? 1 : // + 0)))); + } + + // ------------------------------------------------------------------------------------------------------------------- + // Private method start + /** + * 返回指定数字对应的hex值 + * + * @param val 值 + * @param digits 位 + * @return 值 + */ + private static String digits(long val, int digits) + { + long hi = 1L << (digits * 4); + return Long.toHexString(hi | (val & (hi - 1))).substring(1); + } + + /** + * 检查是否为time-based版本UUID + */ + private void checkTimeBase() + { + if (version() != 1) + { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + } + + /** + * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG) + * + * @return {@link SecureRandom} + */ + public static SecureRandom getSecureRandom() + { + try + { + return SecureRandom.getInstance("SHA1PRNG"); + } + catch (NoSuchAlgorithmException e) + { + throw new UtilException(e); + } + } + + /** + * 获取随机数生成器对象
+ * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。 + * + * @return {@link ThreadLocalRandom} + */ + public static ThreadLocalRandom getRandom() + { + return ThreadLocalRandom.current(); + } +} diff --git a/ktg-common/src/main/java/com/ktg/common/xss/Xss.java b/ktg-common/src/main/java/com/ktg/common/xss/Xss.java new file mode 100644 index 0000000..0c5f37b --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/xss/Xss.java @@ -0,0 +1,27 @@ +package com.ktg.common.xss; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 自定义xss校验注解 + * + * @author ruoyi + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) +@Constraint(validatedBy = { XssValidator.class }) +public @interface Xss +{ + String message() + + default "不允许任何脚本运行"; + + Class[] groups() default {}; + + Class[] payload() default {}; +} diff --git a/ktg-common/src/main/java/com/ktg/common/xss/XssValidator.java b/ktg-common/src/main/java/com/ktg/common/xss/XssValidator.java new file mode 100644 index 0000000..3fac738 --- /dev/null +++ b/ktg-common/src/main/java/com/ktg/common/xss/XssValidator.java @@ -0,0 +1,34 @@ +package com.ktg.common.xss; + +import com.ktg.common.utils.StringUtils; +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 自定义xss校验注解实现 + * + * @author ruoyi + */ +public class XssValidator implements ConstraintValidator +{ + private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; + + @Override + public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) + { + if (StringUtils.isBlank(value)) + { + return true; + } + return !containsHtml(value); + } + + public static boolean containsHtml(String value) + { + Pattern pattern = Pattern.compile(HTML_PATTERN); + Matcher matcher = pattern.matcher(value); + return matcher.matches(); + } +} \ No newline at end of file diff --git a/ktg-framework/pom.xml b/ktg-framework/pom.xml new file mode 100644 index 0000000..fa9090e --- /dev/null +++ b/ktg-framework/pom.xml @@ -0,0 +1,70 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-framework + + + framework框架核心 + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + com.alibaba + druid-spring-boot-starter + + + + + com.github.penggle + kaptcha + + + javax.servlet-api + javax.servlet + + + + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + com.github.oshi + oshi-core + + + + + com.ktg + ktg-system + + + + + \ No newline at end of file diff --git a/ktg-framework/src/main/java/com/ktg/framework/aspectj/DataScopeAspect.java b/ktg-framework/src/main/java/com/ktg/framework/aspectj/DataScopeAspect.java new file mode 100644 index 0000000..86c77c7 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/aspectj/DataScopeAspect.java @@ -0,0 +1,149 @@ +package com.ktg.framework.aspectj; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.springframework.stereotype.Component; +import com.ktg.common.annotation.DataScope; +import com.ktg.common.core.domain.BaseEntity; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.SecurityUtils; + +/** + * 数据过滤处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class DataScopeAspect +{ + /** + * 全部数据权限 + */ + public static final String DATA_SCOPE_ALL = "1"; + + /** + * 自定数据权限 + */ + public static final String DATA_SCOPE_CUSTOM = "2"; + + /** + * 部门数据权限 + */ + public static final String DATA_SCOPE_DEPT = "3"; + + /** + * 部门及以下数据权限 + */ + public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; + + /** + * 仅本人数据权限 + */ + public static final String DATA_SCOPE_SELF = "5"; + + /** + * 数据权限过滤关键字 + */ + public static final String DATA_SCOPE = "dataScope"; + + @Before("@annotation(controllerDataScope)") + public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable + { + clearDataScope(point); + handleDataScope(point, controllerDataScope); + } + + protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope) + { + // 获取当前的用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNotNull(loginUser)) + { + SysUser currentUser = loginUser.getUser(); + // 如果是超级管理员,则不过滤数据 + if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) + { + dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), + controllerDataScope.userAlias()); + } + } + } + + /** + * 数据范围过滤 + * + * @param joinPoint 切点 + * @param user 用户 + * @param userAlias 别名 + */ + public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias) + { + StringBuilder sqlString = new StringBuilder(); + + for (SysRole role : user.getRoles()) + { + String dataScope = role.getDataScope(); + if (DATA_SCOPE_ALL.equals(dataScope)) + { + sqlString = new StringBuilder(); + break; + } + else if (DATA_SCOPE_CUSTOM.equals(dataScope)) + { + sqlString.append(StringUtils.format( + " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, + role.getRoleId())); + } + else if (DATA_SCOPE_DEPT.equals(dataScope)) + { + sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); + } + else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) + { + sqlString.append(StringUtils.format( + " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", + deptAlias, user.getDeptId(), user.getDeptId())); + } + else if (DATA_SCOPE_SELF.equals(dataScope)) + { + if (StringUtils.isNotBlank(userAlias)) + { + sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); + } + else + { + // 数据权限为仅本人且没有userAlias别名不查询任何数据 + sqlString.append(" OR 1=0 "); + } + } + } + + if (StringUtils.isNotBlank(sqlString.toString())) + { + Object params = joinPoint.getArgs()[0]; + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); + } + } + } + + /** + * 拼接权限sql前先清空params.dataScope参数防止注入 + */ + private void clearDataScope(final JoinPoint joinPoint) + { + Object params = joinPoint.getArgs()[0]; + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, ""); + } + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/aspectj/DataSourceAspect.java b/ktg-framework/src/main/java/com/ktg/framework/aspectj/DataSourceAspect.java new file mode 100644 index 0000000..abcd4fb --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/aspectj/DataSourceAspect.java @@ -0,0 +1,72 @@ +package com.ktg.framework.aspectj; + +import java.util.Objects; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import com.ktg.common.annotation.DataSource; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.datasource.DynamicDataSourceContextHolder; + +/** + * 多数据源处理 + * + * @author ruoyi + */ +@Aspect +@Order(1) +@Component +public class DataSourceAspect +{ + protected Logger logger = LoggerFactory.getLogger(getClass()); + + @Pointcut("@annotation(com.ktg.common.annotation.DataSource)" + + "|| @within(com.ktg.common.annotation.DataSource)") + public void dsPointCut() + { + + } + + @Around("dsPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable + { + DataSource dataSource = getDataSource(point); + + if (StringUtils.isNotNull(dataSource)) + { + DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name()); + } + + try + { + return point.proceed(); + } + finally + { + // 销毁数据源 在执行方法之后 + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + + /** + * 获取需要切换的数据源 + */ + public DataSource getDataSource(ProceedingJoinPoint point) + { + MethodSignature signature = (MethodSignature) point.getSignature(); + DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class); + if (Objects.nonNull(dataSource)) + { + return dataSource; + } + + return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/aspectj/LogAspect.java b/ktg-framework/src/main/java/com/ktg/framework/aspectj/LogAspect.java new file mode 100644 index 0000000..109a74a --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/aspectj/LogAspect.java @@ -0,0 +1,217 @@ +package com.ktg.framework.aspectj; + +import java.util.Collection; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Aspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.validation.BindingResult; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.HandlerMapping; +import com.alibaba.fastjson.JSON; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.enums.BusinessStatus; +import com.ktg.common.enums.HttpMethod; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.ip.IpUtils; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.framework.manager.AsyncManager; +import com.ktg.framework.manager.factory.AsyncFactory; +import com.ktg.system.domain.SysOperLog; + +/** + * 操作日志记录处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class LogAspect +{ + private static final Logger log = LoggerFactory.getLogger(LogAspect.class); + + /** + * 处理完请求后执行 + * + * @param joinPoint 切点 + */ + @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) + { + handleLog(joinPoint, controllerLog, null, jsonResult); + } + + /** + * 拦截异常操作 + * + * @param joinPoint 切点 + * @param e 异常 + */ + @AfterThrowing(value = "@annotation(controllerLog)", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) + { + handleLog(joinPoint, controllerLog, e, null); + } + + protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult) + { + try + { + // 获取当前的用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + + // *========数据库日志=========*// + SysOperLog operLog = new SysOperLog(); + operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); + // 请求的地址 + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + operLog.setOperIp(ip); + operLog.setOperUrl(ServletUtils.getRequest().getRequestURI()); + if (loginUser != null) + { + operLog.setOperName(loginUser.getUsername()); + } + + if (e != null) + { + operLog.setStatus(BusinessStatus.FAIL.ordinal()); + operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); + } + // 设置方法名称 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + operLog.setMethod(className + "." + methodName + "()"); + // 设置请求方式 + operLog.setRequestMethod(ServletUtils.getRequest().getMethod()); + // 处理设置注解上的参数 + getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult); + // 保存数据库 + AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); + } + catch (Exception exp) + { + // 记录本地异常日志 + log.error("==前置通知异常=="); + log.error("异常信息:{}", exp.getMessage()); + exp.printStackTrace(); + } + } + + /** + * 获取注解中对方法的描述信息 用于Controller层注解 + * + * @param log 日志 + * @param operLog 操作日志 + * @throws Exception + */ + public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception + { + // 设置action动作 + operLog.setBusinessType(log.businessType().ordinal()); + // 设置标题 + operLog.setTitle(log.title()); + // 设置操作人类别 + operLog.setOperatorType(log.operatorType().ordinal()); + // 是否需要保存request,参数和值 + if (log.isSaveRequestData()) + { + // 获取参数的信息,传入到数据库中。 + setRequestValue(joinPoint, operLog); + } + // 是否需要保存response,参数和值 + if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult)) + { + operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000)); + } + } + + /** + * 获取请求的参数,放到log中 + * + * @param operLog 操作日志 + * @throws Exception 异常 + */ + private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception + { + String requestMethod = operLog.getRequestMethod(); + if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) + { + String params = argsArrayToString(joinPoint.getArgs()); + operLog.setOperParam(StringUtils.substring(params, 0, 2000)); + } + else + { + Map paramsMap = (Map) ServletUtils.getRequest().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); + operLog.setOperParam(StringUtils.substring(paramsMap.toString(), 0, 2000)); + } + } + + /** + * 参数拼装 + */ + private String argsArrayToString(Object[] paramsArray) + { + String params = ""; + if (paramsArray != null && paramsArray.length > 0) + { + for (Object o : paramsArray) + { + if (StringUtils.isNotNull(o) && !isFilterObject(o)) + { + try + { + Object jsonObj = JSON.toJSON(o); + params += jsonObj.toString() + " "; + } + catch (Exception e) + { + } + } + } + } + return params.trim(); + } + + /** + * 判断是否需要过滤的对象。 + * + * @param o 对象信息。 + * @return 如果是需要过滤的对象,则返回true;否则返回false。 + */ + @SuppressWarnings("rawtypes") + public boolean isFilterObject(final Object o) + { + Class clazz = o.getClass(); + if (clazz.isArray()) + { + return clazz.getComponentType().isAssignableFrom(MultipartFile.class); + } + else if (Collection.class.isAssignableFrom(clazz)) + { + Collection collection = (Collection) o; + for (Object value : collection) + { + return value instanceof MultipartFile; + } + } + else if (Map.class.isAssignableFrom(clazz)) + { + Map map = (Map) o; + for (Object value : map.entrySet()) + { + Map.Entry entry = (Map.Entry) value; + return entry.getValue() instanceof MultipartFile; + } + } + return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse + || o instanceof BindingResult; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/aspectj/RateLimiterAspect.java b/ktg-framework/src/main/java/com/ktg/framework/aspectj/RateLimiterAspect.java new file mode 100644 index 0000000..36c7546 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/aspectj/RateLimiterAspect.java @@ -0,0 +1,91 @@ +package com.ktg.framework.aspectj; + +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.List; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.RedisScript; +import org.springframework.stereotype.Component; +import com.ktg.common.annotation.RateLimiter; +import com.ktg.common.enums.LimitType; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.ip.IpUtils; + +/** + * 限流处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class RateLimiterAspect +{ + private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class); + + private RedisTemplate redisTemplate; + + private RedisScript limitScript; + + @Autowired + public void setRedisTemplate1(RedisTemplate redisTemplate) + { + this.redisTemplate = redisTemplate; + } + + @Autowired + public void setLimitScript(RedisScript limitScript) + { + this.limitScript = limitScript; + } + + @Before("@annotation(rateLimiter)") + public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable + { + String key = rateLimiter.key(); + int time = rateLimiter.time(); + int count = rateLimiter.count(); + + String combineKey = getCombineKey(rateLimiter, point); + List keys = Collections.singletonList(combineKey); + try + { + Long number = redisTemplate.execute(limitScript, keys, count, time); + if (StringUtils.isNull(number) || number.intValue() > count) + { + throw new ServiceException("访问过于频繁,请稍候再试"); + } + log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), key); + } + catch (ServiceException e) + { + throw e; + } + catch (Exception e) + { + throw new RuntimeException("服务器限流异常,请稍候再试"); + } + } + + public String getCombineKey(RateLimiter rateLimiter, JoinPoint point) + { + StringBuffer stringBuffer = new StringBuffer(rateLimiter.key()); + if (rateLimiter.limitType() == LimitType.IP) + { + stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest())).append("-"); + } + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + Class targetClass = method.getDeclaringClass(); + stringBuffer.append(targetClass.getName()).append("-").append(method.getName()); + return stringBuffer.toString(); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/ApplicationConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/ApplicationConfig.java new file mode 100644 index 0000000..fb64cf6 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/ApplicationConfig.java @@ -0,0 +1,30 @@ +package com.ktg.framework.config; + +import java.util.TimeZone; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.EnableAspectJAutoProxy; + +/** + * 程序注解配置 + * + * @author ruoyi + */ +@Configuration +// 表示通过aop框架暴露该代理对象,AopContext能够访问 +@EnableAspectJAutoProxy(exposeProxy = true) +// 指定要扫描的Mapper类的包的路径 +@MapperScan("com.ktg.**.mapper") +public class ApplicationConfig +{ + /** + * 时区配置 + */ + @Bean + public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() + { + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/CaptchaConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/CaptchaConfig.java new file mode 100644 index 0000000..4326753 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/CaptchaConfig.java @@ -0,0 +1,83 @@ +package com.ktg.framework.config; + +import java.util.Properties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import static com.google.code.kaptcha.Constants.*; + +/** + * 验证码配置 + * + * @author ruoyi + */ +@Configuration +public class CaptchaConfig +{ + @Bean(name = "captchaProducer") + public DefaultKaptcha getKaptchaBean() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } + + @Bean(name = "captchaProducerMath") + public DefaultKaptcha getKaptchaBeanMath() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 边框颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); + // 验证码文本生成器 + properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.ktg.framework.config.KaptchaTextCreator"); + // 验证码文本字符间距 默认为2 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 验证码噪点颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); + // 干扰实现类 + properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/DruidConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/DruidConfig.java new file mode 100644 index 0000000..7e79ffb --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/DruidConfig.java @@ -0,0 +1,126 @@ +package com.ktg.framework.config; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.sql.DataSource; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; +import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; +import com.alibaba.druid.util.Utils; +import com.ktg.common.enums.DataSourceType; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.framework.config.properties.DruidProperties; +import com.ktg.framework.datasource.DynamicDataSource; + +/** + * druid 配置多数据源 + * + * @author ruoyi + */ +@Configuration +public class DruidConfig +{ + @Bean + @ConfigurationProperties("spring.datasource.druid.master") + public DataSource masterDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + + @Bean + @ConfigurationProperties("spring.datasource.druid.slave") + @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") + public DataSource slaveDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + + @Bean(name = "dynamicDataSource") + @Primary + public DynamicDataSource dataSource(DataSource masterDataSource) + { + Map targetDataSources = new HashMap<>(); + targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); + setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); + return new DynamicDataSource(masterDataSource, targetDataSources); + } + + /** + * 设置数据源 + * + * @param targetDataSources 备选数据源集合 + * @param sourceName 数据源名称 + * @param beanName bean名称 + */ + public void setDataSource(Map targetDataSources, String sourceName, String beanName) + { + try + { + DataSource dataSource = SpringUtils.getBean(beanName); + targetDataSources.put(sourceName, dataSource); + } + catch (Exception e) + { + } + } + + /** + * 去除监控页面底部的广告 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") + public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) + { + // 获取web监控页面的参数 + DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); + // 提取common.js的配置路径 + String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; + String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); + final String filePath = "support/http/resources/js/common.js"; + // 创建filter进行过滤 + Filter filter = new Filter() + { + @Override + public void init(javax.servlet.FilterConfig filterConfig) throws ServletException + { + } + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + chain.doFilter(request, response); + // 重置缓冲区,响应头不会被重置 + response.resetBuffer(); + // 获取common.js + String text = Utils.readFromResource(filePath); + // 正则替换banner, 除去底部的广告信息 + text = text.replaceAll("
", ""); + text = text.replaceAll("powered.*?shrek.wang", ""); + response.getWriter().write(text); + } + @Override + public void destroy() + { + } + }; + FilterRegistrationBean registrationBean = new FilterRegistrationBean(); + registrationBean.setFilter(filter); + registrationBean.addUrlPatterns(commonJsPattern); + return registrationBean; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/FastJson2JsonRedisSerializer.java b/ktg-framework/src/main/java/com/ktg/framework/config/FastJson2JsonRedisSerializer.java new file mode 100644 index 0000000..8b1b4e5 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/FastJson2JsonRedisSerializer.java @@ -0,0 +1,71 @@ +package com.ktg.framework.config; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +import com.alibaba.fastjson.parser.ParserConfig; +import org.springframework.util.Assert; +import java.nio.charset.Charset; + +/** + * Redis使用FastJson序列化 + * + * @author ruoyi + */ +public class FastJson2JsonRedisSerializer implements RedisSerializer +{ + @SuppressWarnings("unused") + private ObjectMapper objectMapper = new ObjectMapper(); + + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + private Class clazz; + + static + { + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + } + + public FastJson2JsonRedisSerializer(Class clazz) + { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) throws SerializationException + { + if (t == null) + { + return new byte[0]; + } + return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); + } + + @Override + public T deserialize(byte[] bytes) throws SerializationException + { + if (bytes == null || bytes.length <= 0) + { + return null; + } + String str = new String(bytes, DEFAULT_CHARSET); + + return JSON.parseObject(str, clazz); + } + + public void setObjectMapper(ObjectMapper objectMapper) + { + Assert.notNull(objectMapper, "'objectMapper' must not be null"); + this.objectMapper = objectMapper; + } + + protected JavaType getJavaType(Class clazz) + { + return TypeFactory.defaultInstance().constructType(clazz); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/FilterConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/FilterConfig.java new file mode 100644 index 0000000..c524b13 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/FilterConfig.java @@ -0,0 +1,58 @@ +package com.ktg.framework.config; + +import java.util.HashMap; +import java.util.Map; +import javax.servlet.DispatcherType; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.ktg.common.filter.RepeatableFilter; +import com.ktg.common.filter.XssFilter; +import com.ktg.common.utils.StringUtils; + +/** + * Filter配置 + * + * @author ruoyi + */ +@Configuration +public class FilterConfig +{ + @Value("${xss.excludes}") + private String excludes; + + @Value("${xss.urlPatterns}") + private String urlPatterns; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + @ConditionalOnProperty(value = "xss.enabled", havingValue = "true") + public FilterRegistrationBean xssFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setDispatcherTypes(DispatcherType.REQUEST); + registration.setFilter(new XssFilter()); + registration.addUrlPatterns(StringUtils.split(urlPatterns, ",")); + registration.setName("xssFilter"); + registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); + Map initParameters = new HashMap(); + initParameters.put("excludes", excludes); + registration.setInitParameters(initParameters); + return registration; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + public FilterRegistrationBean someFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new RepeatableFilter()); + registration.addUrlPatterns("/*"); + registration.setName("repeatableFilter"); + registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE); + return registration; + } + +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/KaptchaTextCreator.java b/ktg-framework/src/main/java/com/ktg/framework/config/KaptchaTextCreator.java new file mode 100644 index 0000000..9aece81 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/KaptchaTextCreator.java @@ -0,0 +1,75 @@ +package com.ktg.framework.config; + +import java.util.Random; +import com.google.code.kaptcha.text.impl.DefaultTextCreator; + +/** + * 验证码文本生成器 + * + * @author ruoyi + */ +public class KaptchaTextCreator extends DefaultTextCreator +{ + private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); + + @Override + public String getText() + { + Integer result = 0; + Random random = new Random(); + int x = random.nextInt(10); + int y = random.nextInt(10); + StringBuilder suChinese = new StringBuilder(); + int randomoperands = (int) Math.round(Math.random() * 2); + if (randomoperands == 0) + { + result = x * y; + suChinese.append(CNUMBERS[x]); + suChinese.append("*"); + suChinese.append(CNUMBERS[y]); + } + else if (randomoperands == 1) + { + if (!(x == 0) && y % x == 0) + { + result = y / x; + suChinese.append(CNUMBERS[y]); + suChinese.append("/"); + suChinese.append(CNUMBERS[x]); + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + } + else if (randomoperands == 2) + { + if (x >= y) + { + result = x - y; + suChinese.append(CNUMBERS[x]); + suChinese.append("-"); + suChinese.append(CNUMBERS[y]); + } + else + { + result = y - x; + suChinese.append(CNUMBERS[y]); + suChinese.append("-"); + suChinese.append(CNUMBERS[x]); + } + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + suChinese.append("=?@" + result); + return suChinese.toString(); + } +} \ No newline at end of file diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/MyBatisConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/MyBatisConfig.java new file mode 100644 index 0000000..1a05b8e --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/MyBatisConfig.java @@ -0,0 +1,132 @@ +package com.ktg.framework.config; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import javax.sql.DataSource; +import org.apache.ibatis.io.VFS; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.util.ClassUtils; +import com.ktg.common.utils.StringUtils; + +/** + * Mybatis支持*匹配扫描包 + * + * @author ruoyi + */ +@Configuration +public class MyBatisConfig +{ + @Autowired + private Environment env; + + static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; + + public static String setTypeAliasesPackage(String typeAliasesPackage) + { + ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); + MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); + List allResult = new ArrayList(); + try + { + for (String aliasesPackage : typeAliasesPackage.split(",")) + { + List result = new ArrayList(); + aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; + Resource[] resources = resolver.getResources(aliasesPackage); + if (resources != null && resources.length > 0) + { + MetadataReader metadataReader = null; + for (Resource resource : resources) + { + if (resource.isReadable()) + { + metadataReader = metadataReaderFactory.getMetadataReader(resource); + try + { + result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); + } + catch (ClassNotFoundException e) + { + e.printStackTrace(); + } + } + } + } + if (result.size() > 0) + { + HashSet hashResult = new HashSet(result); + allResult.addAll(hashResult); + } + } + if (allResult.size() > 0) + { + typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); + } + else + { + throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + return typeAliasesPackage; + } + + public Resource[] resolveMapperLocations(String[] mapperLocations) + { + ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); + List resources = new ArrayList(); + if (mapperLocations != null) + { + for (String mapperLocation : mapperLocations) + { + try + { + Resource[] mappers = resourceResolver.getResources(mapperLocation); + resources.addAll(Arrays.asList(mappers)); + } + catch (IOException e) + { + // ignore + } + } + } + return resources.toArray(new Resource[resources.size()]); + } + + @Bean + public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception + { + String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); + String mapperLocations = env.getProperty("mybatis.mapperLocations"); + String configLocation = env.getProperty("mybatis.configLocation"); + typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); + VFS.addImplClass(SpringBootVFS.class); + + final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); + sessionFactory.setDataSource(dataSource); + sessionFactory.setTypeAliasesPackage(typeAliasesPackage); + sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); + sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); + return sessionFactory.getObject(); + } +} \ No newline at end of file diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/RedisConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/RedisConfig.java new file mode 100644 index 0000000..4874fa8 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/RedisConfig.java @@ -0,0 +1,79 @@ +package com.ktg.framework.config; + +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.data.redis.serializer.StringRedisSerializer; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; + +/** + * redis配置 + * + * @author ruoyi + */ +@Configuration +@EnableCaching +public class RedisConfig extends CachingConfigurerSupport +{ + @Bean + @SuppressWarnings(value = { "unchecked", "rawtypes" }) + public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) + { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(connectionFactory); + + FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + serializer.setObjectMapper(mapper); + + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } + + @Bean + public DefaultRedisScript limitScript() + { + DefaultRedisScript redisScript = new DefaultRedisScript<>(); + redisScript.setScriptText(limitScriptText()); + redisScript.setResultType(Long.class); + return redisScript; + } + + /** + * 限流脚本 + */ + private String limitScriptText() + { + return "local key = KEYS[1]\n" + + "local count = tonumber(ARGV[1])\n" + + "local time = tonumber(ARGV[2])\n" + + "local current = redis.call('get', key);\n" + + "if current and tonumber(current) > count then\n" + + " return tonumber(current);\n" + + "end\n" + + "current = redis.call('incr', key)\n" + + "if tonumber(current) == 1 then\n" + + " redis.call('expire', key, time)\n" + + "end\n" + + "return tonumber(current);"; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/ResourcesConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/ResourcesConfig.java new file mode 100644 index 0000000..ee2a61b --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/ResourcesConfig.java @@ -0,0 +1,70 @@ +package com.ktg.framework.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import com.ktg.common.config.RuoYiConfig; +import com.ktg.common.constant.Constants; +import com.ktg.framework.interceptor.RepeatSubmitInterceptor; + +/** + * 通用配置 + * + * @author ruoyi + */ +@Configuration +public class ResourcesConfig implements WebMvcConfigurer +{ + @Autowired + private RepeatSubmitInterceptor repeatSubmitInterceptor; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) + { + /** 本地文件上传路径 */ + registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") + .addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); + + /** swagger配置 */ + registry.addResourceHandler("/swagger-ui/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); + } + + /** + * 自定义拦截规则 + */ + @Override + public void addInterceptors(InterceptorRegistry registry) + { + registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); + } + + /** + * 跨域配置 + */ + @Bean + public CorsFilter corsFilter() + { + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOriginPattern("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 有效期 1800秒 + config.setMaxAge(1800L); + // 添加映射路径,拦截一切请求 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); + // 返回新的CorsFilter + return new CorsFilter(source); + } +} \ No newline at end of file diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java new file mode 100644 index 0000000..8c01fbc --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java @@ -0,0 +1,148 @@ +package com.ktg.framework.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.authentication.logout.LogoutFilter; +import org.springframework.web.filter.CorsFilter; +import com.ktg.framework.security.filter.JwtAuthenticationTokenFilter; +import com.ktg.framework.security.handle.AuthenticationEntryPointImpl; +import com.ktg.framework.security.handle.LogoutSuccessHandlerImpl; + +/** + * spring security配置 + * + * @author ruoyi + */ +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfig extends WebSecurityConfigurerAdapter +{ + /** + * 自定义用户认证逻辑 + */ + @Autowired + private UserDetailsService userDetailsService; + + /** + * 认证失败处理类 + */ + @Autowired + private AuthenticationEntryPointImpl unauthorizedHandler; + + /** + * 退出处理类 + */ + @Autowired + private LogoutSuccessHandlerImpl logoutSuccessHandler; + + /** + * token认证过滤器 + */ + @Autowired + private JwtAuthenticationTokenFilter authenticationTokenFilter; + + /** + * 跨域过滤器 + */ + @Autowired + private CorsFilter corsFilter; + + /** + * 解决 无法直接注入 AuthenticationManager + * + * @return + * @throws Exception + */ + @Bean + @Override + public AuthenticationManager authenticationManagerBean() throws Exception + { + return super.authenticationManagerBean(); + } + + /** + * anyRequest | 匹配所有请求路径 + * access | SpringEl表达式结果为true时可以访问 + * anonymous | 匿名可以访问 + * denyAll | 用户不能访问 + * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) + * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 + * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 + * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 + * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 + * hasRole | 如果有参数,参数表示角色,则其角色可以访问 + * permitAll | 用户可以任意访问 + * rememberMe | 允许通过remember-me登录的用户访问 + * authenticated | 用户登录后可访问 + */ + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception + { + httpSecurity + // CSRF禁用,因为不使用session + .csrf().disable() + // 认证失败处理类 + .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() + // 基于token,所以不需要session + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() + // 过滤请求 + .authorizeRequests() + // 对于登录login 注册register 验证码captchaImage 允许匿名访问 + .antMatchers("/login", "/register", "/captchaImage").anonymous() + .antMatchers("/mobile/login/**").permitAll() + .antMatchers( + HttpMethod.GET, + "/", + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js", + "/profile/**" + ).permitAll() + .antMatchers("/swagger-ui.html").anonymous() + .antMatchers("/ureport/**").anonymous() + .antMatchers("/swagger-resources/**").anonymous() + .antMatchers("/webjars/**").anonymous() + .antMatchers("/*/api-docs").anonymous() + .antMatchers("/druid/**").anonymous() + .antMatchers("/websocket/**").anonymous() + .antMatchers("/system/autocode/get/**").permitAll() + // 除上面外的所有请求全部需要鉴权认证 + .anyRequest().authenticated() + .and() + .headers().frameOptions().disable(); + httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); + // 添加JWT filter + httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + // 添加CORS filter + httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); + httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); + } + + /** + * 强散列哈希加密实现 + */ + @Bean + public BCryptPasswordEncoder bCryptPasswordEncoder() + { + return new BCryptPasswordEncoder(); + } + + /** + * 身份认证接口 + */ + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception + { + auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/ServerConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/ServerConfig.java new file mode 100644 index 0000000..9827465 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/ServerConfig.java @@ -0,0 +1,32 @@ +package com.ktg.framework.config; + +import javax.servlet.http.HttpServletRequest; +import org.springframework.stereotype.Component; +import com.ktg.common.utils.ServletUtils; + +/** + * 服务相关配置 + * + * @author ruoyi + */ +@Component +public class ServerConfig +{ + /** + * 获取完整的请求路径,包括:域名,端口,上下文访问路径 + * + * @return 服务地址 + */ + public String getUrl() + { + HttpServletRequest request = ServletUtils.getRequest(); + return getDomain(request); + } + + public static String getDomain(HttpServletRequest request) + { + StringBuffer url = request.getRequestURL(); + String contextPath = request.getServletContext().getContextPath(); + return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/ThreadPoolConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/ThreadPoolConfig.java new file mode 100644 index 0000000..8055a74 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/ThreadPoolConfig.java @@ -0,0 +1,63 @@ +package com.ktg.framework.config; + +import com.ktg.common.utils.Threads; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 线程池配置 + * + * @author ruoyi + **/ +@Configuration +public class ThreadPoolConfig +{ + // 核心线程池大小 + private int corePoolSize = 50; + + // 最大可创建的线程数 + private int maxPoolSize = 200; + + // 队列最大长度 + private int queueCapacity = 1000; + + // 线程池维护线程所允许的空闲时间 + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() + { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 线程池对拒绝任务(无线程可用)的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + return executor; + } + + /** + * 执行周期性或定时任务 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() + { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), + new ThreadPoolExecutor.CallerRunsPolicy()) + { + @Override + protected void afterExecute(Runnable r, Throwable t) + { + super.afterExecute(r, t); + Threads.printException(r, t); + } + }; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/properties/DruidProperties.java b/ktg-framework/src/main/java/com/ktg/framework/config/properties/DruidProperties.java new file mode 100644 index 0000000..298a7e7 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/config/properties/DruidProperties.java @@ -0,0 +1,77 @@ +package com.ktg.framework.config.properties; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import com.alibaba.druid.pool.DruidDataSource; + +/** + * druid 配置属性 + * + * @author ruoyi + */ +@Configuration +public class DruidProperties +{ + @Value("${spring.datasource.druid.initialSize}") + private int initialSize; + + @Value("${spring.datasource.druid.minIdle}") + private int minIdle; + + @Value("${spring.datasource.druid.maxActive}") + private int maxActive; + + @Value("${spring.datasource.druid.maxWait}") + private int maxWait; + + @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}") + private int timeBetweenEvictionRunsMillis; + + @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}") + private int minEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}") + private int maxEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.validationQuery}") + private String validationQuery; + + @Value("${spring.datasource.druid.testWhileIdle}") + private boolean testWhileIdle; + + @Value("${spring.datasource.druid.testOnBorrow}") + private boolean testOnBorrow; + + @Value("${spring.datasource.druid.testOnReturn}") + private boolean testOnReturn; + + public DruidDataSource dataSource(DruidDataSource datasource) + { + /** 配置初始化大小、最小、最大 */ + datasource.setInitialSize(initialSize); + datasource.setMaxActive(maxActive); + datasource.setMinIdle(minIdle); + + /** 配置获取连接等待超时的时间 */ + datasource.setMaxWait(maxWait); + + /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ + datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + + /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ + datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); + + /** + * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 + */ + datasource.setValidationQuery(validationQuery); + /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ + datasource.setTestWhileIdle(testWhileIdle); + /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnBorrow(testOnBorrow); + /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnReturn(testOnReturn); + return datasource; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/datasource/DynamicDataSource.java b/ktg-framework/src/main/java/com/ktg/framework/datasource/DynamicDataSource.java new file mode 100644 index 0000000..f59ce3d --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/datasource/DynamicDataSource.java @@ -0,0 +1,26 @@ +package com.ktg.framework.datasource; + +import java.util.Map; +import javax.sql.DataSource; +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * 动态数据源 + * + * @author ruoyi + */ +public class DynamicDataSource extends AbstractRoutingDataSource +{ + public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) + { + super.setDefaultTargetDataSource(defaultTargetDataSource); + super.setTargetDataSources(targetDataSources); + super.afterPropertiesSet(); + } + + @Override + protected Object determineCurrentLookupKey() + { + return DynamicDataSourceContextHolder.getDataSourceType(); + } +} \ No newline at end of file diff --git a/ktg-framework/src/main/java/com/ktg/framework/datasource/DynamicDataSourceContextHolder.java b/ktg-framework/src/main/java/com/ktg/framework/datasource/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000..0601a07 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/datasource/DynamicDataSourceContextHolder.java @@ -0,0 +1,45 @@ +package com.ktg.framework.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 数据源切换处理 + * + * @author ruoyi + */ +public class DynamicDataSourceContextHolder +{ + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); + + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + /** + * 设置数据源的变量 + */ + public static void setDataSourceType(String dsType) + { + log.info("切换到{}数据源", dsType); + CONTEXT_HOLDER.set(dsType); + } + + /** + * 获得数据源的变量 + */ + public static String getDataSourceType() + { + return CONTEXT_HOLDER.get(); + } + + /** + * 清空数据源变量 + */ + public static void clearDataSourceType() + { + CONTEXT_HOLDER.remove(); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/interceptor/RepeatSubmitInterceptor.java b/ktg-framework/src/main/java/com/ktg/framework/interceptor/RepeatSubmitInterceptor.java new file mode 100644 index 0000000..cd5dd9a --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/interceptor/RepeatSubmitInterceptor.java @@ -0,0 +1,55 @@ +package com.ktg.framework.interceptor; + +import java.lang.reflect.Method; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; +import com.alibaba.fastjson.JSONObject; +import com.ktg.common.annotation.RepeatSubmit; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.ServletUtils; + +/** + * 防止重复提交拦截器 + * + * @author ktg + */ +@Component +public abstract class RepeatSubmitInterceptor implements HandlerInterceptor +{ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception + { + if (handler instanceof HandlerMethod) + { + HandlerMethod handlerMethod = (HandlerMethod) handler; + Method method = handlerMethod.getMethod(); + RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class); + if (annotation != null) + { + if (this.isRepeatSubmit(request, annotation)) + { + AjaxResult ajaxResult = AjaxResult.error(annotation.message()); + ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult)); + return false; + } + } + return true; + } + else + { + return true; + } + } + + /** + * 验证是否重复提交由子类实现具体的防重复提交的规则 + * + * @param request + * @return + * @throws Exception + */ + public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation); +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/interceptor/impl/SameUrlDataInterceptor.java b/ktg-framework/src/main/java/com/ktg/framework/interceptor/impl/SameUrlDataInterceptor.java new file mode 100644 index 0000000..20b5d63 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/interceptor/impl/SameUrlDataInterceptor.java @@ -0,0 +1,110 @@ +package com.ktg.framework.interceptor.impl; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson.JSONObject; +import com.ktg.common.annotation.RepeatSubmit; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.filter.RepeatedlyRequestWrapper; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.http.HttpHelper; +import com.ktg.framework.interceptor.RepeatSubmitInterceptor; + +/** + * 判断请求url和数据是否和上一次相同, + * 如果和上次相同,则是重复提交表单。 有效时间为10秒内。 + * + * @author ruoyi + */ +@Component +public class SameUrlDataInterceptor extends RepeatSubmitInterceptor +{ + public final String REPEAT_PARAMS = "repeatParams"; + + public final String REPEAT_TIME = "repeatTime"; + + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + @Autowired + private RedisCache redisCache; + + @SuppressWarnings("unchecked") + @Override + public boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) + { + String nowParams = ""; + if (request instanceof RepeatedlyRequestWrapper) + { + RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; + nowParams = HttpHelper.getBodyString(repeatedlyRequest); + } + + // body参数为空,获取Parameter的数据 + if (StringUtils.isEmpty(nowParams)) + { + nowParams = JSONObject.toJSONString(request.getParameterMap()); + } + Map nowDataMap = new HashMap(); + nowDataMap.put(REPEAT_PARAMS, nowParams); + nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); + + // 请求地址(作为存放cache的key值) + String url = request.getRequestURI(); + + // 唯一值(没有消息头则使用请求地址) + String submitKey = StringUtils.trimToEmpty(request.getHeader(header)); + + // 唯一标识(指定key + url + 消息头) + String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey; + + Object sessionObj = redisCache.getCacheObject(cacheRepeatKey); + if (sessionObj != null) + { + Map sessionMap = (Map) sessionObj; + if (sessionMap.containsKey(url)) + { + Map preDataMap = (Map) sessionMap.get(url); + if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap, annotation.interval())) + { + return true; + } + } + } + Map cacheMap = new HashMap(); + cacheMap.put(url, nowDataMap); + redisCache.setCacheObject(cacheRepeatKey, cacheMap, annotation.interval(), TimeUnit.MILLISECONDS); + return false; + } + + /** + * 判断参数是否相同 + */ + private boolean compareParams(Map nowMap, Map preMap) + { + String nowParams = (String) nowMap.get(REPEAT_PARAMS); + String preParams = (String) preMap.get(REPEAT_PARAMS); + return nowParams.equals(preParams); + } + + /** + * 判断两次间隔时间 + */ + private boolean compareTime(Map nowMap, Map preMap, int interval) + { + long time1 = (Long) nowMap.get(REPEAT_TIME); + long time2 = (Long) preMap.get(REPEAT_TIME); + if ((time1 - time2) < interval) + { + return true; + } + return false; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/manager/AsyncManager.java b/ktg-framework/src/main/java/com/ktg/framework/manager/AsyncManager.java new file mode 100644 index 0000000..9811685 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/manager/AsyncManager.java @@ -0,0 +1,55 @@ +package com.ktg.framework.manager; + +import java.util.TimerTask; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import com.ktg.common.utils.Threads; +import com.ktg.common.utils.spring.SpringUtils; + +/** + * 异步任务管理器 + * + * @author ruoyi + */ +public class AsyncManager +{ + /** + * 操作延迟10毫秒 + */ + private final int OPERATE_DELAY_TIME = 10; + + /** + * 异步操作任务调度线程池 + */ + private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); + + /** + * 单例模式 + */ + private AsyncManager(){} + + private static AsyncManager me = new AsyncManager(); + + public static AsyncManager me() + { + return me; + } + + /** + * 执行任务 + * + * @param task 任务 + */ + public void execute(TimerTask task) + { + executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); + } + + /** + * 停止任务线程池 + */ + public void shutdown() + { + Threads.shutdownAndAwaitTermination(executor); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/manager/ShutdownManager.java b/ktg-framework/src/main/java/com/ktg/framework/manager/ShutdownManager.java new file mode 100644 index 0000000..a7df30c --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/manager/ShutdownManager.java @@ -0,0 +1,39 @@ +package com.ktg.framework.manager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import javax.annotation.PreDestroy; + +/** + * 确保应用退出时能关闭后台线程 + * + * @author ruoyi + */ +@Component +public class ShutdownManager +{ + private static final Logger logger = LoggerFactory.getLogger("sys-user"); + + @PreDestroy + public void destroy() + { + shutdownAsyncManager(); + } + + /** + * 停止异步执行任务 + */ + private void shutdownAsyncManager() + { + try + { + logger.info("====关闭后台任务任务线程池===="); + AsyncManager.me().shutdown(); + } + catch (Exception e) + { + logger.error(e.getMessage(), e); + } + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/manager/factory/AsyncFactory.java b/ktg-framework/src/main/java/com/ktg/framework/manager/factory/AsyncFactory.java new file mode 100644 index 0000000..9d7c17a --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/manager/factory/AsyncFactory.java @@ -0,0 +1,102 @@ +package com.ktg.framework.manager.factory; + +import java.util.TimerTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ktg.common.constant.Constants; +import com.ktg.common.utils.LogUtils; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.ip.AddressUtils; +import com.ktg.common.utils.ip.IpUtils; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.system.domain.SysLogininfor; +import com.ktg.system.domain.SysOperLog; +import com.ktg.system.service.ISysLogininforService; +import com.ktg.system.service.ISysOperLogService; +import eu.bitwalker.useragentutils.UserAgent; + +/** + * 异步工厂(产生任务用) + * + * @author ruoyi + */ +public class AsyncFactory +{ + private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); + + /** + * 记录登录信息 + * + * @param username 用户名 + * @param status 状态 + * @param message 消息 + * @param args 列表 + * @return 任务task + */ + public static TimerTask recordLogininfor(final String username, final String status, final String message, + final Object... args) + { + final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + final String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + return new TimerTask() + { + @Override + public void run() + { + String address = AddressUtils.getRealAddressByIP(ip); + StringBuilder s = new StringBuilder(); + s.append(LogUtils.getBlock(ip)); + s.append(address); + s.append(LogUtils.getBlock(username)); + s.append(LogUtils.getBlock(status)); + s.append(LogUtils.getBlock(message)); + // 打印信息到日志 + sys_user_logger.info(s.toString(), args); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + // 封装对象 + SysLogininfor logininfor = new SysLogininfor(); + logininfor.setUserName(username); + logininfor.setIpaddr(ip); + logininfor.setLoginLocation(address); + logininfor.setBrowser(browser); + logininfor.setOs(os); + logininfor.setMsg(message); + // 日志状态 + if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) + { + logininfor.setStatus(Constants.SUCCESS); + } + else if (Constants.LOGIN_FAIL.equals(status)) + { + logininfor.setStatus(Constants.FAIL); + } + // 插入数据 + SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor); + } + }; + } + + /** + * 操作日志记录 + * + * @param operLog 操作日志信息 + * @return 任务task + */ + public static TimerTask recordOper(final SysOperLog operLog) + { + return new TimerTask() + { + @Override + public void run() + { + // 远程查询操作地点 + operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); + SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog); + } + }; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/message/MessageProvider.java b/ktg-framework/src/main/java/com/ktg/framework/message/MessageProvider.java new file mode 100644 index 0000000..dec25a2 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/message/MessageProvider.java @@ -0,0 +1,41 @@ +package com.ktg.framework.message; + +import com.alibaba.fastjson.JSON; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.websocket.WebSocketUsers; +import com.ktg.system.domain.SysMessage; +import com.ktg.system.service.ISysMessageService; +import com.ktg.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class MessageProvider { + + @Autowired + private ISysMessageService sysMessageService; + @Autowired + private ISysUserService sysUserService; + + @Transactional + public void sendMessage(SysMessage message){ + message.setStatus(UserConstants.MESSAGE_STATUS_UNREAD); + if(StringUtils.isNotNull(message.getRecipientId())){ + SysUser recipient = sysUserService.selectUserById(message.getRecipientId()); + message.setRecipientName(recipient.getUserName()); + message.setRecipientNick(recipient.getNickName()); + } + if(StringUtils.isNotNull(message.getSenderId())){ + SysUser sender = sysUserService.selectUserById(message.getSenderId()); + message.setRecipientName(sender.getUserName()); + message.setRecipientNick(sender.getNickName()); + } + message.setDeletedFlag(UserConstants.NO); + WebSocketUsers.sendMesssageToUserByName(message.getRecipientName(), JSON.toJSONString(message)); + sysMessageService.insertSysMessage(message); + } + +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/security/filter/JwtAuthenticationTokenFilter.java b/ktg-framework/src/main/java/com/ktg/framework/security/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000..c5b8d72 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,44 @@ +package com.ktg.framework.security.filter; + +import java.io.IOException; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.web.service.TokenService; + +/** + * token过滤器 验证token有效性 + * + * @author ruoyi + */ +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter +{ + @Autowired + private TokenService tokenService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) + { + tokenService.verifyToken(loginUser); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + SecurityContextHolder.getContext().setAuthentication(authenticationToken); + } + chain.doFilter(request, response); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/security/handle/AuthenticationEntryPointImpl.java b/ktg-framework/src/main/java/com/ktg/framework/security/handle/AuthenticationEntryPointImpl.java new file mode 100644 index 0000000..39b7bdd --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/security/handle/AuthenticationEntryPointImpl.java @@ -0,0 +1,34 @@ +package com.ktg.framework.security.handle; + +import java.io.IOException; +import java.io.Serializable; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson.JSON; +import com.ktg.common.constant.HttpStatus; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.StringUtils; + +/** + * 认证失败处理类 返回未授权 + * + * @author ruoyi + */ +@Component +public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable +{ + private static final long serialVersionUID = -8970718410437077606L; + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) + throws IOException + { + int code = HttpStatus.UNAUTHORIZED; + String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/security/handle/LogoutSuccessHandlerImpl.java b/ktg-framework/src/main/java/com/ktg/framework/security/handle/LogoutSuccessHandlerImpl.java new file mode 100644 index 0000000..a4b51da --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/security/handle/LogoutSuccessHandlerImpl.java @@ -0,0 +1,53 @@ +package com.ktg.framework.security.handle; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import com.alibaba.fastjson.JSON; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.HttpStatus; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.manager.AsyncManager; +import com.ktg.framework.manager.factory.AsyncFactory; +import com.ktg.framework.web.service.TokenService; + +/** + * 自定义退出处理类 返回成功 + * + * @author ruoyi + */ +@Configuration +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler +{ + @Autowired + private TokenService tokenService; + + /** + * 退出处理 + * + * @return + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException, ServletException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser)) + { + String userName = loginUser.getUsername(); + // 删除用户缓存记录 + tokenService.delLoginUser(loginUser.getToken()); + // 记录用户退出日志 + AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功")); + } + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功"))); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/domain/Server.java b/ktg-framework/src/main/java/com/ktg/framework/web/domain/Server.java new file mode 100644 index 0000000..92e3409 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/domain/Server.java @@ -0,0 +1,240 @@ +package com.ktg.framework.web.domain; + +import java.net.UnknownHostException; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import com.ktg.common.utils.Arith; +import com.ktg.common.utils.ip.IpUtils; +import com.ktg.framework.web.domain.server.Cpu; +import com.ktg.framework.web.domain.server.Jvm; +import com.ktg.framework.web.domain.server.Mem; +import com.ktg.framework.web.domain.server.Sys; +import com.ktg.framework.web.domain.server.SysFile; +import oshi.SystemInfo; +import oshi.hardware.CentralProcessor; +import oshi.hardware.CentralProcessor.TickType; +import oshi.hardware.GlobalMemory; +import oshi.hardware.HardwareAbstractionLayer; +import oshi.software.os.FileSystem; +import oshi.software.os.OSFileStore; +import oshi.software.os.OperatingSystem; +import oshi.util.Util; + +/** + * 服务器相关信息 + * + * @author ruoyi + */ +public class Server +{ + private static final int OSHI_WAIT_SECOND = 1000; + + /** + * CPU相关信息 + */ + private Cpu cpu = new Cpu(); + + /** + * 內存相关信息 + */ + private Mem mem = new Mem(); + + /** + * JVM相关信息 + */ + private Jvm jvm = new Jvm(); + + /** + * 服务器相关信息 + */ + private Sys sys = new Sys(); + + /** + * 磁盘相关信息 + */ + private List sysFiles = new LinkedList(); + + public Cpu getCpu() + { + return cpu; + } + + public void setCpu(Cpu cpu) + { + this.cpu = cpu; + } + + public Mem getMem() + { + return mem; + } + + public void setMem(Mem mem) + { + this.mem = mem; + } + + public Jvm getJvm() + { + return jvm; + } + + public void setJvm(Jvm jvm) + { + this.jvm = jvm; + } + + public Sys getSys() + { + return sys; + } + + public void setSys(Sys sys) + { + this.sys = sys; + } + + public List getSysFiles() + { + return sysFiles; + } + + public void setSysFiles(List sysFiles) + { + this.sysFiles = sysFiles; + } + + public void copyTo() throws Exception + { + SystemInfo si = new SystemInfo(); + HardwareAbstractionLayer hal = si.getHardware(); + + setCpuInfo(hal.getProcessor()); + + setMemInfo(hal.getMemory()); + + setSysInfo(); + + setJvmInfo(); + + setSysFiles(si.getOperatingSystem()); + } + + /** + * 设置CPU信息 + */ + private void setCpuInfo(CentralProcessor processor) + { + // CPU信息 + long[] prevTicks = processor.getSystemCpuLoadTicks(); + Util.sleep(OSHI_WAIT_SECOND); + long[] ticks = processor.getSystemCpuLoadTicks(); + long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()]; + long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()]; + long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()]; + long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()]; + long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()]; + long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()]; + long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()]; + long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()]; + long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal; + cpu.setCpuNum(processor.getLogicalProcessorCount()); + cpu.setTotal(totalCpu); + cpu.setSys(cSys); + cpu.setUsed(user); + cpu.setWait(iowait); + cpu.setFree(idle); + } + + /** + * 设置内存信息 + */ + private void setMemInfo(GlobalMemory memory) + { + mem.setTotal(memory.getTotal()); + mem.setUsed(memory.getTotal() - memory.getAvailable()); + mem.setFree(memory.getAvailable()); + } + + /** + * 设置服务器信息 + */ + private void setSysInfo() + { + Properties props = System.getProperties(); + sys.setComputerName(IpUtils.getHostName()); + sys.setComputerIp(IpUtils.getHostIp()); + sys.setOsName(props.getProperty("os.name")); + sys.setOsArch(props.getProperty("os.arch")); + sys.setUserDir(props.getProperty("user.dir")); + } + + /** + * 设置Java虚拟机 + */ + private void setJvmInfo() throws UnknownHostException + { + Properties props = System.getProperties(); + jvm.setTotal(Runtime.getRuntime().totalMemory()); + jvm.setMax(Runtime.getRuntime().maxMemory()); + jvm.setFree(Runtime.getRuntime().freeMemory()); + jvm.setVersion(props.getProperty("java.version")); + jvm.setHome(props.getProperty("java.home")); + } + + /** + * 设置磁盘信息 + */ + private void setSysFiles(OperatingSystem os) + { + FileSystem fileSystem = os.getFileSystem(); + List fsArray = fileSystem.getFileStores(); + for (OSFileStore fs : fsArray) + { + long free = fs.getUsableSpace(); + long total = fs.getTotalSpace(); + long used = total - free; + SysFile sysFile = new SysFile(); + sysFile.setDirName(fs.getMount()); + sysFile.setSysTypeName(fs.getType()); + sysFile.setTypeName(fs.getName()); + sysFile.setTotal(convertFileSize(total)); + sysFile.setFree(convertFileSize(free)); + sysFile.setUsed(convertFileSize(used)); + sysFile.setUsage(Arith.mul(Arith.div(used, total, 4), 100)); + sysFiles.add(sysFile); + } + } + + /** + * 字节转换 + * + * @param size 字节大小 + * @return 转换后值 + */ + public String convertFileSize(long size) + { + long kb = 1024; + long mb = kb * 1024; + long gb = mb * 1024; + if (size >= gb) + { + return String.format("%.1f GB", (float) size / gb); + } + else if (size >= mb) + { + float f = (float) size / mb; + return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f); + } + else if (size >= kb) + { + float f = (float) size / kb; + return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f); + } + else + { + return String.format("%d B", size); + } + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Cpu.java b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Cpu.java new file mode 100644 index 0000000..c0c070e --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Cpu.java @@ -0,0 +1,101 @@ +package com.ktg.framework.web.domain.server; + +import com.ktg.common.utils.Arith; + +/** + * CPU相关信息 + * + * @author ruoyi + */ +public class Cpu +{ + /** + * 核心数 + */ + private int cpuNum; + + /** + * CPU总的使用率 + */ + private double total; + + /** + * CPU系统使用率 + */ + private double sys; + + /** + * CPU用户使用率 + */ + private double used; + + /** + * CPU当前等待率 + */ + private double wait; + + /** + * CPU当前空闲率 + */ + private double free; + + public int getCpuNum() + { + return cpuNum; + } + + public void setCpuNum(int cpuNum) + { + this.cpuNum = cpuNum; + } + + public double getTotal() + { + return Arith.round(Arith.mul(total, 100), 2); + } + + public void setTotal(double total) + { + this.total = total; + } + + public double getSys() + { + return Arith.round(Arith.mul(sys / total, 100), 2); + } + + public void setSys(double sys) + { + this.sys = sys; + } + + public double getUsed() + { + return Arith.round(Arith.mul(used / total, 100), 2); + } + + public void setUsed(double used) + { + this.used = used; + } + + public double getWait() + { + return Arith.round(Arith.mul(wait / total, 100), 2); + } + + public void setWait(double wait) + { + this.wait = wait; + } + + public double getFree() + { + return Arith.round(Arith.mul(free / total, 100), 2); + } + + public void setFree(double free) + { + this.free = free; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Jvm.java b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Jvm.java new file mode 100644 index 0000000..f734f88 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Jvm.java @@ -0,0 +1,130 @@ +package com.ktg.framework.web.domain.server; + +import java.lang.management.ManagementFactory; +import com.ktg.common.utils.Arith; +import com.ktg.common.utils.DateUtils; + +/** + * JVM相关信息 + * + * @author ruoyi + */ +public class Jvm +{ + /** + * 当前JVM占用的内存总数(M) + */ + private double total; + + /** + * JVM最大可用内存总数(M) + */ + private double max; + + /** + * JVM空闲内存(M) + */ + private double free; + + /** + * JDK版本 + */ + private String version; + + /** + * JDK路径 + */ + private String home; + + public double getTotal() + { + return Arith.div(total, (1024 * 1024), 2); + } + + public void setTotal(double total) + { + this.total = total; + } + + public double getMax() + { + return Arith.div(max, (1024 * 1024), 2); + } + + public void setMax(double max) + { + this.max = max; + } + + public double getFree() + { + return Arith.div(free, (1024 * 1024), 2); + } + + public void setFree(double free) + { + this.free = free; + } + + public double getUsed() + { + return Arith.div(total - free, (1024 * 1024), 2); + } + + public double getUsage() + { + return Arith.mul(Arith.div(total - free, total, 4), 100); + } + + /** + * 获取JDK名称 + */ + public String getName() + { + return ManagementFactory.getRuntimeMXBean().getVmName(); + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getHome() + { + return home; + } + + public void setHome(String home) + { + this.home = home; + } + + /** + * JDK启动时间 + */ + public String getStartTime() + { + return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate()); + } + + /** + * JDK运行时间 + */ + public String getRunTime() + { + return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate()); + } + + /** + * 运行参数 + */ + public String getInputArgs() + { + return ManagementFactory.getRuntimeMXBean().getInputArguments().toString(); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Mem.java b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Mem.java new file mode 100644 index 0000000..9836799 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Mem.java @@ -0,0 +1,61 @@ +package com.ktg.framework.web.domain.server; + +import com.ktg.common.utils.Arith; + +/** + * 內存相关信息 + * + * @author ruoyi + */ +public class Mem +{ + /** + * 内存总量 + */ + private double total; + + /** + * 已用内存 + */ + private double used; + + /** + * 剩余内存 + */ + private double free; + + public double getTotal() + { + return Arith.div(total, (1024 * 1024 * 1024), 2); + } + + public void setTotal(long total) + { + this.total = total; + } + + public double getUsed() + { + return Arith.div(used, (1024 * 1024 * 1024), 2); + } + + public void setUsed(long used) + { + this.used = used; + } + + public double getFree() + { + return Arith.div(free, (1024 * 1024 * 1024), 2); + } + + public void setFree(long free) + { + this.free = free; + } + + public double getUsage() + { + return Arith.mul(Arith.div(used, total, 4), 100); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Sys.java b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Sys.java new file mode 100644 index 0000000..ddab7e2 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/Sys.java @@ -0,0 +1,84 @@ +package com.ktg.framework.web.domain.server; + +/** + * 系统相关信息 + * + * @author ruoyi + */ +public class Sys +{ + /** + * 服务器名称 + */ + private String computerName; + + /** + * 服务器Ip + */ + private String computerIp; + + /** + * 项目路径 + */ + private String userDir; + + /** + * 操作系统 + */ + private String osName; + + /** + * 系统架构 + */ + private String osArch; + + public String getComputerName() + { + return computerName; + } + + public void setComputerName(String computerName) + { + this.computerName = computerName; + } + + public String getComputerIp() + { + return computerIp; + } + + public void setComputerIp(String computerIp) + { + this.computerIp = computerIp; + } + + public String getUserDir() + { + return userDir; + } + + public void setUserDir(String userDir) + { + this.userDir = userDir; + } + + public String getOsName() + { + return osName; + } + + public void setOsName(String osName) + { + this.osName = osName; + } + + public String getOsArch() + { + return osArch; + } + + public void setOsArch(String osArch) + { + this.osArch = osArch; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/SysFile.java b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/SysFile.java new file mode 100644 index 0000000..94c750c --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/domain/server/SysFile.java @@ -0,0 +1,114 @@ +package com.ktg.framework.web.domain.server; + +/** + * 系统文件相关信息 + * + * @author ruoyi + */ +public class SysFile +{ + /** + * 盘符路径 + */ + private String dirName; + + /** + * 盘符类型 + */ + private String sysTypeName; + + /** + * 文件类型 + */ + private String typeName; + + /** + * 总大小 + */ + private String total; + + /** + * 剩余大小 + */ + private String free; + + /** + * 已经使用量 + */ + private String used; + + /** + * 资源的使用率 + */ + private double usage; + + public String getDirName() + { + return dirName; + } + + public void setDirName(String dirName) + { + this.dirName = dirName; + } + + public String getSysTypeName() + { + return sysTypeName; + } + + public void setSysTypeName(String sysTypeName) + { + this.sysTypeName = sysTypeName; + } + + public String getTypeName() + { + return typeName; + } + + public void setTypeName(String typeName) + { + this.typeName = typeName; + } + + public String getTotal() + { + return total; + } + + public void setTotal(String total) + { + this.total = total; + } + + public String getFree() + { + return free; + } + + public void setFree(String free) + { + this.free = free; + } + + public String getUsed() + { + return used; + } + + public void setUsed(String used) + { + this.used = used; + } + + public double getUsage() + { + return usage; + } + + public void setUsage(double usage) + { + this.usage = usage; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/exception/GlobalExceptionHandler.java b/ktg-framework/src/main/java/com/ktg/framework/web/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..b597240 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/exception/GlobalExceptionHandler.java @@ -0,0 +1,114 @@ +package com.ktg.framework.web.exception; + +import javax.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.validation.BindException; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import com.ktg.common.constant.HttpStatus; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.exception.DemoModeException; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.StringUtils; + +/** + * 全局异常处理器 + * + * @author ruoyi + */ +@RestControllerAdvice +public class GlobalExceptionHandler +{ + private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + /** + * 权限校验异常 + */ + @ExceptionHandler(AccessDeniedException.class) + public AjaxResult handleAccessDeniedException(AccessDeniedException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',权限校验失败'{}'", requestURI, e.getMessage()); + return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权"); + } + + /** + * 请求方式不支持 + */ + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, + HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod()); + return AjaxResult.error(e.getMessage()); + } + + /** + * 业务异常 + */ + @ExceptionHandler(ServiceException.class) + public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) + { + log.error(e.getMessage(), e); + Integer code = e.getCode(); + return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); + } + + /** + * 拦截未知的运行时异常 + */ + @ExceptionHandler(RuntimeException.class) + public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',发生未知异常.", requestURI, e); + return AjaxResult.error(e.getMessage()); + } + + /** + * 系统异常 + */ + @ExceptionHandler(Exception.class) + public AjaxResult handleException(Exception e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',发生系统异常.", requestURI, e); + return AjaxResult.error(e.getMessage()); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(BindException.class) + public AjaxResult handleBindException(BindException e) + { + log.error(e.getMessage(), e); + String message = e.getAllErrors().get(0).getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) + { + log.error(e.getMessage(), e); + String message = e.getBindingResult().getFieldError().getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 演示模式异常 + */ + @ExceptionHandler(DemoModeException.class) + public AjaxResult handleDemoModeException(DemoModeException e) + { + return AjaxResult.error("演示模式,不允许操作"); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/MobileLoginService.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/MobileLoginService.java new file mode 100644 index 0000000..eb320d2 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/MobileLoginService.java @@ -0,0 +1,234 @@ +package com.ktg.framework.web.service; + + +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.exception.user.UserPasswordNotMatchException; +import com.ktg.common.utils.DictUtils; +import com.ktg.common.utils.MessageUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.manager.AsyncManager; +import com.ktg.framework.manager.factory.AsyncFactory; +import com.ktg.system.domain.LoginParams; +import com.ktg.system.service.ISysPostService; +import com.ktg.system.service.ISysRoleService; +import com.ktg.system.service.ISysUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.Objects; +import java.util.Set; + +/** + * 移动端登录服务接口 + */ +@Component +public class MobileLoginService { + + private static final Logger log = LoggerFactory.getLogger(MobileLoginService.class); + + @Autowired(required = false) + private TokenService tokenService; + + @Autowired(required = false) + private SysLoginService sysLoginService; + + @Autowired(required = false) + private ISysRoleService sysRoleService; + + @Autowired(required = false) + private AuthenticationManager authenticationManager; + + @Autowired(required = false) + private ISysUserService sysUserService; + + @Autowired(required = false) + private PermissionService permissionService; + + /** + * 注入redis服务 + */ + @Autowired(required = false) + private RedisCache redisCache; + + /** + * 请求时间戳过期时间5分钟 + */ + private static final int REQUEST_TIME_OUT = 1000 * 60 * 5; + + + /** + * jwt密钥 + */ + @Value("${token.secret}") + private String jwtSecretKey; + + public AjaxResult login(LoginParams loginParams) { + log.debug("login and loginParams:{}", loginParams); + + if (Objects.isNull(loginParams)) { + return AjaxResult.error(-6,"登录参数不能为空"); + } + String loginType = loginParams.getLoginType(); + if(StringUtils.isBlank(loginType)){ + return AjaxResult.error(-6,"登录方式不能为空"); + } + //登录方式0验证码登录,1用户名密码登录,2本机一键登录,3微信单点登录 + if(loginType.equals("0")){ + String phoneNo = loginParams.getPhoneNo(); + if(StringUtils.isBlank(phoneNo)){ + return AjaxResult.error(-6,"登录名不能为空"); + } + String validCode = loginParams.getValidCode(); + //2表示登录验证码,校验验证码合法性 + //sysSmsSendService.checkValidCode(phoneNo,validCode,"2"); + loginParams.setUsername(phoneNo); + loginParams.setPassword("SSO_LOGIN"); + }else if(loginType.equals("1")){ + String password = loginParams.getPassword(); + if(StringUtils.isBlank(password)){ + return AjaxResult.error(-6,"密码不能为空"); + } + } + // 用户验证 + Authentication authentication = null; + try + { + authentication = authenticationManager + .authenticate(new UsernamePasswordAuthenticationToken(loginParams.getUsername(), loginParams.getPassword())); + } + catch (Exception e) + { + if (e instanceof BadCredentialsException) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginParams.getUsername(), Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginParams.getUsername(), Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } + } + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + //loginUser.setSource("app"); + SysUser user = loginUser.getUser(); + // 生成token + String token = tokenService.createToken(loginUser); + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginParams.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + sysLoginService.recordLoginInfo(user.getUserId()); + //判断用户是否存在管理员角色 + // 角色集合 +// Set roles = permissionService.getRolePermission(user); +// boolean roleFlag = false; +// if(!CollectionUtils.isEmpty(roles)){ +// for (String roleKey : roles) { +// if(roleKey.equals("agent")){ +// roleFlag = true; +// break; +// } +// } +// } + AjaxResult ajax = AjaxResult.success(""); + ajax.put("token",token); + //token过期时间 + ajax.put("expired",loginUser.getExpireTime()); + ajax.put("user",loginUser.getUser()); + ajax.put("isAgent",String.valueOf(true)); + return ajax; + } + /** + * 发送注册验证码 + * @param loginParams + * @return + */ + public AjaxResult sendCode(LoginParams loginParams) { + if (Objects.isNull(loginParams)) { + return AjaxResult.error(-6,"参数为空"); + } + // 验证验证码 + if (StringUtils.isBlank(loginParams.getPhoneNo())) { + return AjaxResult.error(-6,"发送手机号不能为空"); + } + String validCodeType = "2"; + if (StringUtils.isNotBlank(loginParams.getValidCodeType())) { + validCodeType = loginParams.getValidCodeType(); + } + try{ + //SysSmsSend sysSmsSend = sysSmsSendService.sendMessage(loginParams.getPhoneNo(),validCodeType,true); + //String resultFlag = sysSmsSend.getResultFlag(); + String resultFlag = "n"; + if(resultFlag.equals("f")){ + return AjaxResult.error(-6,"对不起手机号【"+loginParams.getPhoneNo()+"】发送短信失败:失败原因:"); + } + }catch (Exception e){ + throw new ServiceException(e.getMessage()); + } + AjaxResult ajax = AjaxResult.success("验证码发送成功"); + return ajax; + } + + /** + * 手机号验证码注册用户 + * @param loginParams + * @return + */ + @Transactional(readOnly = false) + public AjaxResult registerUser(LoginParams loginParams) { + try{ + if (Objects.isNull(loginParams)) { + return AjaxResult.error(-6,"参数为空"); + } + String phoneNo = loginParams.getPhoneNo(); + if (StringUtils.isBlank(phoneNo)) { + return AjaxResult.error(-6,"发送手机号不能为空"); + } + String validCode = loginParams.getValidCode(); + if (StringUtils.isBlank(validCode)) { + return AjaxResult.error(-6,"验证码不能为空"); + } + loginParams.setUsername(phoneNo); + loginParams.setPassword(phoneNo); + loginParams.setLoginType("1"); + return this.login(loginParams); + }catch (Exception e){ + throw new ServiceException(e.getMessage()); + } + } + + /** + * 设置注册用户角色部门岗位信息 + * @param registerUser + * @return + */ + private void setUserDefaultInfo(SysUser registerUser ){ + String registerRoleCode = DictUtils.getDictValue("sys_config","register_role_code",""); + if (StringUtils.isBlank(registerRoleCode)) { + throw new ServiceException("请前往数据字典【sys_config】中维护注册用户角色编码【register_role_code】"); + } + String registerDeptCode = DictUtils.getDictValue("sys_config","register_dept_code",""); + if (StringUtils.isBlank(registerDeptCode)) { + throw new ServiceException("请前往数据字典【sys_config】中维护注册用户部门编码【register_dept_code】"); + } + String registerPostCode = DictUtils.getDictValue("sys_config","register_post_code",""); + if (StringUtils.isBlank(registerPostCode)) { + throw new ServiceException("请前往数据字典【sys_config】中维护注册用户岗位编码【register_post_code】"); + } + + } + +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/PermissionService.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/PermissionService.java new file mode 100644 index 0000000..592497c --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/PermissionService.java @@ -0,0 +1,165 @@ +package com.ktg.framework.web.service; + +import java.util.Set; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; + +/** + * RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母 + * + * @author ruoyi + */ +@Service("ss") +public class PermissionService +{ + /** 所有权限标识 */ + private static final String ALL_PERMISSION = "*:*:*"; + + /** 管理员角色权限标识 */ + private static final String SUPER_ADMIN = "admin"; + + private static final String ROLE_DELIMETER = ","; + + private static final String PERMISSION_DELIMETER = ","; + + /** + * 验证用户是否具备某权限 + * + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public boolean hasPermi(String permission) + { + if (StringUtils.isEmpty(permission)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + return hasPermissions(loginUser.getPermissions(), permission); + } + + /** + * 验证用户是否不具备某权限,与 hasPermi逻辑相反 + * + * @param permission 权限字符串 + * @return 用户是否不具备某权限 + */ + public boolean lacksPermi(String permission) + { + return hasPermi(permission) != true; + } + + /** + * 验证用户是否具有以下任意一个权限 + * + * @param permissions 以 PERMISSION_NAMES_DELIMETER 为分隔符的权限列表 + * @return 用户是否具有以下任意一个权限 + */ + public boolean hasAnyPermi(String permissions) + { + if (StringUtils.isEmpty(permissions)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + Set authorities = loginUser.getPermissions(); + for (String permission : permissions.split(PERMISSION_DELIMETER)) + { + if (permission != null && hasPermissions(authorities, permission)) + { + return true; + } + } + return false; + } + + /** + * 判断用户是否拥有某个角色 + * + * @param role 角色字符串 + * @return 用户是否具备某角色 + */ + public boolean hasRole(String role) + { + if (StringUtils.isEmpty(role)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (SysRole sysRole : loginUser.getUser().getRoles()) + { + String roleKey = sysRole.getRoleKey(); + if (SUPER_ADMIN.equals(roleKey) || roleKey.equals(StringUtils.trim(role))) + { + return true; + } + } + return false; + } + + /** + * 验证用户是否不具备某角色,与 isRole逻辑相反。 + * + * @param role 角色名称 + * @return 用户是否不具备某角色 + */ + public boolean lacksRole(String role) + { + return hasRole(role) != true; + } + + /** + * 验证用户是否具有以下任意一个角色 + * + * @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表 + * @return 用户是否具有以下任意一个角色 + */ + public boolean hasAnyRoles(String roles) + { + if (StringUtils.isEmpty(roles)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (String role : roles.split(ROLE_DELIMETER)) + { + if (hasRole(role)) + { + return true; + } + } + return false; + } + + /** + * 判断是否包含权限 + * + * @param permissions 权限列表 + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + private boolean hasPermissions(Set permissions, String permission) + { + return permissions.contains(ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission)); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/SysLoginService.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/SysLoginService.java new file mode 100644 index 0000000..437c3b8 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/SysLoginService.java @@ -0,0 +1,134 @@ +package com.ktg.framework.web.service; + +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.exception.user.CaptchaException; +import com.ktg.common.exception.user.CaptchaExpireException; +import com.ktg.common.exception.user.UserPasswordNotMatchException; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.MessageUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.ip.IpUtils; +import com.ktg.framework.manager.AsyncManager; +import com.ktg.framework.manager.factory.AsyncFactory; +import com.ktg.system.service.ISysConfigService; +import com.ktg.system.service.ISysUserService; + +/** + * 登录校验方法 + * + * @author ruoyi + */ +@Component +public class SysLoginService +{ + @Autowired + private TokenService tokenService; + + @Resource + private AuthenticationManager authenticationManager; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysConfigService configService; + + /** + * 登录验证 + * + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public String login(String username, String password, String code, String uuid) + { + boolean captchaOnOff = configService.selectCaptchaOnOff(); + // 验证码开关 + if (captchaOnOff) + { + validateCaptcha(username, code, uuid); + } + // 用户验证 + Authentication authentication = null; + try + { + // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername + authentication = authenticationManager + .authenticate(new UsernamePasswordAuthenticationToken(username, password)); + } + catch (Exception e) + { + if (e instanceof BadCredentialsException) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } + } + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + recordLoginInfo(loginUser.getUserId()); + // 生成token + return tokenService.createToken(loginUser); + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) + { + String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); + throw new CaptchaException(); + } + } + + /** + * 记录登录信息 + * + * @param userId 用户ID + */ + public void recordLoginInfo(Long userId) + { + SysUser sysUser = new SysUser(); + sysUser.setUserId(userId); + sysUser.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest())); + sysUser.setLoginDate(DateUtils.getNowDate()); + userService.updateUserProfile(sysUser); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/SysPermissionService.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/SysPermissionService.java new file mode 100644 index 0000000..34de656 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/SysPermissionService.java @@ -0,0 +1,66 @@ +package com.ktg.framework.web.service; + +import java.util.HashSet; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.system.service.ISysMenuService; +import com.ktg.system.service.ISysRoleService; + +/** + * 用户权限处理 + * + * @author ruoyi + */ +@Component +public class SysPermissionService +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysMenuService menuService; + + /** + * 获取角色数据权限 + * + * @param user 用户信息 + * @return 角色权限信息 + */ + public Set getRolePermission(SysUser user) + { + Set roles = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + roles.add("admin"); + } + else + { + roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); + } + return roles; + } + + /** + * 获取菜单数据权限 + * + * @param user 用户信息 + * @return 菜单权限信息 + */ + public Set getMenuPermission(SysUser user) + { + Set perms = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + perms.add("*:*:*"); + } + else + { + perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); + } + return perms; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/SysRegisterService.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/SysRegisterService.java new file mode 100644 index 0000000..ca7124a --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/SysRegisterService.java @@ -0,0 +1,115 @@ +package com.ktg.framework.web.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.RegisterBody; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.exception.user.CaptchaException; +import com.ktg.common.exception.user.CaptchaExpireException; +import com.ktg.common.utils.MessageUtils; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.manager.AsyncManager; +import com.ktg.framework.manager.factory.AsyncFactory; +import com.ktg.system.service.ISysConfigService; +import com.ktg.system.service.ISysUserService; + +/** + * 注册校验方法 + * + * @author ruoyi + */ +@Component +public class SysRegisterService +{ + @Autowired + private ISysUserService userService; + + @Autowired + private ISysConfigService configService; + + @Autowired + private RedisCache redisCache; + + /** + * 注册 + */ + public String register(RegisterBody registerBody) + { + String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(); + + boolean captchaOnOff = configService.selectCaptchaOnOff(); + // 验证码开关 + if (captchaOnOff) + { + validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); + } + + if (StringUtils.isEmpty(username)) + { + msg = "用户名不能为空"; + } + else if (StringUtils.isEmpty(password)) + { + msg = "用户密码不能为空"; + } + else if (username.length() < UserConstants.USERNAME_MIN_LENGTH + || username.length() > UserConstants.USERNAME_MAX_LENGTH) + { + msg = "账户长度必须在2到20个字符之间"; + } + else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) + { + msg = "密码长度必须在5到20个字符之间"; + } + else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(username))) + { + msg = "保存用户'" + username + "'失败,注册账号已存在"; + } + else + { + SysUser sysUser = new SysUser(); + sysUser.setUserName(username); + sysUser.setNickName(username); + sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword())); + boolean regFlag = userService.registerUser(sysUser); + if (!regFlag) + { + msg = "注册失败,请联系系统管理人员"; + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, + MessageUtils.message("user.register.success"))); + } + } + return msg; + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) + { + String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) + { + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) + { + throw new CaptchaException(); + } + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/TokenService.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/TokenService.java new file mode 100644 index 0000000..2f408d9 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/TokenService.java @@ -0,0 +1,249 @@ +package com.ktg.framework.web.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.utils.ServletUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.ip.AddressUtils; +import com.ktg.common.utils.ip.IpUtils; +import com.ktg.common.utils.uuid.IdUtils; +import eu.bitwalker.useragentutils.UserAgent; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +/** + * token验证处理 + * + * @author ruoyi + */ +@Component +public class TokenService +{ + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + // 令牌有效期(默认30分钟) + @Value("${token.expireTime}") + private int expireTime; + + protected static final long MILLIS_SECOND = 1000; + + protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; + + private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + + @Autowired + private RedisCache redisCache; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(HttpServletRequest request) + { + // 获取请求携带的令牌 + String token = getToken(request); + if (StringUtils.isNotEmpty(token)) + { + try + { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + return user; + } + catch (Exception e) + { + } + } + return null; + } + + /** + * 设置用户身份信息 + */ + public void setLoginUser(LoginUser loginUser) + { + if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) + { + refreshToken(loginUser); + } + } + + /** + * 删除用户身份信息 + */ + public void delLoginUser(String token) + { + if (StringUtils.isNotEmpty(token)) + { + String userKey = getTokenKey(token); + redisCache.deleteObject(userKey); + } + } + + /** + * 创建令牌 + * + * @param loginUser 用户信息 + * @return 令牌 + */ + public String createToken(LoginUser loginUser) + { + String token = IdUtils.fastUUID(); + loginUser.setToken(token); + setUserAgent(loginUser); + refreshToken(loginUser); + + Map claims = new HashMap<>(); + claims.put(Constants.LOGIN_USER_KEY, token); + return createToken(claims); + } + + /** + * 验证令牌有效期,相差不足20分钟,自动刷新缓存 + * + * @param loginUser + * @return 令牌 + */ + public void verifyToken(LoginUser loginUser) + { + long expireTime = loginUser.getExpireTime(); + long currentTime = System.currentTimeMillis(); + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) + { + refreshToken(loginUser); + } + } + + /** + * 刷新令牌有效期 + * + * @param loginUser 登录信息 + */ + public void refreshToken(LoginUser loginUser) + { + loginUser.setLoginTime(System.currentTimeMillis()); + loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); + // 根据uuid将loginUser缓存 + String userKey = getTokenKey(loginUser.getToken()); + redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + } + + /** + * 设置用户代理信息 + * + * @param loginUser 登录信息 + */ + public void setUserAgent(LoginUser loginUser) + { + UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + loginUser.setIpaddr(ip); + loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); + loginUser.setBrowser(userAgent.getBrowser().getName()); + loginUser.setOs(userAgent.getOperatingSystem().getName()); + } + + /** + * 从数据声明生成令牌 + * + * @param claims 数据声明 + * @return 令牌 + */ + private String createToken(Map claims) + { + String token = Jwts.builder() + .setClaims(claims) + .signWith(SignatureAlgorithm.HS512, secret).compact(); + return token; + } + + /** + * 从令牌中获取数据声明 + * + * @param token 令牌 + * @return 数据声明 + */ + private Claims parseToken(String token) + { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } + + /** + * 从令牌中获取用户名 + * + * @param token 令牌 + * @return 用户名 + */ + public String getUsernameFromToken(String token) + { + Claims claims = parseToken(token); + return claims.getSubject(); + } + + /** + * 获取请求token + * + * @param request + * @return token + */ + private String getToken(HttpServletRequest request) + { + String token = request.getHeader(header); + if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) + { + token = token.replace(Constants.TOKEN_PREFIX, ""); + } + return token; + } + + private String getTokenKey(String uuid) + { + return Constants.LOGIN_TOKEN_KEY + uuid; + } + + /** + * 根据Token获取对应的用户 + * @param token + * @return + */ + public LoginUser getUserByToken(String token){ + if (StringUtils.isNotEmpty(token)) + { + try + { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + return user; + } + catch (Exception e) + { + } + } + return null; + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/web/service/UserDetailsServiceImpl.java b/ktg-framework/src/main/java/com/ktg/framework/web/service/UserDetailsServiceImpl.java new file mode 100644 index 0000000..8f78344 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/web/service/UserDetailsServiceImpl.java @@ -0,0 +1,69 @@ +package com.ktg.framework.web.service; + +import com.ktg.system.strategy.PhoneUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.enums.UserStatus; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.service.ISysUserService; + +/** + * 用户验证处理 + * + * @author ruoyi + */ +@Service +public class UserDetailsServiceImpl implements UserDetailsService +{ + private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); + + @Autowired + private ISysUserService userService; + + @Autowired + private SysPermissionService permissionService; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException + { + SysUser user = null; + if(PhoneUtils.isMobile(username)){ + user = userService.selectUserByMobile(username); + } + + if(!StringUtils.isNotNull(user)){ + user = userService.selectUserByUserName(username); + } + + if (StringUtils.isNull(user)) + { + log.info("登录用户:{} 不存在.", username); + throw new ServiceException("登录用户:" + username + " 不存在"); + } + else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) + { + log.info("登录用户:{} 已被删除.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); + } + else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) + { + log.info("登录用户:{} 已被停用.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已停用"); + } + + return createLoginUser(user); + } + + public UserDetails createLoginUser(SysUser user) + { + return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user)); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/websocket/SemaphoreUtils.java b/ktg-framework/src/main/java/com/ktg/framework/websocket/SemaphoreUtils.java new file mode 100644 index 0000000..ca51ee5 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/websocket/SemaphoreUtils.java @@ -0,0 +1,58 @@ +package com.ktg.framework.websocket; + +import java.util.concurrent.Semaphore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 信号量相关处理 + * + * @author ruoyi + */ +public class SemaphoreUtils +{ + /** + * SemaphoreUtils 日志控制器 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(SemaphoreUtils.class); + + /** + * 获取信号量 + * + * @param semaphore + * @return + */ + public static boolean tryAcquire(Semaphore semaphore) + { + boolean flag = false; + + try + { + flag = semaphore.tryAcquire(); + } + catch (Exception e) + { + LOGGER.error("获取信号量异常", e); + } + + return flag; + } + + /** + * 释放信号量 + * + * @param semaphore + */ + public static void release(Semaphore semaphore) + { + + try + { + semaphore.release(); + } + catch (Exception e) + { + LOGGER.error("释放信号量异常", e); + } + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketConfig.java b/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketConfig.java new file mode 100644 index 0000000..e23bfba --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketConfig.java @@ -0,0 +1,20 @@ +package com.ktg.framework.websocket; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; + +/** + * websocket 配置 + * + * @author ruoyi + */ +@Configuration +public class WebSocketConfig +{ + @Bean + public ServerEndpointExporter serverEndpointExporter() + { + return new ServerEndpointExporter(); + } +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketServer.java b/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketServer.java new file mode 100644 index 0000000..973441e --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketServer.java @@ -0,0 +1,142 @@ +package com.ktg.framework.websocket; + +import java.util.concurrent.Semaphore; +import javax.websocket.OnClose; +import javax.websocket.OnError; +import javax.websocket.OnMessage; +import javax.websocket.OnOpen; +import javax.websocket.Session; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.framework.web.service.TokenService; +import com.ktg.system.domain.SysMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * websocket 消息处理 + * + * @author ruoyi + */ +@Component +@ServerEndpoint("/websocket/message/{token}") +public class WebSocketServer +{ + /** + * WebSocketServer 日志控制器 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketServer.class); + + + /** + * 默认最多允许同时在线人数100 + */ + public static int socketMaxOnlineCount = 100; + + private static Semaphore socketSemaphore = new Semaphore(socketMaxOnlineCount); + + /** + * 连接建立成功调用的方法 + */ + @OnOpen + public void onOpen(Session session,@PathParam("token") String token) throws Exception + { + boolean semaphoreFlag = false; + //身份验证 + if(!StringUtils.isNotNull(token)){ + session.close(); + return; + } + + TokenService tokenService = SpringUtils.getBean(TokenService.class); + + LoginUser user = tokenService.getUserByToken(token); + if(!StringUtils.isNotNull(user)){ + session.close(); + return; + } + + // 尝试获取信号量 + semaphoreFlag = SemaphoreUtils.tryAcquire(socketSemaphore); + if (!semaphoreFlag) + { + // 未获取到信号量 + LOGGER.error("\n 当前在线人数超过限制数- {}", socketMaxOnlineCount); + WebSocketUsers.sendMessageToUserByText(session, "当前在线人数超过限制数:" + socketMaxOnlineCount); + session.close(); + } + else + { + // 添加用户 + WebSocketUsers.put(user.getUsername(), session); + LOGGER.info("\n 建立连接 - {}", session); + LOGGER.info("\n 当前人数 - {}", WebSocketUsers.getUsers().size()); + WebSocketUsers.sendMessageToUserByText(session, "连接成功"); + } + } + + /** + * 连接关闭时处理 + */ + @OnClose + public void onClose(Session session) + { + LOGGER.info("\n 关闭连接 - {}", session); + // 移除用户 + WebSocketUsers.remove(session); + // 获取到信号量则需释放 + SemaphoreUtils.release(socketSemaphore); + } + + /** + * 抛出异常时处理 + */ + @OnError + public void onError(Session session, Throwable exception) throws Exception + { + if (session.isOpen()) + { + // 关闭连接 + session.close(); + } + String sessionId = session.getId(); + LOGGER.info("\n 连接异常 - {}", sessionId); + LOGGER.info("\n 异常信息 - {}", exception); + // 移出用户 + WebSocketUsers.remove(session); + // 获取到信号量则需释放 + SemaphoreUtils.release(socketSemaphore); + } + + /** + * 服务器接收到客户端消息时调用的方法 + */ + @OnMessage + public void onMessage(String message, Session session) + { + if(!UserConstants.WEBSOCKET_HEARTBEAT.equals(message)){ + try{ + SysMessage msg = JSON.parseObject(message, new TypeReference(){}); + if(StringUtils.isNotNull(msg.getRecipientName())){ + //这里必须传递username + WebSocketUsers.sendMesssageToUserByName(msg.getRecipientName(),message); + } + }catch (Exception e){ + LOGGER.error("\n 错误的websocket信息格式 - {}", message); + } + } + LOGGER.debug("\n 收到客户端发送的消息 - {}", message); + } + +} diff --git a/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketUsers.java b/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketUsers.java new file mode 100644 index 0000000..ba1be28 --- /dev/null +++ b/ktg-framework/src/main/java/com/ktg/framework/websocket/WebSocketUsers.java @@ -0,0 +1,156 @@ +package com.ktg.framework.websocket; + +import java.io.IOException; +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import javax.websocket.Session; + +import com.ktg.common.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * websocket 客户端用户集 + * + * @author ruoyi + */ +public class WebSocketUsers +{ + /** + * WebSocketUsers 日志控制器 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketUsers.class); + + /** + * 用户集 + */ + private static Map USERS = new ConcurrentHashMap(); + + /** + * 存储用户 + * + * @param key 唯一键 + * @param session 用户信息 + */ + public static void put(String key, Session session) + { + USERS.put(key, session); + } + + /** + * 移除用户 + * + * @param session 用户信息 + * + * @return 移除结果 + */ + public static boolean remove(Session session) + { + String key = null; + boolean flag = USERS.containsValue(session); + if (flag) + { + Set> entries = USERS.entrySet(); + for (Map.Entry entry : entries) + { + Session value = entry.getValue(); + if (value.equals(session)) + { + key = entry.getKey(); + break; + } + } + } + else + { + return true; + } + return remove(key); + } + + /** + * 移出用户 + * + * @param key 键 + */ + public static boolean remove(String key) + { + LOGGER.info("\n 正在移出用户 - {}", key); + Session remove = USERS.remove(key); + if (remove != null) + { + boolean containsValue = USERS.containsValue(remove); + LOGGER.info("\n 移出结果 - {}", containsValue ? "失败" : "成功"); + return containsValue; + } + else + { + return true; + } + } + + /** + * 获取在线用户列表 + * + * @return 返回用户集合 + */ + public static Map getUsers() + { + return USERS; + } + + /** + * 群发消息文本消息 + * + * @param message 消息内容 + */ + public static void sendMessageToUsersByText(String message) + { + Collection values = USERS.values(); + for (Session value : values) + { + sendMessageToUserByText(value, message); + } + } + + /** + * 发送文本消息 + * + * @param session 自己的用户名 + * @param message 消息内容 + */ + public static void sendMessageToUserByText(Session session, String message) + { + if (session != null) + { + try + { + session.getBasicRemote().sendText(message); + } + catch (IOException e) + { + LOGGER.error("\n[发送消息异常]", e); + } + } + else + { + LOGGER.info("\n[你已离线]"); + } + } + + public static void sendMesssageToUserByName(String username,String message){ + Session session = USERS.get(username); + if(StringUtils.isNotNull(session)){ + try + { + session.getBasicRemote().sendText(message); + } + catch (IOException e) + { + LOGGER.error("\n[发送消息异常]", e); + } + } + } +} diff --git a/ktg-generator/pom.xml b/ktg-generator/pom.xml new file mode 100644 index 0000000..8c255eb --- /dev/null +++ b/ktg-generator/pom.xml @@ -0,0 +1,40 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-generator + + + generator代码生成 + + + + + + + org.apache.velocity + velocity + + + + + commons-collections + commons-collections + + + + + com.ktg + ktg-common + + + + + \ No newline at end of file diff --git a/ktg-generator/src/main/java/com/ktg/generator/config/GenConfig.java b/ktg-generator/src/main/java/com/ktg/generator/config/GenConfig.java new file mode 100644 index 0000000..a92f07f --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/config/GenConfig.java @@ -0,0 +1,73 @@ +package com.ktg.generator.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +/** + * 读取代码生成相关配置 + * + * @author ruoyi + */ +@Component +@ConfigurationProperties(prefix = "gen") +@PropertySource(value = { "classpath:generator.yml" }) +public class GenConfig +{ + /** 作者 */ + public static String author; + + /** 生成包路径 */ + public static String packageName; + + /** 自动去除表前缀,默认是false */ + public static boolean autoRemovePre; + + /** 表前缀(类名不会包含表前缀) */ + public static String tablePrefix; + + public static String getAuthor() + { + return author; + } + + @Value("${author}") + public void setAuthor(String author) + { + GenConfig.author = author; + } + + public static String getPackageName() + { + return packageName; + } + + @Value("${packageName}") + public void setPackageName(String packageName) + { + GenConfig.packageName = packageName; + } + + public static boolean getAutoRemovePre() + { + return autoRemovePre; + } + + @Value("${autoRemovePre}") + public void setAutoRemovePre(boolean autoRemovePre) + { + GenConfig.autoRemovePre = autoRemovePre; + } + + public static String getTablePrefix() + { + return tablePrefix; + } + + @Value("${tablePrefix}") + public void setTablePrefix(String tablePrefix) + { + GenConfig.tablePrefix = tablePrefix; + } +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/controller/GenController.java b/ktg-generator/src/main/java/com/ktg/generator/controller/GenController.java new file mode 100644 index 0000000..6586a64 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/controller/GenController.java @@ -0,0 +1,214 @@ +package com.ktg.generator.controller; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.core.text.Convert; +import com.ktg.common.enums.BusinessType; +import com.ktg.generator.domain.GenTable; +import com.ktg.generator.domain.GenTableColumn; +import com.ktg.generator.service.IGenTableColumnService; +import com.ktg.generator.service.IGenTableService; + +/** + * 代码生成 操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/tool/gen") +public class GenController extends BaseController +{ + @Autowired + private IGenTableService genTableService; + + @Autowired + private IGenTableColumnService genTableColumnService; + + /** + * 查询代码生成列表 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping("/list") + public TableDataInfo genList(GenTable genTable) + { + startPage(); + List list = genTableService.selectGenTableList(genTable); + return getDataTable(list); + } + + /** + * 修改代码生成业务 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:query')") + @GetMapping(value = "/{tableId}") + public AjaxResult getInfo(@PathVariable Long tableId) + { + GenTable table = genTableService.selectGenTableById(tableId); + List tables = genTableService.selectGenTableAll(); + List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); + Map map = new HashMap(); + map.put("info", table); + map.put("rows", list); + map.put("tables", tables); + return AjaxResult.success(map); + } + + /** + * 查询数据库列表 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping("/db/list") + public TableDataInfo dataList(GenTable genTable) + { + startPage(); + List list = genTableService.selectDbTableList(genTable); + return getDataTable(list); + } + + /** + * 查询数据表字段列表 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping(value = "/column/{tableId}") + public TableDataInfo columnList(Long tableId) + { + TableDataInfo dataInfo = new TableDataInfo(); + List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); + dataInfo.setRows(list); + dataInfo.setTotal(list.size()); + return dataInfo; + } + + /** + * 导入表结构(保存) + */ + @PreAuthorize("@ss.hasPermi('tool:gen:import')") + @Log(title = "代码生成", businessType = BusinessType.IMPORT) + @PostMapping("/importTable") + public AjaxResult importTableSave(String tables) + { + String[] tableNames = Convert.toStrArray(tables); + // 查询表信息 + List tableList = genTableService.selectDbTableListByNames(tableNames); + genTableService.importGenTable(tableList); + return AjaxResult.success(); + } + + /** + * 修改保存代码生成业务 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:edit')") + @Log(title = "代码生成", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult editSave(@Validated @RequestBody GenTable genTable) + { + genTableService.validateEdit(genTable); + genTableService.updateGenTable(genTable); + return AjaxResult.success(); + } + + /** + * 删除代码生成 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:remove')") + @Log(title = "代码生成", businessType = BusinessType.DELETE) + @DeleteMapping("/{tableIds}") + public AjaxResult remove(@PathVariable Long[] tableIds) + { + genTableService.deleteGenTableByIds(tableIds); + return AjaxResult.success(); + } + + /** + * 预览代码 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:preview')") + @GetMapping("/preview/{tableId}") + public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException + { + Map dataMap = genTableService.previewCode(tableId); + return AjaxResult.success(dataMap); + } + + /** + * 生成代码(下载方式) + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "代码生成", businessType = BusinessType.GENCODE) + @GetMapping("/download/{tableName}") + public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException + { + byte[] data = genTableService.downloadCode(tableName); + genCode(response, data); + } + + /** + * 生成代码(自定义路径) + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "代码生成", businessType = BusinessType.GENCODE) + @GetMapping("/genCode/{tableName}") + public AjaxResult genCode(@PathVariable("tableName") String tableName) + { + genTableService.generatorCode(tableName); + return AjaxResult.success(); + } + + /** + * 同步数据库 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:edit')") + @Log(title = "代码生成", businessType = BusinessType.UPDATE) + @GetMapping("/synchDb/{tableName}") + public AjaxResult synchDb(@PathVariable("tableName") String tableName) + { + genTableService.synchDb(tableName); + return AjaxResult.success(); + } + + /** + * 批量生成代码 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "代码生成", businessType = BusinessType.GENCODE) + @GetMapping("/batchGenCode") + public void batchGenCode(HttpServletResponse response, String tables) throws IOException + { + String[] tableNames = Convert.toStrArray(tables); + byte[] data = genTableService.downloadCode(tableNames); + genCode(response, data); + } + + /** + * 生成zip文件 + */ + private void genCode(HttpServletResponse response, byte[] data) throws IOException + { + response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment; filename=\"ktg.zip\""); + response.addHeader("Content-Length", "" + data.length); + response.setContentType("application/octet-stream; charset=UTF-8"); + IOUtils.write(data, response.getOutputStream()); + } +} \ No newline at end of file diff --git a/ktg-generator/src/main/java/com/ktg/generator/domain/GenTable.java b/ktg-generator/src/main/java/com/ktg/generator/domain/GenTable.java new file mode 100644 index 0000000..03121c4 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/domain/GenTable.java @@ -0,0 +1,372 @@ +package com.ktg.generator.domain; + +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.apache.commons.lang3.ArrayUtils; +import com.ktg.common.constant.GenConstants; +import com.ktg.common.core.domain.BaseEntity; +import com.ktg.common.utils.StringUtils; + +/** + * 业务表 gen_table + * + * @author ruoyi + */ +public class GenTable extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long tableId; + + /** 表名称 */ + @NotBlank(message = "表名称不能为空") + private String tableName; + + /** 表描述 */ + @NotBlank(message = "表描述不能为空") + private String tableComment; + + /** 关联父表的表名 */ + private String subTableName; + + /** 本表关联父表的外键名 */ + private String subTableFkName; + + /** 实体类名称(首字母大写) */ + @NotBlank(message = "实体类名称不能为空") + private String className; + + /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */ + private String tplCategory; + + /** 生成包路径 */ + @NotBlank(message = "生成包路径不能为空") + private String packageName; + + /** 生成模块名 */ + @NotBlank(message = "生成模块名不能为空") + private String moduleName; + + /** 生成业务名 */ + @NotBlank(message = "生成业务名不能为空") + private String businessName; + + /** 生成功能名 */ + @NotBlank(message = "生成功能名不能为空") + private String functionName; + + /** 生成作者 */ + @NotBlank(message = "作者不能为空") + private String functionAuthor; + + /** 生成代码方式(0zip压缩包 1自定义路径) */ + private String genType; + + /** 生成路径(不填默认项目路径) */ + private String genPath; + + /** 主键信息 */ + private GenTableColumn pkColumn; + + /** 子表信息 */ + private GenTable subTable; + + /** 表列信息 */ + @Valid + private List columns; + + /** 其它生成选项 */ + private String options; + + /** 树编码字段 */ + private String treeCode; + + /** 树父编码字段 */ + private String treeParentCode; + + /** 树名称字段 */ + private String treeName; + + /** 上级菜单ID字段 */ + private String parentMenuId; + + /** 上级菜单名称字段 */ + private String parentMenuName; + + public Long getTableId() + { + return tableId; + } + + public void setTableId(Long tableId) + { + this.tableId = tableId; + } + + public String getTableName() + { + return tableName; + } + + public void setTableName(String tableName) + { + this.tableName = tableName; + } + + public String getTableComment() + { + return tableComment; + } + + public void setTableComment(String tableComment) + { + this.tableComment = tableComment; + } + + public String getSubTableName() + { + return subTableName; + } + + public void setSubTableName(String subTableName) + { + this.subTableName = subTableName; + } + + public String getSubTableFkName() + { + return subTableFkName; + } + + public void setSubTableFkName(String subTableFkName) + { + this.subTableFkName = subTableFkName; + } + + public String getClassName() + { + return className; + } + + public void setClassName(String className) + { + this.className = className; + } + + public String getTplCategory() + { + return tplCategory; + } + + public void setTplCategory(String tplCategory) + { + this.tplCategory = tplCategory; + } + + public String getPackageName() + { + return packageName; + } + + public void setPackageName(String packageName) + { + this.packageName = packageName; + } + + public String getModuleName() + { + return moduleName; + } + + public void setModuleName(String moduleName) + { + this.moduleName = moduleName; + } + + public String getBusinessName() + { + return businessName; + } + + public void setBusinessName(String businessName) + { + this.businessName = businessName; + } + + public String getFunctionName() + { + return functionName; + } + + public void setFunctionName(String functionName) + { + this.functionName = functionName; + } + + public String getFunctionAuthor() + { + return functionAuthor; + } + + public void setFunctionAuthor(String functionAuthor) + { + this.functionAuthor = functionAuthor; + } + + public String getGenType() + { + return genType; + } + + public void setGenType(String genType) + { + this.genType = genType; + } + + public String getGenPath() + { + return genPath; + } + + public void setGenPath(String genPath) + { + this.genPath = genPath; + } + + public GenTableColumn getPkColumn() + { + return pkColumn; + } + + public void setPkColumn(GenTableColumn pkColumn) + { + this.pkColumn = pkColumn; + } + + public GenTable getSubTable() + { + return subTable; + } + + public void setSubTable(GenTable subTable) + { + this.subTable = subTable; + } + + public List getColumns() + { + return columns; + } + + public void setColumns(List columns) + { + this.columns = columns; + } + + public String getOptions() + { + return options; + } + + public void setOptions(String options) + { + this.options = options; + } + + public String getTreeCode() + { + return treeCode; + } + + public void setTreeCode(String treeCode) + { + this.treeCode = treeCode; + } + + public String getTreeParentCode() + { + return treeParentCode; + } + + public void setTreeParentCode(String treeParentCode) + { + this.treeParentCode = treeParentCode; + } + + public String getTreeName() + { + return treeName; + } + + public void setTreeName(String treeName) + { + this.treeName = treeName; + } + + public String getParentMenuId() + { + return parentMenuId; + } + + public void setParentMenuId(String parentMenuId) + { + this.parentMenuId = parentMenuId; + } + + public String getParentMenuName() + { + return parentMenuName; + } + + public void setParentMenuName(String parentMenuName) + { + this.parentMenuName = parentMenuName; + } + + public boolean isSub() + { + return isSub(this.tplCategory); + } + + public static boolean isSub(String tplCategory) + { + return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); + } + + public boolean isTree() + { + return isTree(this.tplCategory); + } + + public static boolean isTree(String tplCategory) + { + return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory); + } + + public boolean isCrud() + { + return isCrud(this.tplCategory); + } + + public static boolean isCrud(String tplCategory) + { + return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory); + } + + public boolean isSuperColumn(String javaField) + { + return isSuperColumn(this.tplCategory, javaField); + } + + public static boolean isSuperColumn(String tplCategory, String javaField) + { + if (isTree(tplCategory)) + { + return StringUtils.equalsAnyIgnoreCase(javaField, + ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY)); + } + return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); + } +} \ No newline at end of file diff --git a/ktg-generator/src/main/java/com/ktg/generator/domain/GenTableColumn.java b/ktg-generator/src/main/java/com/ktg/generator/domain/GenTableColumn.java new file mode 100644 index 0000000..0ce9978 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/domain/GenTableColumn.java @@ -0,0 +1,373 @@ +package com.ktg.generator.domain; + +import javax.validation.constraints.NotBlank; +import com.ktg.common.core.domain.BaseEntity; +import com.ktg.common.utils.StringUtils; + +/** + * 代码生成业务字段表 gen_table_column + * + * @author ruoyi + */ +public class GenTableColumn extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long columnId; + + /** 归属表编号 */ + private Long tableId; + + /** 列名称 */ + private String columnName; + + /** 列描述 */ + private String columnComment; + + /** 列类型 */ + private String columnType; + + /** JAVA类型 */ + private String javaType; + + /** JAVA字段名 */ + @NotBlank(message = "Java属性不能为空") + private String javaField; + + /** 是否主键(1是) */ + private String isPk; + + /** 是否自增(1是) */ + private String isIncrement; + + /** 是否必填(1是) */ + private String isRequired; + + /** 是否为插入字段(1是) */ + private String isInsert; + + /** 是否编辑字段(1是) */ + private String isEdit; + + /** 是否列表字段(1是) */ + private String isList; + + /** 是否查询字段(1是) */ + private String isQuery; + + /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */ + private String queryType; + + /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */ + private String htmlType; + + /** 字典类型 */ + private String dictType; + + /** 排序 */ + private Integer sort; + + public void setColumnId(Long columnId) + { + this.columnId = columnId; + } + + public Long getColumnId() + { + return columnId; + } + + public void setTableId(Long tableId) + { + this.tableId = tableId; + } + + public Long getTableId() + { + return tableId; + } + + public void setColumnName(String columnName) + { + this.columnName = columnName; + } + + public String getColumnName() + { + return columnName; + } + + public void setColumnComment(String columnComment) + { + this.columnComment = columnComment; + } + + public String getColumnComment() + { + return columnComment; + } + + public void setColumnType(String columnType) + { + this.columnType = columnType; + } + + public String getColumnType() + { + return columnType; + } + + public void setJavaType(String javaType) + { + this.javaType = javaType; + } + + public String getJavaType() + { + return javaType; + } + + public void setJavaField(String javaField) + { + this.javaField = javaField; + } + + public String getJavaField() + { + return javaField; + } + + public String getCapJavaField() + { + return StringUtils.capitalize(javaField); + } + + public void setIsPk(String isPk) + { + this.isPk = isPk; + } + + public String getIsPk() + { + return isPk; + } + + public boolean isPk() + { + return isPk(this.isPk); + } + + public boolean isPk(String isPk) + { + return isPk != null && StringUtils.equals("1", isPk); + } + + public String getIsIncrement() + { + return isIncrement; + } + + public void setIsIncrement(String isIncrement) + { + this.isIncrement = isIncrement; + } + + public boolean isIncrement() + { + return isIncrement(this.isIncrement); + } + + public boolean isIncrement(String isIncrement) + { + return isIncrement != null && StringUtils.equals("1", isIncrement); + } + + public void setIsRequired(String isRequired) + { + this.isRequired = isRequired; + } + + public String getIsRequired() + { + return isRequired; + } + + public boolean isRequired() + { + return isRequired(this.isRequired); + } + + public boolean isRequired(String isRequired) + { + return isRequired != null && StringUtils.equals("1", isRequired); + } + + public void setIsInsert(String isInsert) + { + this.isInsert = isInsert; + } + + public String getIsInsert() + { + return isInsert; + } + + public boolean isInsert() + { + return isInsert(this.isInsert); + } + + public boolean isInsert(String isInsert) + { + return isInsert != null && StringUtils.equals("1", isInsert); + } + + public void setIsEdit(String isEdit) + { + this.isEdit = isEdit; + } + + public String getIsEdit() + { + return isEdit; + } + + public boolean isEdit() + { + return isInsert(this.isEdit); + } + + public boolean isEdit(String isEdit) + { + return isEdit != null && StringUtils.equals("1", isEdit); + } + + public void setIsList(String isList) + { + this.isList = isList; + } + + public String getIsList() + { + return isList; + } + + public boolean isList() + { + return isList(this.isList); + } + + public boolean isList(String isList) + { + return isList != null && StringUtils.equals("1", isList); + } + + public void setIsQuery(String isQuery) + { + this.isQuery = isQuery; + } + + public String getIsQuery() + { + return isQuery; + } + + public boolean isQuery() + { + return isQuery(this.isQuery); + } + + public boolean isQuery(String isQuery) + { + return isQuery != null && StringUtils.equals("1", isQuery); + } + + public void setQueryType(String queryType) + { + this.queryType = queryType; + } + + public String getQueryType() + { + return queryType; + } + + public String getHtmlType() + { + return htmlType; + } + + public void setHtmlType(String htmlType) + { + this.htmlType = htmlType; + } + + public void setDictType(String dictType) + { + this.dictType = dictType; + } + + public String getDictType() + { + return dictType; + } + + public void setSort(Integer sort) + { + this.sort = sort; + } + + public Integer getSort() + { + return sort; + } + + public boolean isSuperColumn() + { + return isSuperColumn(this.javaField); + } + + public static boolean isSuperColumn(String javaField) + { + return StringUtils.equalsAnyIgnoreCase(javaField, + // BaseEntity + "createBy", "createTime", "updateBy", "updateTime", "remark", + // TreeEntity + "parentName", "parentId", "orderNum", "ancestors"); + } + + public boolean isUsableColumn() + { + return isUsableColumn(javaField); + } + + public static boolean isUsableColumn(String javaField) + { + // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单 + return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); + } + + public String readConverterExp() + { + String remarks = StringUtils.substringBetween(this.columnComment, "(", ")"); + StringBuffer sb = new StringBuffer(); + if (StringUtils.isNotEmpty(remarks)) + { + for (String value : remarks.split(" ")) + { + if (StringUtils.isNotEmpty(value)) + { + Object startStr = value.subSequence(0, 1); + String endStr = value.substring(1); + sb.append("").append(startStr).append("=").append(endStr).append(","); + } + } + return sb.deleteCharAt(sb.length() - 1).toString(); + } + else + { + return this.columnComment; + } + } +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/mapper/GenTableColumnMapper.java b/ktg-generator/src/main/java/com/ktg/generator/mapper/GenTableColumnMapper.java new file mode 100644 index 0000000..b21b6e7 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/mapper/GenTableColumnMapper.java @@ -0,0 +1,60 @@ +package com.ktg.generator.mapper; + +import java.util.List; +import com.ktg.generator.domain.GenTableColumn; + +/** + * 业务字段 数据层 + * + * @author ktg + */ +public interface GenTableColumnMapper +{ + /** + * 根据表名称查询列信息 + * + * @param tableName 表名称 + * @return 列信息 + */ + public List selectDbTableColumnsByName(String tableName); + + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + public List selectGenTableColumnListByTableId(Long tableId); + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int insertGenTableColumn(GenTableColumn genTableColumn); + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int updateGenTableColumn(GenTableColumn genTableColumn); + + /** + * 删除业务字段 + * + * @param genTableColumns 列数据 + * @return 结果 + */ + public int deleteGenTableColumns(List genTableColumns); + + /** + * 批量删除业务字段 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteGenTableColumnByIds(Long[] ids); +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/mapper/GenTableMapper.java b/ktg-generator/src/main/java/com/ktg/generator/mapper/GenTableMapper.java new file mode 100644 index 0000000..2701679 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/mapper/GenTableMapper.java @@ -0,0 +1,83 @@ +package com.ktg.generator.mapper; + +import java.util.List; +import com.ktg.generator.domain.GenTable; + +/** + * 业务 数据层 + * + * @author ktg + */ +public interface GenTableMapper +{ + /** + * 查询业务列表 + * + * @param genTable 业务信息 + * @return 业务集合 + */ + public List selectGenTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param genTable 业务信息 + * @return 数据库表集合 + */ + public List selectDbTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param tableNames 表名称组 + * @return 数据库表集合 + */ + public List selectDbTableListByNames(String[] tableNames); + + /** + * 查询所有表信息 + * + * @return 表信息集合 + */ + public List selectGenTableAll(); + + /** + * 查询表ID业务信息 + * + * @param id 业务ID + * @return 业务信息 + */ + public GenTable selectGenTableById(Long id); + + /** + * 查询表名称业务信息 + * + * @param tableName 表名称 + * @return 业务信息 + */ + public GenTable selectGenTableByName(String tableName); + + /** + * 新增业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + public int insertGenTable(GenTable genTable); + + /** + * 修改业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + public int updateGenTable(GenTable genTable); + + /** + * 批量删除业务 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteGenTableByIds(Long[] ids); +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/service/GenTableColumnServiceImpl.java b/ktg-generator/src/main/java/com/ktg/generator/service/GenTableColumnServiceImpl.java new file mode 100644 index 0000000..13a78fa --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/service/GenTableColumnServiceImpl.java @@ -0,0 +1,68 @@ +package com.ktg.generator.service; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.common.core.text.Convert; +import com.ktg.generator.domain.GenTableColumn; +import com.ktg.generator.mapper.GenTableColumnMapper; + +/** + * 业务字段 服务层实现 + * + * @author ruoyi + */ +@Service +public class GenTableColumnServiceImpl implements IGenTableColumnService +{ + @Autowired + private GenTableColumnMapper genTableColumnMapper; + + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + @Override + public List selectGenTableColumnListByTableId(Long tableId) + { + return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); + } + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int insertGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.insertGenTableColumn(genTableColumn); + } + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int updateGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.updateGenTableColumn(genTableColumn); + } + + /** + * 删除业务字段对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteGenTableColumnByIds(String ids) + { + return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); + } +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/service/GenTableServiceImpl.java b/ktg-generator/src/main/java/com/ktg/generator/service/GenTableServiceImpl.java new file mode 100644 index 0000000..7438d46 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/service/GenTableServiceImpl.java @@ -0,0 +1,521 @@ +package com.ktg.generator.service; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.GenConstants; +import com.ktg.common.core.text.CharsetKit; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.generator.domain.GenTable; +import com.ktg.generator.domain.GenTableColumn; +import com.ktg.generator.mapper.GenTableColumnMapper; +import com.ktg.generator.mapper.GenTableMapper; +import com.ktg.generator.util.GenUtils; +import com.ktg.generator.util.VelocityInitializer; +import com.ktg.generator.util.VelocityUtils; + +/** + * 业务 服务层实现 + * + * @author ruoyi + */ +@Service +public class GenTableServiceImpl implements IGenTableService +{ + private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class); + + @Autowired + private GenTableMapper genTableMapper; + + @Autowired + private GenTableColumnMapper genTableColumnMapper; + + /** + * 查询业务信息 + * + * @param id 业务ID + * @return 业务信息 + */ + @Override + public GenTable selectGenTableById(Long id) + { + GenTable genTable = genTableMapper.selectGenTableById(id); + setTableFromOptions(genTable); + return genTable; + } + + /** + * 查询业务列表 + * + * @param genTable 业务信息 + * @return 业务集合 + */ + @Override + public List selectGenTableList(GenTable genTable) + { + return genTableMapper.selectGenTableList(genTable); + } + + /** + * 查询据库列表 + * + * @param genTable 业务信息 + * @return 数据库表集合 + */ + @Override + public List selectDbTableList(GenTable genTable) + { + return genTableMapper.selectDbTableList(genTable); + } + + /** + * 查询据库列表 + * + * @param tableNames 表名称组 + * @return 数据库表集合 + */ + @Override + public List selectDbTableListByNames(String[] tableNames) + { + return genTableMapper.selectDbTableListByNames(tableNames); + } + + /** + * 查询所有表信息 + * + * @return 表信息集合 + */ + @Override + public List selectGenTableAll() + { + return genTableMapper.selectGenTableAll(); + } + + /** + * 修改业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + @Override + @Transactional + public void updateGenTable(GenTable genTable) + { + String options = JSON.toJSONString(genTable.getParams()); + genTable.setOptions(options); + int row = genTableMapper.updateGenTable(genTable); + if (row > 0) + { + for (GenTableColumn cenTableColumn : genTable.getColumns()) + { + genTableColumnMapper.updateGenTableColumn(cenTableColumn); + } + } + } + + /** + * 删除业务对象 + * + * @param tableIds 需要删除的数据ID + * @return 结果 + */ + @Override + @Transactional + public void deleteGenTableByIds(Long[] tableIds) + { + genTableMapper.deleteGenTableByIds(tableIds); + genTableColumnMapper.deleteGenTableColumnByIds(tableIds); + } + + /** + * 导入表结构 + * + * @param tableList 导入表列表 + */ + @Override + @Transactional + public void importGenTable(List tableList) + { + String operName = SecurityUtils.getUsername(); + try + { + for (GenTable table : tableList) + { + String tableName = table.getTableName(); + GenUtils.initTable(table, operName); + int row = genTableMapper.insertGenTable(table); + if (row > 0) + { + // 保存列信息 + List genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); + for (GenTableColumn column : genTableColumns) + { + GenUtils.initColumnField(column, table); + genTableColumnMapper.insertGenTableColumn(column); + } + } + } + } + catch (Exception e) + { + throw new ServiceException("导入失败:" + e.getMessage()); + } + } + + /** + * 预览代码 + * + * @param tableId 表编号 + * @return 预览数据列表 + */ + @Override + public Map previewCode(Long tableId) + { + Map dataMap = new LinkedHashMap<>(); + // 查询表信息 + GenTable table = genTableMapper.selectGenTableById(tableId); + // 设置主子表信息 + setSubTable(table); + // 设置主键列信息 + setPkColumn(table); + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 获取模板列表 + List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + // 渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + dataMap.put(template, sw.toString()); + } + return dataMap; + } + + /** + * 生成代码(下载方式) + * + * @param tableName 表名称 + * @return 数据 + */ + @Override + public byte[] downloadCode(String tableName) + { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipOutputStream zip = new ZipOutputStream(outputStream); + generatorCode(tableName, zip); + IOUtils.closeQuietly(zip); + return outputStream.toByteArray(); + } + + /** + * 生成代码(自定义路径) + * + * @param tableName 表名称 + */ + @Override + public void generatorCode(String tableName) + { + // 查询表信息 + GenTable table = genTableMapper.selectGenTableByName(tableName); + // 设置主子表信息 + setSubTable(table); + // 设置主键列信息 + setPkColumn(table); + + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 获取模板列表 + List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) + { + // 渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + try + { + String path = getGenPath(table, template); + FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); + } + catch (IOException e) + { + throw new ServiceException("渲染模板失败,表名:" + table.getTableName()); + } + } + } + } + + /** + * 同步数据库 + * + * @param tableName 表名称 + */ + @Override + @Transactional + public void synchDb(String tableName) + { + GenTable table = genTableMapper.selectGenTableByName(tableName); + List tableColumns = table.getColumns(); + Map tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity())); + + List dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); + if (StringUtils.isEmpty(dbTableColumns)) + { + throw new ServiceException("同步数据失败,原表结构不存在"); + } + List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); + + dbTableColumns.forEach(column -> { + GenUtils.initColumnField(column, table); + if (tableColumnMap.containsKey(column.getColumnName())) + { + GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName()); + column.setColumnId(prevColumn.getColumnId()); + if (column.isList()) + { + // 如果是列表,继续保留查询方式/字典类型选项 + column.setDictType(prevColumn.getDictType()); + column.setQueryType(prevColumn.getQueryType()); + } + if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() + && (column.isInsert() || column.isEdit()) + && ((column.isUsableColumn()) || (!column.isSuperColumn()))) + { + // 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项 + column.setIsRequired(prevColumn.getIsRequired()); + column.setHtmlType(prevColumn.getHtmlType()); + } + genTableColumnMapper.updateGenTableColumn(column); + } + else + { + genTableColumnMapper.insertGenTableColumn(column); + } + }); + + List delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); + if (StringUtils.isNotEmpty(delColumns)) + { + genTableColumnMapper.deleteGenTableColumns(delColumns); + } + } + + /** + * 批量生成代码(下载方式) + * + * @param tableNames 表数组 + * @return 数据 + */ + @Override + public byte[] downloadCode(String[] tableNames) + { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipOutputStream zip = new ZipOutputStream(outputStream); + for (String tableName : tableNames) + { + generatorCode(tableName, zip); + } + IOUtils.closeQuietly(zip); + return outputStream.toByteArray(); + } + + /** + * 查询表信息并生成代码 + */ + private void generatorCode(String tableName, ZipOutputStream zip) + { + // 查询表信息 + GenTable table = genTableMapper.selectGenTableByName(tableName); + // 设置主子表信息 + setSubTable(table); + // 设置主键列信息 + setPkColumn(table); + + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 获取模板列表 + List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + // 渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + try + { + // 添加到zip + zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); + IOUtils.write(sw.toString(), zip, Constants.UTF8); + IOUtils.closeQuietly(sw); + zip.flush(); + zip.closeEntry(); + } + catch (IOException e) + { + log.error("渲染模板失败,表名:" + table.getTableName(), e); + } + } + } + + /** + * 修改保存参数校验 + * + * @param genTable 业务信息 + */ + @Override + public void validateEdit(GenTable genTable) + { + if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) + { + String options = JSON.toJSONString(genTable.getParams()); + JSONObject paramsObj = JSONObject.parseObject(options); + if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) + { + throw new ServiceException("树编码字段不能为空"); + } + else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) + { + throw new ServiceException("树父编码字段不能为空"); + } + else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) + { + throw new ServiceException("树名称字段不能为空"); + } + else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) + { + if (StringUtils.isEmpty(genTable.getSubTableName())) + { + throw new ServiceException("关联子表的表名不能为空"); + } + else if (StringUtils.isEmpty(genTable.getSubTableFkName())) + { + throw new ServiceException("子表关联的外键名不能为空"); + } + } + } + } + + /** + * 设置主键列信息 + * + * @param table 业务表信息 + */ + public void setPkColumn(GenTable table) + { + for (GenTableColumn column : table.getColumns()) + { + if (column.isPk()) + { + table.setPkColumn(column); + break; + } + } + if (StringUtils.isNull(table.getPkColumn())) + { + table.setPkColumn(table.getColumns().get(0)); + } + if (GenConstants.TPL_SUB.equals(table.getTplCategory())) + { + for (GenTableColumn column : table.getSubTable().getColumns()) + { + if (column.isPk()) + { + table.getSubTable().setPkColumn(column); + break; + } + } + if (StringUtils.isNull(table.getSubTable().getPkColumn())) + { + table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); + } + } + } + + /** + * 设置主子表信息 + * + * @param table 业务表信息 + */ + public void setSubTable(GenTable table) + { + String subTableName = table.getSubTableName(); + if (StringUtils.isNotEmpty(subTableName)) + { + table.setSubTable(genTableMapper.selectGenTableByName(subTableName)); + } + } + + /** + * 设置代码生成其他选项值 + * + * @param genTable 设置后的生成对象 + */ + public void setTableFromOptions(GenTable genTable) + { + JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); + if (StringUtils.isNotNull(paramsObj)) + { + String treeCode = paramsObj.getString(GenConstants.TREE_CODE); + String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); + String treeName = paramsObj.getString(GenConstants.TREE_NAME); + String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID); + String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME); + + genTable.setTreeCode(treeCode); + genTable.setTreeParentCode(treeParentCode); + genTable.setTreeName(treeName); + genTable.setParentMenuId(parentMenuId); + genTable.setParentMenuName(parentMenuName); + } + } + + /** + * 获取代码生成地址 + * + * @param table 业务表信息 + * @param template 模板文件路径 + * @return 生成地址 + */ + public static String getGenPath(GenTable table, String template) + { + String genPath = table.getGenPath(); + if (StringUtils.equals(genPath, "/")) + { + return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); + } + return genPath + File.separator + VelocityUtils.getFileName(template, table); + } +} \ No newline at end of file diff --git a/ktg-generator/src/main/java/com/ktg/generator/service/IGenTableColumnService.java b/ktg-generator/src/main/java/com/ktg/generator/service/IGenTableColumnService.java new file mode 100644 index 0000000..e217dc1 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/service/IGenTableColumnService.java @@ -0,0 +1,44 @@ +package com.ktg.generator.service; + +import java.util.List; +import com.ktg.generator.domain.GenTableColumn; + +/** + * 业务字段 服务层 + * + * @author ktg + */ +public interface IGenTableColumnService +{ + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + public List selectGenTableColumnListByTableId(Long tableId); + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int insertGenTableColumn(GenTableColumn genTableColumn); + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int updateGenTableColumn(GenTableColumn genTableColumn); + + /** + * 删除业务字段信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteGenTableColumnByIds(String ids); +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/service/IGenTableService.java b/ktg-generator/src/main/java/com/ktg/generator/service/IGenTableService.java new file mode 100644 index 0000000..e83ebfc --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/service/IGenTableService.java @@ -0,0 +1,121 @@ +package com.ktg.generator.service; + +import java.util.List; +import java.util.Map; +import com.ktg.generator.domain.GenTable; + +/** + * 业务 服务层 + * + * @author ruoyi + */ +public interface IGenTableService +{ + /** + * 查询业务列表 + * + * @param genTable 业务信息 + * @return 业务集合 + */ + public List selectGenTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param genTable 业务信息 + * @return 数据库表集合 + */ + public List selectDbTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param tableNames 表名称组 + * @return 数据库表集合 + */ + public List selectDbTableListByNames(String[] tableNames); + + /** + * 查询所有表信息 + * + * @return 表信息集合 + */ + public List selectGenTableAll(); + + /** + * 查询业务信息 + * + * @param id 业务ID + * @return 业务信息 + */ + public GenTable selectGenTableById(Long id); + + /** + * 修改业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + public void updateGenTable(GenTable genTable); + + /** + * 删除业务信息 + * + * @param tableIds 需要删除的表数据ID + * @return 结果 + */ + public void deleteGenTableByIds(Long[] tableIds); + + /** + * 导入表结构 + * + * @param tableList 导入表列表 + */ + public void importGenTable(List tableList); + + /** + * 预览代码 + * + * @param tableId 表编号 + * @return 预览数据列表 + */ + public Map previewCode(Long tableId); + + /** + * 生成代码(下载方式) + * + * @param tableName 表名称 + * @return 数据 + */ + public byte[] downloadCode(String tableName); + + /** + * 生成代码(自定义路径) + * + * @param tableName 表名称 + * @return 数据 + */ + public void generatorCode(String tableName); + + /** + * 同步数据库 + * + * @param tableName 表名称 + */ + public void synchDb(String tableName); + + /** + * 批量生成代码(下载方式) + * + * @param tableNames 表数组 + * @return 数据 + */ + public byte[] downloadCode(String[] tableNames); + + /** + * 修改保存参数校验 + * + * @param genTable 业务信息 + */ + public void validateEdit(GenTable genTable); +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/util/GenUtils.java b/ktg-generator/src/main/java/com/ktg/generator/util/GenUtils.java new file mode 100644 index 0000000..aa1e241 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/util/GenUtils.java @@ -0,0 +1,257 @@ +package com.ktg.generator.util; + +import java.util.Arrays; +import org.apache.commons.lang3.RegExUtils; +import com.ktg.common.constant.GenConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.generator.config.GenConfig; +import com.ktg.generator.domain.GenTable; +import com.ktg.generator.domain.GenTableColumn; + +/** + * 代码生成器 工具类 + * + * @author ruoyi + */ +public class GenUtils +{ + /** + * 初始化表信息 + */ + public static void initTable(GenTable genTable, String operName) + { + genTable.setClassName(convertClassName(genTable.getTableName())); + genTable.setPackageName(GenConfig.getPackageName()); + genTable.setModuleName(getModuleName(GenConfig.getPackageName())); + genTable.setBusinessName(getBusinessName(genTable.getTableName())); + genTable.setFunctionName(replaceText(genTable.getTableComment())); + genTable.setFunctionAuthor(GenConfig.getAuthor()); + genTable.setCreateBy(operName); + } + + /** + * 初始化列属性字段 + */ + public static void initColumnField(GenTableColumn column, GenTable table) + { + String dataType = getDbType(column.getColumnType()); + String columnName = column.getColumnName(); + column.setTableId(table.getTableId()); + column.setCreateBy(table.getCreateBy()); + // 设置java字段名 + column.setJavaField(StringUtils.toCamelCase(columnName)); + // 设置默认类型 + column.setJavaType(GenConstants.TYPE_STRING); + column.setQueryType(GenConstants.QUERY_EQ); + + if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) + { + // 字符串长度超过500设置为文本域 + Integer columnLength = getColumnLength(column.getColumnType()); + String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; + column.setHtmlType(htmlType); + } + else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) + { + column.setJavaType(GenConstants.TYPE_DATE); + column.setHtmlType(GenConstants.HTML_DATETIME); + } + else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) + { + column.setHtmlType(GenConstants.HTML_INPUT); + + // 如果是浮点型 统一用BigDecimal + String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); + if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) + { + column.setJavaType(GenConstants.TYPE_BIGDECIMAL); + } + // 如果是整形 + else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) + { + column.setJavaType(GenConstants.TYPE_INTEGER); + } + // 长整形 + else + { + column.setJavaType(GenConstants.TYPE_LONG); + } + } + + // 插入字段(默认所有字段都需要插入) + column.setIsInsert(GenConstants.REQUIRE); + + // 编辑字段 + if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) + { + column.setIsEdit(GenConstants.REQUIRE); + } + // 列表字段 + if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) + { + column.setIsList(GenConstants.REQUIRE); + } + // 查询字段 + if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) + { + column.setIsQuery(GenConstants.REQUIRE); + } + + // 查询字段类型 + if (StringUtils.endsWithIgnoreCase(columnName, "name")) + { + column.setQueryType(GenConstants.QUERY_LIKE); + } + // 状态字段设置单选框 + if (StringUtils.endsWithIgnoreCase(columnName, "status")) + { + column.setHtmlType(GenConstants.HTML_RADIO); + } + // 类型&性别字段设置下拉框 + else if (StringUtils.endsWithIgnoreCase(columnName, "type") + || StringUtils.endsWithIgnoreCase(columnName, "sex")) + { + column.setHtmlType(GenConstants.HTML_SELECT); + } + // 图片字段设置图片上传控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "image")) + { + column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); + } + // 文件字段设置文件上传控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "file")) + { + column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); + } + // 内容字段设置富文本控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "content")) + { + column.setHtmlType(GenConstants.HTML_EDITOR); + } + } + + /** + * 校验数组是否包含指定值 + * + * @param arr 数组 + * @param targetValue 值 + * @return 是否包含 + */ + public static boolean arraysContains(String[] arr, String targetValue) + { + return Arrays.asList(arr).contains(targetValue); + } + + /** + * 获取模块名 + * + * @param packageName 包名 + * @return 模块名 + */ + public static String getModuleName(String packageName) + { + int lastIndex = packageName.lastIndexOf("."); + int nameLength = packageName.length(); + return StringUtils.substring(packageName, lastIndex + 1, nameLength); + } + + /** + * 获取业务名 + * + * @param tableName 表名 + * @return 业务名 + */ + public static String getBusinessName(String tableName) + { + int lastIndex = tableName.lastIndexOf("_"); + int nameLength = tableName.length(); + return StringUtils.substring(tableName, lastIndex + 1, nameLength); + } + + /** + * 表名转换成Java类名 + * + * @param tableName 表名称 + * @return 类名 + */ + public static String convertClassName(String tableName) + { + boolean autoRemovePre = GenConfig.getAutoRemovePre(); + String tablePrefix = GenConfig.getTablePrefix(); + if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) + { + String[] searchList = StringUtils.split(tablePrefix, ","); + tableName = replaceFirst(tableName, searchList); + } + return StringUtils.convertToCamelCase(tableName); + } + + /** + * 批量替换前缀 + * + * @param replacementm 替换值 + * @param searchList 替换列表 + * @return + */ + public static String replaceFirst(String replacementm, String[] searchList) + { + String text = replacementm; + for (String searchString : searchList) + { + if (replacementm.startsWith(searchString)) + { + text = replacementm.replaceFirst(searchString, ""); + break; + } + } + return text; + } + + /** + * 关键字替换 + * + * @param text 需要被替换的名字 + * @return 替换后的名字 + */ + public static String replaceText(String text) + { + return RegExUtils.replaceAll(text, "(?:表|若依)", ""); + } + + /** + * 获取数据库类型字段 + * + * @param columnType 列类型 + * @return 截取后的列类型 + */ + public static String getDbType(String columnType) + { + if (StringUtils.indexOf(columnType, "(") > 0) + { + return StringUtils.substringBefore(columnType, "("); + } + else + { + return columnType; + } + } + + /** + * 获取字段长度 + * + * @param columnType 列类型 + * @return 截取后的列类型 + */ + public static Integer getColumnLength(String columnType) + { + if (StringUtils.indexOf(columnType, "(") > 0) + { + String length = StringUtils.substringBetween(columnType, "(", ")"); + return Integer.valueOf(length); + } + else + { + return 0; + } + } +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/util/VelocityInitializer.java b/ktg-generator/src/main/java/com/ktg/generator/util/VelocityInitializer.java new file mode 100644 index 0000000..d101974 --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/util/VelocityInitializer.java @@ -0,0 +1,36 @@ +package com.ktg.generator.util; + +import java.util.Properties; +import org.apache.velocity.app.Velocity; +import com.ktg.common.constant.Constants; + +/** + * VelocityEngine工厂 + * + * @author ktg + */ +public class VelocityInitializer +{ + /** + * 初始化vm方法 + */ + public static void initVelocity() + { + Properties p = new Properties(); + try + { + // 加载classpath目录下的vm文件 + p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + //p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + // 定义字符集 + //p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); + p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); + // 初始化Velocity引擎,指定配置Properties + Velocity.init(p); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } +} diff --git a/ktg-generator/src/main/java/com/ktg/generator/util/VelocityUtils.java b/ktg-generator/src/main/java/com/ktg/generator/util/VelocityUtils.java new file mode 100644 index 0000000..88764de --- /dev/null +++ b/ktg-generator/src/main/java/com/ktg/generator/util/VelocityUtils.java @@ -0,0 +1,401 @@ +package com.ktg.generator.util; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.velocity.VelocityContext; +import com.alibaba.fastjson.JSONObject; +import com.ktg.common.constant.GenConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.generator.domain.GenTable; +import com.ktg.generator.domain.GenTableColumn; + +/** + * 模板处理工具类 + * + * @author ruoyi + */ +public class VelocityUtils +{ + /** 项目空间路径 */ + private static final String PROJECT_PATH = "main/java"; + + /** mybatis空间路径 */ + private static final String MYBATIS_PATH = "main/resources/mapper"; + + /** 默认上级菜单,系统工具 */ + private static final String DEFAULT_PARENT_MENU_ID = "3"; + + /** + * 设置模板变量信息 + * + * @return 模板列表 + */ + public static VelocityContext prepareContext(GenTable genTable) + { + String moduleName = genTable.getModuleName(); + String businessName = genTable.getBusinessName(); + String packageName = genTable.getPackageName(); + String tplCategory = genTable.getTplCategory(); + String functionName = genTable.getFunctionName(); + + VelocityContext velocityContext = new VelocityContext(); + velocityContext.put("tplCategory", genTable.getTplCategory()); + velocityContext.put("tableName", genTable.getTableName()); + velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); + velocityContext.put("ClassName", genTable.getClassName()); + velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); + velocityContext.put("moduleName", genTable.getModuleName()); + velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); + velocityContext.put("businessName", genTable.getBusinessName()); + velocityContext.put("basePackage", getPackagePrefix(packageName)); + velocityContext.put("packageName", packageName); + velocityContext.put("author", genTable.getFunctionAuthor()); + velocityContext.put("datetime", DateUtils.getDate()); + velocityContext.put("pkColumn", genTable.getPkColumn()); + velocityContext.put("importList", getImportList(genTable)); + velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); + velocityContext.put("columns", genTable.getColumns()); + velocityContext.put("table", genTable); + velocityContext.put("dicts", getDicts(genTable)); + setMenuVelocityContext(velocityContext, genTable); + if (GenConstants.TPL_TREE.equals(tplCategory)) + { + setTreeVelocityContext(velocityContext, genTable); + } + if (GenConstants.TPL_SUB.equals(tplCategory)) + { + setSubVelocityContext(velocityContext, genTable); + } + return velocityContext; + } + + public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.parseObject(options); + String parentMenuId = getParentMenuId(paramsObj); + context.put("parentMenuId", parentMenuId); + } + + public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.parseObject(options); + String treeCode = getTreecode(paramsObj); + String treeParentCode = getTreeParentCode(paramsObj); + String treeName = getTreeName(paramsObj); + + context.put("treeCode", treeCode); + context.put("treeParentCode", treeParentCode); + context.put("treeName", treeName); + context.put("expandColumn", getExpandColumn(genTable)); + if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) + { + context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); + } + if (paramsObj.containsKey(GenConstants.TREE_NAME)) + { + context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME)); + } + } + + public static void setSubVelocityContext(VelocityContext context, GenTable genTable) + { + GenTable subTable = genTable.getSubTable(); + String subTableName = genTable.getSubTableName(); + String subTableFkName = genTable.getSubTableFkName(); + String subClassName = genTable.getSubTable().getClassName(); + String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); + + context.put("subTable", subTable); + context.put("subTableName", subTableName); + context.put("subTableFkName", subTableFkName); + context.put("subTableFkClassName", subTableFkClassName); + context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); + context.put("subClassName", subClassName); + context.put("subclassName", StringUtils.uncapitalize(subClassName)); + context.put("subImportList", getImportList(genTable.getSubTable())); + } + + /** + * 获取模板信息 + * + * @return 模板列表 + */ + public static List getTemplateList(String tplCategory) + { + List templates = new ArrayList(); + templates.add("vm/java/domain.java.vm"); + templates.add("vm/java/mapper.java.vm"); + templates.add("vm/java/service.java.vm"); + templates.add("vm/java/serviceImpl.java.vm"); + templates.add("vm/java/controller.java.vm"); + templates.add("vm/xml/mapper.xml.vm"); + templates.add("vm/sql/sql.vm"); + templates.add("vm/js/api.js.vm"); + if (GenConstants.TPL_CRUD.equals(tplCategory)) + { + templates.add("vm/vue/index.vue.vm"); + } + else if (GenConstants.TPL_TREE.equals(tplCategory)) + { + templates.add("vm/vue/index-tree.vue.vm"); + } + else if (GenConstants.TPL_SUB.equals(tplCategory)) + { + templates.add("vm/vue/index.vue.vm"); + templates.add("vm/java/sub-domain.java.vm"); + } + return templates; + } + + /** + * 获取文件名 + */ + public static String getFileName(String template, GenTable genTable) + { + // 文件名称 + String fileName = ""; + // 包路径 + String packageName = genTable.getPackageName(); + // 模块名 + String moduleName = genTable.getModuleName(); + // 大写类名 + String className = genTable.getClassName(); + // 业务名称 + String businessName = genTable.getBusinessName(); + + String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); + String mybatisPath = MYBATIS_PATH + "/" + moduleName; + String vuePath = "vue"; + + if (template.contains("domain.java.vm")) + { + fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); + } + if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) + { + fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); + } + else if (template.contains("mapper.java.vm")) + { + fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); + } + else if (template.contains("service.java.vm")) + { + fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); + } + else if (template.contains("serviceImpl.java.vm")) + { + fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); + } + else if (template.contains("controller.java.vm")) + { + fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); + } + else if (template.contains("mapper.xml.vm")) + { + fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); + } + else if (template.contains("sql.vm")) + { + fileName = businessName + "Menu.sql"; + } + else if (template.contains("api.js.vm")) + { + fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); + } + else if (template.contains("index.vue.vm")) + { + fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); + } + else if (template.contains("index-tree.vue.vm")) + { + fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); + } + return fileName; + } + + /** + * 获取包前缀 + * + * @param packageName 包名称 + * @return 包前缀名称 + */ + public static String getPackagePrefix(String packageName) + { + int lastIndex = packageName.lastIndexOf("."); + return StringUtils.substring(packageName, 0, lastIndex); + } + + /** + * 根据列类型获取导入包 + * + * @param genTable 业务表对象 + * @return 返回需要导入的包列表 + */ + public static HashSet getImportList(GenTable genTable) + { + List columns = genTable.getColumns(); + GenTable subGenTable = genTable.getSubTable(); + HashSet importList = new HashSet(); + if (StringUtils.isNotNull(subGenTable)) + { + importList.add("java.util.List"); + } + for (GenTableColumn column : columns) + { + if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) + { + importList.add("java.util.Date"); + importList.add("com.fasterxml.jackson.annotation.JsonFormat"); + } + else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) + { + importList.add("java.math.BigDecimal"); + } + } + return importList; + } + + /** + * 根据列类型获取字典组 + * + * @param genTable 业务表对象 + * @return 返回字典组 + */ + public static String getDicts(GenTable genTable) + { + List columns = genTable.getColumns(); + Set dicts = new HashSet(); + addDicts(dicts, columns); + if (StringUtils.isNotNull(genTable.getSubTable())) + { + List subColumns = genTable.getSubTable().getColumns(); + addDicts(dicts, subColumns); + } + return StringUtils.join(dicts, ", "); + } + + /** + * 添加字典列表 + * + * @param dicts 字典列表 + * @param columns 列集合 + */ + public static void addDicts(Set dicts, List columns) + { + for (GenTableColumn column : columns) + { + if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( + column.getHtmlType(), + new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) + { + dicts.add("'" + column.getDictType() + "'"); + } + } + } + + /** + * 获取权限前缀 + * + * @param moduleName 模块名称 + * @param businessName 业务名称 + * @return 返回权限前缀 + */ + public static String getPermissionPrefix(String moduleName, String businessName) + { + return StringUtils.format("{}:{}", moduleName, businessName); + } + + /** + * 获取上级菜单ID字段 + * + * @param paramsObj 生成其他选项 + * @return 上级菜单ID字段 + */ + public static String getParentMenuId(JSONObject paramsObj) + { + if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID) + && StringUtils.isNotEmpty(paramsObj.getString(GenConstants.PARENT_MENU_ID))) + { + return paramsObj.getString(GenConstants.PARENT_MENU_ID); + } + return DEFAULT_PARENT_MENU_ID; + } + + /** + * 获取树编码 + * + * @param paramsObj 生成其他选项 + * @return 树编码 + */ + public static String getTreecode(JSONObject paramsObj) + { + if (paramsObj.containsKey(GenConstants.TREE_CODE)) + { + return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE)); + } + return StringUtils.EMPTY; + } + + /** + * 获取树父编码 + * + * @param paramsObj 生成其他选项 + * @return 树父编码 + */ + public static String getTreeParentCode(JSONObject paramsObj) + { + if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) + { + return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE)); + } + return StringUtils.EMPTY; + } + + /** + * 获取树名称 + * + * @param paramsObj 生成其他选项 + * @return 树名称 + */ + public static String getTreeName(JSONObject paramsObj) + { + if (paramsObj.containsKey(GenConstants.TREE_NAME)) + { + return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME)); + } + return StringUtils.EMPTY; + } + + /** + * 获取需要在哪一列上面显示展开按钮 + * + * @param genTable 业务表对象 + * @return 展开按钮列序号 + */ + public static int getExpandColumn(GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.parseObject(options); + String treeName = paramsObj.getString(GenConstants.TREE_NAME); + int num = 0; + for (GenTableColumn column : genTable.getColumns()) + { + if (column.isList()) + { + num++; + String columnName = column.getColumnName(); + if (columnName.equals(treeName)) + { + break; + } + } + } + return num; + } +} diff --git a/ktg-generator/src/main/resources/generator.yml b/ktg-generator/src/main/resources/generator.yml new file mode 100644 index 0000000..171717e --- /dev/null +++ b/ktg-generator/src/main/resources/generator.yml @@ -0,0 +1,10 @@ +# 代码生成 +gen: + # 作者 + author: yinjinlu + # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool + packageName: com.ktg.mes.md + # 自动去除表前缀,默认是false + autoRemovePre: false + # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) + tablePrefix: md_ \ No newline at end of file diff --git a/ktg-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ktg-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml new file mode 100644 index 0000000..0559cf4 --- /dev/null +++ b/ktg-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column + + + + + + + + insert into gen_table_column ( + table_id, + column_name, + column_comment, + column_type, + java_type, + java_field, + is_pk, + is_increment, + is_required, + is_insert, + is_edit, + is_list, + is_query, + query_type, + html_type, + dict_type, + sort, + create_by, + create_time + )values( + #{tableId}, + #{columnName}, + #{columnComment}, + #{columnType}, + #{javaType}, + #{javaField}, + #{isPk}, + #{isIncrement}, + #{isRequired}, + #{isInsert}, + #{isEdit}, + #{isList}, + #{isQuery}, + #{queryType}, + #{htmlType}, + #{dictType}, + #{sort}, + #{createBy}, + sysdate() + ) + + + + update gen_table_column + + column_comment = #{columnComment}, + java_type = #{javaType}, + java_field = #{javaField}, + is_insert = #{isInsert}, + is_edit = #{isEdit}, + is_list = #{isList}, + is_query = #{isQuery}, + is_required = #{isRequired}, + query_type = #{queryType}, + html_type = #{htmlType}, + dict_type = #{dictType}, + sort = #{sort}, + update_by = #{updateBy}, + update_time = sysdate() + + where column_id = #{columnId} + + + + delete from gen_table_column where table_id in + + #{tableId} + + + + + delete from gen_table_column where column_id in + + #{item.columnId} + + + + \ No newline at end of file diff --git a/ktg-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ktg-generator/src/main/resources/mapper/generator/GenTableMapper.xml new file mode 100644 index 0000000..e4ca8ed --- /dev/null +++ b/ktg-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table + + + + + + + + + + + + + + + + + + insert into gen_table ( + table_name, + table_comment, + class_name, + tpl_category, + package_name, + module_name, + business_name, + function_name, + function_author, + gen_type, + gen_path, + remark, + create_by, + create_time + )values( + #{tableName}, + #{tableComment}, + #{className}, + #{tplCategory}, + #{packageName}, + #{moduleName}, + #{businessName}, + #{functionName}, + #{functionAuthor}, + #{genType}, + #{genPath}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update gen_table + + table_name = #{tableName}, + table_comment = #{tableComment}, + sub_table_name = #{subTableName}, + sub_table_fk_name = #{subTableFkName}, + class_name = #{className}, + function_author = #{functionAuthor}, + gen_type = #{genType}, + gen_path = #{genPath}, + tpl_category = #{tplCategory}, + package_name = #{packageName}, + module_name = #{moduleName}, + business_name = #{businessName}, + function_name = #{functionName}, + options = #{options}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where table_id = #{tableId} + + + + delete from gen_table where table_id in + + #{tableId} + + + + \ No newline at end of file diff --git a/ktg-generator/src/main/resources/vm/java/controller.java.vm b/ktg-generator/src/main/resources/vm/java/controller.java.vm new file mode 100644 index 0000000..41f3085 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/java/controller.java.vm @@ -0,0 +1,115 @@ +package ${packageName}.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import ${packageName}.domain.${ClassName}; +import ${packageName}.service.I${ClassName}Service; +import com.ktg.common.utils.poi.ExcelUtil; +#if($table.crud || $table.sub) +import com.ktg.common.core.page.TableDataInfo; +#elseif($table.tree) +#end + +/** + * ${functionName}Controller + * + * @author ${author} + * @date ${datetime} + */ +@RestController +@RequestMapping("/${moduleName}/${businessName}") +public class ${ClassName}Controller extends BaseController +{ + @Autowired + private I${ClassName}Service ${className}Service; + + /** + * 查询${functionName}列表 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") + @GetMapping("/list") +#if($table.crud || $table.sub) + public TableDataInfo list(${ClassName} ${className}) + { + startPage(); + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + return getDataTable(list); + } +#elseif($table.tree) + public AjaxResult list(${ClassName} ${className}) + { + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + return AjaxResult.success(list); + } +#end + + /** + * 导出${functionName}列表 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") + @Log(title = "${functionName}", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ${ClassName} ${className}) + { + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); + util.exportExcel(response, list, "${functionName}数据"); + } + + /** + * 获取${functionName}详细信息 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") + @GetMapping(value = "/{${pkColumn.javaField}}") + public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) + { + return AjaxResult.success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); + } + + /** + * 新增${functionName} + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") + @Log(title = "${functionName}", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ${ClassName} ${className}) + { + return toAjax(${className}Service.insert${ClassName}(${className})); + } + + /** + * 修改${functionName} + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") + @Log(title = "${functionName}", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ${ClassName} ${className}) + { + return toAjax(${className}Service.update${ClassName}(${className})); + } + + /** + * 删除${functionName} + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") + @Log(title = "${functionName}", businessType = BusinessType.DELETE) + @DeleteMapping("/{${pkColumn.javaField}s}") + public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) + { + return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); + } +} diff --git a/ktg-generator/src/main/resources/vm/java/domain.java.vm b/ktg-generator/src/main/resources/vm/java/domain.java.vm new file mode 100644 index 0000000..0408ed1 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/java/domain.java.vm @@ -0,0 +1,105 @@ +package ${packageName}.domain; + +#foreach ($import in $importList) +import ${import}; +#end +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +#if($table.crud || $table.sub) +import com.ktg.common.core.domain.BaseEntity; +#elseif($table.tree) +import com.ktg.common.core.domain.TreeEntity; +#end + +/** + * ${functionName}对象 ${tableName} + * + * @author ${author} + * @date ${datetime} + */ +#if($table.crud || $table.sub) +#set($Entity="BaseEntity") +#elseif($table.tree) +#set($Entity="TreeEntity") +#end +public class ${ClassName} extends ${Entity} +{ + private static final long serialVersionUID = 1L; + +#foreach ($column in $columns) +#if(!$table.isSuperColumn($column.javaField)) + /** $column.columnComment */ +#if($column.list) +#set($parentheseIndex=$column.columnComment.indexOf("(")) +#if($parentheseIndex != -1) +#set($comment=$column.columnComment.substring(0, $parentheseIndex)) +#else +#set($comment=$column.columnComment) +#end +#if($parentheseIndex != -1) + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") +#elseif($column.javaType == 'Date') + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") +#else + @Excel(name = "${comment}") +#end +#end + private $column.javaType $column.javaField; + +#end +#end +#if($table.sub) + /** $table.subTable.functionName信息 */ + private List<${subClassName}> ${subclassName}List; + +#end +#foreach ($column in $columns) +#if(!$table.isSuperColumn($column.javaField)) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + public void set${AttrName}($column.javaType $column.javaField) + { + this.$column.javaField = $column.javaField; + } + + public $column.javaType get${AttrName}() + { + return $column.javaField; + } +#end +#end + +#if($table.sub) + public List<${subClassName}> get${subClassName}List() + { + return ${subclassName}List; + } + + public void set${subClassName}List(List<${subClassName}> ${subclassName}List) + { + this.${subclassName}List = ${subclassName}List; + } + +#end + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) +#foreach ($column in $columns) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + .append("${column.javaField}", get${AttrName}()) +#end +#if($table.sub) + .append("${subclassName}List", get${subClassName}List()) +#end + .toString(); + } +} diff --git a/ktg-generator/src/main/resources/vm/java/mapper.java.vm b/ktg-generator/src/main/resources/vm/java/mapper.java.vm new file mode 100644 index 0000000..7e7d7c2 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/java/mapper.java.vm @@ -0,0 +1,91 @@ +package ${packageName}.mapper; + +import java.util.List; +import ${packageName}.domain.${ClassName}; +#if($table.sub) +import ${packageName}.domain.${subClassName}; +#end + +/** + * ${functionName}Mapper接口 + * + * @author ${author} + * @date ${datetime} + */ +public interface ${ClassName}Mapper +{ + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return ${functionName} + */ + public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName}集合 + */ + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int insert${ClassName}(${ClassName} ${className}); + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int update${ClassName}(${ClassName} ${className}); + + /** + * 删除${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的数据主键集合 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); +#if($table.sub) + + /** + * 批量删除${subTable.functionName} + * + * @param ${pkColumn.javaField}s 需要删除的数据主键集合 + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); + + /** + * 批量新增${subTable.functionName} + * + * @param ${subclassName}List ${subTable.functionName}列表 + * @return 结果 + */ + public int batch${subClassName}(List<${subClassName}> ${subclassName}List); + + + /** + * 通过${functionName}主键删除${subTable.functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); +#end +} diff --git a/ktg-generator/src/main/resources/vm/java/service.java.vm b/ktg-generator/src/main/resources/vm/java/service.java.vm new file mode 100644 index 0000000..264882b --- /dev/null +++ b/ktg-generator/src/main/resources/vm/java/service.java.vm @@ -0,0 +1,61 @@ +package ${packageName}.service; + +import java.util.List; +import ${packageName}.domain.${ClassName}; + +/** + * ${functionName}Service接口 + * + * @author ${author} + * @date ${datetime} + */ +public interface I${ClassName}Service +{ + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return ${functionName} + */ + public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName}集合 + */ + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int insert${ClassName}(${ClassName} ${className}); + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int update${ClassName}(${ClassName} ${className}); + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); + + /** + * 删除${functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); +} diff --git a/ktg-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ktg-generator/src/main/resources/vm/java/serviceImpl.java.vm new file mode 100644 index 0000000..b5f3378 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -0,0 +1,169 @@ +package ${packageName}.service.impl; + +import java.util.List; +#foreach ($column in $columns) +#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') +import com.ktg.common.utils.DateUtils; +#break +#end +#end +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +#if($table.sub) +import java.util.ArrayList; +import com.ktg.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import ${packageName}.domain.${subClassName}; +#end +import ${packageName}.mapper.${ClassName}Mapper; +import ${packageName}.domain.${ClassName}; +import ${packageName}.service.I${ClassName}Service; + +/** + * ${functionName}Service业务层处理 + * + * @author ${author} + * @date ${datetime} + */ +@Service +public class ${ClassName}ServiceImpl implements I${ClassName}Service +{ + @Autowired + private ${ClassName}Mapper ${className}Mapper; + + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return ${functionName} + */ + @Override + public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) + { + return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); + } + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName} + */ + @Override + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) + { + return ${className}Mapper.select${ClassName}List(${className}); + } + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int insert${ClassName}(${ClassName} ${className}) + { +#foreach ($column in $columns) +#if($column.javaField == 'createTime') + ${className}.setCreateTime(DateUtils.getNowDate()); +#end +#end +#if($table.sub) + int rows = ${className}Mapper.insert${ClassName}(${className}); + insert${subClassName}(${className}); + return rows; +#else + return ${className}Mapper.insert${ClassName}(${className}); +#end + } + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int update${ClassName}(${ClassName} ${className}) + { +#foreach ($column in $columns) +#if($column.javaField == 'updateTime') + ${className}.setUpdateTime(DateUtils.getNowDate()); +#end +#end +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); + insert${subClassName}(${className}); +#end + return ${className}Mapper.update${ClassName}(${className}); + } + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的${functionName}主键 + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) + { +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); +#end + return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s); + } + + /** + * 删除${functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) + { +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); +#end + return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); + } +#if($table.sub) + + /** + * 新增${subTable.functionName}信息 + * + * @param ${className} ${functionName}对象 + */ + public void insert${subClassName}(${ClassName} ${className}) + { + List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); + ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); + if (StringUtils.isNotNull(${subclassName}List)) + { + List<${subClassName}> list = new ArrayList<${subClassName}>(); + for (${subClassName} ${subclassName} : ${subclassName}List) + { + ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); + list.add(${subclassName}); + } + if (list.size() > 0) + { + ${className}Mapper.batch${subClassName}(list); + } + } + } +#end +} diff --git a/ktg-generator/src/main/resources/vm/java/sub-domain.java.vm b/ktg-generator/src/main/resources/vm/java/sub-domain.java.vm new file mode 100644 index 0000000..cbc3b7f --- /dev/null +++ b/ktg-generator/src/main/resources/vm/java/sub-domain.java.vm @@ -0,0 +1,76 @@ +package ${packageName}.domain; + +#foreach ($import in $subImportList) +import ${import}; +#end +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * ${subTable.functionName}对象 ${subTableName} + * + * @author ${author} + * @date ${datetime} + */ +public class ${subClassName} extends BaseEntity +{ + private static final long serialVersionUID = 1L; + +#foreach ($column in $subTable.columns) +#if(!$table.isSuperColumn($column.javaField)) + /** $column.columnComment */ +#if($column.list) +#set($parentheseIndex=$column.columnComment.indexOf("(")) +#if($parentheseIndex != -1) +#set($comment=$column.columnComment.substring(0, $parentheseIndex)) +#else +#set($comment=$column.columnComment) +#end +#if($parentheseIndex != -1) + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") +#elseif($column.javaType == 'Date') + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") +#else + @Excel(name = "${comment}") +#end +#end + private $column.javaType $column.javaField; + +#end +#end +#foreach ($column in $subTable.columns) +#if(!$table.isSuperColumn($column.javaField)) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + public void set${AttrName}($column.javaType $column.javaField) + { + this.$column.javaField = $column.javaField; + } + + public $column.javaType get${AttrName}() + { + return $column.javaField; + } +#end +#end + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) +#foreach ($column in $subTable.columns) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + .append("${column.javaField}", get${AttrName}()) +#end + .toString(); + } +} diff --git a/ktg-generator/src/main/resources/vm/js/api.js.vm b/ktg-generator/src/main/resources/vm/js/api.js.vm new file mode 100644 index 0000000..9295524 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/js/api.js.vm @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询${functionName}列表 +export function list${BusinessName}(query) { + return request({ + url: '/${moduleName}/${businessName}/list', + method: 'get', + params: query + }) +} + +// 查询${functionName}详细 +export function get${BusinessName}(${pkColumn.javaField}) { + return request({ + url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, + method: 'get' + }) +} + +// 新增${functionName} +export function add${BusinessName}(data) { + return request({ + url: '/${moduleName}/${businessName}', + method: 'post', + data: data + }) +} + +// 修改${functionName} +export function update${BusinessName}(data) { + return request({ + url: '/${moduleName}/${businessName}', + method: 'put', + data: data + }) +} + +// 删除${functionName} +export function del${BusinessName}(${pkColumn.javaField}) { + return request({ + url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, + method: 'delete' + }) +} diff --git a/ktg-generator/src/main/resources/vm/sql/sql.vm b/ktg-generator/src/main/resources/vm/sql/sql.vm new file mode 100644 index 0000000..0575583 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/sql/sql.vm @@ -0,0 +1,22 @@ +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/ktg-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ktg-generator/src/main/resources/vm/vue/index-tree.vue.vm new file mode 100644 index 0000000..d9a5c45 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -0,0 +1,480 @@ + + + diff --git a/ktg-generator/src/main/resources/vm/vue/index.vue.vm b/ktg-generator/src/main/resources/vm/vue/index.vue.vm new file mode 100644 index 0000000..e9a1fae --- /dev/null +++ b/ktg-generator/src/main/resources/vm/vue/index.vue.vm @@ -0,0 +1,598 @@ + + + diff --git a/ktg-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ktg-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm new file mode 100644 index 0000000..d57bbdf --- /dev/null +++ b/ktg-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -0,0 +1,464 @@ + + + diff --git a/ktg-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ktg-generator/src/main/resources/vm/vue/v3/index.vue.vm new file mode 100644 index 0000000..a363ef3 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -0,0 +1,596 @@ + + + diff --git a/ktg-generator/src/main/resources/vm/vue/v3/readme.txt b/ktg-generator/src/main/resources/vm/vue/v3/readme.txt new file mode 100644 index 0000000..a932dcd --- /dev/null +++ b/ktg-generator/src/main/resources/vm/vue/v3/readme.txt @@ -0,0 +1 @@ +���ʹ�õ���ktg-mesǰ�ˣ���ô��Ҫ����һ�´�Ŀ¼��ģ��index.vue.vm��index-tree.vue.vm�ļ����ϼ�vueĿ¼�� \ No newline at end of file diff --git a/ktg-generator/src/main/resources/vm/xml/mapper.xml.vm b/ktg-generator/src/main/resources/vm/xml/mapper.xml.vm new file mode 100644 index 0000000..0ceb3d8 --- /dev/null +++ b/ktg-generator/src/main/resources/vm/xml/mapper.xml.vm @@ -0,0 +1,135 @@ + + + + + +#foreach ($column in $columns) + +#end + +#if($table.sub) + + + + + + +#foreach ($column in $subTable.columns) + +#end + +#end + + + select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName} + + + + + + + + insert into ${tableName} + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + $column.columnName, +#end +#end + + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + #{$column.javaField}, +#end +#end + + + + + update ${tableName} + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName) + $column.columnName = #{$column.javaField}, +#end +#end + + where ${pkColumn.columnName} = #{${pkColumn.javaField}} + + + + delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} + + + + delete from ${tableName} where ${pkColumn.columnName} in + + #{${pkColumn.javaField}} + + +#if($table.sub) + + + delete from ${subTableName} where ${subTableFkName} in + + #{${subTableFkclassName}} + + + + + delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} + + + + insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values + + (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end) + + +#end + \ No newline at end of file diff --git a/ktg-mes/pom.xml b/ktg-mes/pom.xml new file mode 100644 index 0000000..9c0b487 --- /dev/null +++ b/ktg-mes/pom.xml @@ -0,0 +1,57 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-mes + + + MES 系统 + + + + + net.sf.jasperreports + jasperreports + 6.18.1 + + + net.sf.jasperreports + jasperreports-fonts + 6.18.1 + + + + com.itextpdf + itextpdf + 5.5.11 + + + com.itextpdf + itext-pdfa + 5.5.11 + + + com.itextpdf + itext-asian + 5.2.0 + + + + com.ktg + ktg-framework + + + io.swagger + swagger-models + 1.6.2 + + + + \ No newline at end of file diff --git a/ktg-mes/src/main/java/com/ktg/mes/aspect/BarcodeGen.java b/ktg-mes/src/main/java/com/ktg/mes/aspect/BarcodeGen.java new file mode 100644 index 0000000..ca90b03 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/aspect/BarcodeGen.java @@ -0,0 +1,14 @@ +package com.ktg.mes.aspect; + +import java.lang.annotation.*; + +@Target({ElementType.PARAMETER, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface BarcodeGen { + /** + * 业务类型 + * @return + */ + String barcodeType(); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/aspect/BarcodeGenAspect.java b/ktg-mes/src/main/java/com/ktg/mes/aspect/BarcodeGenAspect.java new file mode 100644 index 0000000..109477d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/aspect/BarcodeGenAspect.java @@ -0,0 +1,51 @@ +package com.ktg.mes.aspect; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.mes.wm.domain.WmBarcodeConfig; +import com.ktg.mes.wm.service.IWmBarcodeConfigService; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.Aspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +@Aspect +@Component +public class BarcodeGenAspect { + + private static final Logger log = LoggerFactory.getLogger(BarcodeGenAspect.class); + + @Autowired + private IWmBarcodeConfigService wmBarcodeConfigService; + + /** + * 根据业务controller的类型和返回值生成对应的条码 + * @param joinPoint + * @param gen + * @param returnResult + */ + @AfterReturning(pointcut = "@annotation(gen)",returning = "returnResult") + public void doAfter(JoinPoint joinPoint, BarcodeGen gen, AjaxResult returnResult){ + //先判断当前类型的业务是否配置了需要自动生成条码 + if(!wmBarcodeConfigService.isAutoGen(gen.barcodeType())){ + //无需自动生成条码 + return ; + } + WmBarcodeConfig param = new WmBarcodeConfig(); + param.setBarcodeType(gen.barcodeType()); + List confgs = wmBarcodeConfigService.selectWmBarcodeConfigList(param); + if(CollectionUtils.isEmpty(confgs)){ + log.warn("当前类型的业务未配置对应的条码生成规则!{}",gen.barcodeType()); + } + + Long businessId = (Long)returnResult.get("data"); //获取业务ID + + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalCalendarController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalCalendarController.java new file mode 100644 index 0000000..def278a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalCalendarController.java @@ -0,0 +1,77 @@ +package com.ktg.mes.cal.controller; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.cal.domain.CalCalendar; +import com.ktg.mes.cal.domain.CalHoliday; +import com.ktg.mes.cal.service.ICalCalendarService; +import com.ktg.mes.cal.service.ICalHolidayService; +import com.ktg.mes.cal.utils.CalendarUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 排班日历 + * + * @author yinjinlu + * @date 2022-06-10 + */ +@RestController +@RequestMapping("/mes/cal/calendar") +public class CalCalendarController extends BaseController { + + @Autowired + private ICalCalendarService calCalendarService; + + @Autowired + private ICalHolidayService calHolidayService; + + @PreAuthorize("@ss.hasPermi('mes:cal:calendar:list')") + @GetMapping("/list") + public AjaxResult getCalendars(CalCalendar calCalendar){ + + Date day = calCalendar.getDate(); + List days = null; + if(StringUtils.isNull(day)){ + day = new Date(); + } + + if(UserConstants.CAL_QUERY_BY_TYPE.equals(calCalendar.getQueryType())){ + days=calCalendarService.getCalendarByType(day,calCalendar.getCalendarType()); + }else if(UserConstants.CAL_QUERY_BY_TEAM.equals(calCalendar.getQueryType())){ + days=calCalendarService.getCalendarByTeam(day,calCalendar.getTeamId()); + }else { + days=calCalendarService.getCalendarByUser(day,calCalendar.getUserId()); + } + return AjaxResult.success(getCalendarsWithoutHoliday(days)); + } + + + /** + * 过滤掉节假日 + * @param days + * @return + */ + private List getCalendarsWithoutHoliday(List days){ + CalHoliday param = new CalHoliday(); + List holidays = calHolidayService.selectCalHolidayList(param); + if(CollUtil.isNotEmpty(holidays)){ + List results = days.stream().filter( + calCalendar -> holidays.stream().filter(calHoliday -> calCalendar.getTheDay().equals(CalendarUtil.getDateStr(calHoliday.getTheDay()))).collect(Collectors.toList()).size()==0 + ).collect(Collectors.toList()); + return results; + } + return days; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalHolidayController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalHolidayController.java new file mode 100644 index 0000000..3f82a3e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalHolidayController.java @@ -0,0 +1,113 @@ +package com.ktg.mes.cal.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.cal.domain.CalHoliday; +import com.ktg.mes.cal.service.ICalHolidayService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 节假日设置Controller + * + * @author yinjinlu + * @date 2022-06-08 + */ +@RestController +@RequestMapping("/mes/cal/calholiday") +public class CalHolidayController extends BaseController +{ + @Autowired + private ICalHolidayService calHolidayService; + + /** + * 查询节假日设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:list')") + @GetMapping("/list") + public AjaxResult list(CalHoliday calHoliday) + { + List list = calHolidayService.selectCalHolidayList(calHoliday); + return AjaxResult.success(list); + } + + /** + * 导出节假日设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:export')") + @Log(title = "节假日设置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CalHoliday calHoliday) + { + List list = calHolidayService.selectCalHolidayList(calHoliday); + ExcelUtil util = new ExcelUtil(CalHoliday.class); + util.exportExcel(response, list, "节假日设置数据"); + } + + /** + * 获取节假日设置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:query')") + @GetMapping(value = "/{holidayId}") + public AjaxResult getInfo(@PathVariable("holidayId") Long holidayId) + { + return AjaxResult.success(calHolidayService.selectCalHolidayByHolidayId(holidayId)); + } + + /** + * 新增节假日设置 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:add')") + @Log(title = "节假日设置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CalHoliday calHoliday) + { + CalHoliday param = new CalHoliday(); + param.setTheDay(calHoliday.getTheDay()); + List days = calHolidayService.selectCalHolidayList(param); + if(CollUtil.isNotEmpty(days)){ + calHoliday.setHolidayId(days.get(0).getHolidayId()); + return toAjax(calHolidayService.updateCalHoliday(calHoliday)); + }else{ + return toAjax(calHolidayService.insertCalHoliday(calHoliday)); + } + } + + /** + * 修改节假日设置 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:edit')") + @Log(title = "节假日设置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CalHoliday calHoliday) + { + return toAjax(calHolidayService.updateCalHoliday(calHoliday)); + } + + /** + * 删除节假日设置 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calholiday:remove')") + @Log(title = "节假日设置", businessType = BusinessType.DELETE) + @DeleteMapping("/{holidayIds}") + public AjaxResult remove(@PathVariable Long[] holidayIds) + { + return toAjax(calHolidayService.deleteCalHolidayByHolidayIds(holidayIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalPlanController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalPlanController.java new file mode 100644 index 0000000..a9909ad --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalPlanController.java @@ -0,0 +1,154 @@ +package com.ktg.mes.cal.controller; + +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.cal.domain.CalPlanTeam; +import com.ktg.mes.cal.service.ICalPlanTeamService; +import com.ktg.mes.cal.service.ICalShiftService; +import com.ktg.mes.cal.service.ICalTeamshiftService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.cal.domain.CalPlan; +import com.ktg.mes.cal.service.ICalPlanService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 排班计划Controller + * + * @author yinjinlu + * @date 2022-06-06 + */ +@RestController +@RequestMapping("/mes/cal/calplan") +public class CalPlanController extends BaseController +{ + @Autowired + private ICalPlanService calPlanService; + + @Autowired + private ICalShiftService calShiftService; + + @Autowired + private ICalPlanTeamService calPlanTeamService; + + @Autowired + private ICalTeamshiftService calTeamshiftService; + + /** + * 查询排班计划列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:list')") + @GetMapping("/list") + public TableDataInfo list(CalPlan calPlan) + { + startPage(); + List list = calPlanService.selectCalPlanList(calPlan); + return getDataTable(list); + } + + /** + * 导出排班计划列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')") + @Log(title = "排班计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CalPlan calPlan) + { + List list = calPlanService.selectCalPlanList(calPlan); + ExcelUtil util = new ExcelUtil(CalPlan.class); + util.exportExcel(response, list, "排班计划数据"); + } + + /** + * 获取排班计划详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')") + @GetMapping(value = "/{planId}") + public AjaxResult getInfo(@PathVariable("planId") Long planId) + { + return AjaxResult.success(calPlanService.selectCalPlanByPlanId(planId)); + } + + /** + * 新增排班计划 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')") + @Log(title = "排班计划", businessType = BusinessType.INSERT) + @Transactional + @PostMapping + public AjaxResult add(@RequestBody CalPlan calPlan) + { + int ret = calPlanService.insertCalPlan(calPlan); + //根据选择的轮班方式生成默认的班次 + calShiftService.addDefaultShift(calPlan.getPlanId(),calPlan.getShiftType()); + return toAjax(ret); + } + + + /** + * 修改排班计划 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')") + @Log(title = "排班计划", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping + public AjaxResult edit(@RequestBody CalPlan calPlan) + { + if(UserConstants.ORDER_STATUS_CONFIRMED.equals(calPlan.getStatus())){ + + //检查班组配置 + List teams = calPlanTeamService.selectCalPlanTeamListByPlanId(calPlan.getPlanId()); + if(CollectionUtil.isEmpty(teams)){ + return AjaxResult.error("请配置班组!"); + } else if(teams.size() != 2 && UserConstants.CAL_SHIFT_TYPE_TWO.equals(calPlan.getShiftType())){ + return AjaxResult.error("两班倒请配置两个班组!"); + } else if(teams.size() !=3 && UserConstants.CAL_SHIFT_TYPE_THREE.equals(calPlan.getShiftType())){ + return AjaxResult.error("三倒请配置三个班组!"); + } + + calTeamshiftService.genRecords(calPlan.getPlanId()); + } + return toAjax(calPlanService.updateCalPlan(calPlan)); + } + + /** + * 删除排班计划 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')") + @Log(title = "排班计划", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{planIds}") + public AjaxResult remove(@PathVariable Long[] planIds) + { + for (Long planId:planIds + ) { + //状态判断 + CalPlan plan = calPlanService.selectCalPlanByPlanId(planId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(plan.getStatus())){ + return AjaxResult.error("只能删除草稿状态单据!"); + } + calShiftService.deleteByPlanId(planId); + calPlanTeamService.deleteByPlanId(planId); + } + return toAjax(calPlanService.deleteCalPlanByPlanIds(planIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalPlanTeamController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalPlanTeamController.java new file mode 100644 index 0000000..b678486 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalPlanTeamController.java @@ -0,0 +1,108 @@ +package com.ktg.mes.cal.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.cal.domain.CalPlanTeam; +import com.ktg.mes.cal.service.ICalPlanTeamService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 计划班组Controller + * + * @author yinjinlu + * @date 2022-06-07 + */ +@RestController +@RequestMapping("/mes/cal/planteam") +public class CalPlanTeamController extends BaseController +{ + @Autowired + private ICalPlanTeamService calPlanTeamService; + + /** + * 查询计划班组列表 + */ + @GetMapping("/list") + public TableDataInfo list(CalPlanTeam calPlanTeam) + { + startPage(); + List list = calPlanTeamService.selectCalPlanTeamList(calPlanTeam); + return getDataTable(list); + } + + /** + * 导出计划班组列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')") + @Log(title = "计划班组", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CalPlanTeam calPlanTeam) + { + List list = calPlanTeamService.selectCalPlanTeamList(calPlanTeam); + ExcelUtil util = new ExcelUtil(CalPlanTeam.class); + util.exportExcel(response, list, "计划班组数据"); + } + + /** + * 获取计划班组详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(calPlanTeamService.selectCalPlanTeamByRecordId(recordId)); + } + + /** + * 新增计划班组 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')") + @Log(title = "计划班组", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CalPlanTeam calPlanTeam) + { + if (UserConstants.NOT_UNIQUE.equals(calPlanTeamService.checkPlanTeamUnique(calPlanTeam))) { + return AjaxResult.error("班组已添加,不能重复添加!"); + } + return toAjax(calPlanTeamService.insertCalPlanTeam(calPlanTeam)); + } + + /** + * 修改计划班组 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')") + @Log(title = "计划班组", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CalPlanTeam calPlanTeam) + { + return toAjax(calPlanTeamService.updateCalPlanTeam(calPlanTeam)); + } + + /** + * 删除计划班组 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')") + @Log(title = "计划班组", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(calPlanTeamService.deleteCalPlanTeamByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalShiftController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalShiftController.java new file mode 100644 index 0000000..298ae39 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalShiftController.java @@ -0,0 +1,122 @@ +package com.ktg.mes.cal.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.cal.domain.CalPlan; +import com.ktg.mes.cal.service.ICalPlanService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.cal.domain.CalShift; +import com.ktg.mes.cal.service.ICalShiftService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 计划班次Controller + * + * @author yinjinlu + * @date 2022-06-06 + */ +@RestController +@RequestMapping("/mes/cal/shift") +public class CalShiftController extends BaseController +{ + @Autowired + private ICalShiftService calShiftService; + + @Autowired + private ICalPlanService calPlanService; + + /** + * 查询计划班次列表 + */ + @GetMapping("/list") + public TableDataInfo list(CalShift calShift) + { + startPage(); + List list = calShiftService.selectCalShiftList(calShift); + return getDataTable(list); + } + + /** + * 导出计划班次列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')") + @Log(title = "计划班次", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CalShift calShift) + { + List list = calShiftService.selectCalShiftList(calShift); + ExcelUtil util = new ExcelUtil(CalShift.class); + util.exportExcel(response, list, "计划班次数据"); + } + + /** + * 获取计划班次详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')") + @GetMapping(value = "/{shiftId}") + public AjaxResult getInfo(@PathVariable("shiftId") Long shiftId) + { + return AjaxResult.success(calShiftService.selectCalShiftByShiftId(shiftId)); + } + + /** + * 新增计划班次 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')") + @Log(title = "计划班次", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CalShift calShift) + { + int count = calShiftService.checkShiftCount(calShift.getPlanId()); + CalPlan plan = calPlanService.selectCalPlanByPlanId(calShift.getPlanId()); + if(UserConstants.CAL_SHIFT_TYPE_SINGLE.equals(plan.getShiftType())&&count>0){ + return AjaxResult.error("轮班方式为 白班 时只能有一个班次!"); + } + if(UserConstants.CAL_SHIFT_TYPE_TWO.equals(plan.getShiftType())&&count>1){ + return AjaxResult.error("轮班方式为 两班倒 时只能有两个班次!"); + } + if(UserConstants.CAL_SHIFT_TYPE_THREE.equals(plan.getShiftType())&&count>2){ + return AjaxResult.error("轮班方式为 三班倒 时只能有三个班次!"); + } + + return toAjax(calShiftService.insertCalShift(calShift)); + } + + /** + * 修改计划班次 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')") + @Log(title = "计划班次", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CalShift calShift) + { + return toAjax(calShiftService.updateCalShift(calShift)); + } + + /** + * 删除计划班次 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')") + @Log(title = "计划班次", businessType = BusinessType.DELETE) + @DeleteMapping("/{shiftIds}") + public AjaxResult remove(@PathVariable Long[] shiftIds) + { + return toAjax(calShiftService.deleteCalShiftByShiftIds(shiftIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalTeamController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalTeamController.java new file mode 100644 index 0000000..edf6a15 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalTeamController.java @@ -0,0 +1,124 @@ +package com.ktg.mes.cal.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.mes.cal.service.ICalTeamMemberService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.cal.domain.CalTeam; +import com.ktg.mes.cal.service.ICalTeamService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 班组Controller + * + * @author yinjinlu + * @date 2022-06-05 + */ +@RestController +@RequestMapping("/mes/cal/team") +public class CalTeamController extends BaseController +{ + @Autowired + private ICalTeamService calTeamService; + + @Autowired + private ICalTeamMemberService calTeamMemberService; + + /** + * 查询班组列表 + */ + @GetMapping("/list") + public TableDataInfo list(CalTeam calTeam) + { + startPage(); + List list = calTeamService.selectCalTeamList(calTeam); + return getDataTable(list); + } + + /** + * 查询所有班组列表 + */ + @GetMapping("/listAll") + public AjaxResult listAll(){ + CalTeam calTeam= new CalTeam(); + List list = calTeamService.selectCalTeamList(calTeam); + return AjaxResult.success(list); + } + + /** + * 导出班组列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:export')") + @Log(title = "班组", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CalTeam calTeam) + { + List list = calTeamService.selectCalTeamList(calTeam); + ExcelUtil util = new ExcelUtil(CalTeam.class); + util.exportExcel(response, list, "班组数据"); + } + + /** + * 获取班组详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:query')") + @GetMapping(value = "/{teamId}") + public AjaxResult getInfo(@PathVariable("teamId") Long teamId) + { + return AjaxResult.success(calTeamService.selectCalTeamByTeamId(teamId)); + } + + /** + * 新增班组 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:add')") + @Log(title = "班组", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CalTeam calTeam) + { + return toAjax(calTeamService.insertCalTeam(calTeam)); + } + + /** + * 修改班组 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:edit')") + @Log(title = "班组", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CalTeam calTeam) + { + return toAjax(calTeamService.updateCalTeam(calTeam)); + } + + /** + * 删除班组 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:remove')") + @Log(title = "班组", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{teamIds}") + public AjaxResult remove(@PathVariable Long[] teamIds) + { + for (Long teamId:teamIds + ) { + calTeamMemberService.deleteByTeamId(teamId); + } + return toAjax(calTeamService.deleteCalTeamByTeamIds(teamIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalTeamMemberController.java b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalTeamMemberController.java new file mode 100644 index 0000000..7da17a7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/controller/CalTeamMemberController.java @@ -0,0 +1,98 @@ +package com.ktg.mes.cal.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.cal.domain.CalTeamMember; +import com.ktg.mes.cal.service.ICalTeamMemberService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 班组成员Controller + * + * @author yinjinlu + * @date 2022-06-05 + */ +@RestController +@RequestMapping("/mes/cal/teammember") +public class CalTeamMemberController extends BaseController +{ + @Autowired + private ICalTeamMemberService calTeamMemberService; + + /** + * 查询班组成员列表 + */ + @GetMapping("/list") + public TableDataInfo list(CalTeamMember calTeamMember) + { + startPage(); + List list = calTeamMemberService.selectCalTeamMemberList(calTeamMember); + return getDataTable(list); + } + + /** + * 导出班组成员列表 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:export')") + @Log(title = "班组成员", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CalTeamMember calTeamMember) + { + List list = calTeamMemberService.selectCalTeamMemberList(calTeamMember); + ExcelUtil util = new ExcelUtil(CalTeamMember.class); + util.exportExcel(response, list, "班组成员数据"); + } + + /** + * 获取班组成员详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:query')") + @GetMapping(value = "/{memberId}") + public AjaxResult getInfo(@PathVariable("memberId") Long memberId) + { + return AjaxResult.success(calTeamMemberService.selectCalTeamMemberByMemberId(memberId)); + } + + /** + * 新增班组成员 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:add')") + @Log(title = "班组成员", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CalTeamMember calTeamMember) + { + if(UserConstants.NOT_UNIQUE.equals(calTeamMemberService.checkUserUnique(calTeamMember))){ + return AjaxResult.error("用户"+calTeamMember.getNickName()+"已分配过班组!"); + } + + return toAjax(calTeamMemberService.insertCalTeamMember(calTeamMember)); + } + + /** + * 删除班组成员 + */ + @PreAuthorize("@ss.hasPermi('mes:cal:team:remove')") + @Log(title = "班组成员", businessType = BusinessType.DELETE) + @DeleteMapping("/{memberIds}") + public AjaxResult remove(@PathVariable Long[] memberIds) + { + return toAjax(calTeamMemberService.deleteCalTeamMemberByMemberIds(memberIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalCalendar.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalCalendar.java new file mode 100644 index 0000000..25ef7b6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalCalendar.java @@ -0,0 +1,113 @@ +package com.ktg.mes.cal.domain; + +import com.ktg.common.core.domain.BaseEntity; + +import java.util.Date; +import java.util.List; + +public class CalCalendar extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 查询参数部分 + */ + private String queryType; + + private Date date; + + private String calendarType; + + private Long teamId; + + private Long userId; + + + /** + * 返回值部分 + */ + private String theDay; + + private String shiftType; + + private List teamShifts; + + + public String getQueryType() { + return queryType; + } + + public void setQueryType(String queryType) { + this.queryType = queryType; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getCalendarType() { + return calendarType; + } + + public void setCalendarType(String calendarType) { + this.calendarType = calendarType; + } + + public Long getTeamId() { + return teamId; + } + + public void setTeamId(Long teamId) { + this.teamId = teamId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getTheDay() { + return theDay; + } + + public void setTheDay(String theDay) { + this.theDay = theDay; + } + + public String getShiftType() { + return shiftType; + } + + public void setShiftType(String shiftType) { + this.shiftType = shiftType; + } + + public List getTeamShifts() { + return teamShifts; + } + + public void setTeamShifts(List teamShifts) { + this.teamShifts = teamShifts; + } + + @Override + public String toString() { + return "CalCalendar{" + + "queryType='" + queryType + '\'' + + ", date='" + date + '\'' + + ", calendarType='" + calendarType + '\'' + + ", teamId=" + teamId + + ", userId=" + userId + + ", theDay=" + theDay + + ", shiftType='" + shiftType + '\'' + + ", teamShifts=" + teamShifts + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalHoliday.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalHoliday.java new file mode 100644 index 0000000..1fbabc7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalHoliday.java @@ -0,0 +1,155 @@ +package com.ktg.mes.cal.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 节假日设置对象 cal_holiday + * + * @author yinjinlu + * @date 2022-06-08 + */ +public class CalHoliday extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水号 */ + private Long holidayId; + + /** 日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date theDay; + + /** 日期类型 */ + @Excel(name = "日期类型") + private String holidayType; + + /** 开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date endTime; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setHolidayId(Long holidayId) + { + this.holidayId = holidayId; + } + + public Long getHolidayId() + { + return holidayId; + } + public void setTheDay(Date theDay) + { + this.theDay = theDay; + } + + public Date getTheDay() + { + return theDay; + } + public void setHolidayType(String holidayType) + { + this.holidayType = holidayType; + } + + public String getHolidayType() + { + return holidayType; + } + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStartTime() + { + return startTime; + } + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("holidayId", getHolidayId()) + .append("theDay", getTheDay()) + .append("holidayType", getHolidayType()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalPlan.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalPlan.java new file mode 100644 index 0000000..2cdb1d3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalPlan.java @@ -0,0 +1,213 @@ +package com.ktg.mes.cal.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 排班计划对象 cal_plan + * + * @author yinjinlu + * @date 2022-06-06 + */ +public class CalPlan extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 计划ID */ + private Long planId; + + /** 计划编号 */ + @Excel(name = "计划编号") + private String planCode; + + /** 计划名称 */ + @Excel(name = "计划名称") + private String planName; + + private String calendarType; + + /** 开始日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date startDate; + + /** 结束日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date endDate; + + /** 轮班方式 */ + @Excel(name = "轮班方式") + private String shiftType; + + /** 倒班方式 */ + @Excel(name = "倒班方式") + private String shiftMethod; + + /** 数 */ + @Excel(name = "数") + private Long shiftCount; + + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setPlanCode(String planCode) + { + this.planCode = planCode; + } + + public String getPlanCode() + { + return planCode; + } + public void setPlanName(String planName) + { + this.planName = planName; + } + + public String getPlanName() + { + return planName; + } + public void setStartDate(Date startDate) + { + this.startDate = startDate; + } + + public String getCalendarType() { + return calendarType; + } + + public void setCalendarType(String calendarType) { + this.calendarType = calendarType; + } + + public Date getStartDate() + { + return startDate; + } + public void setEndDate(Date endDate) + { + this.endDate = endDate; + } + + public Date getEndDate() + { + return endDate; + } + public void setShiftType(String shiftType) + { + this.shiftType = shiftType; + } + + public String getShiftType() + { + return shiftType; + } + public void setShiftMethod(String shiftMethod) + { + this.shiftMethod = shiftMethod; + } + + public String getShiftMethod() + { + return shiftMethod; + } + public void setShiftCount(Long shiftCount) + { + this.shiftCount = shiftCount; + } + + public Long getShiftCount() + { + return shiftCount; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "CalPlan{" + + "planId=" + planId + + ", planCode='" + planCode + '\'' + + ", planName='" + planName + '\'' + + ", calendarType='" + calendarType + '\'' + + ", startDate=" + startDate + + ", endDate=" + endDate + + ", shiftType='" + shiftType + '\'' + + ", shiftMethod='" + shiftMethod + '\'' + + ", shiftCount=" + shiftCount + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalPlanTeam.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalPlanTeam.java new file mode 100644 index 0000000..af61b13 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalPlanTeam.java @@ -0,0 +1,150 @@ +package com.ktg.mes.cal.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 计划班组对象 cal_plan_team + * + * @author yinjinlu + * @date 2022-06-07 + */ +public class CalPlanTeam extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水号 */ + private Long recordId; + + /** 计划ID */ + @Excel(name = "计划ID") + private Long planId; + + /** 班组ID */ + @Excel(name = "班组ID") + private Long teamId; + + /** 班组编号 */ + @Excel(name = "班组编号") + private String teamCode; + + /** 班组名称 */ + @Excel(name = "班组名称") + private String teamName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setTeamId(Long teamId) + { + this.teamId = teamId; + } + + public Long getTeamId() + { + return teamId; + } + public void setTeamCode(String teamCode) + { + this.teamCode = teamCode; + } + + public String getTeamCode() + { + return teamCode; + } + public void setTeamName(String teamName) + { + this.teamName = teamName; + } + + public String getTeamName() + { + return teamName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("planId", getPlanId()) + .append("teamId", getTeamId()) + .append("teamCode", getTeamCode()) + .append("teamName", getTeamName()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalQueryType.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalQueryType.java new file mode 100644 index 0000000..0f8fa6c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalQueryType.java @@ -0,0 +1,6 @@ +package com.ktg.mes.cal.domain; + +public enum CalQueryType { + + BY_CALTYPE,BY_TEAM,BY_USER +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalShift.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalShift.java new file mode 100644 index 0000000..aa6e262 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalShift.java @@ -0,0 +1,167 @@ +package com.ktg.mes.cal.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 计划班次对象 cal_shift + * + * @author yinjinlu + * @date 2022-06-06 + */ +public class CalShift extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 班次ID */ + private Long shiftId; + + /** 计划ID */ + @Excel(name = "计划ID") + private Long planId; + + /** 序号 */ + @Excel(name = "序号") + private Integer orderNum; + + /** 班次名称 */ + @Excel(name = "班次名称") + private String shiftName; + + /** 开始时间 */ + @Excel(name = "开始时间") + private String startTime; + + /** 结束时间 */ + + @Excel(name = "结束时间") + private String endTime; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setShiftId(Long shiftId) + { + this.shiftId = shiftId; + } + + public Long getShiftId() + { + return shiftId; + } + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public Integer getOrderNum() + { + return orderNum; + } + public void setShiftName(String shiftName) + { + this.shiftName = shiftName; + } + + public String getShiftName() + { + return shiftName; + } + public void setStartTime(String startTime) + { + this.startTime = startTime; + } + + public String getStartTime() + { + return startTime; + } + public void setEndTime(String endTime) + { + this.endTime = endTime; + } + + public String getEndTime() + { + return endTime; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("shiftId", getShiftId()) + .append("planId", getPlanId()) + .append("orderNum", getOrderNum()) + .append("shiftName", getShiftName()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeam.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeam.java new file mode 100644 index 0000000..a5a10f4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeam.java @@ -0,0 +1,128 @@ +package com.ktg.mes.cal.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 班组对象 cal_team + * + * @author yinjinlu + * @date 2022-06-05 + */ +public class CalTeam extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 班组ID */ + private Long teamId; + + /** 班组编号 */ + @Excel(name = "班组编号") + private String teamCode; + + /** 班组名称 */ + @Excel(name = "班组名称") + private String teamName; + + private String calendarType; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTeamId(Long teamId) + { + this.teamId = teamId; + } + + public Long getTeamId() + { + return teamId; + } + public void setTeamCode(String teamCode) + { + this.teamCode = teamCode; + } + + public String getTeamCode() + { + return teamCode; + } + public void setTeamName(String teamName) + { + this.teamName = teamName; + } + + public String getTeamName() + { + return teamName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getCalendarType() { + return calendarType; + } + + public void setCalendarType(String calendarType) { + this.calendarType = calendarType; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "CalTeam{" + + "teamId=" + teamId + + ", teamCode='" + teamCode + '\'' + + ", teamName='" + teamName + '\'' + + ", calendarType='" + calendarType + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeamMember.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeamMember.java new file mode 100644 index 0000000..3fd1be9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeamMember.java @@ -0,0 +1,164 @@ +package com.ktg.mes.cal.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 班组成员对象 cal_team_member + * + * @author yinjinlu + * @date 2022-06-05 + */ +public class CalTeamMember extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 班组成员ID */ + private Long memberId; + + /** 班组ID */ + @Excel(name = "班组ID") + private Long teamId; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + /** 用户名 */ + @Excel(name = "用户名") + private String userName; + + /** 用户昵称 */ + @Excel(name = "用户昵称") + private String nickName; + + /** 电话 */ + @Excel(name = "电话") + private String tel; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setMemberId(Long memberId) + { + this.memberId = memberId; + } + + public Long getMemberId() + { + return memberId; + } + public void setTeamId(Long teamId) + { + this.teamId = teamId; + } + + public Long getTeamId() + { + return teamId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + public void setTel(String tel) + { + this.tel = tel; + } + + public String getTel() + { + return tel; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("memberId", getMemberId()) + .append("teamId", getTeamId()) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("tel", getTel()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeamshift.java b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeamshift.java new file mode 100644 index 0000000..03cb33b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/domain/CalTeamshift.java @@ -0,0 +1,213 @@ +package com.ktg.mes.cal.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 班组排班对象 cal_teamshift + * + * @author yinjinlu + * @date 2022-06-11 + */ +public class CalTeamshift extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水号 */ + private Long recordId; + + /** 日期 */ + private String theDay; + + /** 班组ID */ + @Excel(name = "班组ID") + private Long teamId; + + /** 班组名称 */ + @Excel(name = "班组名称") + private String teamName; + + /** 班次ID */ + @Excel(name = "班次ID") + private Long shiftId; + + /** 班次名称 */ + @Excel(name = "班次名称") + private String shiftName; + + /** 序号 */ + @Excel(name = "序号") + private Long orderNum; + + /** 计划ID */ + @Excel(name = "计划ID") + private Long planId; + + private String calendarType; + + /** 轮班方式 */ + @Excel(name = "轮班方式") + private String shiftType; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setTheDay(String theDay) + { + this.theDay = theDay; + } + + public String getTheDay() + { + return theDay; + } + public void setTeamId(Long teamId) + { + this.teamId = teamId; + } + + public Long getTeamId() + { + return teamId; + } + public void setTeamName(String teamName) + { + this.teamName = teamName; + } + + public String getTeamName() + { + return teamName; + } + public void setShiftId(Long shiftId) + { + this.shiftId = shiftId; + } + + public Long getShiftId() + { + return shiftId; + } + public void setShiftName(String shiftName) + { + this.shiftName = shiftName; + } + + public String getShiftName() + { + return shiftName; + } + public void setOrderNum(Long orderNum) + { + this.orderNum = orderNum; + } + + public Long getOrderNum() + { + return orderNum; + } + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setShiftType(String shiftType) + { + this.shiftType = shiftType; + } + + public String getCalendarType() { + return calendarType; + } + + public void setCalendarType(String calendarType) { + this.calendarType = calendarType; + } + + public String getShiftType() + { + return shiftType; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "CalTeamshift{" + + "recordId=" + recordId + + ", theDay=" + theDay + + ", teamId=" + teamId + + ", teamName='" + teamName + '\'' + + ", shiftId=" + shiftId + + ", shiftName='" + shiftName + '\'' + + ", orderNum=" + orderNum + + ", planId=" + planId + + ", calendarType='" + calendarType + '\'' + + ", shiftType='" + shiftType + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalHolidayMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalHolidayMapper.java new file mode 100644 index 0000000..84d4910 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalHolidayMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalHoliday; + +/** + * 节假日设置Mapper接口 + * + * @author yinjinlu + * @date 2022-06-08 + */ +public interface CalHolidayMapper +{ + /** + * 查询节假日设置 + * + * @param holidayId 节假日设置主键 + * @return 节假日设置 + */ + public CalHoliday selectCalHolidayByHolidayId(Long holidayId); + + /** + * 查询节假日设置列表 + * + * @param calHoliday 节假日设置 + * @return 节假日设置集合 + */ + public List selectCalHolidayList(CalHoliday calHoliday); + + /** + * 新增节假日设置 + * + * @param calHoliday 节假日设置 + * @return 结果 + */ + public int insertCalHoliday(CalHoliday calHoliday); + + /** + * 修改节假日设置 + * + * @param calHoliday 节假日设置 + * @return 结果 + */ + public int updateCalHoliday(CalHoliday calHoliday); + + /** + * 删除节假日设置 + * + * @param holidayId 节假日设置主键 + * @return 结果 + */ + public int deleteCalHolidayByHolidayId(Long holidayId); + + /** + * 批量删除节假日设置 + * + * @param holidayIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalHolidayByHolidayIds(Long[] holidayIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalPlanMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalPlanMapper.java new file mode 100644 index 0000000..958a266 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalPlanMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalPlan; + +/** + * 排班计划Mapper接口 + * + * @author yinjinlu + * @date 2022-06-06 + */ +public interface CalPlanMapper +{ + /** + * 查询排班计划 + * + * @param planId 排班计划主键 + * @return 排班计划 + */ + public CalPlan selectCalPlanByPlanId(Long planId); + + /** + * 查询排班计划列表 + * + * @param calPlan 排班计划 + * @return 排班计划集合 + */ + public List selectCalPlanList(CalPlan calPlan); + + + + + + /** + * 新增排班计划 + * + * @param calPlan 排班计划 + * @return 结果 + */ + public int insertCalPlan(CalPlan calPlan); + + /** + * 修改排班计划 + * + * @param calPlan 排班计划 + * @return 结果 + */ + public int updateCalPlan(CalPlan calPlan); + + /** + * 删除排班计划 + * + * @param planId 排班计划主键 + * @return 结果 + */ + public int deleteCalPlanByPlanId(Long planId); + + /** + * 批量删除排班计划 + * + * @param planIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalPlanByPlanIds(Long[] planIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalPlanTeamMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalPlanTeamMapper.java new file mode 100644 index 0000000..1020eaa --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalPlanTeamMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalPlanTeam; + +/** + * 计划班组Mapper接口 + * + * @author yinjinlu + * @date 2022-06-07 + */ +public interface CalPlanTeamMapper +{ + /** + * 查询计划班组 + * + * @param recordId 计划班组主键 + * @return 计划班组 + */ + public CalPlanTeam selectCalPlanTeamByRecordId(Long recordId); + + /** + * 查询计划班组列表 + * + * @param calPlanTeam 计划班组 + * @return 计划班组集合 + */ + public List selectCalPlanTeamList(CalPlanTeam calPlanTeam); + + public CalPlanTeam checkPlanTeamUnique(CalPlanTeam calPlanTeam); + + /** + * 新增计划班组 + * + * @param calPlanTeam 计划班组 + * @return 结果 + */ + public int insertCalPlanTeam(CalPlanTeam calPlanTeam); + + /** + * 修改计划班组 + * + * @param calPlanTeam 计划班组 + * @return 结果 + */ + public int updateCalPlanTeam(CalPlanTeam calPlanTeam); + + /** + * 删除计划班组 + * + * @param recordId 计划班组主键 + * @return 结果 + */ + public int deleteCalPlanTeamByRecordId(Long recordId); + + /** + * 批量删除计划班组 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalPlanTeamByRecordIds(Long[] recordIds); + + public int deleteByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalShiftMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalShiftMapper.java new file mode 100644 index 0000000..c965988 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalShiftMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalShift; + +/** + * 计划班次Mapper接口 + * + * @author yinjinlu + * @date 2022-06-06 + */ +public interface CalShiftMapper +{ + /** + * 查询计划班次 + * + * @param shiftId 计划班次主键 + * @return 计划班次 + */ + public CalShift selectCalShiftByShiftId(Long shiftId); + + /** + * 查询计划班次列表 + * + * @param calShift 计划班次 + * @return 计划班次集合 + */ + public List selectCalShiftList(CalShift calShift); + + + + + public int checkShiftCount(Long planId); + + /** + * 新增计划班次 + * + * @param calShift 计划班次 + * @return 结果 + */ + public int insertCalShift(CalShift calShift); + + /** + * 修改计划班次 + * + * @param calShift 计划班次 + * @return 结果 + */ + public int updateCalShift(CalShift calShift); + + /** + * 删除计划班次 + * + * @param shiftId 计划班次主键 + * @return 结果 + */ + public int deleteCalShiftByShiftId(Long shiftId); + + /** + * 批量删除计划班次 + * + * @param shiftIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalShiftByShiftIds(Long[] shiftIds); + + public int deleteByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamMapper.java new file mode 100644 index 0000000..61463b3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalTeam; + +/** + * 班组Mapper接口 + * + * @author yinjinlu + * @date 2022-06-05 + */ +public interface CalTeamMapper +{ + /** + * 查询班组 + * + * @param teamId 班组主键 + * @return 班组 + */ + public CalTeam selectCalTeamByTeamId(Long teamId); + + /** + * 查询班组列表 + * + * @param calTeam 班组 + * @return 班组集合 + */ + public List selectCalTeamList(CalTeam calTeam); + + /** + * 新增班组 + * + * @param calTeam 班组 + * @return 结果 + */ + public int insertCalTeam(CalTeam calTeam); + + /** + * 修改班组 + * + * @param calTeam 班组 + * @return 结果 + */ + public int updateCalTeam(CalTeam calTeam); + + /** + * 删除班组 + * + * @param teamId 班组主键 + * @return 结果 + */ + public int deleteCalTeamByTeamId(Long teamId); + + /** + * 批量删除班组 + * + * @param teamIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalTeamByTeamIds(Long[] teamIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamMemberMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamMemberMapper.java new file mode 100644 index 0000000..c5c43e6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamMemberMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalTeamMember; + +/** + * 班组成员Mapper接口 + * + * @author yinjinlu + * @date 2022-06-05 + */ +public interface CalTeamMemberMapper +{ + /** + * 查询班组成员 + * + * @param memberId 班组成员主键 + * @return 班组成员 + */ + public CalTeamMember selectCalTeamMemberByMemberId(Long memberId); + + /** + * 查询班组成员列表 + * + * @param calTeamMember 班组成员 + * @return 班组成员集合 + */ + public List selectCalTeamMemberList(CalTeamMember calTeamMember); + + public CalTeamMember checkUserUnique(CalTeamMember calTeamMember); + + /** + * 新增班组成员 + * + * @param calTeamMember 班组成员 + * @return 结果 + */ + public int insertCalTeamMember(CalTeamMember calTeamMember); + + /** + * 修改班组成员 + * + * @param calTeamMember 班组成员 + * @return 结果 + */ + public int updateCalTeamMember(CalTeamMember calTeamMember); + + /** + * 删除班组成员 + * + * @param memberId 班组成员主键 + * @return 结果 + */ + public int deleteCalTeamMemberByMemberId(Long memberId); + + public int deleteByTeamId(Long teamId); + + /** + * 批量删除班组成员 + * + * @param memberIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalTeamMemberByMemberIds(Long[] memberIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamshiftMapper.java b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamshiftMapper.java new file mode 100644 index 0000000..7250a84 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/mapper/CalTeamshiftMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.cal.mapper; + +import java.util.List; +import com.ktg.mes.cal.domain.CalTeamshift; + +/** + * 班组排班Mapper接口 + * + * @author yinjinlu + * @date 2022-06-11 + */ +public interface CalTeamshiftMapper +{ + /** + * 查询班组排班 + * + * @param recordId 班组排班主键 + * @return 班组排班 + */ + public CalTeamshift selectCalTeamshiftByRecordId(Long recordId); + + /** + * 查询班组排班列表 + * + * @param calTeamshift 班组排班 + * @return 班组排班集合 + */ + public List selectCalTeamshiftList(CalTeamshift calTeamshift); + + + + /** + * 新增班组排班 + * + * @param calTeamshift 班组排班 + * @return 结果 + */ + public int insertCalTeamshift(CalTeamshift calTeamshift); + + /** + * 修改班组排班 + * + * @param calTeamshift 班组排班 + * @return 结果 + */ + public int updateCalTeamshift(CalTeamshift calTeamshift); + + /** + * 删除班组排班 + * + * @param recordId 班组排班主键 + * @return 结果 + */ + public int deleteCalTeamshiftByRecordId(Long recordId); + + /** + * 批量删除班组排班 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalTeamshiftByRecordIds(Long[] recordIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalCalendarService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalCalendarService.java new file mode 100644 index 0000000..1439669 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalCalendarService.java @@ -0,0 +1,33 @@ +package com.ktg.mes.cal.service; + +import com.ktg.mes.cal.domain.CalCalendar; + +import java.util.Date; +import java.util.List; + +public interface ICalCalendarService { + + /** + * 查询某个班组类型在某月的排班日历 + * @param day + * @param calenderType + * @return + */ + List getCalendarByType(Date day, String calenderType); + + /** + * 查询某个班组在某个月的排班日历 + * @param day + * @param teamId + * @return + */ + List getCalendarByTeam(Date day,Long teamId); + + /** + * 查询某个人在某月的排班日历 + * @param day + * @param userId + * @return + */ + List getCalendarByUser(Date day,Long userId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalHolidayService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalHolidayService.java new file mode 100644 index 0000000..e82cbe2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalHolidayService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalHoliday; + +/** + * 节假日设置Service接口 + * + * @author yinjinlu + * @date 2022-06-08 + */ +public interface ICalHolidayService +{ + /** + * 查询节假日设置 + * + * @param holidayId 节假日设置主键 + * @return 节假日设置 + */ + public CalHoliday selectCalHolidayByHolidayId(Long holidayId); + + /** + * 查询节假日设置列表 + * + * @param calHoliday 节假日设置 + * @return 节假日设置集合 + */ + public List selectCalHolidayList(CalHoliday calHoliday); + + /** + * 新增节假日设置 + * + * @param calHoliday 节假日设置 + * @return 结果 + */ + public int insertCalHoliday(CalHoliday calHoliday); + + /** + * 修改节假日设置 + * + * @param calHoliday 节假日设置 + * @return 结果 + */ + public int updateCalHoliday(CalHoliday calHoliday); + + /** + * 批量删除节假日设置 + * + * @param holidayIds 需要删除的节假日设置主键集合 + * @return 结果 + */ + public int deleteCalHolidayByHolidayIds(Long[] holidayIds); + + /** + * 删除节假日设置信息 + * + * @param holidayId 节假日设置主键 + * @return 结果 + */ + public int deleteCalHolidayByHolidayId(Long holidayId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalPlanService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalPlanService.java new file mode 100644 index 0000000..11539f6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalPlanService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalPlan; + +/** + * 排班计划Service接口 + * + * @author yinjinlu + * @date 2022-06-06 + */ +public interface ICalPlanService +{ + /** + * 查询排班计划 + * + * @param planId 排班计划主键 + * @return 排班计划 + */ + public CalPlan selectCalPlanByPlanId(Long planId); + + /** + * 查询排班计划列表 + * + * @param calPlan 排班计划 + * @return 排班计划集合 + */ + public List selectCalPlanList(CalPlan calPlan); + + /** + * 新增排班计划 + * + * @param calPlan 排班计划 + * @return 结果 + */ + public int insertCalPlan(CalPlan calPlan); + + /** + * 修改排班计划 + * + * @param calPlan 排班计划 + * @return 结果 + */ + public int updateCalPlan(CalPlan calPlan); + + /** + * 批量删除排班计划 + * + * @param planIds 需要删除的排班计划主键集合 + * @return 结果 + */ + public int deleteCalPlanByPlanIds(Long[] planIds); + + /** + * 删除排班计划信息 + * + * @param planId 排班计划主键 + * @return 结果 + */ + public int deleteCalPlanByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalPlanTeamService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalPlanTeamService.java new file mode 100644 index 0000000..98dcab0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalPlanTeamService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalPlanTeam; + +/** + * 计划班组Service接口 + * + * @author yinjinlu + * @date 2022-06-07 + */ +public interface ICalPlanTeamService +{ + /** + * 查询计划班组 + * + * @param recordId 计划班组主键 + * @return 计划班组 + */ + public CalPlanTeam selectCalPlanTeamByRecordId(Long recordId); + + /** + * 查询计划班组列表 + * + * @param calPlanTeam 计划班组 + * @return 计划班组集合 + */ + public List selectCalPlanTeamList(CalPlanTeam calPlanTeam); + + public List selectCalPlanTeamListByPlanId(Long plandId); + + + public String checkPlanTeamUnique(CalPlanTeam calPlanTeam); + + /** + * 新增计划班组 + * + * @param calPlanTeam 计划班组 + * @return 结果 + */ + public int insertCalPlanTeam(CalPlanTeam calPlanTeam); + + /** + * 修改计划班组 + * + * @param calPlanTeam 计划班组 + * @return 结果 + */ + public int updateCalPlanTeam(CalPlanTeam calPlanTeam); + + /** + * 批量删除计划班组 + * + * @param recordIds 需要删除的计划班组主键集合 + * @return 结果 + */ + public int deleteCalPlanTeamByRecordIds(Long[] recordIds); + + /** + * 删除计划班组信息 + * + * @param recordId 计划班组主键 + * @return 结果 + */ + public int deleteCalPlanTeamByRecordId(Long recordId); + + public int deleteByPlanId(Long plandId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalShiftService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalShiftService.java new file mode 100644 index 0000000..d8954d1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalShiftService.java @@ -0,0 +1,77 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalShift; + +/** + * 计划班次Service接口 + * + * @author yinjinlu + * @date 2022-06-06 + */ +public interface ICalShiftService +{ + /** + * 查询计划班次 + * + * @param shiftId 计划班次主键 + * @return 计划班次 + */ + public CalShift selectCalShiftByShiftId(Long shiftId); + + /** + * 查询计划班次列表 + * + * @param calShift 计划班次 + * @return 计划班次集合 + */ + public List selectCalShiftList(CalShift calShift); + + /** + * 根据计划ID查询班次 + * @param planId + * @return + */ + public List selectCalShiftListByPlanId(Long planId); + + + public int checkShiftCount(Long planId); + + + public void addDefaultShift(Long plandId,String shiftType); + + /** + * 新增计划班次 + * + * @param calShift 计划班次 + * @return 结果 + */ + public int insertCalShift(CalShift calShift); + + /** + * 修改计划班次 + * + * @param calShift 计划班次 + * @return 结果 + */ + public int updateCalShift(CalShift calShift); + + /** + * 批量删除计划班次 + * + * @param shiftIds 需要删除的计划班次主键集合 + * @return 结果 + */ + public int deleteCalShiftByShiftIds(Long[] shiftIds); + + /** + * 删除计划班次信息 + * + * @param shiftId 计划班次主键 + * @return 结果 + */ + public int deleteCalShiftByShiftId(Long shiftId); + + public int deleteByPlanId(Long planId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamMemberService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamMemberService.java new file mode 100644 index 0000000..4abc3e6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamMemberService.java @@ -0,0 +1,66 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalTeamMember; + +/** + * 班组成员Service接口 + * + * @author yinjinlu + * @date 2022-06-05 + */ +public interface ICalTeamMemberService +{ + /** + * 查询班组成员 + * + * @param memberId 班组成员主键 + * @return 班组成员 + */ + public CalTeamMember selectCalTeamMemberByMemberId(Long memberId); + + /** + * 查询班组成员列表 + * + * @param calTeamMember 班组成员 + * @return 班组成员集合 + */ + public List selectCalTeamMemberList(CalTeamMember calTeamMember); + + + public String checkUserUnique(CalTeamMember calTeamMember); + + /** + * 新增班组成员 + * + * @param calTeamMember 班组成员 + * @return 结果 + */ + public int insertCalTeamMember(CalTeamMember calTeamMember); + + /** + * 修改班组成员 + * + * @param calTeamMember 班组成员 + * @return 结果 + */ + public int updateCalTeamMember(CalTeamMember calTeamMember); + + /** + * 批量删除班组成员 + * + * @param memberIds 需要删除的班组成员主键集合 + * @return 结果 + */ + public int deleteCalTeamMemberByMemberIds(Long[] memberIds); + + public int deleteByTeamId(Long teamId); + + /** + * 删除班组成员信息 + * + * @param memberId 班组成员主键 + * @return 结果 + */ + public int deleteCalTeamMemberByMemberId(Long memberId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamService.java new file mode 100644 index 0000000..82d2ca3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalTeam; + +/** + * 班组Service接口 + * + * @author yinjinlu + * @date 2022-06-05 + */ +public interface ICalTeamService +{ + /** + * 查询班组 + * + * @param teamId 班组主键 + * @return 班组 + */ + public CalTeam selectCalTeamByTeamId(Long teamId); + + /** + * 查询班组列表 + * + * @param calTeam 班组 + * @return 班组集合 + */ + public List selectCalTeamList(CalTeam calTeam); + + /** + * 新增班组 + * + * @param calTeam 班组 + * @return 结果 + */ + public int insertCalTeam(CalTeam calTeam); + + /** + * 修改班组 + * + * @param calTeam 班组 + * @return 结果 + */ + public int updateCalTeam(CalTeam calTeam); + + /** + * 批量删除班组 + * + * @param teamIds 需要删除的班组主键集合 + * @return 结果 + */ + public int deleteCalTeamByTeamIds(Long[] teamIds); + + /** + * 删除班组信息 + * + * @param teamId 班组主键 + * @return 结果 + */ + public int deleteCalTeamByTeamId(Long teamId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamshiftService.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamshiftService.java new file mode 100644 index 0000000..25a2a96 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/ICalTeamshiftService.java @@ -0,0 +1,66 @@ +package com.ktg.mes.cal.service; + +import java.util.List; +import com.ktg.mes.cal.domain.CalTeamshift; + +/** + * 班组排班Service接口 + * + * @author yinjinlu + * @date 2022-06-11 + */ +public interface ICalTeamshiftService +{ + /** + * 查询班组排班 + * + * @param recordId 班组排班主键 + * @return 班组排班 + */ + public CalTeamshift selectCalTeamshiftByRecordId(Long recordId); + + /** + * 查询班组排班列表 + * + * @param calTeamshift 班组排班 + * @return 班组排班集合 + */ + public List selectCalTeamshiftList(CalTeamshift calTeamshift); + + /** + * 新增班组排班 + * + * @param calTeamshift 班组排班 + * @return 结果 + */ + public int insertCalTeamshift(CalTeamshift calTeamshift); + + /** + * 修改班组排班 + * + * @param calTeamshift 班组排班 + * @return 结果 + */ + public int updateCalTeamshift(CalTeamshift calTeamshift); + + /** + * 批量删除班组排班 + * + * @param recordIds 需要删除的班组排班主键集合 + * @return 结果 + */ + public int deleteCalTeamshiftByRecordIds(Long[] recordIds); + + /** + * 删除班组排班信息 + * + * @param recordId 班组排班主键 + * @return 结果 + */ + public int deleteCalTeamshiftByRecordId(Long recordId); + + + public void genRecords(Long plandId); + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalCalendarServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalCalendarServiceImpl.java new file mode 100644 index 0000000..9c57fab --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalCalendarServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.cal.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.mes.cal.domain.CalCalendar; +import com.ktg.mes.cal.domain.CalHoliday; +import com.ktg.mes.cal.domain.CalTeamMember; +import com.ktg.mes.cal.domain.CalTeamshift; +import com.ktg.mes.cal.mapper.CalPlanMapper; +import com.ktg.mes.cal.mapper.CalTeamMemberMapper; +import com.ktg.mes.cal.mapper.CalTeamshiftMapper; +import com.ktg.mes.cal.service.ICalCalendarService; +import com.ktg.mes.cal.service.ICalHolidayService; +import com.ktg.mes.cal.service.ICalTeamMemberService; +import com.ktg.mes.cal.utils.CalendarUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class CalCalendarServiceImpl implements ICalCalendarService { + + @Autowired + private CalPlanMapper calPlanMapper; + + @Autowired + private CalTeamshiftMapper calTeamshiftMapper; + + @Autowired + private CalTeamMemberMapper calTeamMemberMapper; + + + + + /** + * 1.循环生成当前月份每一天的CalCalendar + * 2.根据月份和班组类型查询合适的plan + * 3.根据plan上的Shift_type和shift_method计算每个班组的班次 + * 4.设置CalShiftTeamBean + * @param day + * @param calenderType + * @return + */ + @Override + public List getCalendarByType(Date day, String calenderType) { + List calendars = null; + calendars = CalendarUtil.getDays(day); + for (CalCalendar cal:calendars + ) { + CalTeamshift param2 = new CalTeamshift(); + param2.setTheDay(cal.getTheDay()); + param2.setCalendarType(calenderType); + List teamshifts = calTeamshiftMapper.selectCalTeamshiftList(param2); + cal.setTeamShifts(teamshifts); + if(CollUtil.isNotEmpty(teamshifts)){ + cal.setShiftType(teamshifts.get(0).getShiftType()); + } + } + return calendars; + } + + @Override + public List getCalendarByTeam(Date day, Long teamId) { + List calendars = null; + calendars = CalendarUtil.getDays(day); + for (CalCalendar cal:calendars + ) { + CalTeamshift param2 = new CalTeamshift(); + param2.setTheDay(cal.getTheDay()); + param2.setTeamId(teamId); + List teamshifts = calTeamshiftMapper.selectCalTeamshiftList(param2); + cal.setTeamShifts(teamshifts); + if(CollUtil.isNotEmpty(teamshifts)){ + cal.setShiftType(teamshifts.get(0).getShiftType()); + } + } + return calendars; + } + + @Override + public List getCalendarByUser(Date day, Long userId) { + List calendars = null; + + CalTeamMember param = new CalTeamMember(); + param.setUserId(userId); + List members = calTeamMemberMapper.selectCalTeamMemberList(param); + if(CollUtil.isNotEmpty(members)){ + Long teamId = members.get(0).getTeamId(); + calendars = CalendarUtil.getDays(day); + for (CalCalendar cal:calendars + ) { + CalTeamshift param2 = new CalTeamshift(); + param2.setTheDay(cal.getTheDay()); + param2.setTeamId(teamId); + List teamshifts = calTeamshiftMapper.selectCalTeamshiftList(param2); + cal.setTeamShifts(teamshifts); + if(CollUtil.isNotEmpty(teamshifts)){ + cal.setShiftType(teamshifts.get(0).getShiftType()); + } + } + } + + return calendars; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalHolidayServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalHolidayServiceImpl.java new file mode 100644 index 0000000..27399cb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalHolidayServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalHolidayMapper; +import com.ktg.mes.cal.domain.CalHoliday; +import com.ktg.mes.cal.service.ICalHolidayService; + +/** + * 节假日设置Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-08 + */ +@Service +public class CalHolidayServiceImpl implements ICalHolidayService +{ + @Autowired + private CalHolidayMapper calHolidayMapper; + + /** + * 查询节假日设置 + * + * @param holidayId 节假日设置主键 + * @return 节假日设置 + */ + @Override + public CalHoliday selectCalHolidayByHolidayId(Long holidayId) + { + return calHolidayMapper.selectCalHolidayByHolidayId(holidayId); + } + + /** + * 查询节假日设置列表 + * + * @param calHoliday 节假日设置 + * @return 节假日设置 + */ + @Override + public List selectCalHolidayList(CalHoliday calHoliday) + { + return calHolidayMapper.selectCalHolidayList(calHoliday); + } + + /** + * 新增节假日设置 + * + * @param calHoliday 节假日设置 + * @return 结果 + */ + @Override + public int insertCalHoliday(CalHoliday calHoliday) + { + calHoliday.setCreateTime(DateUtils.getNowDate()); + return calHolidayMapper.insertCalHoliday(calHoliday); + } + + /** + * 修改节假日设置 + * + * @param calHoliday 节假日设置 + * @return 结果 + */ + @Override + public int updateCalHoliday(CalHoliday calHoliday) + { + calHoliday.setUpdateTime(DateUtils.getNowDate()); + return calHolidayMapper.updateCalHoliday(calHoliday); + } + + /** + * 批量删除节假日设置 + * + * @param holidayIds 需要删除的节假日设置主键 + * @return 结果 + */ + @Override + public int deleteCalHolidayByHolidayIds(Long[] holidayIds) + { + return calHolidayMapper.deleteCalHolidayByHolidayIds(holidayIds); + } + + /** + * 删除节假日设置信息 + * + * @param holidayId 节假日设置主键 + * @return 结果 + */ + @Override + public int deleteCalHolidayByHolidayId(Long holidayId) + { + return calHolidayMapper.deleteCalHolidayByHolidayId(holidayId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalPlanServiceImpl.java new file mode 100644 index 0000000..947ec4d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalPlanServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalPlanMapper; +import com.ktg.mes.cal.domain.CalPlan; +import com.ktg.mes.cal.service.ICalPlanService; + +/** + * 排班计划Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-06 + */ +@Service +public class CalPlanServiceImpl implements ICalPlanService +{ + @Autowired + private CalPlanMapper calPlanMapper; + + /** + * 查询排班计划 + * + * @param planId 排班计划主键 + * @return 排班计划 + */ + @Override + public CalPlan selectCalPlanByPlanId(Long planId) + { + return calPlanMapper.selectCalPlanByPlanId(planId); + } + + /** + * 查询排班计划列表 + * + * @param calPlan 排班计划 + * @return 排班计划 + */ + @Override + public List selectCalPlanList(CalPlan calPlan) + { + return calPlanMapper.selectCalPlanList(calPlan); + } + + /** + * 新增排班计划 + * + * @param calPlan 排班计划 + * @return 结果 + */ + @Override + public int insertCalPlan(CalPlan calPlan) + { + calPlan.setCreateTime(DateUtils.getNowDate()); + return calPlanMapper.insertCalPlan(calPlan); + } + + /** + * 修改排班计划 + * + * @param calPlan 排班计划 + * @return 结果 + */ + @Override + public int updateCalPlan(CalPlan calPlan) + { + calPlan.setUpdateTime(DateUtils.getNowDate()); + return calPlanMapper.updateCalPlan(calPlan); + } + + /** + * 批量删除排班计划 + * + * @param planIds 需要删除的排班计划主键 + * @return 结果 + */ + @Override + public int deleteCalPlanByPlanIds(Long[] planIds) + { + return calPlanMapper.deleteCalPlanByPlanIds(planIds); + } + + /** + * 删除排班计划信息 + * + * @param planId 排班计划主键 + * @return 结果 + */ + @Override + public int deleteCalPlanByPlanId(Long planId) + { + return calPlanMapper.deleteCalPlanByPlanId(planId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalPlanTeamServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalPlanTeamServiceImpl.java new file mode 100644 index 0000000..636433b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalPlanTeamServiceImpl.java @@ -0,0 +1,121 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalPlanTeamMapper; +import com.ktg.mes.cal.domain.CalPlanTeam; +import com.ktg.mes.cal.service.ICalPlanTeamService; + +/** + * 计划班组Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-07 + */ +@Service +public class CalPlanTeamServiceImpl implements ICalPlanTeamService +{ + @Autowired + private CalPlanTeamMapper calPlanTeamMapper; + + /** + * 查询计划班组 + * + * @param recordId 计划班组主键 + * @return 计划班组 + */ + @Override + public CalPlanTeam selectCalPlanTeamByRecordId(Long recordId) + { + return calPlanTeamMapper.selectCalPlanTeamByRecordId(recordId); + } + + /** + * 查询计划班组列表 + * + * @param calPlanTeam 计划班组 + * @return 计划班组 + */ + @Override + public List selectCalPlanTeamList(CalPlanTeam calPlanTeam) + { + return calPlanTeamMapper.selectCalPlanTeamList(calPlanTeam); + } + + @Override + public List selectCalPlanTeamListByPlanId(Long plandId) { + CalPlanTeam param = new CalPlanTeam(); + param.setPlanId(plandId); + return calPlanTeamMapper.selectCalPlanTeamList(param); + } + + @Override + public String checkPlanTeamUnique(CalPlanTeam calPlanTeam) { + CalPlanTeam team = calPlanTeamMapper.checkPlanTeamUnique(calPlanTeam); + Long recodeId = calPlanTeam.getRecordId()==null?-1L:calPlanTeam.getRecordId(); + if(StringUtils.isNotNull(team) && team.getRecordId().longValue() != recodeId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增计划班组 + * + * @param calPlanTeam 计划班组 + * @return 结果 + */ + @Override + public int insertCalPlanTeam(CalPlanTeam calPlanTeam) + { + calPlanTeam.setCreateTime(DateUtils.getNowDate()); + return calPlanTeamMapper.insertCalPlanTeam(calPlanTeam); + } + + /** + * 修改计划班组 + * + * @param calPlanTeam 计划班组 + * @return 结果 + */ + @Override + public int updateCalPlanTeam(CalPlanTeam calPlanTeam) + { + calPlanTeam.setUpdateTime(DateUtils.getNowDate()); + return calPlanTeamMapper.updateCalPlanTeam(calPlanTeam); + } + + /** + * 批量删除计划班组 + * + * @param recordIds 需要删除的计划班组主键 + * @return 结果 + */ + @Override + public int deleteCalPlanTeamByRecordIds(Long[] recordIds) + { + return calPlanTeamMapper.deleteCalPlanTeamByRecordIds(recordIds); + } + + /** + * 删除计划班组信息 + * + * @param recordId 计划班组主键 + * @return 结果 + */ + @Override + public int deleteCalPlanTeamByRecordId(Long recordId) + { + return calPlanTeamMapper.deleteCalPlanTeamByRecordId(recordId); + } + + @Override + public int deleteByPlanId(Long plandId) { + return calPlanTeamMapper.deleteByPlanId(plandId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalShiftServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalShiftServiceImpl.java new file mode 100644 index 0000000..fea9ab5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalShiftServiceImpl.java @@ -0,0 +1,165 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalShiftMapper; +import com.ktg.mes.cal.domain.CalShift; +import com.ktg.mes.cal.service.ICalShiftService; + +/** + * 计划班次Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-06 + */ +@Service +public class CalShiftServiceImpl implements ICalShiftService +{ + @Autowired + private CalShiftMapper calShiftMapper; + + /** + * 查询计划班次 + * + * @param shiftId 计划班次主键 + * @return 计划班次 + */ + @Override + public CalShift selectCalShiftByShiftId(Long shiftId) + { + return calShiftMapper.selectCalShiftByShiftId(shiftId); + } + + /** + * 查询计划班次列表 + * + * @param calShift 计划班次 + * @return 计划班次 + */ + @Override + public List selectCalShiftList(CalShift calShift) + { + return calShiftMapper.selectCalShiftList(calShift); + } + + @Override + public List selectCalShiftListByPlanId(Long planId) { + CalShift param = new CalShift(); + param.setPlanId(planId); + return calShiftMapper.selectCalShiftList(param); + } + + @Override + public int checkShiftCount(Long planId) { + return calShiftMapper.checkShiftCount(planId); + } + + @Override + public void addDefaultShift(Long plandId,String shiftType) { + if(UserConstants.CAL_SHIFT_TYPE_SINGLE.equals(shiftType)){ + CalShift shift = new CalShift(); + shift.setPlanId(plandId); + shift.setShiftName(UserConstants.CAL_SHIFT_NAME_DAY); + shift.setOrderNum(1); + shift.setStartTime("8:00"); + shift.setEndTime("18:00"); + calShiftMapper.insertCalShift(shift); + }else if(UserConstants.CAL_SHIFT_TYPE_TWO.equals(shiftType)){ + CalShift shiftDay = new CalShift(); + shiftDay.setPlanId(plandId); + shiftDay.setShiftName(UserConstants.CAL_SHIFT_NAME_DAY); + shiftDay.setOrderNum(1); + shiftDay.setStartTime("8:00"); + shiftDay.setEndTime("20:00"); + CalShift shiftNight = new CalShift(); + shiftNight.setPlanId(plandId); + shiftNight.setShiftName(UserConstants.CAL_SHIFT_NAME_NIGHT); + shiftNight.setOrderNum(2); + shiftNight.setStartTime("20:00"); + shiftNight.setEndTime("8:00"); + calShiftMapper.insertCalShift(shiftDay); + calShiftMapper.insertCalShift(shiftNight); + }else { + CalShift shiftDay = new CalShift(); + shiftDay.setPlanId(plandId); + shiftDay.setShiftName(UserConstants.CAL_SHIFT_NAME_DAY); + shiftDay.setOrderNum(1); + shiftDay.setStartTime("8:00"); + shiftDay.setEndTime("16:00"); + CalShift shiftMid = new CalShift(); + shiftMid.setPlanId(plandId); + shiftMid.setShiftName(UserConstants.CAL_SHIFT_NAME_MID); + shiftMid.setOrderNum(2); + shiftMid.setStartTime("16:00"); + shiftMid.setEndTime("24:00"); + CalShift shiftNight = new CalShift(); + shiftNight.setPlanId(plandId); + shiftNight.setShiftName(UserConstants.CAL_SHIFT_NAME_NIGHT); + shiftNight.setOrderNum(3); + shiftNight.setStartTime("00:00"); + shiftNight.setEndTime("8:00"); + calShiftMapper.insertCalShift(shiftDay); + calShiftMapper.insertCalShift(shiftMid); + calShiftMapper.insertCalShift(shiftNight); + } + } + + /** + * 新增计划班次 + * + * @param calShift 计划班次 + * @return 结果 + */ + @Override + public int insertCalShift(CalShift calShift) + { + calShift.setCreateTime(DateUtils.getNowDate()); + return calShiftMapper.insertCalShift(calShift); + } + + /** + * 修改计划班次 + * + * @param calShift 计划班次 + * @return 结果 + */ + @Override + public int updateCalShift(CalShift calShift) + { + calShift.setUpdateTime(DateUtils.getNowDate()); + return calShiftMapper.updateCalShift(calShift); + } + + /** + * 批量删除计划班次 + * + * @param shiftIds 需要删除的计划班次主键 + * @return 结果 + */ + @Override + public int deleteCalShiftByShiftIds(Long[] shiftIds) + { + return calShiftMapper.deleteCalShiftByShiftIds(shiftIds); + } + + /** + * 删除计划班次信息 + * + * @param shiftId 计划班次主键 + * @return 结果 + */ + @Override + public int deleteCalShiftByShiftId(Long shiftId) + { + return calShiftMapper.deleteCalShiftByShiftId(shiftId); + } + + @Override + public int deleteByPlanId(Long planId) { + return calShiftMapper.deleteByPlanId(planId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamMemberServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamMemberServiceImpl.java new file mode 100644 index 0000000..493fd37 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamMemberServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalTeamMemberMapper; +import com.ktg.mes.cal.domain.CalTeamMember; +import com.ktg.mes.cal.service.ICalTeamMemberService; + +/** + * 班组成员Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-05 + */ +@Service +public class CalTeamMemberServiceImpl implements ICalTeamMemberService +{ + @Autowired + private CalTeamMemberMapper calTeamMemberMapper; + + /** + * 查询班组成员 + * + * @param memberId 班组成员主键 + * @return 班组成员 + */ + @Override + public CalTeamMember selectCalTeamMemberByMemberId(Long memberId) + { + return calTeamMemberMapper.selectCalTeamMemberByMemberId(memberId); + } + + /** + * 查询班组成员列表 + * + * @param calTeamMember 班组成员 + * @return 班组成员 + */ + @Override + public List selectCalTeamMemberList(CalTeamMember calTeamMember) + { + return calTeamMemberMapper.selectCalTeamMemberList(calTeamMember); + } + + @Override + public String checkUserUnique(CalTeamMember calTeamMember) { + CalTeamMember member = calTeamMemberMapper.checkUserUnique(calTeamMember); + Long memberId = calTeamMember.getMemberId()==null?-1L:calTeamMember.getMemberId(); + if(StringUtils.isNotNull(member) && memberId !=member.getMemberId()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增班组成员 + * + * @param calTeamMember 班组成员 + * @return 结果 + */ + @Override + public int insertCalTeamMember(CalTeamMember calTeamMember) + { + calTeamMember.setCreateTime(DateUtils.getNowDate()); + return calTeamMemberMapper.insertCalTeamMember(calTeamMember); + } + + /** + * 修改班组成员 + * + * @param calTeamMember 班组成员 + * @return 结果 + */ + @Override + public int updateCalTeamMember(CalTeamMember calTeamMember) + { + calTeamMember.setUpdateTime(DateUtils.getNowDate()); + return calTeamMemberMapper.updateCalTeamMember(calTeamMember); + } + + /** + * 批量删除班组成员 + * + * @param memberIds 需要删除的班组成员主键 + * @return 结果 + */ + @Override + public int deleteCalTeamMemberByMemberIds(Long[] memberIds) + { + return calTeamMemberMapper.deleteCalTeamMemberByMemberIds(memberIds); + } + + @Override + public int deleteByTeamId(Long teamId) { + return calTeamMemberMapper.deleteByTeamId(teamId); + } + + /** + * 删除班组成员信息 + * + * @param memberId 班组成员主键 + * @return 结果 + */ + @Override + public int deleteCalTeamMemberByMemberId(Long memberId) + { + return calTeamMemberMapper.deleteCalTeamMemberByMemberId(memberId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamServiceImpl.java new file mode 100644 index 0000000..bae266e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalTeamMapper; +import com.ktg.mes.cal.domain.CalTeam; +import com.ktg.mes.cal.service.ICalTeamService; + +/** + * 班组Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-05 + */ +@Service +public class CalTeamServiceImpl implements ICalTeamService +{ + @Autowired + private CalTeamMapper calTeamMapper; + + /** + * 查询班组 + * + * @param teamId 班组主键 + * @return 班组 + */ + @Override + public CalTeam selectCalTeamByTeamId(Long teamId) + { + return calTeamMapper.selectCalTeamByTeamId(teamId); + } + + /** + * 查询班组列表 + * + * @param calTeam 班组 + * @return 班组 + */ + @Override + public List selectCalTeamList(CalTeam calTeam) + { + return calTeamMapper.selectCalTeamList(calTeam); + } + + /** + * 新增班组 + * + * @param calTeam 班组 + * @return 结果 + */ + @Override + public int insertCalTeam(CalTeam calTeam) + { + calTeam.setCreateTime(DateUtils.getNowDate()); + return calTeamMapper.insertCalTeam(calTeam); + } + + /** + * 修改班组 + * + * @param calTeam 班组 + * @return 结果 + */ + @Override + public int updateCalTeam(CalTeam calTeam) + { + calTeam.setUpdateTime(DateUtils.getNowDate()); + return calTeamMapper.updateCalTeam(calTeam); + } + + /** + * 批量删除班组 + * + * @param teamIds 需要删除的班组主键 + * @return 结果 + */ + @Override + public int deleteCalTeamByTeamIds(Long[] teamIds) + { + return calTeamMapper.deleteCalTeamByTeamIds(teamIds); + } + + /** + * 删除班组信息 + * + * @param teamId 班组主键 + * @return 结果 + */ + @Override + public int deleteCalTeamByTeamId(Long teamId) + { + return calTeamMapper.deleteCalTeamByTeamId(teamId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamshiftServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamshiftServiceImpl.java new file mode 100644 index 0000000..d486e28 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/service/impl/CalTeamshiftServiceImpl.java @@ -0,0 +1,383 @@ +package com.ktg.mes.cal.service.impl; + +import java.util.Date; +import java.util.List; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.cal.domain.CalPlan; +import com.ktg.mes.cal.domain.CalPlanTeam; +import com.ktg.mes.cal.domain.CalShift; +import com.ktg.mes.cal.mapper.CalPlanMapper; +import com.ktg.mes.cal.mapper.CalPlanTeamMapper; +import com.ktg.mes.cal.mapper.CalShiftMapper; +import com.ktg.mes.cal.utils.CalendarUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import com.ktg.mes.cal.mapper.CalTeamshiftMapper; +import com.ktg.mes.cal.domain.CalTeamshift; +import com.ktg.mes.cal.service.ICalTeamshiftService; + +/** + * 班组排班Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-11 + */ +@Service +public class CalTeamshiftServiceImpl implements ICalTeamshiftService +{ + @Autowired + private CalTeamshiftMapper calTeamshiftMapper; + + @Autowired + private CalPlanMapper calPlanMapper; + + @Autowired + private CalShiftMapper calShiftMapper; + + @Autowired + private CalPlanTeamMapper calPlanTeamMapper; + + /** + * 查询班组排班 + * + * @param recordId 班组排班主键 + * @return 班组排班 + */ + @Override + public CalTeamshift selectCalTeamshiftByRecordId(Long recordId) + { + return calTeamshiftMapper.selectCalTeamshiftByRecordId(recordId); + } + + /** + * 查询班组排班列表 + * + * @param calTeamshift 班组排班 + * @return 班组排班 + */ + @Override + public List selectCalTeamshiftList(CalTeamshift calTeamshift) + { + return calTeamshiftMapper.selectCalTeamshiftList(calTeamshift); + } + + /** + * 新增班组排班 + * + * @param calTeamshift 班组排班 + * @return 结果 + */ + @Override + public int insertCalTeamshift(CalTeamshift calTeamshift) + { + calTeamshift.setCreateTime(DateUtils.getNowDate()); + return calTeamshiftMapper.insertCalTeamshift(calTeamshift); + } + + /** + * 修改班组排班 + * + * @param calTeamshift 班组排班 + * @return 结果 + */ + @Override + public int updateCalTeamshift(CalTeamshift calTeamshift) + { + calTeamshift.setUpdateTime(DateUtils.getNowDate()); + return calTeamshiftMapper.updateCalTeamshift(calTeamshift); + } + + /** + * 批量删除班组排班 + * + * @param recordIds 需要删除的班组排班主键 + * @return 结果 + */ + @Override + public int deleteCalTeamshiftByRecordIds(Long[] recordIds) + { + return calTeamshiftMapper.deleteCalTeamshiftByRecordIds(recordIds); + } + + /** + * 删除班组排班信息 + * + * @param recordId 班组排班主键 + * @return 结果 + */ + @Override + public int deleteCalTeamshiftByRecordId(Long recordId) + { + return calTeamshiftMapper.deleteCalTeamshiftByRecordId(recordId); + } + + /** + * 根据排班计划生成每个班组的明细排班记录 + * 1.查询计划头 + * 2.查询计划中的班组 + * 3.查询计划中的班次 + * 4.计算计划的开始日期和结束日期的差值 + * 5.遍历每一天,设置每一天的班组与班次的对应关系(要结合轮班方式) + * @param plandId + */ + @Async + @Override + public void genRecords(Long plandId) { + CalPlan plan =calPlanMapper.selectCalPlanByPlanId(plandId); + CalShift p1 = new CalShift(); + p1.setPlanId(plandId); + List shifts = calShiftMapper.selectCalShiftList(p1); + CalPlanTeam p2 = new CalPlanTeam(); + p2.setPlanId(plandId); + List teams = calPlanTeamMapper.selectCalPlanTeamList(p2); + Long days = CalendarUtil.getDateDiff(plan.getStartDate(),plan.getEndDate()); + + int shiftIndex =0; + Date nowDate =null; + for(int i =0;i teamshifts = calTeamshiftMapper.selectCalTeamshiftList(param); + if(CollUtil.isNotEmpty(teamshifts)){ + calTeamshift.setRecordId(teamshifts.get(0).getRecordId()); + calTeamshiftMapper.updateCalTeamshift(calTeamshift); + }else{ + calTeamshiftMapper.insertCalTeamshift(calTeamshift); + } + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/cal/utils/CalendarUtil.java b/ktg-mes/src/main/java/com/ktg/mes/cal/utils/CalendarUtil.java new file mode 100644 index 0000000..f872822 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/cal/utils/CalendarUtil.java @@ -0,0 +1,522 @@ +package com.ktg.mes.cal.utils; + +import com.ktg.mes.cal.domain.CalCalendar; + +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.Month; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.*; + +public class CalendarUtil { + + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + /** + * 星期日; + */ + public static final String SUNDAY = "星期日"; + + /** + * 星期一; + */ + public static final String MONDAY = "星期一"; + + /** + * 星期二; + */ + public static final String TUESDAY = "星期二"; + + /** + * 星期三; + */ + public static final String WEDNESDAY = "星期三"; + + /** + * 星期四; + */ + public static final String THURSDAY = "星期四"; + + /** + * 星期五; + */ + public static final String FRIDAY = "星期五"; + + /** + * 星期六; + */ + public static final String SATURDAY = "星期六"; + + /** + * 显示年月日时分秒,例如 2015-08-11 09:51:53. + */ + public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; + /** + * 显示年月日时分,例如 2015-08-11 09:51. + */ + public static final String NO_SECOND_DATETIME_PATTERN = "yyyy-MM-dd HH:mm"; + /** + * 仅显示年月日,例如 2015-08-11. + */ + public static final String DATE_PATTERN = "yyyy-MM-dd"; + /** + * 仅显示时分秒,例如 09:51:53. + */ + public static final String TIME_PATTERN = "HH:mm:ss"; + /** + * 显示年月日时分秒(由/分割),例如 2015/08/11 09:51:53. + */ + public static final String DATETIME_PATTERN_WITH_SLASH = "yyyy/MM/dd HH:mm:ss"; + /** + * 显示年月日(由/分割),例如 2015/08/11. + */ + public static final String DATE_PATTERN_WITH_SLASH = "yyyy/MM/dd"; + /** + * 仅显示年(无符号),例如 2015. + */ + private static final String YEAR_PATTERN = "yyyy"; + /** + * 仅显示年月,例如 2015-08. + */ + private static final String MONTH_PATTERN = "yyyy-MM"; + + /** + * 获取当前日期和时间字符串. + * + * @return String 日期时间字符串,例如 2015-08-11 09:51:53 + */ + public static String getDateTimeStr() { + return format(new Date(), DATETIME_PATTERN); + } + + /** + * 时间戳转换为日期时间字符串 + * + * @param timestamp 时间戳 + * @param pattern 日期格式 例如DATETIME_PATTERN + * @return String 日期时间字符串,例如 2015-08-11 09:51:53 + */ + public static String getDateTimeStr(long timestamp, String pattern) { + return new SimpleDateFormat(pattern).format(timestamp); + } + + /** + * 获取当前日期字符串. + * + * @return String 日期字符串,例如2015-08-11 + */ + public static String getDateStr() { + return format(new Date(), DATE_PATTERN); + } + + /** + * 获取指定日期字符串. + * + * @return String 日期字符串,例如2015-08-11 + */ + public static String getDateStr(Date theday) { + return format(theday, DATE_PATTERN); + } + + /** + * 获取当前时间字符串. + * + * @return String 时间字符串,例如 09:51:53 + */ + public static String getTimeStr() { + return format(new Date(), TIME_PATTERN); + } + + /** + * 获取当前年份字符串. + * + * @return String 当前年份字符串,例如 2015 + */ + public static String getYearStr() { + return format(new Date(), YEAR_PATTERN); + } + + /** + * 获取当前月份字符串. + * + * @return String 当前月份字符串,例如 08 + */ + public static String getMonthStr() { + return format(new Date(), "MM"); + } + + /** + * 获取当前天数字符串. + * + * @return String 当前天数字符串,例如 11 + */ + public static String getDayStr() { + return format(new Date(), "dd"); + } + + /** + * 获取当前星期字符串. + * + * @return String 当前星期字符串,例如 星期二 + */ + public static String getDayOfWeekStr() { + return format(new Date(), "E"); + } + + /** + * 获取指定日期是星期几 + * + * @param date 日期 + * @return String 星期几 + */ + public static String getDayOfWeekStr(Date date) { + String[] weekOfDays = {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY}; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int num = calendar.get(Calendar.DAY_OF_WEEK) - 1; + return weekOfDays[num]; + } + + + /** + * 获取日期时间字符串 + * + * @param date 需要转化的日期时间 + * @param pattern 时间格式 + * @return String 日期时间字符串,例如 2015-08-11 09:51:53 + */ + public static String format(Date date, String pattern) { + return new SimpleDateFormat(pattern).format(date); + } + + /** + * 获取指定日期num年数之后的日期. + * + * @param num 间隔年数(负数表示之前) + * @return Date 日期 + */ + public static Date addYears(Date date, int num) { + return add(date, num, Calendar.YEAR); + } + + /** + * 获取指定日期num月数之后的日期. + * + * @param num 间隔月数(负数表示之前) + * @return Date 日期 + */ + public static Date addMonths(Date date, int num) { + return add(date, num, Calendar.MONTH); + } + + /** + * 获取指定日期num周数之后的日期. + * + * @param date 日期 + * @param num 周数(负数表示之前) + * @return Date 新的日期 + */ + public static Date addWeeks(Date date, int num) { + return add(date, num, Calendar.WEEK_OF_YEAR); + } + + /** + * 获取指定日期num天数之后的日期. + * + * @param date 日期 + * @param num 天数(负数表示之前) + * @return Date 新的日期 + */ + public static Date addDays(Date date, int num) { + return add(date, num, Calendar.DAY_OF_MONTH); + } + + /** + * 获取指定日期num小时之后的日期. + * + * @param date 日期 + * @param num 小时数(负数表示之前) + * @return Date 新的日期 + */ + public static Date addHours(Date date, int num) { + return add(date, num, Calendar.HOUR_OF_DAY); + } + + /** + * 获取指定日期num分钟之后的日期. + * + * @param date 日期 + * @param num 分钟数(负数表示之前) + * @return Date 新的日期 + */ + public static Date addMinutes(Date date, int num) { + return add(date, num, Calendar.MINUTE); + } + + /** + * 获取指定日期num秒钟之后的日期. + * + * @param date 日期 + * @param num 秒钟数(负数表示之前) + * @return Date 新的日期 + */ + public static Date addSeconds(Date date, int num) { + return add(date, num, Calendar.SECOND); + } + + /** + * 获取当前日期指定数量日期时间单位之后的日期. + * + * @param date 日期 + * @param num 数量 + * @param unit 日期时间单位 + * @return Date 新的日期 + */ + public static Date add(Date date, int num, int unit) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(unit, num); + return calendar.getTime(); + } + + /** + * 获取本周的第一天,一个星期的第一天是星期一,最后一天是星期天 + * + * @return Calendar 日历 + */ + public static Date getStartDayOfWeek(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 + calendar.setFirstDayOfWeek(Calendar.MONDAY); + calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + return calendar.getTime(); + } + + /** + * 获取本周的最后一天,一个星期的第一天是星期一,最后一天是星期天 + * + * @return Calendar 日历 + */ + public static Date getEndDayOfWeek(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 + calendar.setFirstDayOfWeek(Calendar.MONDAY); + calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + return calendar.getTime(); + } + + /** + * 获取指定日期当周第一天的日期字符串 + * + * @param date 指定日期 + * @return String 格式:yyyy-MM-dd + */ + public static String getWeekStartTimeStr(Date date) { + return getDateStr(getStartDayOfWeek(date)); + } + + /** + * 获取本周最后一天的日期字符串 + * + * @return String 格式:yyyy-MM-dd + */ + public static String getWeekEndTimeStr() { + return getDateStr(getEndDayOfWeek(new Date())); + } + + + /** + * 获取指定日期所在月份的开始日期 + * @param date + * @return + */ + public static Date getMonthStart(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int index = calendar.get(Calendar.DAY_OF_MONTH); + calendar.add(Calendar.DATE, (1 - index)); + return calendar.getTime(); + } + + /** + * 获取指定日期所在月份的最后一天 + * @param date + * @return + */ + public static Date getMonthEnd(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, 1); + int index = calendar.get(Calendar.DAY_OF_MONTH); + calendar.add(Calendar.DATE, (-index)); + return calendar.getTime(); + } + + /** + * 获取指定日期对应月份第一天 + * @param date + * @return + */ + public static String getMonthStartStr(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int index = calendar.get(Calendar.DAY_OF_MONTH); + calendar.add(Calendar.DATE, (1 - index)); + return sdf.format(calendar.getTime()); + } + + /** + * 获取指定日期对应月份最后一天 + * @param date + * @return + */ + public static String getMonthEndStr(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, 1); + int index = calendar.get(Calendar.DAY_OF_MONTH); + calendar.add(Calendar.DATE, (-index)); + return sdf.format(calendar.getTime()); + } + + + /** + * 获取指定日期对应季度的第一天 + * @param theDay + * @return + */ + public static String getQuarterStartStr(Date theDay){ + LocalDate resDate = null; + if (theDay == null) { + resDate = LocalDate.now(); + }else{ + resDate = LocalDate.parse(sdf.format(theDay),formatter); + } + Month month = resDate.getMonth(); + Month firstMonthOfQuarter = month.firstMonthOfQuarter(); + + resDate = LocalDate.of(resDate.getYear(), firstMonthOfQuarter, 1); + + return resDate.toString(); + } + + /** + * 获取指定日期对应季度的最后一天 + * @param theDay + * @return + */ + public static String getQuarterEandStr(Date theDay){ + LocalDate resDate = LocalDate.now(); + if (theDay == null) { + resDate = LocalDate.now(); + }else { + resDate = LocalDate.parse(sdf.format(theDay),formatter); + } + Month month = resDate.getMonth(); + Month firstMonthOfQuarter = month.firstMonthOfQuarter(); + Month endMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); + resDate = LocalDate.of(resDate.getYear(), endMonthOfQuarter, endMonthOfQuarter.length(resDate.isLeapYear())); + return resDate.toString(); + } + + + public static Date getNext(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DATE, 1); + return calendar.getTime(); + } + + public static Long getDateDiff(Date start,Date end){ + LocalDate sdate = LocalDate.parse(sdf.format(start),formatter); + LocalDate edate = LocalDate.parse(sdf.format(end),formatter); + return sdate.until(edate,ChronoUnit.DAYS); + } + + public static Long getDateDiff(String start,Date end){ + LocalDate sdate = LocalDate.parse(start,formatter); + LocalDate edate = LocalDate.parse(sdf.format(end),formatter); + return edate.until(sdate,ChronoUnit.DAYS); + } + + public static Long getDateDiff(Date start,String end){ + LocalDate sdate = LocalDate.parse(sdf.format(start),formatter); + LocalDate edate = LocalDate.parse(sdf.format(end),formatter); + return edate.until(sdate,ChronoUnit.DAYS); + } + + /** + * 计算两个日期之间的天数差值 + * @param start + * @param end + * @return + */ + public static Long getDateDiff(String start,String end){ + LocalDate sdate = LocalDate.parse(start,formatter); + LocalDate edate = LocalDate.parse(end,formatter); + return edate.until(sdate,ChronoUnit.DAYS); + } + + public static Date getDatePlus(Date theDay,Integer count){ + LocalDate sdate = LocalDate.parse(sdf.format(theDay),formatter); + sdate.plusDays(count); + return Date.from(sdate.atStartOfDay(ZoneId.systemDefault()).toInstant()); + } + + + /** + * 获取指定月份的所有日期 + * @param d + * @return + */ + public static List getDays(Date d){ + List lst=new ArrayList(); + Date date = getMonthStart(d); + Date monthEnd = getMonthEnd(d); + while (!date.after(monthEnd)) { + CalCalendar cal = new CalCalendar(); + cal.setTheDay(sdf.format(date)); + lst.add(cal); + date = getNext(date); + } + return lst; + } + + /** + * 获取指定日期前后N天的所有日期 + * @param date + * @param num + * @param pattern + * @return + */ + public static List getDateStrList(Date date, int num, String pattern) { + List result = new ArrayList<>(); + Calendar c = Calendar.getInstance(); + c.setTime(date); + boolean flag = false; + if (num < 0) { + num = Math.abs(num); + flag = true; + } + for (int i = 0; i < num; i++) { + result.add(new SimpleDateFormat(pattern).format(c.getTimeInMillis())); + c.add(Calendar.DATE, flag ? -1 : 1); + } + if (flag) { + Collections.reverse(result); + } + return result; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckMachineryController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckMachineryController.java new file mode 100644 index 0000000..e2d29ce --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckMachineryController.java @@ -0,0 +1,111 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvCheckMachinery; +import com.ktg.mes.dv.service.IDvCheckMachineryService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 点检设备Controller + * + * @author yinjinlu + * @date 2022-06-17 + */ +@RestController +@RequestMapping("/mes/dv/checkmachinery") +public class DvCheckMachineryController extends BaseController +{ + @Autowired + private IDvCheckMachineryService dvCheckMachineryService; + + /** + * 查询点检设备列表 + */ + @GetMapping("/list") + public TableDataInfo list(DvCheckMachinery dvCheckMachinery) + { + startPage(); + List list = dvCheckMachineryService.selectDvCheckMachineryList(dvCheckMachinery); + return getDataTable(list); + } + + /** + * 导出点检设备列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')") + @Log(title = "点检设备", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvCheckMachinery dvCheckMachinery) + { + List list = dvCheckMachineryService.selectDvCheckMachineryList(dvCheckMachinery); + ExcelUtil util = new ExcelUtil(DvCheckMachinery.class); + util.exportExcel(response, list, "点检设备数据"); + } + + /** + * 获取点检设备详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(dvCheckMachineryService.selectDvCheckMachineryByRecordId(recordId)); + } + + /** + * 新增点检设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')") + @Log(title = "点检设备", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvCheckMachinery dvCheckMachinery) + { + if(UserConstants.NOT_UNIQUE.equals(dvCheckMachineryService.checkMachineryUnique(dvCheckMachinery))){ + return AjaxResult.error("设备已设置过点检计划!"); + } + return toAjax(dvCheckMachineryService.insertDvCheckMachinery(dvCheckMachinery)); + } + + /** + * 修改点检设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')") + @Log(title = "点检设备", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvCheckMachinery dvCheckMachinery) + { + if(UserConstants.NOT_UNIQUE.equals(dvCheckMachineryService.checkMachineryUnique(dvCheckMachinery))){ + return AjaxResult.error("设备已设置过点检计划!"); + } + return toAjax(dvCheckMachineryService.updateDvCheckMachinery(dvCheckMachinery)); + } + + /** + * 删除点检设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')") + @Log(title = "点检设备", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(dvCheckMachineryService.deleteDvCheckMachineryByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckPlanController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckPlanController.java new file mode 100644 index 0000000..84743ae --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckPlanController.java @@ -0,0 +1,147 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.dv.domain.DvCheckMachinery; +import com.ktg.mes.dv.domain.DvCheckSubject; +import com.ktg.mes.dv.service.IDvCheckMachineryService; +import com.ktg.mes.dv.service.IDvCheckSubjectService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvCheckPlan; +import com.ktg.mes.dv.service.IDvCheckPlanService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 设备点检计划头Controller + * + * @author yinjinlu + * @date 2022-06-16 + */ +@RestController +@RequestMapping("/mes/dv/checkplan") +public class DvCheckPlanController extends BaseController +{ + @Autowired + private IDvCheckPlanService dvCheckPlanService; + + @Autowired + IDvCheckMachineryService dvCheckMachineryService; + + @Autowired + IDvCheckSubjectService dvCheckSubjectService; + + /** + * 查询设备点检计划头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:list')") + @GetMapping("/list") + public TableDataInfo list(DvCheckPlan dvCheckPlan) + { + startPage(); + List list = dvCheckPlanService.selectDvCheckPlanList(dvCheckPlan); + return getDataTable(list); + } + + /** + * 导出设备点检计划头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')") + @Log(title = "设备点检计划头", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvCheckPlan dvCheckPlan) + { + List list = dvCheckPlanService.selectDvCheckPlanList(dvCheckPlan); + ExcelUtil util = new ExcelUtil(DvCheckPlan.class); + util.exportExcel(response, list, "设备点检计划头数据"); + } + + /** + * 获取设备点检计划头详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')") + @GetMapping(value = "/{planId}") + public AjaxResult getInfo(@PathVariable("planId") Long planId) + { + return AjaxResult.success(dvCheckPlanService.selectDvCheckPlanByPlanId(planId)); + } + + /** + * 新增设备点检计划头 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')") + @Log(title = "设备点检计划头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvCheckPlan dvCheckPlan) + { + return toAjax(dvCheckPlanService.insertDvCheckPlan(dvCheckPlan)); + } + + /** + * 修改设备点检计划头 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')") + @Log(title = "设备点检计划头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvCheckPlan dvCheckPlan) + { + if(UserConstants.ORDER_STATUS_FINISHED.equals(dvCheckPlan.getStatus())){ + DvCheckMachinery para1 = new DvCheckMachinery(); + para1.setPlanId(dvCheckPlan.getPlanId()); + List machinerys = dvCheckMachineryService.selectDvCheckMachineryList(para1); + if(!CollUtil.isNotEmpty(machinerys)){ + return AjaxResult.error("请指定设备!"); + } + + DvCheckSubject para2 = new DvCheckSubject(); + para2.setPlanId(dvCheckPlan.getPlanId()); + List subjects = dvCheckSubjectService.selectDvCheckSubjectList(para2); + if(!CollUtil.isNotEmpty(subjects)){ + return AjaxResult.error("请指定项目!"); + } + } + return toAjax(dvCheckPlanService.updateDvCheckPlan(dvCheckPlan)); + } + + /** + * 删除设备点检计划头 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')") + @Log(title = "设备点检计划头", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{planIds}") + public AjaxResult remove(@PathVariable Long[] planIds) + { + for (Long planId:planIds + ) { + DvCheckPlan plan = dvCheckPlanService.selectDvCheckPlanByPlanId(planId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(plan.getStatus())){ + return AjaxResult.error("只能删除草稿状态单据!"); + } + + dvCheckMachineryService.deleteByPlanId(planId); + dvCheckSubjectService.deleteByPlanId(planId); + } + + + + return toAjax(dvCheckPlanService.deleteDvCheckPlanByPlanIds(planIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckSubjectController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckSubjectController.java new file mode 100644 index 0000000..1d35b3d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvCheckSubjectController.java @@ -0,0 +1,112 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvCheckSubject; +import com.ktg.mes.dv.service.IDvCheckSubjectService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 点检项目Controller + * + * @author yinjinlu + * @date 2022-06-18 + */ +@RestController +@RequestMapping("/mes/dv/checksubject") +public class DvCheckSubjectController extends BaseController +{ + @Autowired + private IDvCheckSubjectService dvCheckSubjectService; + + /** + * 查询点检项目列表 + */ + @GetMapping("/list") + public TableDataInfo list(DvCheckSubject dvCheckSubject) + { + startPage(); + List list = dvCheckSubjectService.selectDvCheckSubjectList(dvCheckSubject); + return getDataTable(list); + } + + /** + * 导出点检项目列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')") + @Log(title = "点检项目", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvCheckSubject dvCheckSubject) + { + List list = dvCheckSubjectService.selectDvCheckSubjectList(dvCheckSubject); + ExcelUtil util = new ExcelUtil(DvCheckSubject.class); + util.exportExcel(response, list, "点检项目数据"); + } + + /** + * 获取点检项目详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(dvCheckSubjectService.selectDvCheckSubjectByRecordId(recordId)); + } + + /** + * 新增点检项目 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')") + @Log(title = "点检项目", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvCheckSubject dvCheckSubject) + { + if(UserConstants.NOT_UNIQUE.equals(dvCheckSubjectService.checkSubjectUnique(dvCheckSubject))){ + return AjaxResult.error("点检项目已经添加过!"); + } + + return toAjax(dvCheckSubjectService.insertDvCheckSubject(dvCheckSubject)); + } + + /** + * 修改点检项目 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')") + @Log(title = "点检项目", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvCheckSubject dvCheckSubject) + { + if(UserConstants.NOT_UNIQUE.equals(dvCheckSubjectService.checkSubjectUnique(dvCheckSubject))){ + return AjaxResult.error("点检项目已经添加过!"); + } + return toAjax(dvCheckSubjectService.updateDvCheckSubject(dvCheckSubject)); + } + + /** + * 删除点检项目 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')") + @Log(title = "点检项目", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(dvCheckSubjectService.deleteDvCheckSubjectByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryController.java new file mode 100644 index 0000000..f50ca66 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryController.java @@ -0,0 +1,122 @@ +package com.ktg.mes.dv.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.dv.domain.DvMachinery; +import com.ktg.mes.dv.service.IDvMachineryService; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 设备Controller + * + * @author yinjinlu + * @date 2022-05-08 + */ +@RestController +@RequestMapping("/mes/dv/machinery") +public class DvMachineryController extends BaseController +{ + @Autowired + private IDvMachineryService dvMachineryService; + + @Autowired + private WmBarCodeUtil wmBarCodeUtil; + + /** + * 查询设备列表 + */ + @GetMapping("/list") + public TableDataInfo list(DvMachinery dvMachinery) + { + startPage(); + List list = dvMachineryService.selectDvMachineryList(dvMachinery); + return getDataTable(list); + } + + /** + * 导出设备列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinery:export')") + @Log(title = "设备", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvMachinery dvMachinery) + { + List list = dvMachineryService.selectDvMachineryList(dvMachinery); + ExcelUtil util = new ExcelUtil(DvMachinery.class); + util.exportExcel(response, list, "设备数据"); + } + + /** + * 获取设备详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinery:query')") + @GetMapping(value = "/{machineryId}") + public AjaxResult getInfo(@PathVariable("machineryId") Long machineryId) + { + return AjaxResult.success(dvMachineryService.selectDvMachineryByMachineryId(machineryId)); + } + + /** + * 新增设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinery:add')") + @Log(title = "设备", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvMachinery dvMachinery) + { + dvMachineryService.insertDvMachinery(dvMachinery); + wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_MACHINERY,dvMachinery.getMachineryId(),dvMachinery.getMachineryCode(),dvMachinery.getMachineryName()); + return AjaxResult.success(dvMachinery.getMachineryId()); + } + + /** + * 修改设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinery:edit')") + @Log(title = "设备", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvMachinery dvMachinery) + { + return toAjax(dvMachineryService.updateDvMachinery(dvMachinery)); + } + + /** + * 删除设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinery:remove')") + @Log(title = "设备", businessType = BusinessType.DELETE) + @DeleteMapping("/{machineryIds}") + public AjaxResult remove(@PathVariable Long[] machineryIds) + { + return toAjax(dvMachineryService.deleteDvMachineryByMachineryIds(machineryIds)); + } + + /** + * 依据上传的文件批量更新或新增设备 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinery:import')") + @Log(title = "设备", businessType = BusinessType.IMPORT) + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, + @RequestParam(name = "updateSupport", defaultValue = "false") boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(DvMachinery.class); + List dvMachineryList = util.importExcel(file.getInputStream()); + String operName = SecurityUtils.getUsername(); + String message = dvMachineryService.importMachinery(dvMachineryList, updateSupport, operName); + return AjaxResult.success("导入成功,共导入 " + message + " 条数据"); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java new file mode 100644 index 0000000..f87578a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java @@ -0,0 +1,123 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.dv.domain.DvMachinery; +import com.ktg.mes.dv.service.IDvMachineryService; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvMachineryType; +import com.ktg.mes.dv.service.IDvMachineryTypeService; +import com.ktg.common.utils.poi.ExcelUtil; + +/** + * 设备类型Controller + * + * @author yinjinlu + * @date 2022-05-08 + */ +@RestController +@RequestMapping("/mes/dv/machinerytype") +public class DvMachineryTypeController extends BaseController +{ + @Autowired + private IDvMachineryTypeService dvMachineryTypeService; + + @Autowired + private IDvMachineryService dvMachineryService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + /** + * 查询设备类型列表 + */ + @GetMapping("/list") + public AjaxResult list(DvMachineryType dvMachineryType) + { + List list = dvMachineryTypeService.selectDvMachineryTypeList(dvMachineryType); + return AjaxResult.success(list); + } + + /** + * 导出设备类型列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:export')") + @Log(title = "设备类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvMachineryType dvMachineryType) + { + List list = dvMachineryTypeService.selectDvMachineryTypeList(dvMachineryType); + ExcelUtil util = new ExcelUtil(DvMachineryType.class); + util.exportExcel(response, list, "设备类型数据"); + } + + /** + * 获取设备类型详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:query')") + @GetMapping(value = "/{machineryTypeId}") + public AjaxResult getInfo(@PathVariable("machineryTypeId") Long machineryTypeId) + { + return AjaxResult.success(dvMachineryTypeService.selectDvMachineryTypeByMachineryTypeId(machineryTypeId)); + } + + /** + * 新增设备类型 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:add')") + @Log(title = "设备类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvMachineryType dvMachineryType) + { + dvMachineryType.setMachineryTypeCode(autoCodeUtil.genSerialCode(UserConstants.MACHINERY_TYPE_CODE,null)); + return toAjax(dvMachineryTypeService.insertDvMachineryType(dvMachineryType)); + } + + /** + * 修改设备类型 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:edit')") + @Log(title = "设备类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvMachineryType dvMachineryType) + { + return toAjax(dvMachineryTypeService.updateDvMachineryType(dvMachineryType)); + } + + /** + * 删除设备类型 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:machinerytype:remove')") + @Log(title = "设备类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{machineryTypeIds}") + public AjaxResult remove(@PathVariable Long[] machineryTypeIds) + { + for (Long typeId:machineryTypeIds + ) { + DvMachinery param = new DvMachinery(); + param.setMachineryId(typeId); + List machinerys = dvMachineryService.selectDvMachineryList(param); + if(CollUtil.isNotEmpty(machinerys)){ + return AjaxResult.error("设备类型下已配置了设备,不能删除!"); + } + } + + return toAjax(dvMachineryTypeService.deleteDvMachineryTypeByMachineryTypeIds(machineryTypeIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvRepairController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvRepairController.java new file mode 100644 index 0000000..6dfb94e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvRepairController.java @@ -0,0 +1,112 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvRepair; +import com.ktg.mes.dv.service.IDvRepairService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 设备维修单Controller + * + * @author yinjinlu + * @date 2022-08-06 + */ +@RestController +@RequestMapping("/mes/dv/repair") +public class DvRepairController extends BaseController +{ + @Autowired + private IDvRepairService dvRepairService; + + /** + * 查询设备维修单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:list')") + @GetMapping("/list") + public TableDataInfo list(DvRepair dvRepair) + { + startPage(); + List list = dvRepairService.selectDvRepairList(dvRepair); + return getDataTable(list); + } + + /** + * 导出设备维修单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:export')") + @Log(title = "设备维修单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvRepair dvRepair) + { + List list = dvRepairService.selectDvRepairList(dvRepair); + ExcelUtil util = new ExcelUtil(DvRepair.class); + util.exportExcel(response, list, "设备维修单数据"); + } + + /** + * 获取设备维修单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:query')") + @GetMapping(value = "/{repairId}") + public AjaxResult getInfo(@PathVariable("repairId") Long repairId) + { + return AjaxResult.success(dvRepairService.selectDvRepairByRepairId(repairId)); + } + + /** + * 新增设备维修单 + */ + @PreAuthorize("@ss.hasPermi('dv:repair:add')") + @Log(title = "设备维修单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvRepair dvRepair) + { + if(UserConstants.NOT_UNIQUE.equals(dvRepairService.checkCodeUnique(dvRepair))){ + return AjaxResult.error("维修单编号已存!"); + } + return toAjax(dvRepairService.insertDvRepair(dvRepair)); + } + + /** + * 修改设备维修单 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:edit')") + @Log(title = "设备维修单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvRepair dvRepair) + { + if(UserConstants.NOT_UNIQUE.equals(dvRepairService.checkCodeUnique(dvRepair))){ + return AjaxResult.error("维修单编号已存!"); + } + return toAjax(dvRepairService.updateDvRepair(dvRepair)); + } + + /** + * 删除设备维修单 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:remove')") + @Log(title = "设备维修单", businessType = BusinessType.DELETE) + @DeleteMapping("/{repairIds}") + public AjaxResult remove(@PathVariable Long[] repairIds) + { + return toAjax(dvRepairService.deleteDvRepairByRepairIds(repairIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvRepairLineController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvRepairLineController.java new file mode 100644 index 0000000..d46acd7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvRepairLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvRepairLine; +import com.ktg.mes.dv.service.IDvRepairLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 设备维修单行Controller + * + * @author yinjinlu + * @date 2022-08-08 + */ +@RestController +@RequestMapping("/mes/dv/repairline") +public class DvRepairLineController extends BaseController +{ + @Autowired + private IDvRepairLineService dvRepairLineService; + + /** + * 查询设备维修单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:list')") + @GetMapping("/list") + public TableDataInfo list(DvRepairLine dvRepairLine) + { + startPage(); + List list = dvRepairLineService.selectDvRepairLineList(dvRepairLine); + return getDataTable(list); + } + + /** + * 导出设备维修单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:export')") + @Log(title = "设备维修单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvRepairLine dvRepairLine) + { + List list = dvRepairLineService.selectDvRepairLineList(dvRepairLine); + ExcelUtil util = new ExcelUtil(DvRepairLine.class); + util.exportExcel(response, list, "设备维修单行数据"); + } + + /** + * 获取设备维修单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(dvRepairLineService.selectDvRepairLineByLineId(lineId)); + } + + /** + * 新增设备维修单行 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:add')") + @Log(title = "设备维修单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvRepairLine dvRepairLine) + { + return toAjax(dvRepairLineService.insertDvRepairLine(dvRepairLine)); + } + + /** + * 修改设备维修单行 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:edit')") + @Log(title = "设备维修单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvRepairLine dvRepairLine) + { + return toAjax(dvRepairLineService.updateDvRepairLine(dvRepairLine)); + } + + /** + * 删除设备维修单行 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:repair:remove')") + @Log(title = "设备维修单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(dvRepairLineService.deleteDvRepairLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvSubjectController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvSubjectController.java new file mode 100644 index 0000000..1ecfd55 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvSubjectController.java @@ -0,0 +1,111 @@ +package com.ktg.mes.dv.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.dv.domain.DvSubject; +import com.ktg.mes.dv.service.IDvSubjectService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 设备点检保养项目Controller + * + * @author yinjinlu + * @date 2022-06-16 + */ +@RestController +@RequestMapping("/mes/dv/dvsubject") +public class DvSubjectController extends BaseController +{ + @Autowired + private IDvSubjectService dvSubjectService; + + /** + * 查询设备点检保养项目列表 + */ + @GetMapping("/list") + public TableDataInfo list(DvSubject dvSubject) + { + startPage(); + List list = dvSubjectService.selectDvSubjectList(dvSubject); + return getDataTable(list); + } + + /** + * 导出设备点检保养项目列表 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:export')") + @Log(title = "设备点检保养项目", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvSubject dvSubject) + { + List list = dvSubjectService.selectDvSubjectList(dvSubject); + ExcelUtil util = new ExcelUtil(DvSubject.class); + util.exportExcel(response, list, "设备点检保养项目数据"); + } + + /** + * 获取设备点检保养项目详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:query')") + @GetMapping(value = "/{subjectId}") + public AjaxResult getInfo(@PathVariable("subjectId") Long subjectId) + { + return AjaxResult.success(dvSubjectService.selectDvSubjectBySubjectId(subjectId)); + } + + /** + * 新增设备点检保养项目 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:add')") + @Log(title = "设备点检保养项目", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DvSubject dvSubject) + { + if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){ + return AjaxResult.error("项目编码已存在!"); + } + return toAjax(dvSubjectService.insertDvSubject(dvSubject)); + } + + /** + * 修改设备点检保养项目 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:edit')") + @Log(title = "设备点检保养项目", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DvSubject dvSubject) + { + if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){ + return AjaxResult.error("项目编码已存在!"); + } + return toAjax(dvSubjectService.updateDvSubject(dvSubject)); + } + + /** + * 删除设备点检保养项目 + */ + @PreAuthorize("@ss.hasPermi('mes:dv:dvsubject:remove')") + @Log(title = "设备点检保养项目", businessType = BusinessType.DELETE) + @DeleteMapping("/{subjectIds}") + public AjaxResult remove(@PathVariable Long[] subjectIds) + { + return toAjax(dvSubjectService.deleteDvSubjectBySubjectIds(subjectIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckMachinery.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckMachinery.java new file mode 100644 index 0000000..c735461 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckMachinery.java @@ -0,0 +1,178 @@ +package com.ktg.mes.dv.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 点检设备对象 dv_check_machinery + * + * @author yinjinlu + * @date 2022-06-17 + */ +public class DvCheckMachinery extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水号 */ + private Long recordId; + + /** 计划ID */ + @Excel(name = "计划ID") + private Long planId; + + /** 设备ID */ + @Excel(name = "设备ID") + private Long machineryId; + + /** 设备编码 */ + @Excel(name = "设备编码") + private String machineryCode; + + /** 设备名称 */ + @Excel(name = "设备名称") + private String machineryName; + + /** 品牌 */ + @Excel(name = "品牌") + private String machineryBrand; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String machinerySpec; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setMachineryId(Long machineryId) + { + this.machineryId = machineryId; + } + + public Long getMachineryId() + { + return machineryId; + } + public void setMachineryCode(String machineryCode) + { + this.machineryCode = machineryCode; + } + + public String getMachineryCode() + { + return machineryCode; + } + public void setMachineryName(String machineryName) + { + this.machineryName = machineryName; + } + + public String getMachineryName() + { + return machineryName; + } + public void setMachineryBrand(String machineryBrand) + { + this.machineryBrand = machineryBrand; + } + + public String getMachineryBrand() + { + return machineryBrand; + } + public void setMachinerySpec(String machinerySpec) + { + this.machinerySpec = machinerySpec; + } + + public String getMachinerySpec() + { + return machinerySpec; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("planId", getPlanId()) + .append("machineryId", getMachineryId()) + .append("machineryCode", getMachineryCode()) + .append("machineryName", getMachineryName()) + .append("machineryBrand", getMachineryBrand()) + .append("machinerySpec", getMachinerySpec()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckPlan.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckPlan.java new file mode 100644 index 0000000..33d9269 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckPlan.java @@ -0,0 +1,202 @@ +package com.ktg.mes.dv.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 设备点检计划头对象 dv_check_plan + * + * @author yinjinlu + * @date 2022-06-16 + */ +public class DvCheckPlan extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 计划ID */ + private Long planId; + + /** 计划编码 */ + @Excel(name = "计划编码") + private String planCode; + + /** 计划名称 */ + @Excel(name = "计划名称") + private String planName; + + private String planType; + + /** 开始日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date startDate; + + /** 结束日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date endDate; + + /** 频率 */ + @Excel(name = "频率") + private String cycleType; + + /** 次数 */ + @Excel(name = "次数") + private Long cycleCount; + + /** 状态 */ + @Excel(name = "状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setPlanCode(String planCode) + { + this.planCode = planCode; + } + + public String getPlanCode() + { + return planCode; + } + public void setPlanName(String planName) + { + this.planName = planName; + } + + public String getPlanName() + { + return planName; + } + public void setStartDate(Date startDate) + { + this.startDate = startDate; + } + + public String getPlanType() { + return planType; + } + + public void setPlanType(String planType) { + this.planType = planType; + } + + public Date getStartDate() + { + return startDate; + } + public void setEndDate(Date endDate) + { + this.endDate = endDate; + } + + public Date getEndDate() + { + return endDate; + } + public void setCycleType(String cycleType) + { + this.cycleType = cycleType; + } + + public String getCycleType() + { + return cycleType; + } + public void setCycleCount(Long cycleCount) + { + this.cycleCount = cycleCount; + } + + public Long getCycleCount() + { + return cycleCount; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "DvCheckPlan{" + + "planId=" + planId + + ", planCode='" + planCode + '\'' + + ", planName='" + planName + '\'' + + ", planType='" + planType + '\'' + + ", startDate=" + startDate + + ", endDate=" + endDate + + ", cycleType='" + cycleType + '\'' + + ", cycleCount=" + cycleCount + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckSubject.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckSubject.java new file mode 100644 index 0000000..0c82617 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvCheckSubject.java @@ -0,0 +1,192 @@ +package com.ktg.mes.dv.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 点检项目对象 dv_check_subject + * + * @author yinjinlu + * @date 2022-06-18 + */ +public class DvCheckSubject extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水号 */ + private Long recordId; + + /** 计划ID */ + @Excel(name = "计划ID") + private Long planId; + + /** 设备ID */ + @Excel(name = "设备ID") + private Long subjectId; + + /** 项目编码 */ + @Excel(name = "项目编码") + private String subjectCode; + + /** 项目名称 */ + @Excel(name = "项目名称") + private String subjectName; + + /** 项目类型 */ + @Excel(name = "项目类型") + private String subjectType; + + /** 项目内容 */ + @Excel(name = "项目内容") + private String subjectContent; + + /** 标准 */ + @Excel(name = "标准") + private String subjectStandard; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setSubjectId(Long subjectId) + { + this.subjectId = subjectId; + } + + public Long getSubjectId() + { + return subjectId; + } + public void setSubjectCode(String subjectCode) + { + this.subjectCode = subjectCode; + } + + public String getSubjectCode() + { + return subjectCode; + } + public void setSubjectName(String subjectName) + { + this.subjectName = subjectName; + } + + public String getSubjectName() + { + return subjectName; + } + public void setSubjectType(String subjectType) + { + this.subjectType = subjectType; + } + + public String getSubjectType() + { + return subjectType; + } + public void setSubjectContent(String subjectContent) + { + this.subjectContent = subjectContent; + } + + public String getSubjectContent() + { + return subjectContent; + } + public void setSubjectStandard(String subjectStandard) + { + this.subjectStandard = subjectStandard; + } + + public String getSubjectStandard() + { + return subjectStandard; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("planId", getPlanId()) + .append("subjectId", getSubjectId()) + .append("subjectCode", getSubjectCode()) + .append("subjectName", getSubjectName()) + .append("subjectType", getSubjectType()) + .append("subjectContent", getSubjectContent()) + .append("subjectStandard", getSubjectStandard()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvMachinery.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvMachinery.java new file mode 100644 index 0000000..b18d5b0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvMachinery.java @@ -0,0 +1,248 @@ +package com.ktg.mes.dv.domain; + +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 设备对象 dv_machinery + * + * @author yinjinlu + * @date 2022-05-08 + */ +public class DvMachinery extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 设备类型ID */ + private Long machineryId; + + /** 设备类型编码 */ + @Excel(name = "设备编码") + private String machineryCode; + + /** 设备类型名称 */ + @Excel(name = "设备名称") + private String machineryName; + + /** 品牌 */ + @Excel(name = "品牌") + private String machineryBrand; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String machinerySpec; + + /** 设备类型ID */ + @Excel(name = "设备类型ID") + private Long machineryTypeId; + + /** 设备类型编码 */ + @Excel(name = "设备类型编码") + private String machineryTypeCode; + + /** 设备类型名称 */ + @Excel(name = "设备类型名称") + private String machineryTypeName; + + /** 所属车间ID */ + @Excel(name = "所属车间ID") + private Long workshopId; + + /** 所属车间编码 */ + @Excel(name = "所属车间编码") + private String workshopCode; + + /** 所属车间名称 */ + @Excel(name = "所属车间名称") + private String workshopName; + + /** 设备状态 */ + @Excel(name = "设备状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setMachineryId(Long machineryId) + { + this.machineryId = machineryId; + } + + public Long getMachineryId() + { + return machineryId; + } + public void setMachineryCode(String machineryCode) + { + this.machineryCode = machineryCode; + } + + public String getMachineryCode() + { + return machineryCode; + } + public void setMachineryName(String machineryName) + { + this.machineryName = machineryName; + } + + public String getMachineryName() + { + return machineryName; + } + public void setMachineryBrand(String machineryBrand) + { + this.machineryBrand = machineryBrand; + } + + public String getMachineryBrand() + { + return machineryBrand; + } + public void setMachinerySpec(String machinerySpec) + { + this.machinerySpec = machinerySpec; + } + + public String getMachinerySpec() + { + return machinerySpec; + } + public void setMachineryTypeId(Long machineryTypeId) + { + this.machineryTypeId = machineryTypeId; + } + + public Long getMachineryTypeId() + { + return machineryTypeId; + } + public void setMachineryTypeCode(String machineryTypeCode) + { + this.machineryTypeCode = machineryTypeCode; + } + + public String getMachineryTypeCode() + { + return machineryTypeCode; + } + public void setMachineryTypeName(String machineryTypeName) + { + this.machineryTypeName = machineryTypeName; + } + + public String getMachineryTypeName() + { + return machineryTypeName; + } + public void setWorkshopId(Long workshopId) + { + this.workshopId = workshopId; + } + + public Long getWorkshopId() + { + return workshopId; + } + public void setWorkshopCode(String workshopCode) + { + this.workshopCode = workshopCode; + } + + public String getWorkshopCode() + { + return workshopCode; + } + public void setWorkshopName(String workshopName) + { + this.workshopName = workshopName; + } + + public String getWorkshopName() + { + return workshopName; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("machineryId", getMachineryId()) + .append("machineryCode", getMachineryCode()) + .append("machineryName", getMachineryName()) + .append("machineryBrand", getMachineryBrand()) + .append("machinerySpec", getMachinerySpec()) + .append("machineryTypeId", getMachineryTypeId()) + .append("machineryTypeCode", getMachineryTypeCode()) + .append("machineryTypeName", getMachineryTypeName()) + .append("workshopId", getWorkshopId()) + .append("workshopCode", getWorkshopCode()) + .append("workshopName", getWorkshopName()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvMachineryType.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvMachineryType.java new file mode 100644 index 0000000..7237554 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvMachineryType.java @@ -0,0 +1,151 @@ +package com.ktg.mes.dv.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.TreeEntity; + +/** + * 设备类型对象 dv_machinery_type + * + * @author yinjinlu + * @date 2022-05-08 + */ +public class DvMachineryType extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 设备类型ID */ + private Long machineryTypeId; + + /** 设备类型编码 */ + @Excel(name = "设备类型编码") + private String machineryTypeCode; + + /** 设备类型名称 */ + @Excel(name = "设备类型名称") + private String machineryTypeName; + + /** 父类型ID */ + @Excel(name = "父类型ID") + private Long parentTypeId; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setMachineryTypeId(Long machineryTypeId) + { + this.machineryTypeId = machineryTypeId; + } + + public Long getMachineryTypeId() + { + return machineryTypeId; + } + public void setMachineryTypeCode(String machineryTypeCode) + { + this.machineryTypeCode = machineryTypeCode; + } + + public String getMachineryTypeCode() + { + return machineryTypeCode; + } + public void setMachineryTypeName(String machineryTypeName) + { + this.machineryTypeName = machineryTypeName; + } + + public String getMachineryTypeName() + { + return machineryTypeName; + } + public void setParentTypeId(Long parentTypeId) + { + this.parentTypeId = parentTypeId; + } + + public Long getParentTypeId() + { + return parentTypeId; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("machineryTypeId", getMachineryTypeId()) + .append("machineryTypeCode", getMachineryTypeCode()) + .append("machineryTypeName", getMachineryTypeName()) + .append("parentTypeId", getParentTypeId()) + .append("ancestors", getAncestors()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvRepair.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvRepair.java new file mode 100644 index 0000000..833e007 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvRepair.java @@ -0,0 +1,329 @@ +package com.ktg.mes.dv.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 设备维修单对象 dv_repair + * + * @author yinjinlu + * @date 2022-08-06 + */ +public class DvRepair extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 维修单ID */ + private Long repairId; + + /** 维修单编号 */ + @Excel(name = "维修单编号") + private String repairCode; + + /** 维修单名称 */ + @Excel(name = "维修单名称") + private String repairName; + + /** 设备ID */ + @Excel(name = "设备ID") + private Long machineryId; + + /** 设备编码 */ + @Excel(name = "设备编码") + private String machineryCode; + + /** 设备名称 */ + @Excel(name = "设备名称") + private String machineryName; + + /** 品牌 */ + @Excel(name = "品牌") + private String machineryBrand; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String machinerySpec; + + /** 设备类型ID */ + @Excel(name = "设备类型ID") + private Long machineryTypeId; + + /** 报修日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "报修日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date requireDate; + + /** 维修完成日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "维修完成日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date finishDate; + + /** 验收日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "验收日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date confirmDate; + + /** 维修结果 */ + @Excel(name = "维修结果") + private String repairResult; + + /** 维修人员 */ + @Excel(name = "维修人员") + private String acceptedBy; + + private String acceptName; + + /** 验收人员 */ + @Excel(name = "验收人员") + private String confirmBy; + + private String confirmName; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRepairId(Long repairId) + { + this.repairId = repairId; + } + + public Long getRepairId() + { + return repairId; + } + public void setRepairCode(String repairCode) + { + this.repairCode = repairCode; + } + + public String getRepairCode() + { + return repairCode; + } + public void setRepairName(String repairName) + { + this.repairName = repairName; + } + + public String getRepairName() + { + return repairName; + } + public void setMachineryId(Long machineryId) + { + this.machineryId = machineryId; + } + + public Long getMachineryId() + { + return machineryId; + } + public void setMachineryCode(String machineryCode) + { + this.machineryCode = machineryCode; + } + + public String getMachineryCode() + { + return machineryCode; + } + public void setMachineryName(String machineryName) + { + this.machineryName = machineryName; + } + + public String getMachineryName() + { + return machineryName; + } + public void setMachineryBrand(String machineryBrand) + { + this.machineryBrand = machineryBrand; + } + + public String getMachineryBrand() + { + return machineryBrand; + } + public void setMachinerySpec(String machinerySpec) + { + this.machinerySpec = machinerySpec; + } + + public String getMachinerySpec() + { + return machinerySpec; + } + public void setMachineryTypeId(Long machineryTypeId) + { + this.machineryTypeId = machineryTypeId; + } + + public Long getMachineryTypeId() + { + return machineryTypeId; + } + public void setRequireDate(Date requireDate) + { + this.requireDate = requireDate; + } + + public Date getRequireDate() + { + return requireDate; + } + public void setFinishDate(Date finishDate) + { + this.finishDate = finishDate; + } + + public Date getFinishDate() + { + return finishDate; + } + public void setConfirmDate(Date confirmDate) + { + this.confirmDate = confirmDate; + } + + public Date getConfirmDate() + { + return confirmDate; + } + public void setRepairResult(String repairResult) + { + this.repairResult = repairResult; + } + + public String getRepairResult() + { + return repairResult; + } + public void setAcceptedBy(String acceptedBy) + { + this.acceptedBy = acceptedBy; + } + + public String getAcceptedBy() + { + return acceptedBy; + } + public void setConfirmBy(String confirmBy) + { + this.confirmBy = confirmBy; + } + + public String getConfirmBy() + { + return confirmBy; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getAcceptName() { + return acceptName; + } + + public void setAcceptName(String acceptName) { + this.acceptName = acceptName; + } + + public String getConfirmName() { + return confirmName; + } + + public void setConfirmName(String confirmName) { + this.confirmName = confirmName; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("repairId", getRepairId()) + .append("repairCode", getRepairCode()) + .append("repairName", getRepairName()) + .append("machineryId", getMachineryId()) + .append("machineryCode", getMachineryCode()) + .append("machineryName", getMachineryName()) + .append("machineryBrand", getMachineryBrand()) + .append("machinerySpec", getMachinerySpec()) + .append("machineryTypeId", getMachineryTypeId()) + .append("requireDate", getRequireDate()) + .append("finishDate", getFinishDate()) + .append("confirmDate", getConfirmDate()) + .append("repairResult", getRepairResult()) + .append("acceptedBy", getAcceptedBy()) + .append("confirmBy", getConfirmBy()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvRepairLine.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvRepairLine.java new file mode 100644 index 0000000..2d65c7e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvRepairLine.java @@ -0,0 +1,234 @@ +package com.ktg.mes.dv.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 设备维修单行对象 dv_repair_line + * + * @author yinjinlu + * @date 2022-08-08 + */ +public class DvRepairLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 维修单ID */ + @Excel(name = "维修单ID") + private Long repairId; + + /** 项目ID */ + @Excel(name = "项目ID") + private Long subjectId; + + /** 项目编码 */ + @Excel(name = "项目编码") + private String subjectCode; + + /** 项目名称 */ + @Excel(name = "项目名称") + private String subjectName; + + /** 项目类型 */ + @Excel(name = "项目类型") + private String subjectType; + + /** 项目内容 */ + @Excel(name = "项目内容") + private String subjectContent; + + /** 标准 */ + @Excel(name = "标准") + private String subjectStandard; + + /** 故障描述 */ + @Excel(name = "故障描述") + private String malfunction; + + /** 故障描述资源 */ + @Excel(name = "故障描述资源") + private String malfunctionUrl; + + /** 维修情况 */ + @Excel(name = "维修情况") + private String repairDes; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRepairId(Long repairId) + { + this.repairId = repairId; + } + + public Long getRepairId() + { + return repairId; + } + public void setSubjectId(Long subjectId) + { + this.subjectId = subjectId; + } + + public Long getSubjectId() + { + return subjectId; + } + public void setSubjectCode(String subjectCode) + { + this.subjectCode = subjectCode; + } + + public String getSubjectCode() + { + return subjectCode; + } + public void setSubjectName(String subjectName) + { + this.subjectName = subjectName; + } + + public String getSubjectName() + { + return subjectName; + } + public void setSubjectType(String subjectType) + { + this.subjectType = subjectType; + } + + public String getSubjectType() + { + return subjectType; + } + public void setSubjectContent(String subjectContent) + { + this.subjectContent = subjectContent; + } + + public String getSubjectContent() + { + return subjectContent; + } + public void setSubjectStandard(String subjectStandard) + { + this.subjectStandard = subjectStandard; + } + + public String getSubjectStandard() + { + return subjectStandard; + } + public void setMalfunction(String malfunction) + { + this.malfunction = malfunction; + } + + public String getMalfunction() + { + return malfunction; + } + public void setMalfunctionUrl(String malfunctionUrl) + { + this.malfunctionUrl = malfunctionUrl; + } + + public String getMalfunctionUrl() + { + return malfunctionUrl; + } + public void setRepairDes(String repairDes) + { + this.repairDes = repairDes; + } + + public String getRepairDes() + { + return repairDes; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("repairId", getRepairId()) + .append("subjectId", getSubjectId()) + .append("subjectCode", getSubjectCode()) + .append("subjectName", getSubjectName()) + .append("subjectType", getSubjectType()) + .append("subjectContent", getSubjectContent()) + .append("subjectStandard", getSubjectStandard()) + .append("malfunction", getMalfunction()) + .append("malfunctionUrl", getMalfunctionUrl()) + .append("repairDes", getRepairDes()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvSubject.java b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvSubject.java new file mode 100644 index 0000000..87694db --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/domain/DvSubject.java @@ -0,0 +1,178 @@ +package com.ktg.mes.dv.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 设备点检保养项目对象 dv_subject + * + * @author yinjinlu + * @date 2022-06-16 + */ +public class DvSubject extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 项目ID */ + private Long subjectId; + + /** 项目编码 */ + @Excel(name = "项目编码") + private String subjectCode; + + /** 项目名称 */ + @Excel(name = "项目名称") + private String subjectName; + + /** 项目类型 */ + @Excel(name = "项目类型") + private String subjectType; + + /** 项目内容 */ + @Excel(name = "项目内容") + private String subjectContent; + + /** 标准 */ + @Excel(name = "标准") + private String subjectStandard; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setSubjectId(Long subjectId) + { + this.subjectId = subjectId; + } + + public Long getSubjectId() + { + return subjectId; + } + public void setSubjectCode(String subjectCode) + { + this.subjectCode = subjectCode; + } + + public String getSubjectCode() + { + return subjectCode; + } + public void setSubjectName(String subjectName) + { + this.subjectName = subjectName; + } + + public String getSubjectName() + { + return subjectName; + } + public void setSubjectType(String subjectType) + { + this.subjectType = subjectType; + } + + public String getSubjectType() + { + return subjectType; + } + public void setSubjectContent(String subjectContent) + { + this.subjectContent = subjectContent; + } + + public String getSubjectContent() + { + return subjectContent; + } + public void setSubjectStandard(String subjectStandard) + { + this.subjectStandard = subjectStandard; + } + + public String getSubjectStandard() + { + return subjectStandard; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("subjectId", getSubjectId()) + .append("subjectCode", getSubjectCode()) + .append("subjectName", getSubjectName()) + .append("subjectType", getSubjectType()) + .append("subjectContent", getSubjectContent()) + .append("subjectStandard", getSubjectStandard()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckMachineryMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckMachineryMapper.java new file mode 100644 index 0000000..eb51f9b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckMachineryMapper.java @@ -0,0 +1,70 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvCheckMachinery; + +/** + * 点检设备Mapper接口 + * + * @author yinjinlu + * @date 2022-06-17 + */ +public interface DvCheckMachineryMapper +{ + /** + * 查询点检设备 + * + * @param recordId 点检设备主键 + * @return 点检设备 + */ + public DvCheckMachinery selectDvCheckMachineryByRecordId(Long recordId); + + /** + * 查询点检设备列表 + * + * @param dvCheckMachinery 点检设备 + * @return 点检设备集合 + */ + public List selectDvCheckMachineryList(DvCheckMachinery dvCheckMachinery); + + public DvCheckMachinery checkMachineryUnique(DvCheckMachinery dvCheckMachinery); + + /** + * 新增点检设备 + * + * @param dvCheckMachinery 点检设备 + * @return 结果 + */ + public int insertDvCheckMachinery(DvCheckMachinery dvCheckMachinery); + + /** + * 修改点检设备 + * + * @param dvCheckMachinery 点检设备 + * @return 结果 + */ + public int updateDvCheckMachinery(DvCheckMachinery dvCheckMachinery); + + /** + * 删除点检设备 + * + * @param recordId 点检设备主键 + * @return 结果 + */ + public int deleteDvCheckMachineryByRecordId(Long recordId); + + /** + * 批量删除点检设备 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvCheckMachineryByRecordIds(Long[] recordIds); + + /** + * 根据计划头ID删除对应的设备列表 + * @param planId + * @return + */ + public int deleteByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckPlanMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckPlanMapper.java new file mode 100644 index 0000000..cf15d22 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckPlanMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvCheckPlan; + +/** + * 设备点检计划头Mapper接口 + * + * @author yinjinlu + * @date 2022-06-16 + */ +public interface DvCheckPlanMapper +{ + /** + * 查询设备点检计划头 + * + * @param planId 设备点检计划头主键 + * @return 设备点检计划头 + */ + public DvCheckPlan selectDvCheckPlanByPlanId(Long planId); + + /** + * 查询设备点检计划头列表 + * + * @param dvCheckPlan 设备点检计划头 + * @return 设备点检计划头集合 + */ + public List selectDvCheckPlanList(DvCheckPlan dvCheckPlan); + + public DvCheckPlan checkPlanCodeUnique(DvCheckPlan dvCheckPlan); + + /** + * 新增设备点检计划头 + * + * @param dvCheckPlan 设备点检计划头 + * @return 结果 + */ + public int insertDvCheckPlan(DvCheckPlan dvCheckPlan); + + /** + * 修改设备点检计划头 + * + * @param dvCheckPlan 设备点检计划头 + * @return 结果 + */ + public int updateDvCheckPlan(DvCheckPlan dvCheckPlan); + + /** + * 删除设备点检计划头 + * + * @param planId 设备点检计划头主键 + * @return 结果 + */ + public int deleteDvCheckPlanByPlanId(Long planId); + + /** + * 批量删除设备点检计划头 + * + * @param planIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvCheckPlanByPlanIds(Long[] planIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckSubjectMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckSubjectMapper.java new file mode 100644 index 0000000..d8df716 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvCheckSubjectMapper.java @@ -0,0 +1,71 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvCheckSubject; + +/** + * 点检项目Mapper接口 + * + * @author yinjinlu + * @date 2022-06-18 + */ +public interface DvCheckSubjectMapper +{ + /** + * 查询点检项目 + * + * @param recordId 点检项目主键 + * @return 点检项目 + */ + public DvCheckSubject selectDvCheckSubjectByRecordId(Long recordId); + + /** + * 查询点检项目列表 + * + * @param dvCheckSubject 点检项目 + * @return 点检项目集合 + */ + public List selectDvCheckSubjectList(DvCheckSubject dvCheckSubject); + + + public DvCheckSubject checkSubjectUnique(DvCheckSubject dvCheckSubject); + + /** + * 新增点检项目 + * + * @param dvCheckSubject 点检项目 + * @return 结果 + */ + public int insertDvCheckSubject(DvCheckSubject dvCheckSubject); + + /** + * 修改点检项目 + * + * @param dvCheckSubject 点检项目 + * @return 结果 + */ + public int updateDvCheckSubject(DvCheckSubject dvCheckSubject); + + /** + * 删除点检项目 + * + * @param recordId 点检项目主键 + * @return 结果 + */ + public int deleteDvCheckSubjectByRecordId(Long recordId); + + /** + * 批量删除点检项目 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvCheckSubjectByRecordIds(Long[] recordIds); + + /** + * 根据计划ID删除对应的计划项目 + * @param planId + * @return + */ + public int deleteByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvMachineryMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvMachineryMapper.java new file mode 100644 index 0000000..a994c8b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvMachineryMapper.java @@ -0,0 +1,71 @@ +package com.ktg.mes.dv.mapper; + +import com.ktg.mes.dv.domain.DvMachinery; + +import java.util.List; + +/** + * 设备Mapper接口 + * + * @author yinjinlu + * @date 2022-05-08 + */ +public interface DvMachineryMapper +{ + /** + * 查询设备 + * + * @param machineryId 设备主键 + * @return 设备 + */ + public DvMachinery selectDvMachineryByMachineryId(Long machineryId); + + /** + * 依据设备编码查询设备 + * + * @param machineryCode 设备编码 + * @return 设备 + */ + public DvMachinery selectByMachineryCode( String machineryCode); + + /** + * 查询设备列表 + * + * @param dvMachinery 设备 + * @return 设备集合 + */ + public List selectDvMachineryList(DvMachinery dvMachinery); + + /** + * 新增设备 + * + * @param dvMachinery 设备 + * @return 结果 + */ + public int insertDvMachinery(DvMachinery dvMachinery); + + /** + * 修改设备 + * + * @param dvMachinery 设备 + * @return 结果 + */ + public int updateDvMachinery(DvMachinery dvMachinery); + + /** + * 删除设备 + * + * @param machineryId 设备主键 + * @return 结果 + */ + public int deleteDvMachineryByMachineryId(Long machineryId); + + /** + * 批量删除设备 + * + * @param machineryIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvMachineryByMachineryIds(Long[] machineryIds); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvMachineryTypeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvMachineryTypeMapper.java new file mode 100644 index 0000000..d23424c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvMachineryTypeMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvMachineryType; + +/** + * 设备类型Mapper接口 + * + * @author yinjinlu + * @date 2022-05-08 + */ +public interface DvMachineryTypeMapper +{ + /** + * 查询设备类型 + * + * @param machineryTypeId 设备类型主键 + * @return 设备类型 + */ + public DvMachineryType selectDvMachineryTypeByMachineryTypeId(Long machineryTypeId); + + /** + * 查询设备类型列表 + * + * @param dvMachineryType 设备类型 + * @return 设备类型集合 + */ + public List selectDvMachineryTypeList(DvMachineryType dvMachineryType); + + /** + * 新增设备类型 + * + * @param dvMachineryType 设备类型 + * @return 结果 + */ + public int insertDvMachineryType(DvMachineryType dvMachineryType); + + /** + * 修改设备类型 + * + * @param dvMachineryType 设备类型 + * @return 结果 + */ + public int updateDvMachineryType(DvMachineryType dvMachineryType); + + /** + * 删除设备类型 + * + * @param machineryTypeId 设备类型主键 + * @return 结果 + */ + public int deleteDvMachineryTypeByMachineryTypeId(Long machineryTypeId); + + /** + * 批量删除设备类型 + * + * @param machineryTypeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvMachineryTypeByMachineryTypeIds(Long[] machineryTypeIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvRepairLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvRepairLineMapper.java new file mode 100644 index 0000000..8723326 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvRepairLineMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvRepairLine; + +/** + * 设备维修单行Mapper接口 + * + * @author yinjinlu + * @date 2022-08-08 + */ +public interface DvRepairLineMapper +{ + /** + * 查询设备维修单行 + * + * @param lineId 设备维修单行主键 + * @return 设备维修单行 + */ + public DvRepairLine selectDvRepairLineByLineId(Long lineId); + + /** + * 查询设备维修单行列表 + * + * @param dvRepairLine 设备维修单行 + * @return 设备维修单行集合 + */ + public List selectDvRepairLineList(DvRepairLine dvRepairLine); + + /** + * 新增设备维修单行 + * + * @param dvRepairLine 设备维修单行 + * @return 结果 + */ + public int insertDvRepairLine(DvRepairLine dvRepairLine); + + /** + * 修改设备维修单行 + * + * @param dvRepairLine 设备维修单行 + * @return 结果 + */ + public int updateDvRepairLine(DvRepairLine dvRepairLine); + + /** + * 删除设备维修单行 + * + * @param lineId 设备维修单行主键 + * @return 结果 + */ + public int deleteDvRepairLineByLineId(Long lineId); + + /** + * 批量删除设备维修单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvRepairLineByLineIds(Long[] lineIds); + + public int deleteByRepairId(Long repairId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvRepairMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvRepairMapper.java new file mode 100644 index 0000000..fe508b1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvRepairMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvRepair; + +/** + * 设备维修单Mapper接口 + * + * @author yinjinlu + * @date 2022-08-06 + */ +public interface DvRepairMapper +{ + /** + * 查询设备维修单 + * + * @param repairId 设备维修单主键 + * @return 设备维修单 + */ + public DvRepair selectDvRepairByRepairId(Long repairId); + + /** + * 查询设备维修单列表 + * + * @param dvRepair 设备维修单 + * @return 设备维修单集合 + */ + public List selectDvRepairList(DvRepair dvRepair); + + public DvRepair checkCodeUnique(DvRepair dvRepair); + + + /** + * 新增设备维修单 + * + * @param dvRepair 设备维修单 + * @return 结果 + */ + public int insertDvRepair(DvRepair dvRepair); + + /** + * 修改设备维修单 + * + * @param dvRepair 设备维修单 + * @return 结果 + */ + public int updateDvRepair(DvRepair dvRepair); + + /** + * 删除设备维修单 + * + * @param repairId 设备维修单主键 + * @return 结果 + */ + public int deleteDvRepairByRepairId(Long repairId); + + /** + * 批量删除设备维修单 + * + * @param repairIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvRepairByRepairIds(Long[] repairIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvSubjectMapper.java b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvSubjectMapper.java new file mode 100644 index 0000000..b212167 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/mapper/DvSubjectMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.dv.mapper; + +import java.util.List; +import com.ktg.mes.dv.domain.DvSubject; + +/** + * 设备点检保养项目Mapper接口 + * + * @author yinjinlu + * @date 2022-06-16 + */ +public interface DvSubjectMapper +{ + /** + * 查询设备点检保养项目 + * + * @param subjectId 设备点检保养项目主键 + * @return 设备点检保养项目 + */ + public DvSubject selectDvSubjectBySubjectId(Long subjectId); + + /** + * 查询设备点检保养项目列表 + * + * @param dvSubject 设备点检保养项目 + * @return 设备点检保养项目集合 + */ + public List selectDvSubjectList(DvSubject dvSubject); + + + public DvSubject checkSubjectCodeUnique(DvSubject dvSubject); + + /** + * 新增设备点检保养项目 + * + * @param dvSubject 设备点检保养项目 + * @return 结果 + */ + public int insertDvSubject(DvSubject dvSubject); + + /** + * 修改设备点检保养项目 + * + * @param dvSubject 设备点检保养项目 + * @return 结果 + */ + public int updateDvSubject(DvSubject dvSubject); + + /** + * 删除设备点检保养项目 + * + * @param subjectId 设备点检保养项目主键 + * @return 结果 + */ + public int deleteDvSubjectBySubjectId(Long subjectId); + + /** + * 批量删除设备点检保养项目 + * + * @param subjectIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDvSubjectBySubjectIds(Long[] subjectIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckMachineryService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckMachineryService.java new file mode 100644 index 0000000..2529dd9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckMachineryService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvCheckMachinery; + +/** + * 点检设备Service接口 + * + * @author yinjinlu + * @date 2022-06-17 + */ +public interface IDvCheckMachineryService +{ + /** + * 查询点检设备 + * + * @param recordId 点检设备主键 + * @return 点检设备 + */ + public DvCheckMachinery selectDvCheckMachineryByRecordId(Long recordId); + + /** + * 查询点检设备列表 + * + * @param dvCheckMachinery 点检设备 + * @return 点检设备集合 + */ + public List selectDvCheckMachineryList(DvCheckMachinery dvCheckMachinery); + + public String checkMachineryUnique(DvCheckMachinery dvCheckMachinery); + + /** + * 新增点检设备 + * + * @param dvCheckMachinery 点检设备 + * @return 结果 + */ + public int insertDvCheckMachinery(DvCheckMachinery dvCheckMachinery); + + /** + * 修改点检设备 + * + * @param dvCheckMachinery 点检设备 + * @return 结果 + */ + public int updateDvCheckMachinery(DvCheckMachinery dvCheckMachinery); + + /** + * 批量删除点检设备 + * + * @param recordIds 需要删除的点检设备主键集合 + * @return 结果 + */ + public int deleteDvCheckMachineryByRecordIds(Long[] recordIds); + + /** + * 删除点检设备信息 + * + * @param recordId 点检设备主键 + * @return 结果 + */ + public int deleteDvCheckMachineryByRecordId(Long recordId); + + /** + * 根据计划头ID删除对应的设备列表 + * @param planId + * @return + */ + public int deleteByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckPlanService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckPlanService.java new file mode 100644 index 0000000..daad349 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckPlanService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvCheckPlan; + +/** + * 设备点检计划头Service接口 + * + * @author yinjinlu + * @date 2022-06-16 + */ +public interface IDvCheckPlanService +{ + /** + * 查询设备点检计划头 + * + * @param planId 设备点检计划头主键 + * @return 设备点检计划头 + */ + public DvCheckPlan selectDvCheckPlanByPlanId(Long planId); + + /** + * 查询设备点检计划头列表 + * + * @param dvCheckPlan 设备点检计划头 + * @return 设备点检计划头集合 + */ + public List selectDvCheckPlanList(DvCheckPlan dvCheckPlan); + + /** + * 检查计划编码是否唯一 + * @param dvCheckPlan + * @return + */ + public String checkPlanCodeUnique(DvCheckPlan dvCheckPlan); + + /** + * 新增设备点检计划头 + * + * @param dvCheckPlan 设备点检计划头 + * @return 结果 + */ + public int insertDvCheckPlan(DvCheckPlan dvCheckPlan); + + /** + * 修改设备点检计划头 + * + * @param dvCheckPlan 设备点检计划头 + * @return 结果 + */ + public int updateDvCheckPlan(DvCheckPlan dvCheckPlan); + + /** + * 批量删除设备点检计划头 + * + * @param planIds 需要删除的设备点检计划头主键集合 + * @return 结果 + */ + public int deleteDvCheckPlanByPlanIds(Long[] planIds); + + /** + * 删除设备点检计划头信息 + * + * @param planId 设备点检计划头主键 + * @return 结果 + */ + public int deleteDvCheckPlanByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckSubjectService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckSubjectService.java new file mode 100644 index 0000000..dae4fa5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvCheckSubjectService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvCheckSubject; + +/** + * 点检项目Service接口 + * + * @author yinjinlu + * @date 2022-06-18 + */ +public interface IDvCheckSubjectService +{ + /** + * 查询点检项目 + * + * @param recordId 点检项目主键 + * @return 点检项目 + */ + public DvCheckSubject selectDvCheckSubjectByRecordId(Long recordId); + + /** + * 查询点检项目列表 + * + * @param dvCheckSubject 点检项目 + * @return 点检项目集合 + */ + public List selectDvCheckSubjectList(DvCheckSubject dvCheckSubject); + + + /** + * 检查当前计划下,点检项目是否唯一 + * @param dvCheckSubject + * @return + */ + public String checkSubjectUnique(DvCheckSubject dvCheckSubject); + + /** + * 新增点检项目 + * + * @param dvCheckSubject 点检项目 + * @return 结果 + */ + public int insertDvCheckSubject(DvCheckSubject dvCheckSubject); + + /** + * 修改点检项目 + * + * @param dvCheckSubject 点检项目 + * @return 结果 + */ + public int updateDvCheckSubject(DvCheckSubject dvCheckSubject); + + /** + * 批量删除点检项目 + * + * @param recordIds 需要删除的点检项目主键集合 + * @return 结果 + */ + public int deleteDvCheckSubjectByRecordIds(Long[] recordIds); + + /** + * 删除点检项目信息 + * + * @param recordId 点检项目主键 + * @return 结果 + */ + public int deleteDvCheckSubjectByRecordId(Long recordId); + + /** + * 根据计划ID删除对应的计划项目 + * @param planId + * @return + */ + public int deleteByPlanId(Long planId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvMachineryService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvMachineryService.java new file mode 100644 index 0000000..2bcbcf1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvMachineryService.java @@ -0,0 +1,73 @@ +package com.ktg.mes.dv.service; + +import com.ktg.mes.dv.domain.DvMachinery; + +import java.util.List; + +/** + * 设备Service接口 + * + * @author yinjinlu + * @date 2022-05-08 + */ +public interface IDvMachineryService +{ + /** + * 查询设备 + * + * @param machineryId 设备主键 + * @return 设备 + */ + public DvMachinery selectDvMachineryByMachineryId(Long machineryId); + + /** + * 查询设备列表 + * + * @param dvMachinery 设备 + * @return 设备集合 + */ + public List selectDvMachineryList(DvMachinery dvMachinery); + + /** + * 新增设备 + * + * @param dvMachinery 设备 + * @return 结果 + */ + public int insertDvMachinery(DvMachinery dvMachinery); + + /** + * 修改设备 + * + * @param dvMachinery 设备 + * @return 结果 + */ + public int updateDvMachinery(DvMachinery dvMachinery); + + /** + * 批量删除设备 + * + * @param machineryIds 需要删除的设备主键集合 + * @return 结果 + */ + public int deleteDvMachineryByMachineryIds(Long[] machineryIds); + + /** + * 删除设备信息 + * + * @param machineryId 设备主键 + * @return 结果 + */ + public int deleteDvMachineryByMachineryId(Long machineryId); + + /** + * 依据上传的文件,批量导入或更新设备信息 + * + * @param machineryList 设备信息列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + public String importMachinery(List machineryList, Boolean isUpdateSupport, String operName); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvMachineryTypeService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvMachineryTypeService.java new file mode 100644 index 0000000..a5fa963 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvMachineryTypeService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvMachineryType; + +/** + * 设备类型Service接口 + * + * @author yinjinlu + * @date 2022-05-08 + */ +public interface IDvMachineryTypeService +{ + /** + * 查询设备类型 + * + * @param machineryTypeId 设备类型主键 + * @return 设备类型 + */ + public DvMachineryType selectDvMachineryTypeByMachineryTypeId(Long machineryTypeId); + + /** + * 查询设备类型列表 + * + * @param dvMachineryType 设备类型 + * @return 设备类型集合 + */ + public List selectDvMachineryTypeList(DvMachineryType dvMachineryType); + + /** + * 新增设备类型 + * + * @param dvMachineryType 设备类型 + * @return 结果 + */ + public int insertDvMachineryType(DvMachineryType dvMachineryType); + + /** + * 修改设备类型 + * + * @param dvMachineryType 设备类型 + * @return 结果 + */ + public int updateDvMachineryType(DvMachineryType dvMachineryType); + + /** + * 批量删除设备类型 + * + * @param machineryTypeIds 需要删除的设备类型主键集合 + * @return 结果 + */ + public int deleteDvMachineryTypeByMachineryTypeIds(Long[] machineryTypeIds); + + /** + * 删除设备类型信息 + * + * @param machineryTypeId 设备类型主键 + * @return 结果 + */ + public int deleteDvMachineryTypeByMachineryTypeId(Long machineryTypeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvRepairLineService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvRepairLineService.java new file mode 100644 index 0000000..536ce55 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvRepairLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvRepairLine; + +/** + * 设备维修单行Service接口 + * + * @author yinjinlu + * @date 2022-08-08 + */ +public interface IDvRepairLineService +{ + /** + * 查询设备维修单行 + * + * @param lineId 设备维修单行主键 + * @return 设备维修单行 + */ + public DvRepairLine selectDvRepairLineByLineId(Long lineId); + + /** + * 查询设备维修单行列表 + * + * @param dvRepairLine 设备维修单行 + * @return 设备维修单行集合 + */ + public List selectDvRepairLineList(DvRepairLine dvRepairLine); + + /** + * 新增设备维修单行 + * + * @param dvRepairLine 设备维修单行 + * @return 结果 + */ + public int insertDvRepairLine(DvRepairLine dvRepairLine); + + /** + * 修改设备维修单行 + * + * @param dvRepairLine 设备维修单行 + * @return 结果 + */ + public int updateDvRepairLine(DvRepairLine dvRepairLine); + + /** + * 批量删除设备维修单行 + * + * @param lineIds 需要删除的设备维修单行主键集合 + * @return 结果 + */ + public int deleteDvRepairLineByLineIds(Long[] lineIds); + + /** + * 删除设备维修单行信息 + * + * @param lineId 设备维修单行主键 + * @return 结果 + */ + public int deleteDvRepairLineByLineId(Long lineId); + + /** + * 根据维修单头删除所有行信息 + * @param repairId + * @return + */ + public int deleteByRepairId(Long repairId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvRepairService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvRepairService.java new file mode 100644 index 0000000..8a1c0cb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvRepairService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvRepair; + +/** + * 设备维修单Service接口 + * + * @author yinjinlu + * @date 2022-08-06 + */ +public interface IDvRepairService +{ + /** + * 查询设备维修单 + * + * @param repairId 设备维修单主键 + * @return 设备维修单 + */ + public DvRepair selectDvRepairByRepairId(Long repairId); + + /** + * 查询设备维修单列表 + * + * @param dvRepair 设备维修单 + * @return 设备维修单集合 + */ + public List selectDvRepairList(DvRepair dvRepair); + + /** + * 检测维修单编号是否唯一 + * @param dvRepair + * @return + */ + public String checkCodeUnique(DvRepair dvRepair); + + /** + * 新增设备维修单 + * + * @param dvRepair 设备维修单 + * @return 结果 + */ + public int insertDvRepair(DvRepair dvRepair); + + /** + * 修改设备维修单 + * + * @param dvRepair 设备维修单 + * @return 结果 + */ + public int updateDvRepair(DvRepair dvRepair); + + /** + * 批量删除设备维修单 + * + * @param repairIds 需要删除的设备维修单主键集合 + * @return 结果 + */ + public int deleteDvRepairByRepairIds(Long[] repairIds); + + /** + * 删除设备维修单信息 + * + * @param repairId 设备维修单主键 + * @return 结果 + */ + public int deleteDvRepairByRepairId(Long repairId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvSubjectService.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvSubjectService.java new file mode 100644 index 0000000..260034e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/IDvSubjectService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.dv.service; + +import java.util.List; +import com.ktg.mes.dv.domain.DvSubject; + +/** + * 设备点检保养项目Service接口 + * + * @author yinjinlu + * @date 2022-06-16 + */ +public interface IDvSubjectService +{ + /** + * 查询设备点检保养项目 + * + * @param subjectId 设备点检保养项目主键 + * @return 设备点检保养项目 + */ + public DvSubject selectDvSubjectBySubjectId(Long subjectId); + + /** + * 查询设备点检保养项目列表 + * + * @param dvSubject 设备点检保养项目 + * @return 设备点检保养项目集合 + */ + public List selectDvSubjectList(DvSubject dvSubject); + + /** + * 检查项目编码是否重复 + * @param dvSubject + * @return + */ + public String checkSubjectCodeUnique(DvSubject dvSubject); + + /** + * 新增设备点检保养项目 + * + * @param dvSubject 设备点检保养项目 + * @return 结果 + */ + public int insertDvSubject(DvSubject dvSubject); + + /** + * 修改设备点检保养项目 + * + * @param dvSubject 设备点检保养项目 + * @return 结果 + */ + public int updateDvSubject(DvSubject dvSubject); + + /** + * 批量删除设备点检保养项目 + * + * @param subjectIds 需要删除的设备点检保养项目主键集合 + * @return 结果 + */ + public int deleteDvSubjectBySubjectIds(Long[] subjectIds); + + /** + * 删除设备点检保养项目信息 + * + * @param subjectId 设备点检保养项目主键 + * @return 结果 + */ + public int deleteDvSubjectBySubjectId(Long subjectId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckMachineryServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckMachineryServiceImpl.java new file mode 100644 index 0000000..b9da8fe --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckMachineryServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvCheckMachineryMapper; +import com.ktg.mes.dv.domain.DvCheckMachinery; +import com.ktg.mes.dv.service.IDvCheckMachineryService; + +/** + * 点检设备Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-17 + */ +@Service +public class DvCheckMachineryServiceImpl implements IDvCheckMachineryService +{ + @Autowired + private DvCheckMachineryMapper dvCheckMachineryMapper; + + /** + * 查询点检设备 + * + * @param recordId 点检设备主键 + * @return 点检设备 + */ + @Override + public DvCheckMachinery selectDvCheckMachineryByRecordId(Long recordId) + { + return dvCheckMachineryMapper.selectDvCheckMachineryByRecordId(recordId); + } + + /** + * 查询点检设备列表 + * + * @param dvCheckMachinery 点检设备 + * @return 点检设备 + */ + @Override + public List selectDvCheckMachineryList(DvCheckMachinery dvCheckMachinery) + { + return dvCheckMachineryMapper.selectDvCheckMachineryList(dvCheckMachinery); + } + + @Override + public String checkMachineryUnique(DvCheckMachinery dvCheckMachinery) { + DvCheckMachinery machinery = dvCheckMachineryMapper.checkMachineryUnique(dvCheckMachinery); + Long recordId = dvCheckMachinery.getRecordId()==null?-1L:dvCheckMachinery.getRecordId(); + if(StringUtils.isNotNull(machinery) && machinery.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增点检设备 + * + * @param dvCheckMachinery 点检设备 + * @return 结果 + */ + @Override + public int insertDvCheckMachinery(DvCheckMachinery dvCheckMachinery) + { + dvCheckMachinery.setCreateTime(DateUtils.getNowDate()); + return dvCheckMachineryMapper.insertDvCheckMachinery(dvCheckMachinery); + } + + /** + * 修改点检设备 + * + * @param dvCheckMachinery 点检设备 + * @return 结果 + */ + @Override + public int updateDvCheckMachinery(DvCheckMachinery dvCheckMachinery) + { + dvCheckMachinery.setUpdateTime(DateUtils.getNowDate()); + return dvCheckMachineryMapper.updateDvCheckMachinery(dvCheckMachinery); + } + + /** + * 批量删除点检设备 + * + * @param recordIds 需要删除的点检设备主键 + * @return 结果 + */ + @Override + public int deleteDvCheckMachineryByRecordIds(Long[] recordIds) + { + return dvCheckMachineryMapper.deleteDvCheckMachineryByRecordIds(recordIds); + } + + /** + * 删除点检设备信息 + * + * @param recordId 点检设备主键 + * @return 结果 + */ + @Override + public int deleteDvCheckMachineryByRecordId(Long recordId) + { + return dvCheckMachineryMapper.deleteDvCheckMachineryByRecordId(recordId); + } + + @Override + public int deleteByPlanId(Long planId) { + return dvCheckMachineryMapper.deleteByPlanId(planId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckPlanServiceImpl.java new file mode 100644 index 0000000..6d376a4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckPlanServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvCheckPlanMapper; +import com.ktg.mes.dv.domain.DvCheckPlan; +import com.ktg.mes.dv.service.IDvCheckPlanService; + +/** + * 设备点检计划头Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-16 + */ +@Service +public class DvCheckPlanServiceImpl implements IDvCheckPlanService +{ + @Autowired + private DvCheckPlanMapper dvCheckPlanMapper; + + /** + * 查询设备点检计划头 + * + * @param planId 设备点检计划头主键 + * @return 设备点检计划头 + */ + @Override + public DvCheckPlan selectDvCheckPlanByPlanId(Long planId) + { + return dvCheckPlanMapper.selectDvCheckPlanByPlanId(planId); + } + + /** + * 查询设备点检计划头列表 + * + * @param dvCheckPlan 设备点检计划头 + * @return 设备点检计划头 + */ + @Override + public List selectDvCheckPlanList(DvCheckPlan dvCheckPlan) + { + return dvCheckPlanMapper.selectDvCheckPlanList(dvCheckPlan); + } + + @Override + public String checkPlanCodeUnique(DvCheckPlan dvCheckPlan) { + DvCheckPlan plan = dvCheckPlanMapper.checkPlanCodeUnique(dvCheckPlan); + Long planId = dvCheckPlan.getPlanId()==null?-1L:dvCheckPlan.getPlanId(); + if(StringUtils.isNotNull(plan) && plan.getPlanId().longValue()==planId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增设备点检计划头 + * + * @param dvCheckPlan 设备点检计划头 + * @return 结果 + */ + @Override + public int insertDvCheckPlan(DvCheckPlan dvCheckPlan) + { + dvCheckPlan.setCreateTime(DateUtils.getNowDate()); + return dvCheckPlanMapper.insertDvCheckPlan(dvCheckPlan); + } + + /** + * 修改设备点检计划头 + * + * @param dvCheckPlan 设备点检计划头 + * @return 结果 + */ + @Override + public int updateDvCheckPlan(DvCheckPlan dvCheckPlan) + { + dvCheckPlan.setUpdateTime(DateUtils.getNowDate()); + return dvCheckPlanMapper.updateDvCheckPlan(dvCheckPlan); + } + + /** + * 批量删除设备点检计划头 + * + * @param planIds 需要删除的设备点检计划头主键 + * @return 结果 + */ + @Override + public int deleteDvCheckPlanByPlanIds(Long[] planIds) + { + return dvCheckPlanMapper.deleteDvCheckPlanByPlanIds(planIds); + } + + /** + * 删除设备点检计划头信息 + * + * @param planId 设备点检计划头主键 + * @return 结果 + */ + @Override + public int deleteDvCheckPlanByPlanId(Long planId) + { + return dvCheckPlanMapper.deleteDvCheckPlanByPlanId(planId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckSubjectServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckSubjectServiceImpl.java new file mode 100644 index 0000000..7729ffe --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvCheckSubjectServiceImpl.java @@ -0,0 +1,116 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvCheckSubjectMapper; +import com.ktg.mes.dv.domain.DvCheckSubject; +import com.ktg.mes.dv.service.IDvCheckSubjectService; + +/** + * 点检项目Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-18 + */ +@Service +public class DvCheckSubjectServiceImpl implements IDvCheckSubjectService +{ + @Autowired + private DvCheckSubjectMapper dvCheckSubjectMapper; + + /** + * 查询点检项目 + * + * @param recordId 点检项目主键 + * @return 点检项目 + */ + @Override + public DvCheckSubject selectDvCheckSubjectByRecordId(Long recordId) + { + return dvCheckSubjectMapper.selectDvCheckSubjectByRecordId(recordId); + } + + /** + * 查询点检项目列表 + * + * @param dvCheckSubject 点检项目 + * @return 点检项目 + */ + @Override + public List selectDvCheckSubjectList(DvCheckSubject dvCheckSubject) + { + return dvCheckSubjectMapper.selectDvCheckSubjectList(dvCheckSubject); + } + + @Override + public String checkSubjectUnique(DvCheckSubject dvCheckSubject) { + DvCheckSubject subject = dvCheckSubjectMapper.checkSubjectUnique(dvCheckSubject); + Long recordId = dvCheckSubject.getRecordId()==null?-1L:dvCheckSubject.getRecordId(); + if(StringUtils.isNotNull(subject) && subject.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + + return UserConstants.UNIQUE; + } + + /** + * 新增点检项目 + * + * @param dvCheckSubject 点检项目 + * @return 结果 + */ + @Override + public int insertDvCheckSubject(DvCheckSubject dvCheckSubject) + { + dvCheckSubject.setCreateTime(DateUtils.getNowDate()); + return dvCheckSubjectMapper.insertDvCheckSubject(dvCheckSubject); + } + + /** + * 修改点检项目 + * + * @param dvCheckSubject 点检项目 + * @return 结果 + */ + @Override + public int updateDvCheckSubject(DvCheckSubject dvCheckSubject) + { + dvCheckSubject.setUpdateTime(DateUtils.getNowDate()); + return dvCheckSubjectMapper.updateDvCheckSubject(dvCheckSubject); + } + + /** + * 批量删除点检项目 + * + * @param recordIds 需要删除的点检项目主键 + * @return 结果 + */ + @Override + public int deleteDvCheckSubjectByRecordIds(Long[] recordIds) + { + return dvCheckSubjectMapper.deleteDvCheckSubjectByRecordIds(recordIds); + } + + /** + * 删除点检项目信息 + * + * @param recordId 点检项目主键 + * @return 结果 + */ + @Override + public int deleteDvCheckSubjectByRecordId(Long recordId) + { + return dvCheckSubjectMapper.deleteDvCheckSubjectByRecordId(recordId); + } + + @Override + public int deleteByPlanId(Long planId) { + return dvCheckSubjectMapper.deleteByPlanId(planId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvMachineryServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvMachineryServiceImpl.java new file mode 100644 index 0000000..8eb1ed5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvMachineryServiceImpl.java @@ -0,0 +1,132 @@ +package com.ktg.mes.dv.service.impl; + +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.dv.domain.DvMachinery; +import com.ktg.mes.dv.mapper.DvMachineryMapper; +import com.ktg.mes.dv.service.IDvMachineryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 设备Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-08 + */ +@Service +public class DvMachineryServiceImpl implements IDvMachineryService +{ + @Autowired + private DvMachineryMapper dvMachineryMapper; + + /** + * 查询设备 + * + * @param machineryId 设备主键 + * @return 设备 + */ + @Override + public DvMachinery selectDvMachineryByMachineryId(Long machineryId) + { + return dvMachineryMapper.selectDvMachineryByMachineryId(machineryId); + } + + /** + * 查询设备列表 + * + * @param dvMachinery 设备 + * @return 设备 + */ + @Override + public List selectDvMachineryList(DvMachinery dvMachinery) + { + return dvMachineryMapper.selectDvMachineryList(dvMachinery); + } + + /** + * 新增设备 + * + * @param dvMachinery 设备 + * @return 结果 + */ + @Override + public int insertDvMachinery(DvMachinery dvMachinery) + { + dvMachinery.setCreateTime(DateUtils.getNowDate()); + return dvMachineryMapper.insertDvMachinery(dvMachinery); + } + + /** + * 修改设备 + * + * @param dvMachinery 设备 + * @return 结果 + */ + @Override + public int updateDvMachinery(DvMachinery dvMachinery) + { + dvMachinery.setUpdateTime(DateUtils.getNowDate()); + return dvMachineryMapper.updateDvMachinery(dvMachinery); + } + + /** + * 批量删除设备 + * + * @param machineryIds 需要删除的设备主键 + * @return 结果 + */ + @Override + public int deleteDvMachineryByMachineryIds(Long[] machineryIds) + { + return dvMachineryMapper.deleteDvMachineryByMachineryIds(machineryIds); + } + + /** + * 删除设备信息 + * + * @param machineryId 设备主键 + * @return 结果 + */ + @Override + public int deleteDvMachineryByMachineryId(Long machineryId) + { + return dvMachineryMapper.deleteDvMachineryByMachineryId(machineryId); + } + + /** + * 依据上传的文件更新或插入设备信息 + */ + @Override + public String importMachinery(List machineryList, Boolean isUpdateSupport, String operName) { + if (machineryList == null || machineryList.isEmpty()) { + return "导入数据为空"; + } + int successCount = 0; + int failureCount = 0; + for (DvMachinery machinery : machineryList) { + // 去除空格 + String machineryCode = machinery.getMachineryCode().trim(); + DvMachinery existing = dvMachineryMapper.selectByMachineryCode(machineryCode); + if (existing != null) { + if (isUpdateSupport) { + // 更新数据 + machinery.setMachineryId(existing.getMachineryId()); // 确保使用现有 ID 进行更新 + dvMachineryMapper.updateDvMachinery(machinery); + successCount++; + } else { + // 不更新数据 + failureCount++; + } + } else { + // 新增数据 + dvMachineryMapper.insertDvMachinery(machinery); + successCount++; + } + } + return String.format("操作用户:%s,导入完成,成功 %d 条,失败 %d 条。", operName, successCount, failureCount); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvMachineryTypeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvMachineryTypeServiceImpl.java new file mode 100644 index 0000000..12fe0f0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvMachineryTypeServiceImpl.java @@ -0,0 +1,105 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; + +import com.ktg.common.core.domain.entity.ItemType; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvMachineryTypeMapper; +import com.ktg.mes.dv.domain.DvMachineryType; +import com.ktg.mes.dv.service.IDvMachineryTypeService; + +/** + * 设备类型Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-08 + */ +@Service +public class DvMachineryTypeServiceImpl implements IDvMachineryTypeService +{ + @Autowired + private DvMachineryTypeMapper dvMachineryTypeMapper; + + /** + * 查询设备类型 + * + * @param machineryTypeId 设备类型主键 + * @return 设备类型 + */ + @Override + public DvMachineryType selectDvMachineryTypeByMachineryTypeId(Long machineryTypeId) + { + return dvMachineryTypeMapper.selectDvMachineryTypeByMachineryTypeId(machineryTypeId); + } + + /** + * 查询设备类型列表 + * + * @param dvMachineryType 设备类型 + * @return 设备类型 + */ + @Override + public List selectDvMachineryTypeList(DvMachineryType dvMachineryType) + { + return dvMachineryTypeMapper.selectDvMachineryTypeList(dvMachineryType); + } + + /** + * 新增设备类型 + * + * @param dvMachineryType 设备类型 + * @return 结果 + */ + @Override + public int insertDvMachineryType(DvMachineryType dvMachineryType) + { + if(dvMachineryType.getParentTypeId()!= null){ + DvMachineryType parent = dvMachineryTypeMapper.selectDvMachineryTypeByMachineryTypeId(dvMachineryType.getParentTypeId()); + if(StringUtils.isNotNull(parent)){ + dvMachineryType.setAncestors(parent.getAncestors()+","+parent.getMachineryTypeId()); + } + } + dvMachineryType.setCreateTime(DateUtils.getNowDate()); + return dvMachineryTypeMapper.insertDvMachineryType(dvMachineryType); + } + + /** + * 修改设备类型 + * + * @param dvMachineryType 设备类型 + * @return 结果 + */ + @Override + public int updateDvMachineryType(DvMachineryType dvMachineryType) + { + dvMachineryType.setUpdateTime(DateUtils.getNowDate()); + return dvMachineryTypeMapper.updateDvMachineryType(dvMachineryType); + } + + /** + * 批量删除设备类型 + * + * @param machineryTypeIds 需要删除的设备类型主键 + * @return 结果 + */ + @Override + public int deleteDvMachineryTypeByMachineryTypeIds(Long[] machineryTypeIds) + { + return dvMachineryTypeMapper.deleteDvMachineryTypeByMachineryTypeIds(machineryTypeIds); + } + + /** + * 删除设备类型信息 + * + * @param machineryTypeId 设备类型主键 + * @return 结果 + */ + @Override + public int deleteDvMachineryTypeByMachineryTypeId(Long machineryTypeId) + { + return dvMachineryTypeMapper.deleteDvMachineryTypeByMachineryTypeId(machineryTypeId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvRepairLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvRepairLineServiceImpl.java new file mode 100644 index 0000000..a9a4413 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvRepairLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvRepairLineMapper; +import com.ktg.mes.dv.domain.DvRepairLine; +import com.ktg.mes.dv.service.IDvRepairLineService; + +/** + * 设备维修单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-08 + */ +@Service +public class DvRepairLineServiceImpl implements IDvRepairLineService +{ + @Autowired + private DvRepairLineMapper dvRepairLineMapper; + + /** + * 查询设备维修单行 + * + * @param lineId 设备维修单行主键 + * @return 设备维修单行 + */ + @Override + public DvRepairLine selectDvRepairLineByLineId(Long lineId) + { + return dvRepairLineMapper.selectDvRepairLineByLineId(lineId); + } + + /** + * 查询设备维修单行列表 + * + * @param dvRepairLine 设备维修单行 + * @return 设备维修单行 + */ + @Override + public List selectDvRepairLineList(DvRepairLine dvRepairLine) + { + return dvRepairLineMapper.selectDvRepairLineList(dvRepairLine); + } + + /** + * 新增设备维修单行 + * + * @param dvRepairLine 设备维修单行 + * @return 结果 + */ + @Override + public int insertDvRepairLine(DvRepairLine dvRepairLine) + { + dvRepairLine.setCreateTime(DateUtils.getNowDate()); + return dvRepairLineMapper.insertDvRepairLine(dvRepairLine); + } + + /** + * 修改设备维修单行 + * + * @param dvRepairLine 设备维修单行 + * @return 结果 + */ + @Override + public int updateDvRepairLine(DvRepairLine dvRepairLine) + { + dvRepairLine.setUpdateTime(DateUtils.getNowDate()); + return dvRepairLineMapper.updateDvRepairLine(dvRepairLine); + } + + /** + * 批量删除设备维修单行 + * + * @param lineIds 需要删除的设备维修单行主键 + * @return 结果 + */ + @Override + public int deleteDvRepairLineByLineIds(Long[] lineIds) + { + return dvRepairLineMapper.deleteDvRepairLineByLineIds(lineIds); + } + + /** + * 删除设备维修单行信息 + * + * @param lineId 设备维修单行主键 + * @return 结果 + */ + @Override + public int deleteDvRepairLineByLineId(Long lineId) + { + return dvRepairLineMapper.deleteDvRepairLineByLineId(lineId); + } + + @Override + public int deleteByRepairId(Long repairId) { + return dvRepairLineMapper.deleteByRepairId(repairId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvRepairServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvRepairServiceImpl.java new file mode 100644 index 0000000..50ee650 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvRepairServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvRepairMapper; +import com.ktg.mes.dv.domain.DvRepair; +import com.ktg.mes.dv.service.IDvRepairService; + +/** + * 设备维修单Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-06 + */ +@Service +public class DvRepairServiceImpl implements IDvRepairService +{ + @Autowired + private DvRepairMapper dvRepairMapper; + + /** + * 查询设备维修单 + * + * @param repairId 设备维修单主键 + * @return 设备维修单 + */ + @Override + public DvRepair selectDvRepairByRepairId(Long repairId) + { + return dvRepairMapper.selectDvRepairByRepairId(repairId); + } + + /** + * 查询设备维修单列表 + * + * @param dvRepair 设备维修单 + * @return 设备维修单 + */ + @Override + public List selectDvRepairList(DvRepair dvRepair) + { + return dvRepairMapper.selectDvRepairList(dvRepair); + } + + @Override + public String checkCodeUnique(DvRepair dvRepair) { + DvRepair rp = dvRepairMapper.checkCodeUnique(dvRepair); + Long repairId = dvRepair.getRepairId() ==null?-1L: dvRepair.getRepairId(); + if(StringUtils.isNotNull(rp) && repairId.longValue() != rp.getRepairId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增设备维修单 + * + * @param dvRepair 设备维修单 + * @return 结果 + */ + @Override + public int insertDvRepair(DvRepair dvRepair) + { + dvRepair.setCreateTime(DateUtils.getNowDate()); + return dvRepairMapper.insertDvRepair(dvRepair); + } + + /** + * 修改设备维修单 + * + * @param dvRepair 设备维修单 + * @return 结果 + */ + @Override + public int updateDvRepair(DvRepair dvRepair) + { + dvRepair.setUpdateTime(DateUtils.getNowDate()); + return dvRepairMapper.updateDvRepair(dvRepair); + } + + /** + * 批量删除设备维修单 + * + * @param repairIds 需要删除的设备维修单主键 + * @return 结果 + */ + @Override + public int deleteDvRepairByRepairIds(Long[] repairIds) + { + return dvRepairMapper.deleteDvRepairByRepairIds(repairIds); + } + + /** + * 删除设备维修单信息 + * + * @param repairId 设备维修单主键 + * @return 结果 + */ + @Override + public int deleteDvRepairByRepairId(Long repairId) + { + return dvRepairMapper.deleteDvRepairByRepairId(repairId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvSubjectServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvSubjectServiceImpl.java new file mode 100644 index 0000000..b449892 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/service/impl/DvSubjectServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.dv.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.dv.mapper.DvSubjectMapper; +import com.ktg.mes.dv.domain.DvSubject; +import com.ktg.mes.dv.service.IDvSubjectService; + +/** + * 设备点检保养项目Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-16 + */ +@Service +public class DvSubjectServiceImpl implements IDvSubjectService +{ + @Autowired + private DvSubjectMapper dvSubjectMapper; + + /** + * 查询设备点检保养项目 + * + * @param subjectId 设备点检保养项目主键 + * @return 设备点检保养项目 + */ + @Override + public DvSubject selectDvSubjectBySubjectId(Long subjectId) + { + return dvSubjectMapper.selectDvSubjectBySubjectId(subjectId); + } + + /** + * 查询设备点检保养项目列表 + * + * @param dvSubject 设备点检保养项目 + * @return 设备点检保养项目 + */ + @Override + public List selectDvSubjectList(DvSubject dvSubject) + { + return dvSubjectMapper.selectDvSubjectList(dvSubject); + } + + @Override + public String checkSubjectCodeUnique(DvSubject dvSubject) { + DvSubject subject = dvSubjectMapper.checkSubjectCodeUnique(dvSubject); + Long subjectId = dvSubject.getSubjectId()==null?-1L:dvSubject.getSubjectId(); + if(StringUtils.isNotNull(subject) && subject.getSubjectId().longValue() == subjectId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增设备点检保养项目 + * + * @param dvSubject 设备点检保养项目 + * @return 结果 + */ + @Override + public int insertDvSubject(DvSubject dvSubject) + { + dvSubject.setCreateTime(DateUtils.getNowDate()); + return dvSubjectMapper.insertDvSubject(dvSubject); + } + + /** + * 修改设备点检保养项目 + * + * @param dvSubject 设备点检保养项目 + * @return 结果 + */ + @Override + public int updateDvSubject(DvSubject dvSubject) + { + dvSubject.setUpdateTime(DateUtils.getNowDate()); + return dvSubjectMapper.updateDvSubject(dvSubject); + } + + /** + * 批量删除设备点检保养项目 + * + * @param subjectIds 需要删除的设备点检保养项目主键 + * @return 结果 + */ + @Override + public int deleteDvSubjectBySubjectIds(Long[] subjectIds) + { + return dvSubjectMapper.deleteDvSubjectBySubjectIds(subjectIds); + } + + /** + * 删除设备点检保养项目信息 + * + * @param subjectId 设备点检保养项目主键 + * @return 结果 + */ + @Override + public int deleteDvSubjectBySubjectId(Long subjectId) + { + return dvSubjectMapper.deleteDvSubjectBySubjectId(subjectId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/ItemTypeController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/ItemTypeController.java new file mode 100644 index 0000000..666d5c3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/ItemTypeController.java @@ -0,0 +1,138 @@ +package com.ktg.mes.md.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.ItemType; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.service.IItemTypeService; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Iterator; +import java.util.List; + +@RestController +@RequestMapping("/mes/md/itemtype") +public class ItemTypeController extends BaseController { + + @Autowired + private IItemTypeService iItemTypeService; + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询分类列表 + * @param itemType + * @return + */ + @GetMapping("/list") + public AjaxResult list(ItemType itemType){ + List list =iItemTypeService.selectItemTypeList(itemType); + return AjaxResult.success(list); + } + + /** + * 查询部门列表(排除当前和父节点) + * @param itemTypeId + * @return + */ + @GetMapping("/list/exclude/{itemTypeId}") + public AjaxResult excludeChild(@PathVariable(value = "itemTypeId",required = false)Long itemTypeId){ + List list = iItemTypeService.selectItemTypeList(new ItemType()); + Iterator it = list.iterator(); + Long parentTypeId =0L; + while (it.hasNext()){ + ItemType itemType = (ItemType) it.next(); + if(itemType.getItemTypeId() == itemTypeId){ + parentTypeId = itemType.getParentTypeId(); + it.remove(); + } + + if(itemType.getItemTypeId() == parentTypeId){ + it.remove(); + } + } + return AjaxResult.success(list); + } + + /** + * 查询部门详情 + * @param itemTypeId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:md:itemtype:query')") + @GetMapping(value = "/{itemTypeId}") + public AjaxResult getInfo(@PathVariable Long itemTypeId){ + //权限校验? + return AjaxResult.success(iItemTypeService.selectItemTypeById(itemTypeId)); + } + + /** + * 获取树形结构数据 + * @param itemType + * @return + */ + @GetMapping("/treeselect") + public AjaxResult treeSelect(ItemType itemType){ + List list = iItemTypeService.selectItemTypeList(itemType); + return AjaxResult.success(iItemTypeService.buildTreeSelect(list)); + } + + + @PreAuthorize("@ss.hasPermi('mes:md:itemtype:add')") + @Log(title = "新增物料产品分类信息",businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody ItemType itemType){ + + if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeCodeUnique(itemType))){ + return AjaxResult.error("分类"+itemType.getItemTypeCode()+"编码已存在"); + } + if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeNameUnique(itemType))){ + return AjaxResult.error("分类"+itemType.getItemTypeCode()+"名称已存在"); + } + if(itemType.getParentTypeId() ==null || itemType.getParentTypeId()==0){ + itemType.setParentTypeId(0L); + } + //自动生成一个唯一编码 + itemType.setItemTypeCode(autoCodeUtil.genSerialCode(UserConstants.ITEM_TYPE_CODE,null)); + itemType.setCreateBy(getUsername()); + return AjaxResult.success(iItemTypeService.insertItemType(itemType)); + } + + @PreAuthorize("@ss.hasPermi('mes:md:itemtype:update')") + @Log(title = "更新物料产品分类",businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult update(@Validated @RequestBody ItemType itemType){ + if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeCodeUnique(itemType))){ + return AjaxResult.error("分类"+itemType.getItemTypeCode()+"编码已存在"); + } + if(UserConstants.NOT_UNIQUE.equals(iItemTypeService.checkItemTypeNameUnique(itemType))){ + return AjaxResult.error("分类"+itemType.getItemTypeCode()+"名称已存在"); + } + itemType.setUpdateBy(getUsername()); + return AjaxResult.success(iItemTypeService.updateItemType(itemType)); + } + + @PreAuthorize("@ss.hasPermi('mes:md:itemtype:remove')") + @Log(title = "删除物料产品分类",businessType = BusinessType.DELETE) + @DeleteMapping("/{itemTypeId}") + public AjaxResult del(@PathVariable Long itemTypeId){ + + if(iItemTypeService.checkHasChild(itemTypeId)){ + return AjaxResult.error("分类下有子分类,请先删除子分类"); + } + + if(iItemTypeService.checkHasItem(itemTypeId)){ + return AjaxResult.error("分类下有物料,请先删除物料"); + } + + //权限数据检查? + return AjaxResult.success(iItemTypeService.removeItemType(itemTypeId)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdClientController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdClientController.java new file mode 100644 index 0000000..88093ad --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdClientController.java @@ -0,0 +1,174 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdClient; +import com.ktg.mes.md.service.IMdClientService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 客户Controller + * + * @author yinjinlu + * @date 2022-05-06 + */ +@RestController +@RequestMapping("/mes/md/client") +public class MdClientController extends BaseController +{ + @Autowired + private IMdClientService mdClientService; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + /** + * 查询客户列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdClient mdClient) + { + startPage(); + List list = mdClientService.selectMdClientList(mdClient); + return getDataTable(list); + } + + /** + * 导出客户列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:client:export')") + @Log(title = "客户", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdClient mdClient) + { + List list = mdClientService.selectMdClientList(mdClient); + ExcelUtil util = new ExcelUtil(MdClient.class); + util.exportExcel(response, list, "客户数据"); + } + + + /** + * 下载导入模板 + * @param response + */ + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) + { + ExcelUtil util = new ExcelUtil(MdClient.class); + util.importTemplateExcel(response, "客户数据"); + } + + + /** + * 从模板导入客户数据 + * @param file + * @param updateSupport + * @return + * @throws Exception + */ + @Log(title = "客户", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('mes:md:client:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(MdClient.class); + List clientList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = mdClientService.importClient(clientList,updateSupport,operName); + return AjaxResult.success(message); + } + + + /** + * 获取客户详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:client:query')") + @GetMapping(value = "/{clientId}") + public AjaxResult getInfo(@PathVariable("clientId") Long clientId) + { + return AjaxResult.success(mdClientService.selectMdClientByClientId(clientId)); + } + + /** + * 新增客户 + */ + @PreAuthorize("@ss.hasPermi('mes:md:client:add')") + @Log(title = "客户", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdClient mdClient) + { + if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientCodeUnique(mdClient))){ + return AjaxResult.error("客户编码已存在!"); + } + + if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNameUnique(mdClient))){ + return AjaxResult.error("客户名称已存在!"); + } + + if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNickUnique(mdClient))){ + return AjaxResult.error("客户简称已存在!"); + } + + mdClientService.insertMdClient(mdClient); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_CLIENT,mdClient.getClientId(),mdClient.getClientCode(),mdClient.getClientName()); + + return AjaxResult.success(mdClient.getClientId()); + } + + /** + * 修改客户 + */ + @PreAuthorize("@ss.hasPermi('mes:md:client:edit')") + @Log(title = "客户", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdClient mdClient) + { + if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientCodeUnique(mdClient))){ + return AjaxResult.error("客户编码已存在!"); + } + + if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNameUnique(mdClient))){ + return AjaxResult.error("客户名称已存在!"); + } + + if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNickUnique(mdClient))){ + return AjaxResult.error("客户简称已存在!"); + } + return toAjax(mdClientService.updateMdClient(mdClient)); + } + + /** + * 删除客户 + */ + @PreAuthorize("@ss.hasPermi('mes:md:client:remove')") + @Log(title = "客户", businessType = BusinessType.DELETE) + @DeleteMapping("/{clientIds}") + public AjaxResult remove(@PathVariable Long[] clientIds) + { + return toAjax(mdClientService.deleteMdClientByClientIds(clientIds)); + } + + + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java new file mode 100644 index 0000000..f775b92 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java @@ -0,0 +1,189 @@ +package com.ktg.mes.md.controller; + +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.aspect.BarcodeGen; +import com.ktg.mes.md.domain.MdUnitMeasure; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.service.IMdItemService; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.ItemType; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.service.IItemTypeService; +import com.ktg.mes.md.service.IMdUnitMeasureService; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@RestController +@RequestMapping("/mes/md/mditem") +public class MdItemController extends BaseController { + + @Autowired + private IMdItemService mdItemService; + + @Autowired + private IItemTypeService iItemTypeService; + + @Autowired + private IMdUnitMeasureService mdUnitMeasureService; + + @Autowired + private WmBarCodeUtil barcodeUtil; + + /** + * 列表查询 + * @param mdItem + * @return + */ + @GetMapping("/list") + public TableDataInfo list(MdItem mdItem){ + startPage(); + List list = mdItemService.selectMdItemList(mdItem); + return getDataTable(list); + } + + /** + * 导出物料列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')") + @Log(title = "物料管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdItem mdItem) + { + List list = mdItemService.getExeportList(mdItem); + ExcelUtil util = new ExcelUtil(MdItem.class); + util.exportExcel(response, list, "物料产品数据"); + } + + /** + * 下载导入模板 + * @param response + */ + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) + { + ExcelUtil util = new ExcelUtil(MdItem.class); + util.importTemplateExcel(response, "物料产品数据"); + } + + + /** + * 从模板导入供应商数据 + * @param file + * @param updateSupport + * @return + * @throws Exception + */ + @Log(title = "物料管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('mes:md:mditem:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(MdItem.class); + List mdItemList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = mdItemService.importItem(mdItemList, updateSupport, operName); + return AjaxResult.success(message); + } + + + + + /** + * 主键查询 + * @param itemId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')") + @GetMapping(value = "/{itemId}") + public AjaxResult getInfo(@PathVariable Long itemId){ + return AjaxResult.success(mdItemService.selectMdItemById(itemId)); + } + + /** + * 新增 + * @param mdItem + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')") + @Log(title = "物料管理",businessType = BusinessType.INSERT) + @BarcodeGen(barcodeType = UserConstants.BARCODE_TYPE_ITEM) + @PostMapping + public AjaxResult add(@Validated @RequestBody MdItem mdItem){ + if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))){ + return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料编码已存在"); + } + if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))){ + return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料名称已存在"); + } + + ItemType type =iItemTypeService.selectItemTypeById(mdItem.getItemTypeId()); + if(StringUtils.isNotNull(type)){ + mdItem.setItemTypeCode(type.getItemTypeCode()); + mdItem.setItemTypeName(type.getItemTypeName()); + mdItem.setItemOrProduct(type.getItemOrProduct()); + } + + MdUnitMeasure measure = mdUnitMeasureService.selectMdUnitByCode(mdItem.getUnitOfMeasure()); + if(StringUtils.isNotNull(measure)){ + mdItem.setUnitName(measure.getMeasureName()); + } + mdItem.setCreateBy(getUsername()); + mdItemService.insertMdItem(mdItem); + barcodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_ITEM,mdItem.getItemId(),mdItem.getItemCode(), mdItem.getItemName()); + return AjaxResult.success(mdItem.getItemId()); + } + + /** + * 更新 + * @param mdItem + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')") + @Log(title = "物料管理",businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody MdItem mdItem){ + if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))){ + return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料编码已存在"); + } + if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))){ + return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料名称已存在"); + } + ItemType type =iItemTypeService.selectItemTypeById(mdItem.getItemTypeId()); + if(StringUtils.isNotNull(type)){ + mdItem.setItemTypeCode(type.getItemTypeCode()); + mdItem.setItemTypeName(type.getItemTypeName()); + mdItem.setItemOrProduct(type.getItemOrProduct()); + } + if(StringUtils.isNotNull(mdItem.getSafeStockFlag())&& "N".equals(mdItem.getSafeStockFlag())){ + mdItem.setMinStock(0D); + mdItem.setMaxStock(0D); + } + MdUnitMeasure measure = mdUnitMeasureService.selectMdUnitByCode(mdItem.getUnitOfMeasure()); + if(StringUtils.isNotNull(measure)){ + mdItem.setUnitName(measure.getMeasureName()); + } + + mdItem.setUpdateBy(getUsername()); + return toAjax(mdItemService.updateMdItem(mdItem)); + } + + @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')") + @Log(title = "物料管理",businessType = BusinessType.DELETE) + @DeleteMapping("/{itemIds}") + public AjaxResult remove(@PathVariable Long[] itemIds){ + return toAjax(mdItemService.deleteByItemIds(itemIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java new file mode 100644 index 0000000..32e7e4b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java @@ -0,0 +1,109 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.mes.md.service.IMdProductBomService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdProductBom; +import com.ktg.mes.md.service.IMdProductBomService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品BOM关系Controller + * + * @author yinjinlu + * @date 2022-05-09 + */ +@RestController +@RequestMapping("/mes/md/bom") +public class MdProductBomController extends BaseController +{ + @Autowired + private IMdProductBomService mdProductBomService; + + /** + * 查询产品BOM关系列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdProductBom mdProductBom) + { + startPage(); + List list = mdProductBomService.selectMdProductBomList(mdProductBom); + return getDataTable(list); + } + + /** + * 导出产品BOM关系列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')") + @Log(title = "产品BOM关系", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdProductBom mdProductBom) + { + List list = mdProductBomService.selectMdProductBomList(mdProductBom); + ExcelUtil util = new ExcelUtil(MdProductBom.class); + util.exportExcel(response, list, "产品BOM关系数据"); + } + + /** + * 获取产品BOM关系详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')") + @GetMapping(value = "/{bomId}") + public AjaxResult getInfo(@PathVariable("bomId") Long bomId) + { + return AjaxResult.success(mdProductBomService.selectMdProductBomByBomId(bomId)); + } + + /** + * 新增产品BOM关系 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')") + @Log(title = "产品BOM关系", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdProductBom mdProductBom) + { + if(mdProductBom.getBomItemId() == mdProductBom.getItemId()){ + return AjaxResult.error("产品不能作为自身的BOM物料!"); + } + + return toAjax(mdProductBomService.insertMdProductBom(mdProductBom)); + } + + /** + * 修改产品BOM关系 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')") + @Log(title = "产品BOM关系", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdProductBom mdProductBom) + { + return toAjax(mdProductBomService.updateMdProductBom(mdProductBom)); + } + + /** + * 删除产品BOM关系 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')") + @Log(title = "产品BOM关系", businessType = BusinessType.DELETE) + @DeleteMapping("/{bomIds}") + public AjaxResult remove(@PathVariable Long[] bomIds) + { + return toAjax(mdProductBomService.deleteMdProductBomByBomIds(bomIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductSipController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductSipController.java new file mode 100644 index 0000000..f003d69 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductSipController.java @@ -0,0 +1,103 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdProductSip; +import com.ktg.mes.md.service.IMdProductSipService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品SIPController + * + * @author yinjinlu + * @date 2023-10-31 + */ +@RestController +@RequestMapping("/mes/md/sip") +public class MdProductSipController extends BaseController +{ + @Autowired + private IMdProductSipService mdProductSipService; + + /** + * 查询产品SIP列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdProductSip mdProductSip) + { + startPage(); + List list = mdProductSipService.selectMdProductSipList(mdProductSip); + return getDataTable(list); + } + + /** + * 导出产品SIP列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')") + @Log(title = "产品SIP", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdProductSip mdProductSip) + { + List list = mdProductSipService.selectMdProductSipList(mdProductSip); + ExcelUtil util = new ExcelUtil(MdProductSip.class); + util.exportExcel(response, list, "产品SIP数据"); + } + + /** + * 获取产品SIP详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')") + @GetMapping(value = "/{sipId}") + public AjaxResult getInfo(@PathVariable("sipId") Long sipId) + { + return AjaxResult.success(mdProductSipService.selectMdProductSipBySipId(sipId)); + } + + /** + * 新增产品SIP + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')") + @Log(title = "产品SIP", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdProductSip mdProductSip) + { + return toAjax(mdProductSipService.insertMdProductSip(mdProductSip)); + } + + /** + * 修改产品SIP + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')") + @Log(title = "产品SIP", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdProductSip mdProductSip) + { + return toAjax(mdProductSipService.updateMdProductSip(mdProductSip)); + } + + /** + * 删除产品SIP + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')") + @Log(title = "产品SIP", businessType = BusinessType.DELETE) + @DeleteMapping("/{sipIds}") + public AjaxResult remove(@PathVariable Long[] sipIds) + { + return toAjax(mdProductSipService.deleteMdProductSipBySipIds(sipIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductSopController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductSopController.java new file mode 100644 index 0000000..e16a0a7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductSopController.java @@ -0,0 +1,103 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdProductSop; +import com.ktg.mes.md.service.IMdProductSopService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品SOPController + * + * @author yinjinlu + * @date 2022-07-26 + */ +@RestController +@RequestMapping("/mes/md/sop") +public class MdProductSopController extends BaseController +{ + @Autowired + private IMdProductSopService mdProductSopService; + + /** + * 查询产品SOP列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdProductSop mdProdutSop) + { + startPage(); + List list = mdProductSopService.selectMdProductSopList(mdProdutSop); + return getDataTable(list); + } + + /** + * 导出产品SOP列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:export')") + @Log(title = "产品SOP", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdProductSop mdProdutSop) + { + List list = mdProductSopService.selectMdProductSopList(mdProdutSop); + ExcelUtil util = new ExcelUtil(MdProductSop.class); + util.exportExcel(response, list, "产品SOP数据"); + } + + /** + * 获取产品SOP详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:query')") + @GetMapping(value = "/{sopId}") + public AjaxResult getInfo(@PathVariable("sopId") Long sopId) + { + return AjaxResult.success(mdProductSopService.selectMdProductSopBySopId(sopId)); + } + + /** + * 新增产品SOP + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:add')") + @Log(title = "产品SOP", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdProductSop mdProdutSop) + { + return toAjax(mdProductSopService.insertMdProductSop(mdProdutSop)); + } + + /** + * 修改产品SOP + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')") + @Log(title = "产品SOP", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdProductSop mdProdutSop) + { + return toAjax(mdProductSopService.updateMdProductSop(mdProdutSop)); + } + + /** + * 删除产品SOP + */ + @PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')") + @Log(title = "产品SOP", businessType = BusinessType.DELETE) + @DeleteMapping("/{sopIds}") + public AjaxResult remove(@PathVariable Long[] sopIds) + { + return toAjax(mdProductSopService.deleteMdProductSopBySopIds(sopIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdUnitMeasureController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdUnitMeasureController.java new file mode 100644 index 0000000..74a75a3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdUnitMeasureController.java @@ -0,0 +1,113 @@ +package com.ktg.mes.md.controller; + +import com.ktg.mes.md.service.IMdUnitMeasureService; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.MdUnitMeasure; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 单位Controller + * + * @author ruoyi + * @date 2022-04-27 + */ +@RestController +@RequestMapping("/mes/md/unitmeasure") +public class MdUnitMeasureController extends BaseController +{ + @Autowired + private IMdUnitMeasureService mdUnitMeasureService; + + /** + * 查询单位列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdUnitMeasure mdUnitMeasure) + { + startPage(); + List list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure); + return getDataTable(list); + } + + @GetMapping("/listprimary") + public AjaxResult listPrimary(){ + MdUnitMeasure mdUnitMeasure = new MdUnitMeasure(); + mdUnitMeasure.setPrimaryFlag("Y"); + List list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure); + return AjaxResult.success(list); + } + + @GetMapping("/selectall") + public AjaxResult selectAll(){ + MdUnitMeasure mdUnitMeasure = new MdUnitMeasure(); + mdUnitMeasure.setEnableFlag("Y"); + List list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure); + return AjaxResult.success(list); + } + + /** + * 导出单位列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:export')") + @Log(title = "单位", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdUnitMeasure mdUnitMeasure) + { + List list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure); + ExcelUtil util = new ExcelUtil(MdUnitMeasure.class); + util.exportExcel(response, list, "单位数据"); + } + + /** + * 获取单位详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:query')") + @GetMapping(value = "/{measureId}") + public AjaxResult getInfo(@PathVariable("measureId") Long measureId) + { + return AjaxResult.success(mdUnitMeasureService.selectMdUnitMeasureByMeasureId(measureId)); + } + + /** + * 新增单位 + */ + @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:add')") + @Log(title = "单位", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdUnitMeasure mdUnitMeasure) + { + return toAjax(mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure)); + } + + /** + * 修改单位 + */ + @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:edit')") + @Log(title = "单位", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdUnitMeasure mdUnitMeasure) + { + return toAjax(mdUnitMeasureService.updateMdUnitMeasure(mdUnitMeasure)); + } + + /** + * 删除单位 + */ + @PreAuthorize("@ss.hasPermi('mes:md:unitmeasure:remove')") + @Log(title = "单位", businessType = BusinessType.DELETE) + @DeleteMapping("/{measureIds}") + public AjaxResult remove(@PathVariable Long[] measureIds) + { + return toAjax(mdUnitMeasureService.deleteMdUnitMeasureByMeasureIds(measureIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdVendorController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdVendorController.java new file mode 100644 index 0000000..30653c4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdVendorController.java @@ -0,0 +1,164 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.service.IMdVendorService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 供应商Controller + * + * @author yinjinlu + * @date 2022-05-06 + */ +@RestController +@RequestMapping("/mes/md/vendor") +public class MdVendorController extends BaseController +{ + @Autowired + private IMdVendorService mdVendorService; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + /** + * 查询供应商列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdVendor mdVendor) + { + startPage(); + List list = mdVendorService.selectMdVendorList(mdVendor); + return getDataTable(list); + } + + /** + * 导出供应商列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:vendor:export')") + @Log(title = "供应商", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdVendor mdVendor) + { + List list = mdVendorService.selectMdVendorList(mdVendor); + ExcelUtil util = new ExcelUtil(MdVendor.class); + util.exportExcel(response, list, "供应商数据"); + } + + /** + * 下载导入模板 + * @param response + */ + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) + { + ExcelUtil util = new ExcelUtil(MdVendor.class); + util.importTemplateExcel(response, "供应商数据"); + } + + + /** + * 从模板导入供应商数据 + * @param file + * @param updateSupport + * @return + * @throws Exception + */ + @Log(title = "供应商", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('mes:md:vendor:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(MdVendor.class); + List vendorList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = mdVendorService.importVendor(vendorList, updateSupport, operName); + return AjaxResult.success(message); + } + + /** + * 获取供应商详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:vendor:query')") + @GetMapping(value = "/{vendorId}") + public AjaxResult getInfo(@PathVariable("vendorId") Long vendorId) + { + return AjaxResult.success(mdVendorService.selectMdVendorByVendorId(vendorId)); + } + + /** + * 新增供应商 + */ + @PreAuthorize("@ss.hasPermi('mes:md:vendor:add')") + @Log(title = "供应商", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdVendor mdVendor) + { + if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorCodeUnique(mdVendor))){ + return AjaxResult.error("供应商编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNameUnique(mdVendor))){ + return AjaxResult.error("供应商名称已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNickUnique(mdVendor))){ + return AjaxResult.error("供应商简称已存在!"); + } + + mdVendorService.insertMdVendor(mdVendor); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_VENDOR,mdVendor.getVendorId(),mdVendor.getVendorCode(),mdVendor.getVendorName()); + + return AjaxResult.success(mdVendor.getVendorId()); + } + + /** + * 修改供应商 + */ + @PreAuthorize("@ss.hasPermi('mes:md:vendor:edit')") + @Log(title = "供应商", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdVendor mdVendor) + { + if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorCodeUnique(mdVendor))){ + return AjaxResult.error("供应商编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNameUnique(mdVendor))){ + return AjaxResult.error("供应商名称已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNickUnique(mdVendor))){ + return AjaxResult.error("供应商简称已存在!"); + } + return toAjax(mdVendorService.updateMdVendor(mdVendor)); + } + + /** + * 删除供应商 + */ + @PreAuthorize("@ss.hasPermi('mes:md:vendor:remove')") + @Log(title = "供应商", businessType = BusinessType.DELETE) + @DeleteMapping("/{vendorIds}") + public AjaxResult remove(@PathVariable Long[] vendorIds) + { + return toAjax(mdVendorService.deleteMdVendorByVendorIds(vendorIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkshopController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkshopController.java new file mode 100644 index 0000000..34a5031 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkshopController.java @@ -0,0 +1,129 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdWorkshop; +import com.ktg.mes.md.service.IMdWorkshopService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 车间Controller + * + * @author yinjinlu + * @date 2022-05-07 + */ +@RestController +@RequestMapping("/mes/md/workshop") +public class MdWorkshopController extends BaseController +{ + @Autowired + private IMdWorkshopService mdWorkshopService; + + /** + * 查询车间列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdWorkshop mdWorkshop) + { + startPage(); + List list = mdWorkshopService.selectMdWorkshopList(mdWorkshop); + return getDataTable(list); + } + + /** + * 获取所有可用车间 + * @return + */ + @GetMapping("/listAll") + public AjaxResult listAll(){ + MdWorkshop mdWorkshop = new MdWorkshop(); + mdWorkshop.setEnableFlag("Y"); + List list = mdWorkshopService.selectMdWorkshopList(mdWorkshop); + return AjaxResult.success(list); + } + + /** + * 导出车间列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workshop:export')") + @Log(title = "车间", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdWorkshop mdWorkshop) + { + List list = mdWorkshopService.selectMdWorkshopList(mdWorkshop); + ExcelUtil util = new ExcelUtil(MdWorkshop.class); + util.exportExcel(response, list, "车间数据"); + } + + /** + * 获取车间详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workshop:query')") + @GetMapping(value = "/{workshopId}") + public AjaxResult getInfo(@PathVariable("workshopId") Long workshopId) + { + return AjaxResult.success(mdWorkshopService.selectMdWorkshopByWorkshopId(workshopId)); + } + + /** + * 新增车间 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workshop:add')") + @Log(title = "车间", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdWorkshop mdWorkshop) + { + if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopCodeUnique(mdWorkshop))){ + return AjaxResult.error("车间编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopNameUnique(mdWorkshop))){ + return AjaxResult.error("车间名称已存在!"); + } + return toAjax(mdWorkshopService.insertMdWorkshop(mdWorkshop)); + } + + /** + * 修改车间 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workshop:edit')") + @Log(title = "车间", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdWorkshop mdWorkshop) + { + if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopCodeUnique(mdWorkshop))){ + return AjaxResult.error("车间编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdWorkshopService.checkWorkshopNameUnique(mdWorkshop))){ + return AjaxResult.error("车间名称已存在!"); + } + return toAjax(mdWorkshopService.updateMdWorkshop(mdWorkshop)); + } + + /** + * 删除车间 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workshop:remove')") + @Log(title = "车间", businessType = BusinessType.DELETE) + @DeleteMapping("/{workshopIds}") + public AjaxResult remove(@PathVariable Long[] workshopIds) + { + return toAjax(mdWorkshopService.deleteMdWorkshopByWorkshopIds(workshopIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationController.java new file mode 100644 index 0000000..c11801c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationController.java @@ -0,0 +1,241 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdWorkshop; +import com.ktg.mes.md.service.*; +import com.ktg.mes.pro.domain.ProProcess; +import com.ktg.mes.pro.service.IProProcessService; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工作站Controller + * + * @author yinjinlu + * @date 2022-05-10 + */ +@RestController +@RequestMapping("/mes/md/workstation") +public class MdWorkstationController extends BaseController +{ + @Autowired + private IMdWorkstationService mdWorkstationService; + + @Autowired + private IMdWorkstationMachineService mdWorkstationMachineService; + + @Autowired + private IMdWorkstationToolService mdWorkstationToolService; + + @Autowired + private IMdWorkstationWorkerService mdWorkstationWorkerService; + + @Autowired + private IProProcessService proProcessService; + + @Autowired + private IMdWorkshopService mdWorkshopService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + /** + * 查询工作站列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdWorkstation mdWorkstation) + { + startPage(); + List list = mdWorkstationService.selectMdWorkstationList(mdWorkstation); + return getDataTable(list); + } + + /** + * 导出工作站列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')") + @Log(title = "工作站", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdWorkstation mdWorkstation) + { + List list = mdWorkstationService.selectMdWorkstationList(mdWorkstation); + ExcelUtil util = new ExcelUtil(MdWorkstation.class); + util.exportExcel(response, list, "工作站数据"); + } + + /** + * 获取工作站详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')") + @GetMapping(value = "/{workstationId}") + public AjaxResult getInfo(@PathVariable("workstationId") Long workstationId) + { + return AjaxResult.success(mdWorkstationService.selectMdWorkstationByWorkstationId(workstationId)); + } + + /** + * 新增工作站 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')") + @Log(title = "工作站", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdWorkstation mdWorkstation) + { + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationCodeUnique(mdWorkstation))){ + return AjaxResult.error("工作站编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationNameUnique(mdWorkstation))){ + return AjaxResult.error("工作站名称已存在!"); + } + ProProcess process = proProcessService.selectProProcessByProcessId(mdWorkstation.getProcessId()); + mdWorkstation.setProcessCode(process.getProcessCode()); + mdWorkstation.setProcessName(process.getProcessName()); + + MdWorkshop workshop = mdWorkshopService.selectMdWorkshopByWorkshopId(mdWorkstation.getWorkshopId()); + mdWorkstation.setWorkshopCode(workshop.getWorkshopCode()); + mdWorkstation.setWorkshopName(workshop.getWorkshopName()); + + //线边库的设置 + WmWarehouse warehouse = null; + WmStorageLocation location = null; + WmStorageArea area = null; + if(StringUtils.isNotNull(mdWorkstation.getWarehouseId())){ + //如果有指定线边库 + warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(mdWorkstation.getWarehouseId()); + location = wmStorageLocationService.selectWmStorageLocationByLocationId(mdWorkstation.getLocationId()); + area = wmStorageAreaService.selectWmStorageAreaByAreaId(mdWorkstation.getAreaId()); + }else { + //设置默认的线边库 + warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH); + if(StringUtils.isNull(warehouse)){ + //如果没有找到默认的线边库,则进行一次初始化 + warehouse = wmWarehouseService.initVirtualWarehouse(); + } + location = wmStorageLocationService.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS); + area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA); + } + mdWorkstation.setWarehouseId(warehouse.getWarehouseId()); + mdWorkstation.setWarehouseCode(warehouse.getWarehouseCode()); + mdWorkstation.setWarehouseName(warehouse.getWarehouseName()); + mdWorkstation.setLocationId(location.getLocationId()); + mdWorkstation.setLocationCode(location.getLocationCode()); + mdWorkstation.setLocationName(location.getLocationName()); + mdWorkstation.setAreaId(area.getAreaId()); + mdWorkstation.setAreaCode(area.getAreaCode()); + mdWorkstation.setAreaName(area.getAreaName()); + mdWorkstationService.insertMdWorkstation(mdWorkstation); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WORKSTATION,mdWorkstation.getWorkstationId(), mdWorkstation.getWorkstationCode(),mdWorkstation.getWorkstationName()); + return AjaxResult.success(mdWorkstation.getWorkstationId()); + } + + /** + * 修改工作站 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')") + @Log(title = "工作站", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdWorkstation mdWorkstation) + { + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationCodeUnique(mdWorkstation))){ + return AjaxResult.error("工作站编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationService.checkWorkStationNameUnique(mdWorkstation))){ + return AjaxResult.error("工作站名称已存在!"); + } + ProProcess process = proProcessService.selectProProcessByProcessId(mdWorkstation.getProcessId()); + if(!StringUtils.isNotNull(process)){ + return AjaxResult.error("工序不存在!"); + } + mdWorkstation.setProcessCode(process.getProcessCode()); + mdWorkstation.setProcessName(process.getProcessName()); + + MdWorkshop workshop = mdWorkshopService.selectMdWorkshopByWorkshopId(mdWorkstation.getWorkshopId()); + if(!StringUtils.isNotNull(workshop)){ + return AjaxResult.error("车间不存在!"); + } + mdWorkstation.setWorkshopCode(workshop.getWorkshopCode()); + mdWorkstation.setWorkshopName(workshop.getWorkshopName()); + + //线边库的设置 + WmWarehouse warehouse = null; + WmStorageLocation location = null; + WmStorageArea area = null; + if(StringUtils.isNotNull(mdWorkstation.getWarehouseId())){ + //如果有指定线边库 + warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(mdWorkstation.getWarehouseId()); + location = wmStorageLocationService.selectWmStorageLocationByLocationId(mdWorkstation.getLocationId()); + area = wmStorageAreaService.selectWmStorageAreaByAreaId(mdWorkstation.getAreaId()); + }else { + //设置默认的线边库 + warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH); + if(StringUtils.isNull(warehouse)){ + //如果没有找到默认的线边库,则进行一次初始化 + warehouse = wmWarehouseService.initVirtualWarehouse(); + } + location = wmStorageLocationService.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS); + area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA); + } + mdWorkstation.setWarehouseCode(warehouse.getWarehouseCode()); + mdWorkstation.setWarehouseName(warehouse.getWarehouseName()); + mdWorkstation.setLocationCode(location.getLocationCode()); + mdWorkstation.setLocationName(location.getLocationName()); + mdWorkstation.setAreaCode(area.getAreaCode()); + mdWorkstation.setAreaName(area.getAreaName()); + + return toAjax(mdWorkstationService.updateMdWorkstation(mdWorkstation)); + } + + /** + * 删除工作站 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')") + @Log(title = "工作站", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{workstationIds}") + public AjaxResult remove(@PathVariable Long[] workstationIds) + { + for (Long workstationId: workstationIds + ) { + mdWorkstationMachineService.deleteByWorkstationId(workstationId); + mdWorkstationToolService.deleteByWorkstationId(workstationId); + mdWorkstationWorkerService.deleteByWorkstationId(workstationId); + } + return toAjax(mdWorkstationService.deleteMdWorkstationByWorkstationIds(workstationIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationMachineController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationMachineController.java new file mode 100644 index 0000000..a289628 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationMachineController.java @@ -0,0 +1,116 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdWorkstationService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdWorkstationMachine; +import com.ktg.mes.md.service.IMdWorkstationMachineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 设备资源Controller + * + * @author yinjinlu + * @date 2022-05-12 + */ +@RestController +@RequestMapping("/mes/md/workstationmachine") +public class MdWorkstationMachineController extends BaseController +{ + @Autowired + private IMdWorkstationMachineService mdWorkstationMachineService; + + @Autowired + private IMdWorkstationService mdWorkstationService; + + /** + * 查询设备资源列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdWorkstationMachine mdWorkstationMachine) + { + startPage(); + List list = mdWorkstationMachineService.selectMdWorkstationMachineList(mdWorkstationMachine); + return getDataTable(list); + } + + /** + * 导出设备资源列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')") + @Log(title = "设备资源", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdWorkstationMachine mdWorkstationMachine) + { + List list = mdWorkstationMachineService.selectMdWorkstationMachineList(mdWorkstationMachine); + ExcelUtil util = new ExcelUtil(MdWorkstationMachine.class); + util.exportExcel(response, list, "设备资源数据"); + } + + /** + * 获取设备资源详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(mdWorkstationMachineService.selectMdWorkstationMachineByRecordId(recordId)); + } + + /** + * 新增设备资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')") + @Log(title = "设备资源", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdWorkstationMachine mdWorkstationMachine) + { + MdWorkstationMachine machine = mdWorkstationMachineService.checkMachineryExists(mdWorkstationMachine); + if(StringUtils.isNotNull(machine)){ + MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(machine.getWorkstationId()); + return AjaxResult.error("设备已分配至工作站:"+workstation.getWorkstationName()); + } + return toAjax(mdWorkstationMachineService.insertMdWorkstationMachine(mdWorkstationMachine)); + } + + /** + * 修改设备资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')") + @Log(title = "设备资源", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdWorkstationMachine mdWorkstationMachine) + { + return toAjax(mdWorkstationMachineService.updateMdWorkstationMachine(mdWorkstationMachine)); + } + + /** + * 删除设备资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')") + @Log(title = "设备资源", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(mdWorkstationMachineService.deleteMdWorkstationMachineByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationToolController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationToolController.java new file mode 100644 index 0000000..6bc6df2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationToolController.java @@ -0,0 +1,122 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.tm.domain.TmToolType; +import com.ktg.mes.tm.service.ITmToolTypeService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdWorkstationTool; +import com.ktg.mes.md.service.IMdWorkstationToolService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工装夹具资源Controller + * + * @author yinjinlu + * @date 2022-05-12 + */ +@RestController +@RequestMapping("/mes/md/workstationtool") +public class MdWorkstationToolController extends BaseController +{ + @Autowired + private IMdWorkstationToolService mdWorkstationToolService; + + @Autowired + private ITmToolTypeService toolTypeService; + + /** + * 查询工装夹具资源列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdWorkstationTool mdWorkstationTool) + { + startPage(); + List list = mdWorkstationToolService.selectMdWorkstationToolList(mdWorkstationTool); + return getDataTable(list); + } + + /** + * 导出工装夹具资源列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')") + @Log(title = "工装夹具资源", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdWorkstationTool mdWorkstationTool) + { + List list = mdWorkstationToolService.selectMdWorkstationToolList(mdWorkstationTool); + ExcelUtil util = new ExcelUtil(MdWorkstationTool.class); + util.exportExcel(response, list, "工装夹具资源数据"); + } + + /** + * 获取工装夹具资源详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(mdWorkstationToolService.selectMdWorkstationToolByRecordId(recordId)); + } + + /** + * 新增工装夹具资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')") + @Log(title = "工装夹具资源", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdWorkstationTool mdWorkstationTool) + { + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationToolService.checkToolTypeExists(mdWorkstationTool))){ + return AjaxResult.error("此工装夹具类型已添加!"); + } + TmToolType type = toolTypeService.selectTmToolTypeByToolTypeId(mdWorkstationTool.getToolTypeId()); + mdWorkstationTool.setToolTypeCode(type.getToolTypeCode()); + mdWorkstationTool.setToolTypeName(type.getToolTypeName()); + return toAjax(mdWorkstationToolService.insertMdWorkstationTool(mdWorkstationTool)); + } + + /** + * 修改工装夹具资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')") + @Log(title = "工装夹具资源", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdWorkstationTool mdWorkstationTool) + { + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationToolService.checkToolTypeExists(mdWorkstationTool))){ + return AjaxResult.error("此工装夹具类型已添加!"); + } + TmToolType type = toolTypeService.selectTmToolTypeByToolTypeId(mdWorkstationTool.getToolTypeId()); + mdWorkstationTool.setToolTypeCode(type.getToolTypeCode()); + mdWorkstationTool.setToolTypeName(type.getToolTypeName()); + return toAjax(mdWorkstationToolService.updateMdWorkstationTool(mdWorkstationTool)); + } + + /** + * 删除工装夹具资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')") + @Log(title = "工装夹具资源", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(mdWorkstationToolService.deleteMdWorkstationToolByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationWorkerController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationWorkerController.java new file mode 100644 index 0000000..c8df429 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdWorkstationWorkerController.java @@ -0,0 +1,123 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.domain.SysPost; +import com.ktg.system.service.ISysPostService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdWorkstationWorker; +import com.ktg.mes.md.service.IMdWorkstationWorkerService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 人力资源Controller + * + * @author yinjinlu + * @date 2022-05-12 + */ +@RestController +@RequestMapping("/mes/md/workstationworker") +public class MdWorkstationWorkerController extends BaseController +{ + @Autowired + private IMdWorkstationWorkerService mdWorkstationWorkerService; + + @Autowired + private ISysPostService sysPostService; + + /** + * 查询人力资源列表 + */ + @GetMapping("/list") + public TableDataInfo list(MdWorkstationWorker mdWorkstationWorker) + { + startPage(); + List list = mdWorkstationWorkerService.selectMdWorkstationWorkerList(mdWorkstationWorker); + return getDataTable(list); + } + + /** + * 导出人力资源列表 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:export')") + @Log(title = "人力资源", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MdWorkstationWorker mdWorkstationWorker) + { + List list = mdWorkstationWorkerService.selectMdWorkstationWorkerList(mdWorkstationWorker); + ExcelUtil util = new ExcelUtil(MdWorkstationWorker.class); + util.exportExcel(response, list, "人力资源数据"); + } + + /** + * 获取人力资源详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(mdWorkstationWorkerService.selectMdWorkstationWorkerByRecordId(recordId)); + } + + /** + * 新增人力资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:add')") + @Log(title = "人力资源", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MdWorkstationWorker mdWorkstationWorker) + { + SysPost post = sysPostService.selectPostById(mdWorkstationWorker.getPostId()); + mdWorkstationWorker.setPostCode(post.getPostCode()); + mdWorkstationWorker.setPostName(post.getPostName()); + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationWorkerService.checkPostExist(mdWorkstationWorker))){ + return AjaxResult.error("此岗位已经添加!"); + } + return toAjax(mdWorkstationWorkerService.insertMdWorkstationWorker(mdWorkstationWorker)); + } + + /** + * 修改人力资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:edit')") + @Log(title = "人力资源", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MdWorkstationWorker mdWorkstationWorker) + { + SysPost post = sysPostService.selectPostById(mdWorkstationWorker.getPostId()); + mdWorkstationWorker.setPostCode(post.getPostCode()); + mdWorkstationWorker.setPostName(post.getPostName()); + if(UserConstants.NOT_UNIQUE.equals(mdWorkstationWorkerService.checkPostExist(mdWorkstationWorker))){ + return AjaxResult.error("此岗位已经添加!"); + } + return toAjax(mdWorkstationWorkerService.updateMdWorkstationWorker(mdWorkstationWorker)); + } + + /** + * 删除人力资源 + */ + @PreAuthorize("@ss.hasPermi('mes:md:workstation:remove')") + @Log(title = "人力资源", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(mdWorkstationWorkerService.deleteMdWorkstationWorkerByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdClientMobController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdClientMobController.java new file mode 100644 index 0000000..9210474 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdClientMobController.java @@ -0,0 +1,36 @@ +package com.ktg.mes.md.controller.mobile; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.mes.md.domain.MdClient; +import com.ktg.mes.md.service.IMdClientService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("客户信息") +@RestController +@RequestMapping("/mobile/md/client") +public class MdClientMobController extends BaseController { + @Autowired + private IMdClientService mdClientService; + + /** + * 查询客户列表 + */ + @ApiOperation("查询客户清单(分页)") + @GetMapping("/list") + public TableDataInfo list(MdClient mdClient) + { + startPage(); + List list = mdClientService.selectMdClientList(mdClient); + return getDataTable(list); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdItemMobController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdItemMobController.java new file mode 100644 index 0000000..3a0d5c7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdItemMobController.java @@ -0,0 +1,37 @@ +package com.ktg.mes.md.controller.mobile; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.service.IMdItemService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("物料信息") +@RestController +@RequestMapping("/mobile/md/item") +public class MdItemMobController extends BaseController { + + @Autowired + private IMdItemService mdItemService; + + /** + * 列表查询 + * @param mdItem + * @return + */ + @ApiOperation("查询物料清单(分页)") + @GetMapping("/list") + public TableDataInfo list(MdItem mdItem){ + startPage(); + List list = mdItemService.selectMdItemList(mdItem); + return getDataTable(list); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdProductSOPMobController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdProductSOPMobController.java new file mode 100644 index 0000000..4f8c26d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdProductSOPMobController.java @@ -0,0 +1,33 @@ +package com.ktg.mes.md.controller.mobile; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.mes.md.domain.MdProductSop; +import com.ktg.mes.md.service.IMdProductSopService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/mobile/md/sop") +public class MdProductSOPMobController extends BaseController { + @Autowired + private IMdProductSopService mdProductSopService; + + /** + * 查询产品SOP列表 + */ + @ApiOperation("查询产品SOP信息") + @GetMapping("/list") + public AjaxResult list(MdProductSop mdProdutSop) + { + startPage(); + List list = mdProductSopService.selectMdProductSopList(mdProdutSop); + return AjaxResult.success(list); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdVendorMobController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdVendorMobController.java new file mode 100644 index 0000000..eaf2bc2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdVendorMobController.java @@ -0,0 +1,36 @@ +package com.ktg.mes.md.controller.mobile; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.service.IMdVendorService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("供应商信息") +@RestController +@RequestMapping("/mobile/md/vendor") +public class MdVendorMobController extends BaseController { + + @Autowired + private IMdVendorService mdVendorService; + + /** + * 查询供应商列表 + */ + @ApiOperation("查询供应商清单(分页)") + @GetMapping("/list") + public TableDataInfo list(MdVendor mdVendor) + { + startPage(); + List list = mdVendorService.selectMdVendorList(mdVendor); + return getDataTable(list); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdWorkstationMobController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdWorkstationMobController.java new file mode 100644 index 0000000..7e90664 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/mobile/MdWorkstationMobController.java @@ -0,0 +1,110 @@ +package com.ktg.mes.md.controller.mobile; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.StringUtils; +import com.ktg.framework.web.service.TokenService; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdWorkstationService; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProUserWorkstation; +import com.ktg.mes.pro.domain.ProWorkrecord; +import com.ktg.mes.pro.service.IProUserWorkstationService; +import com.ktg.mes.pro.service.IProWorkrecordService; +import com.ktg.system.service.ISysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Api +@RestController +@RequestMapping("/mobile/md/workstation") +public class MdWorkstationMobController extends BaseController { + @Autowired + private TokenService tokenService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private IMdWorkstationService mdWorkstationService; + + @Autowired + private IProWorkrecordService workrecordService; + + @Autowired + private IProUserWorkstationService userWorkstationService; + + @ApiOperation("工作站查询接口") + @GetMapping("/getWorkstationList") + public AjaxResult getWorkstationList(MdWorkstation mdWorkstation){ + List list = mdWorkstationService.selectMdWorkstationList(mdWorkstation); + return AjaxResult.success(list); + } + + @ApiOperation("获取当前用户绑定的工作站") + @GetMapping("/getMyWorkstation") + public AjaxResult getBindWorkstation(HttpServletRequest request){ + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser user = sysUserService.selectUserById(loginUser.getUser().getUserId()); + ProUserWorkstation param = new ProUserWorkstation(); + param.setUserId(user.getUserId()); + List uw = userWorkstationService.selectProUserWorkstationList(param); + if(!CollectionUtil.isEmpty(uw)){ + return AjaxResult.success(uw.get(0)); + } + return AjaxResult.success(); + } + + @ApiOperation("上工/下工记录") + @PutMapping() + @Transactional + public AjaxResult bindWorkstation(@RequestBody ProWorkrecord workrecord){ + MdWorkstation param = new MdWorkstation(); + param.setWorkstationCode(workrecord.getWorkstationCode()); + List workstations = mdWorkstationService.selectMdWorkstationList(param); + MdWorkstation workstation = null; + if(!CollectionUtil.isEmpty(workstations)){ + workstation = workstations.get(0); + } + + if(!StringUtils.isNotNull(workstation)){ + return AjaxResult.error("未能找到对应的工作站"); + } + + SysUser user = sysUserService.selectUserById(workrecord.getUserId()); + workrecord.setUserName(user.getUserName()); + workrecord.setWorkstationId(workstation.getWorkstationId()); + workrecord.setWorkstationName(workstation.getWorkstationName()); + workrecordService.insertProWorkrecord(workrecord); + + ProUserWorkstation uw = new ProUserWorkstation(); + uw.setUserId(workrecord.getUserId()); + uw.setUserName(workrecord.getUserName()); + uw.setNickName(workrecord.getNickName()); + uw.setWorkstationId(workstation.getWorkstationId()); + uw.setWorkstationCode(workstation.getWorkstationCode()); + uw.setWorkstationName(workstation.getWorkstationName()); + + if(UserConstants.YES.equals(workrecord.getOperationFlag())){ + //如果是绑定 + userWorkstationService.deleteByUserName(workrecord.getUserName()); + + userWorkstationService.insertProUserWorkstation(uw); + }else{ + userWorkstationService.deleteByUserName(workrecord.getUserName()); + } + + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdClient.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdClient.java new file mode 100644 index 0000000..84bc9ef --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdClient.java @@ -0,0 +1,357 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 客户对象 md_client + * + * @author yinjinlu + * @date 2022-05-06 + */ +public class MdClient extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 客户ID */ + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 客户简称 */ + @Excel(name = "客户简称") + private String clientNick; + + /** 客户英文名称 */ + @Excel(name = "客户英文名称") + private String clientEn; + + /** 客户简介 */ + @Excel(name = "客户简介") + private String clientDes; + + /** 客户LOGO地址 */ + private String clientLogo; + + /** 客户类型 */ + private String clientType; + + /** 客户地址 */ + @Excel(name = "客户地址") + private String address; + + /** 客户官网地址 */ + @Excel(name = "客户官网地址") + private String website; + + /** 客户邮箱地址 */ + @Excel(name = "客户邮箱地址") + private String email; + + /** 客户电话 */ + @Excel(name = "客户电话") + private String tel; + + /** 联系人1 */ + @Excel(name = "联系人1") + private String contact1; + + /** 联系人1-电话 */ + @Excel(name = "联系人1-电话") + private String contact1Tel; + + /** 联系人1-邮箱 */ + @Excel(name = "联系人1-邮箱") + private String contact1Email; + + /** 联系人2 */ + @Excel(name = "联系人2") + private String contact2; + + /** 联系人2-电话 */ + @Excel(name = "联系人2-电话") + private String contact2Tel; + + /** 联系人2-邮箱 */ + @Excel(name = "联系人2-邮箱") + private String contact2Email; + + /** 统一社会信用代码 */ + @Excel(name = "统一社会信用代码") + private String creditCode; + + /** 是否启用 */ + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setClientNick(String clientNick) + { + this.clientNick = clientNick; + } + + public String getClientNick() + { + return clientNick; + } + public void setClientEn(String clientEn) + { + this.clientEn = clientEn; + } + + public String getClientEn() + { + return clientEn; + } + public void setClientDes(String clientDes) + { + this.clientDes = clientDes; + } + + public String getClientDes() + { + return clientDes; + } + public void setClientLogo(String clientLogo) + { + this.clientLogo = clientLogo; + } + + public String getClientLogo() + { + return clientLogo; + } + public void setClientType(String clientType) + { + this.clientType = clientType; + } + + public String getClientType() + { + return clientType; + } + public void setAddress(String address) + { + this.address = address; + } + + public String getAddress() + { + return address; + } + public void setWebsite(String website) + { + this.website = website; + } + + public String getWebsite() + { + return website; + } + public void setEmail(String email) + { + this.email = email; + } + + public String getEmail() + { + return email; + } + public void setTel(String tel) + { + this.tel = tel; + } + + public String getTel() + { + return tel; + } + public void setContact1(String contact1) + { + this.contact1 = contact1; + } + + public String getContact1() + { + return contact1; + } + public void setContact1Tel(String contact1Tel) + { + this.contact1Tel = contact1Tel; + } + + public String getContact1Tel() + { + return contact1Tel; + } + public void setContact1Email(String contact1Email) + { + this.contact1Email = contact1Email; + } + + public String getContact1Email() + { + return contact1Email; + } + public void setContact2(String contact2) + { + this.contact2 = contact2; + } + + public String getContact2() + { + return contact2; + } + public void setContact2Tel(String contact2Tel) + { + this.contact2Tel = contact2Tel; + } + + public String getContact2Tel() + { + return contact2Tel; + } + public void setContact2Email(String contact2Email) + { + this.contact2Email = contact2Email; + } + + public String getContact2Email() + { + return contact2Email; + } + public void setCreditCode(String creditCode) + { + this.creditCode = creditCode; + } + + public String getCreditCode() + { + return creditCode; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("clientId", getClientId()) + .append("clientCode", getClientCode()) + .append("clientName", getClientName()) + .append("clientNick", getClientNick()) + .append("clientEn", getClientEn()) + .append("clientDes", getClientDes()) + .append("clientLogo", getClientLogo()) + .append("clientType", getClientType()) + .append("address", getAddress()) + .append("website", getWebsite()) + .append("email", getEmail()) + .append("tel", getTel()) + .append("contact1", getContact1()) + .append("contact1Tel", getContact1Tel()) + .append("contact1Email", getContact1Email()) + .append("contact2", getContact2()) + .append("contact2Tel", getContact2Tel()) + .append("contact2Email", getContact2Email()) + .append("creditCode", getCreditCode()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java new file mode 100644 index 0000000..6d8c1bd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java @@ -0,0 +1,222 @@ +package com.ktg.mes.md.domain; + +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +public class MdItem extends BaseEntity { + + private static final long serialVersionUID = 1L; + + + private Long itemId; + @Excel(name = "物料/产品编码") + private String itemCode; + @Excel(name = "物料/产品名称") + private String itemName; + @Excel(name = "规格型号") + private String specification; + @Excel(name = "单位编码") + private String unitOfMeasure; + @Excel(name = "单位名称") + private String unitName; + private String itemOrProduct; + private Long itemTypeId; + private String itemTypeCode; + @Excel(name = "分类名称") + private String itemTypeName; + private String enableFlag; + private String safeStockFlag; + private Double minStock; + private Double maxStock; + private String highValue; + private String attr1; + private String attr2; + private String attr3; + private String attr4; + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + @Size(min = 0,max = 64,message = "物料产品编码长度不能超过64个字符") + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + @NotBlank(message = "物料产品名称不能为空") + @Size(min = 0,max = 255,message = "物料产品编码名称不能超过255个字符") + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + @Size(min = 0,max = 500,message = "规格型号不能超过255个字符") + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + @NotBlank(message = "单位编码不能为空") + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitName() { + return unitName; + } + + public void setUnitName(String unitName) { + this.unitName = unitName; + } + + public String getItemOrProduct() { + return itemOrProduct; + } + + public void setItemOrProduct(String itemOrProduct) { + this.itemOrProduct = itemOrProduct; + } + + @NotNull(message = "物料类型不能为空") + public Long getItemTypeId() { + return itemTypeId; + } + + public void setItemTypeId(Long itemTypeId) { + this.itemTypeId = itemTypeId; + } + + public String getItemTypeCode() { + return itemTypeCode; + } + + public void setItemTypeCode(String itemTypeCode) { + this.itemTypeCode = itemTypeCode; + } + + public String getItemTypeName() { + return itemTypeName; + } + + public void setItemTypeName(String itemTypeName) { + this.itemTypeName = itemTypeName; + } + + public String getEnableFlag() { + return enableFlag; + } + + public void setEnableFlag(String enableFlag) { + this.enableFlag = enableFlag; + } + + public String getSafeStockFlag() { + return safeStockFlag; + } + + public void setSafeStockFlag(String safeStockFlag) { + this.safeStockFlag = safeStockFlag; + } + + public Double getMinStock() { + return minStock; + } + + public void setMinStock(Double minStock) { + this.minStock = minStock; + } + + public Double getMaxStock() { + return maxStock; + } + + public void setMaxStock(Double maxStock) { + this.maxStock = maxStock; + } + + public String getHighValue() { + return highValue; + } + + public void setHighValue(String highValue) { + this.highValue = highValue; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr3() { + return attr3; + } + + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr4() { + return attr4; + } + + public void setAttr4(String attr4) { + this.attr4 = attr4; + } + + + @Override + public String toString() { + return "MdItem{" + + "itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", itemOrProduct='" + itemOrProduct + '\'' + + ", itemTypeId=" + itemTypeId + + ", itemTypeCode='" + itemTypeCode + '\'' + + ", itemTypeName='" + itemTypeName + '\'' + + ", enableFlag='" + enableFlag + '\'' + + ", safeStockFlag='" + safeStockFlag + '\'' + + ", minStock=" + minStock + + ", maxStock=" + maxStock + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3='" + attr3 + '\'' + + ", attr4='" + attr4 + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java new file mode 100644 index 0000000..e42098e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java @@ -0,0 +1,221 @@ +package com.ktg.mes.md.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品BOM关系对象 md_product_bom + * + * @author yinjinlu + * @date 2022-05-09 + */ +public class MdProductBom extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水号 */ + private Long bomId; + + /** 物料产品ID */ + @Excel(name = "物料产品ID") + private Long itemId; + + /** BOM物料ID */ + @Excel(name = "BOM物料ID") + private Long bomItemId; + + /** BOM物料编码 */ + @Excel(name = "BOM物料编码") + private String bomItemCode; + + /** BOM物料名称 */ + @Excel(name = "BOM物料名称") + private String bomItemName; + + /** BOM物料规格 */ + @Excel(name = "BOM物料规格") + private String bomItemSpec; + + /** BOM物料单位 */ + @Excel(name = "BOM物料单位") + private String unitOfMeasure; + + /** 产品物料标识 */ + @Excel(name = "产品物料标识") + private String itemOrProduct; + + /** 物料使用比例 */ + @Excel(name = "物料使用比例") + private BigDecimal quantity; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setBomId(Long bomId) + { + this.bomId = bomId; + } + + public Long getBomId() + { + return bomId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setBomItemId(Long bomItemId) + { + this.bomItemId = bomItemId; + } + + public Long getBomItemId() + { + return bomItemId; + } + public void setBomItemCode(String bomItemCode) + { + this.bomItemCode = bomItemCode; + } + + public String getBomItemCode() + { + return bomItemCode; + } + public void setBomItemName(String bomItemName) + { + this.bomItemName = bomItemName; + } + + public String getBomItemName() + { + return bomItemName; + } + public void setBomItemSpec(String bomItemSpec) + { + this.bomItemSpec = bomItemSpec; + } + + public String getBomItemSpec() + { + return bomItemSpec; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setItemOrProduct(String itemOrProduct) + { + this.itemOrProduct = itemOrProduct; + } + + public String getItemOrProduct() + { + return itemOrProduct; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("bomId", getBomId()) + .append("itemId", getItemId()) + .append("bomItemId", getBomItemId()) + .append("bomItemCode", getBomItemCode()) + .append("bomItemName", getBomItemName()) + .append("bomItemSpec", getBomItemSpec()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("itemOrProduct", getItemOrProduct()) + .append("quantity", getQuantity()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductSip.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductSip.java new file mode 100644 index 0000000..930816d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductSip.java @@ -0,0 +1,206 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品SIP对象 md_product_sip + * + * @author yinjinlu + * @date 2023-10-31 + */ +public class MdProductSip extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long sipId; + + /** 物料产品ID */ + @Excel(name = "物料产品ID") + private Long itemId; + + /** 排列顺序 */ + @Excel(name = "排列顺序") + private Integer orderNum; + + /** 对应的工序 */ + @Excel(name = "对应的工序") + private Long processId; + + /** 工序编号 */ + @Excel(name = "工序编号") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 标题 */ + @Excel(name = "标题") + private String sipTitle; + + /** 详细描述 */ + @Excel(name = "详细描述") + private String sipDescription; + + /** 图片地址 */ + @Excel(name = "图片地址") + private String sipUrl; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setSipId(Long sipId) + { + this.sipId = sipId; + } + + public Long getSipId() + { + return sipId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public Integer getOrderNum() + { + return orderNum; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setSipTitle(String sipTitle) + { + this.sipTitle = sipTitle; + } + + public String getSipTitle() + { + return sipTitle; + } + public void setSipDescription(String sipDescription) + { + this.sipDescription = sipDescription; + } + + public String getSipDescription() + { + return sipDescription; + } + public void setSipUrl(String sipUrl) + { + this.sipUrl = sipUrl; + } + + public String getSipUrl() + { + return sipUrl; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("sipId", getSipId()) + .append("itemId", getItemId()) + .append("orderNum", getOrderNum()) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("sipTitle", getSipTitle()) + .append("sipDescription", getSipDescription()) + .append("sipUrl", getSipUrl()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductSop.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductSop.java new file mode 100644 index 0000000..a1de411 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductSop.java @@ -0,0 +1,206 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品SOP对象 md_produt_sop + * + * @author yinjinlu + * @date 2022-07-26 + */ +public class MdProductSop extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long sopId; + + /** 物料产品ID */ + @Excel(name = "物料产品ID") + private Long itemId; + + /** 排列顺序 */ + @Excel(name = "排列顺序") + private Integer orderNum; + + /** 对应的工序 */ + @Excel(name = "对应的工序") + private Long processId; + + /** 工序编号 */ + @Excel(name = "工序编号") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 标题 */ + @Excel(name = "标题") + private String sopTitle; + + /** 详细描述 */ + @Excel(name = "详细描述") + private String sopDescription; + + /** 图片地址 */ + @Excel(name = "图片地址") + private String sopUrl; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setSopId(Long sopId) + { + this.sopId = sopId; + } + + public Long getSopId() + { + return sopId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public Integer getOrderNum() + { + return orderNum; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setSopTitle(String sopTitle) + { + this.sopTitle = sopTitle; + } + + public String getSopTitle() + { + return sopTitle; + } + public void setSopDescription(String sopDescription) + { + this.sopDescription = sopDescription; + } + + public String getSopDescription() + { + return sopDescription; + } + public void setSopUrl(String sopUrl) + { + this.sopUrl = sopUrl; + } + + public String getSopUrl() + { + return sopUrl; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("sopId", getSopId()) + .append("itemId", getItemId()) + .append("orderNum", getOrderNum()) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("sopTitle", getSopTitle()) + .append("sopDescription", getSopDescription()) + .append("sopUrl", getSopUrl()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdUnitMeasure.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdUnitMeasure.java new file mode 100644 index 0000000..333cfe3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdUnitMeasure.java @@ -0,0 +1,184 @@ +package com.ktg.mes.md.domain; + +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.math.BigDecimal; + +/** + * 单位对象 md_unit_measure + * + * @author ruoyi + * @date 2022-04-27 + */ +public class MdUnitMeasure extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 单位ID */ + private Long measureId; + + /** 单位编码 */ + @Excel(name = "单位编码") + private String measureCode; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String measureName; + + /** 是否是主单位 */ + @Excel(name = "是否是主单位") + private String primaryFlag; + + /** 主单位ID */ + @Excel(name = "主单位ID") + private Long primaryId; + + /** 与主单位换算比例 */ + @Excel(name = "与主单位换算比例") + private BigDecimal changeRate; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setMeasureId(Long measureId) + { + this.measureId = measureId; + } + + public Long getMeasureId() + { + return measureId; + } + public void setMeasureCode(String measureCode) + { + this.measureCode = measureCode; + } + + public String getMeasureCode() + { + return measureCode; + } + public void setMeasureName(String measureName) + { + this.measureName = measureName; + } + + public String getMeasureName() + { + return measureName; + } + public void setPrimaryFlag(String primaryFlag) + { + this.primaryFlag = primaryFlag; + } + + public String getPrimaryFlag() + { + return primaryFlag; + } + public void setPrimaryId(Long primaryId) + { + this.primaryId = primaryId; + } + + public Long getPrimaryId() + { + return primaryId; + } + public void setChangeRate(BigDecimal changeRate) + { + this.changeRate = changeRate; + } + + public BigDecimal getChangeRate() + { + return changeRate; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("measureId", getMeasureId()) + .append("measureCode", getMeasureCode()) + .append("measureName", getMeasureName()) + .append("primaryFlag", getPrimaryFlag()) + .append("primaryId", getPrimaryId()) + .append("changeRate", getChangeRate()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdVendor.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdVendor.java new file mode 100644 index 0000000..62472d2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdVendor.java @@ -0,0 +1,370 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 供应商对象 md_vendor + * + * @author yinjinlu + * @date 2022-05-06 + */ +public class MdVendor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 供应商英文名称 */ + @Excel(name = "供应商英文名称") + private String vendorEn; + + /** 供应商简介 */ + @Excel(name = "供应商简介") + private String vendorDes; + + /** 供应商LOGO地址 */ + private String vendorLogo; + + /** 供应商等级 */ + private String vendorLevel; + + /** 供应商评分 */ + private Long vendorScore; + + /** 供应商地址 */ + @Excel(name = "供应商地址") + private String address; + + /** 供应商官网地址 */ + @Excel(name = "供应商官网地址") + private String website; + + /** 供应商邮箱地址 */ + @Excel(name = "供应商邮箱地址") + private String email; + + /** 供应商电话 */ + @Excel(name = "供应商电话") + private String tel; + + /** 联系人1 */ + @Excel(name = "联系人1") + private String contact1; + + /** 联系人1-电话 */ + @Excel(name = "联系人1-电话") + private String contact1Tel; + + /** 联系人1-邮箱 */ + @Excel(name = "联系人1-邮箱") + private String contact1Email; + + /** 联系人2 */ + @Excel(name = "联系人2") + private String contact2; + + /** 联系人2-电话 */ + @Excel(name = "联系人2-电话") + private String contact2Tel; + + /** 联系人2-邮箱 */ + @Excel(name = "联系人2-邮箱") + private String contact2Email; + + /** 统一社会信用代码 */ + @Excel(name = "统一社会信用代码") + private String creditCode; + + /** 是否启用 */ + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setVendorEn(String vendorEn) + { + this.vendorEn = vendorEn; + } + + public String getVendorEn() + { + return vendorEn; + } + public void setVendorDes(String vendorDes) + { + this.vendorDes = vendorDes; + } + + public String getVendorDes() + { + return vendorDes; + } + public void setVendorLogo(String vendorLogo) + { + this.vendorLogo = vendorLogo; + } + + public String getVendorLogo() + { + return vendorLogo; + } + public void setVendorLevel(String vendorLevel) + { + this.vendorLevel = vendorLevel; + } + + public String getVendorLevel() + { + return vendorLevel; + } + public void setVendorScore(Long vendorScore) + { + this.vendorScore = vendorScore; + } + + public Long getVendorScore() + { + return vendorScore; + } + public void setAddress(String address) + { + this.address = address; + } + + public String getAddress() + { + return address; + } + public void setWebsite(String website) + { + this.website = website; + } + + public String getWebsite() + { + return website; + } + public void setEmail(String email) + { + this.email = email; + } + + public String getEmail() + { + return email; + } + public void setTel(String tel) + { + this.tel = tel; + } + + public String getTel() + { + return tel; + } + public void setContact1(String contact1) + { + this.contact1 = contact1; + } + + public String getContact1() + { + return contact1; + } + public void setContact1Tel(String contact1Tel) + { + this.contact1Tel = contact1Tel; + } + + public String getContact1Tel() + { + return contact1Tel; + } + public void setContact1Email(String contact1Email) + { + this.contact1Email = contact1Email; + } + + public String getContact1Email() + { + return contact1Email; + } + public void setContact2(String contact2) + { + this.contact2 = contact2; + } + + public String getContact2() + { + return contact2; + } + public void setContact2Tel(String contact2Tel) + { + this.contact2Tel = contact2Tel; + } + + public String getContact2Tel() + { + return contact2Tel; + } + public void setContact2Email(String contact2Email) + { + this.contact2Email = contact2Email; + } + + public String getContact2Email() + { + return contact2Email; + } + public void setCreditCode(String creditCode) + { + this.creditCode = creditCode; + } + + public String getCreditCode() + { + return creditCode; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("vendorId", getVendorId()) + .append("vendorCode", getVendorCode()) + .append("vendorName", getVendorName()) + .append("vendorNick", getVendorNick()) + .append("vendorEn", getVendorEn()) + .append("vendorDes", getVendorDes()) + .append("vendorLogo", getVendorLogo()) + .append("vendorLevel", getVendorLevel()) + .append("vendorScore", getVendorScore()) + .append("address", getAddress()) + .append("website", getWebsite()) + .append("email", getEmail()) + .append("tel", getTel()) + .append("contact1", getContact1()) + .append("contact1Tel", getContact1Tel()) + .append("contact1Email", getContact1Email()) + .append("contact2", getContact2()) + .append("contact2Tel", getContact2Tel()) + .append("contact2Email", getContact2Email()) + .append("creditCode", getCreditCode()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkshop.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkshop.java new file mode 100644 index 0000000..9eaac38 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkshop.java @@ -0,0 +1,165 @@ +package com.ktg.mes.md.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 车间对象 md_workshop + * + * @author yinjinlu + * @date 2022-05-07 + */ +public class MdWorkshop extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 车间ID */ + private Long workshopId; + + /** 车间编码 */ + @Excel(name = "车间编码") + private String workshopCode; + + /** 车间名称 */ + @Excel(name = "车间名称") + private String workshopName; + + /** 面积 */ + @Excel(name = "面积") + private BigDecimal area; + + /** 负责人 */ + @Excel(name = "负责人") + private String charge; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setWorkshopId(Long workshopId) + { + this.workshopId = workshopId; + } + + public Long getWorkshopId() + { + return workshopId; + } + public void setWorkshopCode(String workshopCode) + { + this.workshopCode = workshopCode; + } + + public String getWorkshopCode() + { + return workshopCode; + } + public void setWorkshopName(String workshopName) + { + this.workshopName = workshopName; + } + + public String getWorkshopName() + { + return workshopName; + } + public void setArea(BigDecimal area) + { + this.area = area; + } + + public BigDecimal getArea() + { + return area; + } + public void setCharge(String charge) + { + this.charge = charge; + } + + public String getCharge() + { + return charge; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("workshopId", getWorkshopId()) + .append("workshopCode", getWorkshopCode()) + .append("workshopName", getWorkshopName()) + .append("area", getArea()) + .append("charge", getCharge()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstation.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstation.java new file mode 100644 index 0000000..0f9b93d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstation.java @@ -0,0 +1,347 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 工作站对象 md_workstation + * + * @author yinjinlu + * @date 2022-05-10 + */ +public class MdWorkstation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工作站ID */ + private Long workstationId; + + /** 工作站编码 */ + @Excel(name = "工作站编码") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 工作站地点 */ + @Excel(name = "工作站地点") + private String workstationAddress; + + /** 所在车间ID */ + @Excel(name = "所在车间ID") + private Long workshopId; + + /** 所在车间编码 */ + @Excel(name = "所在车间编码") + private String workshopCode; + + /** 所在车间名称 */ + @Excel(name = "所在车间名称") + private String workshopName; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 线边库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 线边库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 线边库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setWorkstationAddress(String workstationAddress) + { + this.workstationAddress = workstationAddress; + } + + public String getWorkstationAddress() + { + return workstationAddress; + } + public void setWorkshopId(Long workshopId) + { + this.workshopId = workshopId; + } + + public Long getWorkshopId() + { + return workshopId; + } + public void setWorkshopCode(String workshopCode) + { + this.workshopCode = workshopCode; + } + + public String getWorkshopCode() + { + return workshopCode; + } + public void setWorkshopName(String workshopName) + { + this.workshopName = workshopName; + } + + public String getWorkshopName() + { + return workshopName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "MdWorkstation{" + + "workstationId=" + workstationId + + ", workstationCode='" + workstationCode + '\'' + + ", workstationName='" + workstationName + '\'' + + ", workstationAddress='" + workstationAddress + '\'' + + ", workshopId=" + workshopId + + ", workshopCode='" + workshopCode + '\'' + + ", workshopName='" + workshopName + '\'' + + ", processId=" + processId + + ", processCode='" + processCode + '\'' + + ", processName='" + processName + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", enableFlag='" + enableFlag + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationMachine.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationMachine.java new file mode 100644 index 0000000..280053e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationMachine.java @@ -0,0 +1,164 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 设备资源对象 md_workstation_machine + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class MdWorkstationMachine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 设备ID */ + @Excel(name = "设备ID") + private Long machineryId; + + /** 设备编码 */ + @Excel(name = "设备编码") + private String machineryCode; + + /** 设备名称 */ + @Excel(name = "设备名称") + private String machineryName; + + /** 数量 */ + @Excel(name = "数量") + private Integer quantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setMachineryId(Long machineryId) + { + this.machineryId = machineryId; + } + + public Long getMachineryId() + { + return machineryId; + } + public void setMachineryCode(String machineryCode) + { + this.machineryCode = machineryCode; + } + + public String getMachineryCode() + { + return machineryCode; + } + public void setMachineryName(String machineryName) + { + this.machineryName = machineryName; + } + + public String getMachineryName() + { + return machineryName; + } + public void setQuantity(Integer quantity) + { + this.quantity = quantity; + } + + public Integer getQuantity() + { + return quantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("workstationId", getWorkstationId()) + .append("machineryId", getMachineryId()) + .append("machineryCode", getMachineryCode()) + .append("machineryName", getMachineryName()) + .append("quantity", getQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationTool.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationTool.java new file mode 100644 index 0000000..24715fb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationTool.java @@ -0,0 +1,164 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 工装夹具资源对象 md_workstation_tool + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class MdWorkstationTool extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工装夹具类型ID */ + @Excel(name = "工装夹具类型ID") + private Long toolTypeId; + + /** 类型编码 */ + @Excel(name = "类型编码") + private String toolTypeCode; + + /** 类型名称 */ + @Excel(name = "类型名称") + private String toolTypeName; + + /** 数量 */ + @Excel(name = "数量") + private Integer quantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setToolTypeId(Long toolTypeId) + { + this.toolTypeId = toolTypeId; + } + + public Long getToolTypeId() + { + return toolTypeId; + } + public void setToolTypeCode(String toolTypeCode) + { + this.toolTypeCode = toolTypeCode; + } + + public String getToolTypeCode() + { + return toolTypeCode; + } + public void setToolTypeName(String toolTypeName) + { + this.toolTypeName = toolTypeName; + } + + public String getToolTypeName() + { + return toolTypeName; + } + public void setQuantity(Integer quantity) + { + this.quantity = quantity; + } + + public Integer getQuantity() + { + return quantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("workstationId", getWorkstationId()) + .append("toolTypeId", getToolTypeId()) + .append("toolTypeCode", getToolTypeCode()) + .append("toolTypeName", getToolTypeName()) + .append("quantity", getQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationWorker.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationWorker.java new file mode 100644 index 0000000..daf539d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdWorkstationWorker.java @@ -0,0 +1,164 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 人力资源对象 md_workstation_worker + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class MdWorkstationWorker extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 岗位ID */ + @Excel(name = "岗位ID") + private Long postId; + + /** 岗位编码 */ + @Excel(name = "岗位编码") + private String postCode; + + /** 岗位名称 */ + @Excel(name = "岗位名称") + private String postName; + + /** 数量 */ + @Excel(name = "数量") + private Integer quantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setPostId(Long postId) + { + this.postId = postId; + } + + public Long getPostId() + { + return postId; + } + public void setPostCode(String postCode) + { + this.postCode = postCode; + } + + public String getPostCode() + { + return postCode; + } + public void setPostName(String postName) + { + this.postName = postName; + } + + public String getPostName() + { + return postName; + } + public void setQuantity(Integer quantity) + { + this.quantity = quantity; + } + + public Integer getQuantity() + { + return quantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("workstationId", getWorkstationId()) + .append("postId", getPostId()) + .append("postCode", getPostCode()) + .append("postName", getPostName()) + .append("quantity", getQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/ItemTypeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/ItemTypeMapper.java new file mode 100644 index 0000000..0994abd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/ItemTypeMapper.java @@ -0,0 +1,112 @@ +package com.ktg.mes.md.mapper; + +import com.ktg.common.core.domain.entity.ItemType; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ItemTypeMapper { + + /** + * 根据条件查询物料分类 + * @param itemType + * @return + */ + public List selectItemTypeList(ItemType itemType); + + /** + * 根据主键查询物料分类 + * @param itemTypeId + * @return + */ + public ItemType selectItemTypeById(Long itemTypeId); + + /** + * 根据分类名称查找分类 + * 在重名的情况下,支持按【上级分类】/【下级分类】的模式进行查找 + * @param itemTypeName + * @return + */ + public List selectItemTypeByName(String itemTypeName); + + /** + * 根据父类ID查询是否有子类 + * @param parentTypeId + * @return + */ + public Integer hasChildByItemTypeId(Long parentTypeId); + + + /** + * 根据物料分类查询是否有对应的物料和产品 + * @param itemTypeId + * @return + */ + public Integer hasItemByItemTypeId(Long itemTypeId); + + /** + * 根据父类查询所有子类 + * @param parentTypeId + * @return + */ + public List selectChildrenItemTypeById(Long parentTypeId); + + + /** + * 查询是否有可用的子类 + * @param parentTypeId + * @return + */ + public Integer selectNormalChildrenItemTypeById(Long parentTypeId); + + /** + * 检查同一个父类下子类名称是否重复 + * @param itemTypeName + * @param parentTypeId + * @return + */ + public ItemType checkItemTypeNameUnique(@Param("itemTypeName") String itemTypeName,@Param("parentTypeId") Long parentTypeId); + + /** + * 检查同一个父类下子类编码是否重复 + * @param itemTypeCode + * @param parentTypeId + * @return + */ + public ItemType checkItemTypeCodeUnique(@Param("itemTypeCode") String itemTypeCode,@Param("parentTypeId") Long parentTypeId); + + /** + * 新增物料分类 + * @param itemType + * @return + */ + public Integer insertItemType(ItemType itemType); + + /** + * 更新物料分类 + * @param itemType + * @return + */ + public Integer updateItemType(ItemType itemType); + + /** + * 设置物料分类不可用 + * @param itemTypeIds + */ + public void updateItemTypeStatusNormal(Long[] itemTypeIds); + + /** + * 根据主键删除物料分类 + * @param itemTypeId + * @return + */ + public Integer deleteItemTypeById(Long itemTypeId); + + /** + * 批量删除物料分类 + * @param itemTypeIds + * @return + */ + public Integer deleteItemTypeByIds(Long[] itemTypeIds); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdClientMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdClientMapper.java new file mode 100644 index 0000000..cdbfc63 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdClientMapper.java @@ -0,0 +1,83 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdClient; + +/** + * 客户Mapper接口 + * + * @author yinjinlu + * @date 2022-05-06 + */ +public interface MdClientMapper +{ + /** + * 查询客户 + * + * @param clientId 客户主键 + * @return 客户 + */ + public MdClient selectMdClientByClientId(Long clientId); + + /** + * 查询客户列表 + * + * @param mdClient 客户 + * @return 客户集合 + */ + public List selectMdClientList(MdClient mdClient); + + /** + * 检查客户编码是否重复 + * @param mdClient + * @return + */ + public MdClient checkClientCodeUnique(MdClient mdClient); + + /** + * 检查客户名称是否重复 + * @param mdClient + * @return + */ + public MdClient checkClientNameUnique(MdClient mdClient); + + /** + * 检查客户简称是否重复 + * @param mdClient + * @return + */ + public MdClient checkClientNickUnique(MdClient mdClient); + + + /** + * 新增客户 + * + * @param mdClient 客户 + * @return 结果 + */ + public int insertMdClient(MdClient mdClient); + + /** + * 修改客户 + * + * @param mdClient 客户 + * @return 结果 + */ + public int updateMdClient(MdClient mdClient); + + /** + * 删除客户 + * + * @param clientId 客户主键 + * @return 结果 + */ + public int deleteMdClientByClientId(Long clientId); + + /** + * 批量删除客户 + * + * @param clientIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdClientByClientIds(Long[] clientIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java new file mode 100644 index 0000000..b528aa6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java @@ -0,0 +1,74 @@ +package com.ktg.mes.md.mapper; + +import com.ktg.mes.md.domain.MdItem; + +import java.util.List; + +public interface MdItemMapper { + /** + * 根据条件查询物料编码 + * @param mdItem + * @return + */ + public List selectMdItemList(MdItem mdItem); + + /** + * 查询所有物料编码 + * @return + */ + public List selectMdItemAll(); + + + public List getExeportList(MdItem mdItem); + + + /** + * 根据物料ID查询物料 + * @param itemId + * @return + */ + public MdItem selectMdItemById(Long itemId); + + /** + * 检查物料编码是否唯一 + * @param mdItem + * @return + */ + public MdItem checkItemCodeUnique(MdItem mdItem); + + /** + * 检查物料名称是否唯一 + * @param mdItem + * @return + */ + public MdItem checkItemNameUnique(MdItem mdItem); + + /** + * 新增物料 + * @param mdItem + * @return + */ + public int insertMdItem(MdItem mdItem); + + /** + * 更新物料 + * @param mdItem + * @return + */ + public int updateMdItem(MdItem mdItem); + + /** + * 根据ID删除物料 + * @param itemId + * @return + */ + public int deleteMdItemById(Long itemId); + + /** + * 批量删除物料 + * @param itemIds + * @return + */ + public int deleteMdItemByIds(Long[] itemIds); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java new file mode 100644 index 0000000..bace5fb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdProductBom; + +/** + * 产品BOM关系Mapper接口 + * + * @author yinjinlu + * @date 2022-05-09 + */ +public interface MdProductBomMapper +{ + /** + * 查询产品BOM关系 + * + * @param bomId 产品BOM关系主键 + * @return 产品BOM关系 + */ + public MdProductBom selectMdProductBomByBomId(Long bomId); + + /** + * 查询产品BOM关系列表 + * + * @param mdProductBom 产品BOM关系 + * @return 产品BOM关系集合 + */ + public List selectMdProductBomList(MdProductBom mdProductBom); + + /** + * 新增产品BOM关系 + * + * @param mdProductBom 产品BOM关系 + * @return 结果 + */ + public int insertMdProductBom(MdProductBom mdProductBom); + + /** + * 修改产品BOM关系 + * + * @param mdProductBom 产品BOM关系 + * @return 结果 + */ + public int updateMdProductBom(MdProductBom mdProductBom); + + /** + * 删除产品BOM关系 + * + * @param bomId 产品BOM关系主键 + * @return 结果 + */ + public int deleteMdProductBomByBomId(Long bomId); + + /** + * 批量删除产品BOM关系 + * + * @param bomIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdProductBomByBomIds(Long[] bomIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductSipMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductSipMapper.java new file mode 100644 index 0000000..52d59ab --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductSipMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdProductSip; + +/** + * 产品SIPMapper接口 + * + * @author yinjinlu + * @date 2023-10-31 + */ +public interface MdProductSipMapper +{ + /** + * 查询产品SIP + * + * @param sipId 产品SIP主键 + * @return 产品SIP + */ + public MdProductSip selectMdProductSipBySipId(Long sipId); + + /** + * 查询产品SIP列表 + * + * @param mdProductSip 产品SIP + * @return 产品SIP集合 + */ + public List selectMdProductSipList(MdProductSip mdProductSip); + + /** + * 新增产品SIP + * + * @param mdProductSip 产品SIP + * @return 结果 + */ + public int insertMdProductSip(MdProductSip mdProductSip); + + /** + * 修改产品SIP + * + * @param mdProductSip 产品SIP + * @return 结果 + */ + public int updateMdProductSip(MdProductSip mdProductSip); + + /** + * 删除产品SIP + * + * @param sipId 产品SIP主键 + * @return 结果 + */ + public int deleteMdProductSipBySipId(Long sipId); + + /** + * 批量删除产品SIP + * + * @param sipIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdProductSipBySipIds(Long[] sipIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductSopMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductSopMapper.java new file mode 100644 index 0000000..ab9660e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductSopMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdProductSop; + +/** + * 产品SOPMapper接口 + * + * @author yinjinlu + * @date 2022-07-26 + */ +public interface MdProductSopMapper +{ + /** + * 查询产品SOP + * + * @param sopId 产品SOP主键 + * @return 产品SOP + */ + public MdProductSop selectMdProductSopBySopId(Long sopId); + + /** + * 查询产品SOP列表 + * + * @param mdProductSop 产品SOP + * @return 产品SOP集合 + */ + public List selectMdProductSopList(MdProductSop mdProductSop); + + /** + * 新增产品SOP + * + * @param mdProductSop 产品SOP + * @return 结果 + */ + public int insertMdProductSop(MdProductSop mdProductSop); + + /** + * 修改产品SOP + * + * @param mdProductSop 产品SOP + * @return 结果 + */ + public int updateMdProductSop(MdProductSop mdProductSop); + + /** + * 删除产品SOP + * + * @param sopId 产品SOP主键 + * @return 结果 + */ + public int deleteMdProductSopBySopId(Long sopId); + + /** + * 批量删除产品SOP + * + * @param sopIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdProductSopBySopIds(Long[] sopIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdUnitMeasureMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdUnitMeasureMapper.java new file mode 100644 index 0000000..1952d4e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdUnitMeasureMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.md.mapper; + +import com.ktg.mes.md.domain.MdUnitMeasure; + +import java.util.List; + +/** + * 单位Mapper接口 + * + * @author ruoyi + * @date 2022-04-27 + */ +public interface MdUnitMeasureMapper +{ + /** + * 查询单位 + * + * @param measureId 单位主键 + * @return 单位 + */ + public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId); + + /** + * 查询单位列表 + * + * @param mdUnitMeasure 单位 + * @return 单位集合 + */ + public List selectMdUnitMeasureList(MdUnitMeasure mdUnitMeasure); + + public MdUnitMeasure selectMdUnitByCode(String unitCode); + + /** + * 新增单位 + * + * @param mdUnitMeasure 单位 + * @return 结果 + */ + public int insertMdUnitMeasure(MdUnitMeasure mdUnitMeasure); + + /** + * 修改单位 + * + * @param mdUnitMeasure 单位 + * @return 结果 + */ + public int updateMdUnitMeasure(MdUnitMeasure mdUnitMeasure); + + /** + * 删除单位 + * + * @param measureId 单位主键 + * @return 结果 + */ + public int deleteMdUnitMeasureByMeasureId(Long measureId); + + /** + * 批量删除单位 + * + * @param measureIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdUnitMeasureByMeasureIds(Long[] measureIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdVendorMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdVendorMapper.java new file mode 100644 index 0000000..224ddae --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdVendorMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdVendor; + +/** + * 供应商Mapper接口 + * + * @author yinjinlu + * @date 2022-05-06 + */ +public interface MdVendorMapper +{ + /** + * 查询供应商 + * + * @param vendorId 供应商主键 + * @return 供应商 + */ + public MdVendor selectMdVendorByVendorId(Long vendorId); + + /** + * 查询供应商列表 + * + * @param mdVendor 供应商 + * @return 供应商集合 + */ + public List selectMdVendorList(MdVendor mdVendor); + + public MdVendor checkVendorCodeUnique(MdVendor mdVendor); + public MdVendor checkVendorNameUnique(MdVendor mdVendor); + public MdVendor checkVendorNickUnique(MdVendor mdVendor); + + /** + * 新增供应商 + * + * @param mdVendor 供应商 + * @return 结果 + */ + public int insertMdVendor(MdVendor mdVendor); + + /** + * 修改供应商 + * + * @param mdVendor 供应商 + * @return 结果 + */ + public int updateMdVendor(MdVendor mdVendor); + + /** + * 删除供应商 + * + * @param vendorId 供应商主键 + * @return 结果 + */ + public int deleteMdVendorByVendorId(Long vendorId); + + /** + * 批量删除供应商 + * + * @param vendorIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdVendorByVendorIds(Long[] vendorIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkshopMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkshopMapper.java new file mode 100644 index 0000000..8908ccd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkshopMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkshop; + +/** + * 车间Mapper接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface MdWorkshopMapper +{ + /** + * 查询车间 + * + * @param workshopId 车间主键 + * @return 车间 + */ + public MdWorkshop selectMdWorkshopByWorkshopId(Long workshopId); + + /** + * 查询车间列表 + * + * @param mdWorkshop 车间 + * @return 车间集合 + */ + public List selectMdWorkshopList(MdWorkshop mdWorkshop); + + /** + * 检查车间编码是否唯一 + * @param mdWorkshop + * @return + */ + public MdWorkshop checkWorkshopCodeUnique(MdWorkshop mdWorkshop); + + /** + * 检查车间名称是否唯一 + * @param mdWorkshop + * @return + */ + public MdWorkshop checkWorkshopNameUnique(MdWorkshop mdWorkshop); + + /** + * 新增车间 + * + * @param mdWorkshop 车间 + * @return 结果 + */ + public int insertMdWorkshop(MdWorkshop mdWorkshop); + + /** + * 修改车间 + * + * @param mdWorkshop 车间 + * @return 结果 + */ + public int updateMdWorkshop(MdWorkshop mdWorkshop); + + /** + * 删除车间 + * + * @param workshopId 车间主键 + * @return 结果 + */ + public int deleteMdWorkshopByWorkshopId(Long workshopId); + + /** + * 批量删除车间 + * + * @param workshopIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdWorkshopByWorkshopIds(Long[] workshopIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationMachineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationMachineMapper.java new file mode 100644 index 0000000..b099c1e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationMachineMapper.java @@ -0,0 +1,70 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstationMachine; + +/** + * 设备资源Mapper接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface MdWorkstationMachineMapper +{ + /** + * 查询设备资源 + * + * @param recordId 设备资源主键 + * @return 设备资源 + */ + public MdWorkstationMachine selectMdWorkstationMachineByRecordId(Long recordId); + + /** + * 查询设备资源列表 + * + * @param mdWorkstationMachine 设备资源 + * @return 设备资源集合 + */ + public List selectMdWorkstationMachineList(MdWorkstationMachine mdWorkstationMachine); + + public MdWorkstationMachine checkMachineryExists(MdWorkstationMachine mdWorkstationMachine); + + /** + * 新增设备资源 + * + * @param mdWorkstationMachine 设备资源 + * @return 结果 + */ + public int insertMdWorkstationMachine(MdWorkstationMachine mdWorkstationMachine); + + /** + * 修改设备资源 + * + * @param mdWorkstationMachine 设备资源 + * @return 结果 + */ + public int updateMdWorkstationMachine(MdWorkstationMachine mdWorkstationMachine); + + /** + * 删除设备资源 + * + * @param recordId 设备资源主键 + * @return 结果 + */ + public int deleteMdWorkstationMachineByRecordId(Long recordId); + + /** + * 批量删除设备资源 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdWorkstationMachineByRecordIds(Long[] recordIds); + + /** + * 根据工作站ID删除对应的设备列表 + * @param workstationId + * @return + */ + public int deleteByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationMapper.java new file mode 100644 index 0000000..57b6fcd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstation; + +/** + * 工作站Mapper接口 + * + * @author yinjinlu + * @date 2022-05-10 + */ +public interface MdWorkstationMapper +{ + /** + * 查询工作站 + * + * @param workstationId 工作站主键 + * @return 工作站 + */ + public MdWorkstation selectMdWorkstationByWorkstationId(Long workstationId); + + /** + * 查询工作站列表 + * + * @param mdWorkstation 工作站 + * @return 工作站集合 + */ + public List selectMdWorkstationList(MdWorkstation mdWorkstation); + + public MdWorkstation checkWorkStationCodeUnique(MdWorkstation mdWorkstation); + public MdWorkstation checkWorkStationNameUnique(MdWorkstation mdWorkstation); + + + /** + * 新增工作站 + * + * @param mdWorkstation 工作站 + * @return 结果 + */ + public int insertMdWorkstation(MdWorkstation mdWorkstation); + + /** + * 修改工作站 + * + * @param mdWorkstation 工作站 + * @return 结果 + */ + public int updateMdWorkstation(MdWorkstation mdWorkstation); + + /** + * 删除工作站 + * + * @param workstationId 工作站主键 + * @return 结果 + */ + public int deleteMdWorkstationByWorkstationId(Long workstationId); + + /** + * 批量删除工作站 + * + * @param workstationIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdWorkstationByWorkstationIds(Long[] workstationIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationToolMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationToolMapper.java new file mode 100644 index 0000000..a0fa541 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationToolMapper.java @@ -0,0 +1,70 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstationTool; + +/** + * 工装夹具资源Mapper接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface MdWorkstationToolMapper +{ + /** + * 查询工装夹具资源 + * + * @param recordId 工装夹具资源主键 + * @return 工装夹具资源 + */ + public MdWorkstationTool selectMdWorkstationToolByRecordId(Long recordId); + + /** + * 查询工装夹具资源列表 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 工装夹具资源集合 + */ + public List selectMdWorkstationToolList(MdWorkstationTool mdWorkstationTool); + + public MdWorkstationTool checkToolTypeExists(MdWorkstationTool mdWorkstationTool); + + /** + * 新增工装夹具资源 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 结果 + */ + public int insertMdWorkstationTool(MdWorkstationTool mdWorkstationTool); + + /** + * 修改工装夹具资源 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 结果 + */ + public int updateMdWorkstationTool(MdWorkstationTool mdWorkstationTool); + + /** + * 删除工装夹具资源 + * + * @param recordId 工装夹具资源主键 + * @return 结果 + */ + public int deleteMdWorkstationToolByRecordId(Long recordId); + + /** + * 批量删除工装夹具资源 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdWorkstationToolByRecordIds(Long[] recordIds); + + /** + * 根据工作站ID删除对应的工装夹具信息 + * @param workstationId + * @return + */ + public int deleteByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationWorkerMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationWorkerMapper.java new file mode 100644 index 0000000..e009136 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdWorkstationWorkerMapper.java @@ -0,0 +1,71 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstationWorker; + +/** + * 人力资源Mapper接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface MdWorkstationWorkerMapper +{ + /** + * 查询人力资源 + * + * @param recordId 人力资源主键 + * @return 人力资源 + */ + public MdWorkstationWorker selectMdWorkstationWorkerByRecordId(Long recordId); + + /** + * 查询人力资源列表 + * + * @param mdWorkstationWorker 人力资源 + * @return 人力资源集合 + */ + public List selectMdWorkstationWorkerList(MdWorkstationWorker mdWorkstationWorker); + + public MdWorkstationWorker checkPostExist(MdWorkstationWorker mdWorkstationWorker); + + + /** + * 新增人力资源 + * + * @param mdWorkstationWorker 人力资源 + * @return 结果 + */ + public int insertMdWorkstationWorker(MdWorkstationWorker mdWorkstationWorker); + + /** + * 修改人力资源 + * + * @param mdWorkstationWorker 人力资源 + * @return 结果 + */ + public int updateMdWorkstationWorker(MdWorkstationWorker mdWorkstationWorker); + + /** + * 删除人力资源 + * + * @param recordId 人力资源主键 + * @return 结果 + */ + public int deleteMdWorkstationWorkerByRecordId(Long recordId); + + /** + * 批量删除人力资源 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdWorkstationWorkerByRecordIds(Long[] recordIds); + + /** + * 根据工作站ID删除对应的人员信息 + * @param workstationId + * @return + */ + public int deleteByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IItemTypeService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IItemTypeService.java new file mode 100644 index 0000000..19a69f5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IItemTypeService.java @@ -0,0 +1,31 @@ +package com.ktg.mes.md.service; + +import com.ktg.common.core.domain.TreeSelect; +import com.ktg.common.core.domain.entity.ItemType; + +import java.util.List; + +public interface IItemTypeService { + + public List selectItemTypeList(ItemType itemType); + + public ItemType selectItemTypeByName(String typeName); + + public ItemType selectItemTypeById(Long itemTypeId); + + public List buildTreeSelect(List list); + + public String checkItemTypeCodeUnique(ItemType itemType); + + public String checkItemTypeNameUnique(ItemType itemType); + + public Integer insertItemType(ItemType itemType); + + public Integer updateItemType(ItemType itemType); + + public Integer removeItemType(Long itemTypeId); + + public boolean checkHasChild(Long itemTypeId); + + public boolean checkHasItem(Long itemTypeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdClientService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdClientService.java new file mode 100644 index 0000000..3c5ca0c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdClientService.java @@ -0,0 +1,79 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdClient; +import com.ktg.mes.md.domain.MdVendor; + +/** + * 客户Service接口 + * + * @author yinjinlu + * @date 2022-05-06 + */ +public interface IMdClientService +{ + /** + * 查询客户 + * + * @param clientId 客户主键 + * @return 客户 + */ + public MdClient selectMdClientByClientId(Long clientId); + + /** + * 查询客户列表 + * + * @param mdClient 客户 + * @return 客户集合 + */ + public List selectMdClientList(MdClient mdClient); + + public String checkClientCodeUnique(MdClient mdClient); + + public String checkClientNameUnique(MdClient mdClient); + + public String checkClientNickUnique(MdClient mdClient); + + /** + * 新增客户 + * + * @param mdClient 客户 + * @return 结果 + */ + public int insertMdClient(MdClient mdClient); + + /** + * 修改客户 + * + * @param mdClient 客户 + * @return 结果 + */ + public int updateMdClient(MdClient mdClient); + + /** + * 批量删除客户 + * + * @param clientIds 需要删除的客户主键集合 + * @return 结果 + */ + public int deleteMdClientByClientIds(Long[] clientIds); + + /** + * 删除客户信息 + * + * @param clientId 客户主键 + * @return 结果 + */ + public int deleteMdClientByClientId(Long clientId); + + + /** + * 导入客户信息 + * @param clientList + * @param isUpdateSupport + * @param operName + * @return + */ + public String importClient(List clientList, Boolean isUpdateSupport, String operName); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java new file mode 100644 index 0000000..5c64f07 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java @@ -0,0 +1,91 @@ +package com.ktg.mes.md.service; + +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.domain.MdVendor; + +import java.util.List; + +public interface IMdItemService { + + /** + * 根据条件查询物料编码 + * @param mdItem + * @return + */ + public List selectMdItemList(MdItem mdItem); + + /** + * 查询所有物料编码 + * @return + */ + public List selectMdItemAll(); + + /** + * 获取导出格式的物料产品清单 + * 主要区别是物料分类会以【父级分类】/【子集分类】的方式组合 + * @param mdItem + * @return + */ + public List getExeportList(MdItem mdItem); + + + /** + * 导入物料信息 + * @param itemList + * @param isUpdateSupport + * @param operName + * @return + */ + public String importItem(List itemList, Boolean isUpdateSupport, String operName); + + /** + * 根据主键查询物料编码 + * @param itemId + * @return + */ + public MdItem selectMdItemById(Long itemId); + + /** + * 检查物料编码是否唯一 + * @param mdItem + * @return + */ + public String checkItemCodeUnique(MdItem mdItem); + + /** + * 检查物料名称是否唯一 + * @param mdItem + * @return + */ + public String checkItemNameUnique(MdItem mdItem); + + /** + * 新增物料编码 + * @param mdItem + * @return + */ + public int insertMdItem(MdItem mdItem); + + /** + * 更新物料编码 + * @param mdItem + * @return + */ + public int updateMdItem(MdItem mdItem); + + /** + * 批量删除物料编码 + * @param itemIds + * @return + */ + public int deleteByItemIds(Long[] itemIds); + + /** + * 根据主键删除物料编码 + * @param itemId + * @return + */ + public int deleteByItemId(Long itemId); + +} + diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java new file mode 100644 index 0000000..e0eb80d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdProductBom; + +/** + * 产品BOM关系Service接口 + * + * @author yinjinlu + * @date 2022-05-09 + */ +public interface IMdProductBomService +{ + /** + * 查询产品BOM关系 + * + * @param bomId 产品BOM关系主键 + * @return 产品BOM关系 + */ + public MdProductBom selectMdProductBomByBomId(Long bomId); + + /** + * 查询产品BOM关系列表 + * + * @param mdProductBom 产品BOM关系 + * @return 产品BOM关系集合 + */ + public List selectMdProductBomList(MdProductBom mdProductBom); + + /** + * 新增产品BOM关系 + * + * @param mdProductBom 产品BOM关系 + * @return 结果 + */ + public int insertMdProductBom(MdProductBom mdProductBom); + + /** + * 修改产品BOM关系 + * + * @param mdProductBom 产品BOM关系 + * @return 结果 + */ + public int updateMdProductBom(MdProductBom mdProductBom); + + /** + * 批量删除产品BOM关系 + * + * @param bomIds 需要删除的产品BOM关系主键集合 + * @return 结果 + */ + public int deleteMdProductBomByBomIds(Long[] bomIds); + + /** + * 删除产品BOM关系信息 + * + * @param bomId 产品BOM关系主键 + * @return 结果 + */ + public int deleteMdProductBomByBomId(Long bomId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductSipService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductSipService.java new file mode 100644 index 0000000..079985f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductSipService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdProductSip; + +/** + * 产品SIPService接口 + * + * @author yinjinlu + * @date 2023-10-31 + */ +public interface IMdProductSipService +{ + /** + * 查询产品SIP + * + * @param sipId 产品SIP主键 + * @return 产品SIP + */ + public MdProductSip selectMdProductSipBySipId(Long sipId); + + /** + * 查询产品SIP列表 + * + * @param mdProductSip 产品SIP + * @return 产品SIP集合 + */ + public List selectMdProductSipList(MdProductSip mdProductSip); + + /** + * 新增产品SIP + * + * @param mdProductSip 产品SIP + * @return 结果 + */ + public int insertMdProductSip(MdProductSip mdProductSip); + + /** + * 修改产品SIP + * + * @param mdProductSip 产品SIP + * @return 结果 + */ + public int updateMdProductSip(MdProductSip mdProductSip); + + /** + * 批量删除产品SIP + * + * @param sipIds 需要删除的产品SIP主键集合 + * @return 结果 + */ + public int deleteMdProductSipBySipIds(Long[] sipIds); + + /** + * 删除产品SIP信息 + * + * @param sipId 产品SIP主键 + * @return 结果 + */ + public int deleteMdProductSipBySipId(Long sipId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductSopService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductSopService.java new file mode 100644 index 0000000..e250faa --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductSopService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdProductSop; + +/** + * 产品SOPService接口 + * + * @author yinjinlu + * @date 2022-07-26 + */ +public interface IMdProductSopService +{ + /** + * 查询产品SOP + * + * @param sopId 产品SOP主键 + * @return 产品SOP + */ + public MdProductSop selectMdProductSopBySopId(Long sopId); + + /** + * 查询产品SOP列表 + * + * @param mdProdutSop 产品SOP + * @return 产品SOP集合 + */ + public List selectMdProductSopList(MdProductSop mdProductSop); + + /** + * 新增产品SOP + * + * @param mdProdutSop 产品SOP + * @return 结果 + */ + public int insertMdProductSop(MdProductSop mdProductSop); + + /** + * 修改产品SOP + * + * @param mdProdutSop 产品SOP + * @return 结果 + */ + public int updateMdProductSop(MdProductSop mdProductSop); + + /** + * 批量删除产品SOP + * + * @param sopIds 需要删除的产品SOP主键集合 + * @return 结果 + */ + public int deleteMdProductSopBySopIds(Long[] sopIds); + + /** + * 删除产品SOP信息 + * + * @param sopId 产品SOP主键 + * @return 结果 + */ + public int deleteMdProductSopBySopId(Long sopId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdUnitMeasureService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdUnitMeasureService.java new file mode 100644 index 0000000..2747cd5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdUnitMeasureService.java @@ -0,0 +1,69 @@ +package com.ktg.mes.md.service; + +import com.ktg.mes.md.domain.MdUnitMeasure; + +import java.util.List; + +/** + * 单位Service接口 + * + * @author ruoyi + * @date 2022-04-27 + */ +public interface IMdUnitMeasureService +{ + /** + * 查询单位 + * + * @param measureId 单位主键 + * @return 单位 + */ + public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId); + + /** + * 查询单位列表 + * + * @param mdUnitMeasure 单位 + * @return 单位集合 + */ + public List selectMdUnitMeasureList(MdUnitMeasure mdUnitMeasure); + + /** + * 根据单位编码查询单位名称 + * @param unitCode + * @return + */ + public MdUnitMeasure selectMdUnitByCode(String unitCode); + + /** + * 新增单位 + * + * @param mdUnitMeasure 单位 + * @return 结果 + */ + public int insertMdUnitMeasure(MdUnitMeasure mdUnitMeasure); + + /** + * 修改单位 + * + * @param mdUnitMeasure 单位 + * @return 结果 + */ + public int updateMdUnitMeasure(MdUnitMeasure mdUnitMeasure); + + /** + * 批量删除单位 + * + * @param measureIds 需要删除的单位主键集合 + * @return 结果 + */ + public int deleteMdUnitMeasureByMeasureIds(Long[] measureIds); + + /** + * 删除单位信息 + * + * @param measureId 单位主键 + * @return 结果 + */ + public int deleteMdUnitMeasureByMeasureId(Long measureId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdVendorService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdVendorService.java new file mode 100644 index 0000000..435556b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdVendorService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdVendor; + +/** + * 供应商Service接口 + * + * @author yinjinlu + * @date 2022-05-06 + */ +public interface IMdVendorService +{ + /** + * 查询供应商 + * + * @param vendorId 供应商主键 + * @return 供应商 + */ + public MdVendor selectMdVendorByVendorId(Long vendorId); + + /** + * 查询供应商列表 + * + * @param mdVendor 供应商 + * @return 供应商集合 + */ + public List selectMdVendorList(MdVendor mdVendor); + + public String checkVendorCodeUnique(MdVendor mdVendor); + public String checkVendorNameUnique(MdVendor mdVendor); + public String checkVendorNickUnique(MdVendor mdVendor); + + /** + * 导入供应商信息 + * @param vendorList + * @param isUpdateSupport + * @param operName + * @return + */ + public String importVendor(List vendorList, Boolean isUpdateSupport, String operName); + + + /** + * 新增供应商 + * + * @param mdVendor 供应商 + * @return 结果 + */ + public int insertMdVendor(MdVendor mdVendor); + + /** + * 修改供应商 + * + * @param mdVendor 供应商 + * @return 结果 + */ + public int updateMdVendor(MdVendor mdVendor); + + /** + * 批量删除供应商 + * + * @param vendorIds 需要删除的供应商主键集合 + * @return 结果 + */ + public int deleteMdVendorByVendorIds(Long[] vendorIds); + + /** + * 删除供应商信息 + * + * @param vendorId 供应商主键 + * @return 结果 + */ + public int deleteMdVendorByVendorId(Long vendorId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkshopService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkshopService.java new file mode 100644 index 0000000..66fa34d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkshopService.java @@ -0,0 +1,65 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkshop; + +/** + * 车间Service接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface IMdWorkshopService +{ + /** + * 查询车间 + * + * @param workshopId 车间主键 + * @return 车间 + */ + public MdWorkshop selectMdWorkshopByWorkshopId(Long workshopId); + + /** + * 查询车间列表 + * + * @param mdWorkshop 车间 + * @return 车间集合 + */ + public List selectMdWorkshopList(MdWorkshop mdWorkshop); + + public String checkWorkshopCodeUnique(MdWorkshop mdWorkshop); + + public String checkWorkshopNameUnique(MdWorkshop mdWorkshop); + + /** + * 新增车间 + * + * @param mdWorkshop 车间 + * @return 结果 + */ + public int insertMdWorkshop(MdWorkshop mdWorkshop); + + /** + * 修改车间 + * + * @param mdWorkshop 车间 + * @return 结果 + */ + public int updateMdWorkshop(MdWorkshop mdWorkshop); + + /** + * 批量删除车间 + * + * @param workshopIds 需要删除的车间主键集合 + * @return 结果 + */ + public int deleteMdWorkshopByWorkshopIds(Long[] workshopIds); + + /** + * 删除车间信息 + * + * @param workshopId 车间主键 + * @return 结果 + */ + public int deleteMdWorkshopByWorkshopId(Long workshopId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationMachineService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationMachineService.java new file mode 100644 index 0000000..ffd9abf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationMachineService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstationMachine; + +/** + * 设备资源Service接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface IMdWorkstationMachineService +{ + /** + * 查询设备资源 + * + * @param recordId 设备资源主键 + * @return 设备资源 + */ + public MdWorkstationMachine selectMdWorkstationMachineByRecordId(Long recordId); + + /** + * 查询设备资源列表 + * + * @param mdWorkstationMachine 设备资源 + * @return 设备资源集合 + */ + public List selectMdWorkstationMachineList(MdWorkstationMachine mdWorkstationMachine); + + public MdWorkstationMachine checkMachineryExists(MdWorkstationMachine mdWorkstationMachine); + + /** + * 新增设备资源 + * + * @param mdWorkstationMachine 设备资源 + * @return 结果 + */ + public int insertMdWorkstationMachine(MdWorkstationMachine mdWorkstationMachine); + + /** + * 修改设备资源 + * + * @param mdWorkstationMachine 设备资源 + * @return 结果 + */ + public int updateMdWorkstationMachine(MdWorkstationMachine mdWorkstationMachine); + + /** + * 批量删除设备资源 + * + * @param recordIds 需要删除的设备资源主键集合 + * @return 结果 + */ + public int deleteMdWorkstationMachineByRecordIds(Long[] recordIds); + + /** + * 删除设备资源信息 + * + * @param recordId 设备资源主键 + * @return 结果 + */ + public int deleteMdWorkstationMachineByRecordId(Long recordId); + + /** + * 根据工作站ID删除对应的设备列表 + * @param workstationId + * @return + */ + public int deleteByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationService.java new file mode 100644 index 0000000..ab26825 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstation; + +/** + * 工作站Service接口 + * + * @author yinjinlu + * @date 2022-05-10 + */ +public interface IMdWorkstationService +{ + /** + * 查询工作站 + * + * @param workstationId 工作站主键 + * @return 工作站 + */ + public MdWorkstation selectMdWorkstationByWorkstationId(Long workstationId); + + /** + * 查询工作站列表 + * + * @param mdWorkstation 工作站 + * @return 工作站集合 + */ + public List selectMdWorkstationList(MdWorkstation mdWorkstation); + + /** + * 检查编码是否存在 + * @param mdWorkstation + * @return + */ + public String checkWorkStationCodeUnique(MdWorkstation mdWorkstation); + + /** + * 检查名称是否存在 + * @param mdWorkstation + * @return + */ + public String checkWorkStationNameUnique(MdWorkstation mdWorkstation); + + /** + * 新增工作站 + * + * @param mdWorkstation 工作站 + * @return 结果 + */ + public int insertMdWorkstation(MdWorkstation mdWorkstation); + + /** + * 修改工作站 + * + * @param mdWorkstation 工作站 + * @return 结果 + */ + public int updateMdWorkstation(MdWorkstation mdWorkstation); + + /** + * 批量删除工作站 + * + * @param workstationIds 需要删除的工作站主键集合 + * @return 结果 + */ + public int deleteMdWorkstationByWorkstationIds(Long[] workstationIds); + + /** + * 删除工作站信息 + * + * @param workstationId 工作站主键 + * @return 结果 + */ + public int deleteMdWorkstationByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationToolService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationToolService.java new file mode 100644 index 0000000..cd5d70d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationToolService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstationTool; + +/** + * 工装夹具资源Service接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface IMdWorkstationToolService +{ + /** + * 查询工装夹具资源 + * + * @param recordId 工装夹具资源主键 + * @return 工装夹具资源 + */ + public MdWorkstationTool selectMdWorkstationToolByRecordId(Long recordId); + + /** + * 查询工装夹具资源列表 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 工装夹具资源集合 + */ + public List selectMdWorkstationToolList(MdWorkstationTool mdWorkstationTool); + + /** + * 检查当前工作站是否已添加了此工装夹具类型 + * @param mdWorkstationTool + * @return + */ + public String checkToolTypeExists(MdWorkstationTool mdWorkstationTool); + + /** + * 新增工装夹具资源 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 结果 + */ + public int insertMdWorkstationTool(MdWorkstationTool mdWorkstationTool); + + /** + * 修改工装夹具资源 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 结果 + */ + public int updateMdWorkstationTool(MdWorkstationTool mdWorkstationTool); + + /** + * 批量删除工装夹具资源 + * + * @param recordIds 需要删除的工装夹具资源主键集合 + * @return 结果 + */ + public int deleteMdWorkstationToolByRecordIds(Long[] recordIds); + + /** + * 删除工装夹具资源信息 + * + * @param recordId 工装夹具资源主键 + * @return 结果 + */ + public int deleteMdWorkstationToolByRecordId(Long recordId); + + /** + * 根据工作站ID删除对应的工装夹具信息 + * @param workstationId + * @return + */ + public int deleteByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationWorkerService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationWorkerService.java new file mode 100644 index 0000000..6579c6a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdWorkstationWorkerService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.MdWorkstationWorker; + +/** + * 人力资源Service接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface IMdWorkstationWorkerService +{ + /** + * 查询人力资源 + * + * @param recordId 人力资源主键 + * @return 人力资源 + */ + public MdWorkstationWorker selectMdWorkstationWorkerByRecordId(Long recordId); + + /** + * 查询人力资源列表 + * + * @param mdWorkstationWorker 人力资源 + * @return 人力资源集合 + */ + public List selectMdWorkstationWorkerList(MdWorkstationWorker mdWorkstationWorker); + + /** + * 检查当前工作站是否已添加此岗位资源 + * @param mdWorkstationWorker + * @return + */ + public String checkPostExist(MdWorkstationWorker mdWorkstationWorker); + + /** + * 新增人力资源 + * + * @param mdWorkstationWorker 人力资源 + * @return 结果 + */ + public int insertMdWorkstationWorker(MdWorkstationWorker mdWorkstationWorker); + + /** + * 修改人力资源 + * + * @param mdWorkstationWorker 人力资源 + * @return 结果 + */ + public int updateMdWorkstationWorker(MdWorkstationWorker mdWorkstationWorker); + + /** + * 批量删除人力资源 + * + * @param recordIds 需要删除的人力资源主键集合 + * @return 结果 + */ + public int deleteMdWorkstationWorkerByRecordIds(Long[] recordIds); + + /** + * 删除人力资源信息 + * + * @param recordId 人力资源主键 + * @return 结果 + */ + public int deleteMdWorkstationWorkerByRecordId(Long recordId); + + /** + * 根据工作站ID删除对应的人员信息 + * @param workstationId + * @return + */ + public int deleteByWorkstationId(Long workstationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/ItemTypeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/ItemTypeServiceImpl.java new file mode 100644 index 0000000..1b3ca44 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/ItemTypeServiceImpl.java @@ -0,0 +1,170 @@ +package com.ktg.mes.md.service.impl; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.TreeSelect; +import com.ktg.common.core.domain.entity.ItemType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.mapper.ItemTypeMapper; +import com.ktg.mes.md.service.IItemTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class ItemTypeServiceImpl implements IItemTypeService { + + @Autowired + private ItemTypeMapper itemTypeMapper; + + @Override + public List selectItemTypeList(ItemType itemType) { + return itemTypeMapper.selectItemTypeList(itemType); + } + + /** + * 根据分类名称查找分类 + * 在重名的情况下,支持按【上级分类】/【下级分类】的模式进行查找 + * @param itemTypeName + * @return + */ + @Override + public ItemType selectItemTypeByName(String itemTypeName) { + List types = itemTypeMapper.selectItemTypeByName(itemTypeName); + if(!CollectionUtils.isEmpty(types)){ + return types.get(0); + } + return null; + } + + @Override + public ItemType selectItemTypeById(Long itemTypeId) { + return itemTypeMapper.selectItemTypeById(itemTypeId); + } + + @Override + public List buildTreeSelect(List list) { + List itemTypes = buildTree(list); + return itemTypes.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + private List buildTree(List itemTypes){ + List returnList = new ArrayList(); + List tempList = new ArrayList(); + for(ItemType it : itemTypes){ + tempList.add(it.getItemTypeId()); + } + + for(ItemType it : itemTypes){ + if(!tempList.contains(it.getParentTypeId())){ + recursionFn(itemTypes,it); + returnList.add(it); + } + } + if(returnList.isEmpty()){ + returnList = itemTypes; + } + return returnList; + } + + /** + * 递归列表 + */ + private void recursionFn(List list, ItemType t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (ItemType tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, ItemType t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + ItemType n = (ItemType) it.next(); + if (StringUtils.isNotNull(n.getParentTypeId()) && n.getParentTypeId().longValue() == t.getItemTypeId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, ItemType t) + { + return getChildList(list, t).size() > 0; + } + + + @Override + public String checkItemTypeCodeUnique(ItemType itemType) { + ItemType itemType1 =itemTypeMapper.checkItemTypeCodeUnique(itemType.getItemTypeCode(),itemType.getParentTypeId()); + Long itemTypeId = itemType.getItemTypeId() ==null? -1L:itemType.getItemTypeId(); + if(StringUtils.isNotNull(itemType1)&& itemTypeId.longValue() != itemType1.getItemTypeId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkItemTypeNameUnique(ItemType itemType) { + ItemType itemType1 =itemTypeMapper.checkItemTypeNameUnique(itemType.getItemTypeName(),itemType.getParentTypeId()); + Long itemTypeId = itemType.getItemTypeId() ==null? -1L:itemType.getItemTypeId(); + if(StringUtils.isNotNull(itemType1)&& itemTypeId.longValue() != itemType1.getItemTypeId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public Integer insertItemType(ItemType itemType) { + if(itemType.getParentTypeId()!= null){ + ItemType parent = itemTypeMapper.selectItemTypeById(itemType.getParentTypeId()); + if(StringUtils.isNotNull(parent)){ + itemType.setAncestors(parent.getAncestors()+","+parent.getItemTypeId()); + } + } + return itemTypeMapper.insertItemType(itemType); + } + + @Override + public Integer updateItemType(ItemType itemType) { + return itemTypeMapper.updateItemType(itemType); + } + + @Override + public Integer removeItemType(Long itemTypeId) { + return itemTypeMapper.deleteItemTypeById(itemTypeId); + } + + @Override + public boolean checkHasChild(Long itemTypeId) { + int num =itemTypeMapper.hasChildByItemTypeId(itemTypeId); + return num >0 ? true:false; + } + + @Override + public boolean checkHasItem(Long itemTypeId) { + int num =itemTypeMapper.hasItemByItemTypeId(itemTypeId); + return num >0 ? true:false; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdClientServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdClientServiceImpl.java new file mode 100644 index 0000000..5a01bf2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdClientServiceImpl.java @@ -0,0 +1,204 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.bean.BeanValidators; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import com.ktg.system.strategy.AutoCodeUtil; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdClientMapper; +import com.ktg.mes.md.domain.MdClient; +import com.ktg.mes.md.service.IMdClientService; + +import javax.validation.Validator; + +/** + * 客户Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-06 + */ +@Service +public class MdClientServiceImpl implements IMdClientService +{ + @Autowired + private MdClientMapper mdClientMapper; + + @Autowired + protected Validator validator; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询客户 + * + * @param clientId 客户主键 + * @return 客户 + */ + @Override + public MdClient selectMdClientByClientId(Long clientId) + { + return mdClientMapper.selectMdClientByClientId(clientId); + } + + /** + * 查询客户列表 + * + * @param mdClient 客户 + * @return 客户 + */ + @Override + public List selectMdClientList(MdClient mdClient) + { + return mdClientMapper.selectMdClientList(mdClient); + } + + @Override + public String checkClientCodeUnique(MdClient mdClient) { + MdClient client = mdClientMapper.checkClientCodeUnique(mdClient); + Long clientId = mdClient.getClientId()==null?-1L:mdClient.getClientId(); + if(StringUtils.isNotNull(client) && client.getClientId().longValue() !=clientId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkClientNameUnique(MdClient mdClient) { + MdClient client = mdClientMapper.checkClientNameUnique(mdClient); + Long clientId = mdClient.getClientId()==null?-1L:mdClient.getClientId(); + if(StringUtils.isNotNull(client) && client.getClientId().longValue() !=clientId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkClientNickUnique(MdClient mdClient) { + MdClient client = mdClientMapper.checkClientNickUnique(mdClient); + Long clientId = mdClient.getClientId()==null?-1L:mdClient.getClientId(); + if(StringUtils.isNotNull(client) && client.getClientId().longValue() !=clientId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增客户 + * + * @param mdClient 客户 + * @return 结果 + */ + @Override + public int insertMdClient(MdClient mdClient) + { + mdClient.setCreateTime(DateUtils.getNowDate()); + return mdClientMapper.insertMdClient(mdClient); + } + + /** + * 修改客户 + * + * @param mdClient 客户 + * @return 结果 + */ + @Override + public int updateMdClient(MdClient mdClient) + { + mdClient.setUpdateTime(DateUtils.getNowDate()); + return mdClientMapper.updateMdClient(mdClient); + } + + /** + * 批量删除客户 + * + * @param clientIds 需要删除的客户主键 + * @return 结果 + */ + @Override + public int deleteMdClientByClientIds(Long[] clientIds) + { + return mdClientMapper.deleteMdClientByClientIds(clientIds); + } + + /** + * 删除客户信息 + * + * @param clientId 客户主键 + * @return 结果 + */ + @Override + public int deleteMdClientByClientId(Long clientId) + { + return mdClientMapper.deleteMdClientByClientId(clientId); + } + + + /** + * 导入客户信息 + * @param clientList + * @param isUpdateSupport + * @param operName + * @return + */ + @Override + public String importClient(List clientList, Boolean isUpdateSupport, String operName) { + if (StringUtils.isNull(clientList) || clientList.size() == 0) + { + throw new ServiceException("导入客户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (MdClient client : clientList) + { + try{ + //是否存在 + MdClient v = mdClientMapper.checkClientCodeUnique(client); + if(StringUtils.isNull(v)){ + BeanValidators.validateWithException(validator, client); + String clientCode = autoCodeUtil.genSerialCode(UserConstants.CLIENT_CODE,""); + client.setClientCode(clientCode); + this.insertMdClient(client); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_CLIENT,client.getClientId(),client.getClientCode(),client.getClientName()); + successNum++; + }else if (isUpdateSupport){ + BeanValidators.validateWithException(validator, client); + client.setUpdateBy(operName); + client.setClientId(v.getClientId()); + this.updateMdClient(client); + successNum++; + }else { + failureNum++; + failureMsg.append("
" + failureNum + "、客户 " + client.getClientName() + " 已存在"); + } + + }catch (Exception e){ + failureNum++; + String msg = "
" + failureNum + "、客户 " + client.getClientName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条"); + } + return successMsg.toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java new file mode 100644 index 0000000..32299aa --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java @@ -0,0 +1,173 @@ +package com.ktg.mes.md.service.impl; + +import com.ktg.common.core.domain.entity.ItemType; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.bean.BeanValidators; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.mapper.ItemTypeMapper; +import com.ktg.mes.md.service.IMdItemService; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.mapper.MdItemMapper; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.validation.Validator; +import java.util.List; + +@Service +public class MdItemServiceImpl implements IMdItemService { + + @Autowired + private MdItemMapper mdItemMapper; + + @Autowired + private ItemTypeMapper itemTypeMapper; + + @Autowired + protected Validator validator; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + @Override + public List selectMdItemList(MdItem mdItem) { + return mdItemMapper.selectMdItemList(mdItem); + } + + @Override + public List selectMdItemAll() { + return mdItemMapper.selectMdItemAll(); + } + + @Override + public List getExeportList(MdItem mdItem) { + return mdItemMapper.getExeportList(mdItem); + } + + @Override + public String importItem(List itemList, Boolean isUpdateSupport, String operName) { + if (StringUtils.isNull(itemList) || itemList.size() == 0) + { + throw new ServiceException("导入物料产品数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (MdItem item : itemList) + { + try{ + //物料分类是否正确 + if(StringUtils.isNotNull(item.getItemTypeName())){ + List types = itemTypeMapper.selectItemTypeByName(item.getItemTypeName()); + if(!CollectionUtils.isEmpty(types)){ + item.setItemTypeId(types.get(0).getItemTypeId()); + item.setItemTypeCode(types.get(0).getItemTypeCode()); + item.setItemTypeName(types.get(0).getItemTypeName()); + item.setItemOrProduct(types.get(0).getItemOrProduct()); + + item.setSafeStockFlag(UserConstants.NO); + item.setEnableFlag(UserConstants.YES); + item.setHighValue(UserConstants.NO); + + //是否存在 + MdItem v = mdItemMapper.checkItemCodeUnique(item); + if(StringUtils.isNull(v)){ + BeanValidators.validateWithException(validator, item); + String itemCode = autoCodeUtil.genSerialCode(UserConstants.ITEM_CODE,""); + item.setItemCode(itemCode); + this.insertMdItem(item); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_ITEM,item.getItemId(),item.getItemCode(),item.getItemName()); + successNum++; + }else if (isUpdateSupport){ + BeanValidators.validateWithException(validator, item); + item.setUpdateBy(operName); + item.setItemId(v.getItemId()); + this.updateMdItem(item); + successNum++; + }else { + failureNum++; + failureMsg.append("
" + failureNum + "、物料/产品 " + item.getItemName() + " 已存在"); + } + }else{ + failureNum++; + failureMsg.append("
" + failureNum + "、物料/产品 " + item.getItemName() + " 请填写正确的分类"); + } + }else { + failureNum++; + failureMsg.append("
" + failureNum + "、物料/产品 " + item.getItemName() + " 请填写分类"); + } + }catch (Exception e){ + failureNum++; + String msg = "
" + failureNum + "、物料/产品 " + item.getItemName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条"); + } + return successMsg.toString(); + } + + + @Override + public MdItem selectMdItemById(Long itemId) { + return mdItemMapper.selectMdItemById(itemId); + } + + @Override + public String checkItemCodeUnique(MdItem mdItem) { + MdItem item = mdItemMapper.checkItemCodeUnique(mdItem); + Long itemId = mdItem.getItemId() == null? -1L:mdItem.getItemId(); + if(StringUtils.isNotNull(item) && item.getItemId().longValue() != itemId.longValue()){ + return UserConstants.NOT_UNIQUE; + }else{ + return UserConstants.UNIQUE; + } + } + + @Override + public String checkItemNameUnique(MdItem mdItem) { + MdItem item = mdItemMapper.checkItemNameUnique(mdItem); + Long itemId = mdItem.getItemId() == null? -1L:mdItem.getItemId(); + if(StringUtils.isNotNull(item) && item.getItemId().longValue() != itemId.longValue()){ + return UserConstants.NOT_UNIQUE; + }else{ + return UserConstants.UNIQUE; + } + } + + @Override + public int insertMdItem(MdItem mdItem) { + return mdItemMapper.insertMdItem(mdItem); + } + + @Override + public int updateMdItem(MdItem mdItem) { + return mdItemMapper.updateMdItem(mdItem); + } + + @Override + public int deleteByItemIds(Long[] itemIds) { + return mdItemMapper.deleteMdItemByIds(itemIds); + } + + @Override + public int deleteByItemId(Long itemId) { + return mdItemMapper.deleteMdItemById(itemId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java new file mode 100644 index 0000000..a8d8013 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdProductBomMapper; +import com.ktg.mes.md.domain.MdProductBom; +import com.ktg.mes.md.service.IMdProductBomService; + +/** + * 产品BOM关系Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-09 + */ +@Service +public class MdProductBomServiceImpl implements IMdProductBomService +{ + @Autowired + private MdProductBomMapper mdProductBomMapper; + + /** + * 查询产品BOM关系 + * + * @param bomId 产品BOM关系主键 + * @return 产品BOM关系 + */ + @Override + public MdProductBom selectMdProductBomByBomId(Long bomId) + { + return mdProductBomMapper.selectMdProductBomByBomId(bomId); + } + + /** + * 查询产品BOM关系列表 + * + * @param mdProductBom 产品BOM关系 + * @return 产品BOM关系 + */ + @Override + public List selectMdProductBomList(MdProductBom mdProductBom) + { + return mdProductBomMapper.selectMdProductBomList(mdProductBom); + } + + /** + * 新增产品BOM关系 + * + * @param mdProductBom 产品BOM关系 + * @return 结果 + */ + @Override + public int insertMdProductBom(MdProductBom mdProductBom) + { + mdProductBom.setCreateTime(DateUtils.getNowDate()); + return mdProductBomMapper.insertMdProductBom(mdProductBom); + } + + /** + * 修改产品BOM关系 + * + * @param mdProductBom 产品BOM关系 + * @return 结果 + */ + @Override + public int updateMdProductBom(MdProductBom mdProductBom) + { + mdProductBom.setUpdateTime(DateUtils.getNowDate()); + return mdProductBomMapper.updateMdProductBom(mdProductBom); + } + + /** + * 批量删除产品BOM关系 + * + * @param bomIds 需要删除的产品BOM关系主键 + * @return 结果 + */ + @Override + public int deleteMdProductBomByBomIds(Long[] bomIds) + { + return mdProductBomMapper.deleteMdProductBomByBomIds(bomIds); + } + + /** + * 删除产品BOM关系信息 + * + * @param bomId 产品BOM关系主键 + * @return 结果 + */ + @Override + public int deleteMdProductBomByBomId(Long bomId) + { + return mdProductBomMapper.deleteMdProductBomByBomId(bomId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductSipServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductSipServiceImpl.java new file mode 100644 index 0000000..da1b511 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductSipServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdProductSipMapper; +import com.ktg.mes.md.domain.MdProductSip; +import com.ktg.mes.md.service.IMdProductSipService; + +/** + * 产品SIPService业务层处理 + * + * @author yinjinlu + * @date 2023-10-31 + */ +@Service +public class MdProductSipServiceImpl implements IMdProductSipService +{ + @Autowired + private MdProductSipMapper mdProductSipMapper; + + /** + * 查询产品SIP + * + * @param sipId 产品SIP主键 + * @return 产品SIP + */ + @Override + public MdProductSip selectMdProductSipBySipId(Long sipId) + { + return mdProductSipMapper.selectMdProductSipBySipId(sipId); + } + + /** + * 查询产品SIP列表 + * + * @param mdProductSip 产品SIP + * @return 产品SIP + */ + @Override + public List selectMdProductSipList(MdProductSip mdProductSip) + { + return mdProductSipMapper.selectMdProductSipList(mdProductSip); + } + + /** + * 新增产品SIP + * + * @param mdProductSip 产品SIP + * @return 结果 + */ + @Override + public int insertMdProductSip(MdProductSip mdProductSip) + { + mdProductSip.setCreateTime(DateUtils.getNowDate()); + return mdProductSipMapper.insertMdProductSip(mdProductSip); + } + + /** + * 修改产品SIP + * + * @param mdProductSip 产品SIP + * @return 结果 + */ + @Override + public int updateMdProductSip(MdProductSip mdProductSip) + { + mdProductSip.setUpdateTime(DateUtils.getNowDate()); + return mdProductSipMapper.updateMdProductSip(mdProductSip); + } + + /** + * 批量删除产品SIP + * + * @param sipIds 需要删除的产品SIP主键 + * @return 结果 + */ + @Override + public int deleteMdProductSipBySipIds(Long[] sipIds) + { + return mdProductSipMapper.deleteMdProductSipBySipIds(sipIds); + } + + /** + * 删除产品SIP信息 + * + * @param sipId 产品SIP主键 + * @return 结果 + */ + @Override + public int deleteMdProductSipBySipId(Long sipId) + { + return mdProductSipMapper.deleteMdProductSipBySipId(sipId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductSopServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductSopServiceImpl.java new file mode 100644 index 0000000..756ec0b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductSopServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdProductSopMapper; +import com.ktg.mes.md.domain.MdProductSop; +import com.ktg.mes.md.service.IMdProductSopService; + +/** + * 产品SOPService业务层处理 + * + * @author yinjinlu + * @date 2022-07-26 + */ +@Service +public class MdProductSopServiceImpl implements IMdProductSopService +{ + @Autowired + private MdProductSopMapper mdProductSopMapper; + + /** + * 查询产品SOP + * + * @param sopId 产品SOP主键 + * @return 产品SOP + */ + @Override + public MdProductSop selectMdProductSopBySopId(Long sopId) + { + return mdProductSopMapper.selectMdProductSopBySopId(sopId); + } + + /** + * 查询产品SOP列表 + * + * @param mdProdutSop 产品SOP + * @return 产品SOP + */ + @Override + public List selectMdProductSopList(MdProductSop mdProdutSop) + { + return mdProductSopMapper.selectMdProductSopList(mdProdutSop); + } + + /** + * 新增产品SOP + * + * @param mdProdutSop 产品SOP + * @return 结果 + */ + @Override + public int insertMdProductSop(MdProductSop mdProdutSop) + { + mdProdutSop.setCreateTime(DateUtils.getNowDate()); + return mdProductSopMapper.insertMdProductSop(mdProdutSop); + } + + /** + * 修改产品SOP + * + * @param mdProdutSop 产品SOP + * @return 结果 + */ + @Override + public int updateMdProductSop(MdProductSop mdProdutSop) + { + mdProdutSop.setUpdateTime(DateUtils.getNowDate()); + return mdProductSopMapper.updateMdProductSop(mdProdutSop); + } + + /** + * 批量删除产品SOP + * + * @param sopIds 需要删除的产品SOP主键 + * @return 结果 + */ + @Override + public int deleteMdProductSopBySopIds(Long[] sopIds) + { + return mdProductSopMapper.deleteMdProductSopBySopIds(sopIds); + } + + /** + * 删除产品SOP信息 + * + * @param sopId 产品SOP主键 + * @return 结果 + */ + @Override + public int deleteMdProductSopBySopId(Long sopId) + { + return mdProductSopMapper.deleteMdProductSopBySopId(sopId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdUnitMeasureServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdUnitMeasureServiceImpl.java new file mode 100644 index 0000000..85e307d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdUnitMeasureServiceImpl.java @@ -0,0 +1,102 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.mes.md.service.IMdUnitMeasureService; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdUnitMeasureMapper; +import com.ktg.mes.md.domain.MdUnitMeasure; + +/** + * 单位Service业务层处理 + * + * @author ruoyi + * @date 2022-04-27 + */ +@Service +public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService +{ + @Autowired + private MdUnitMeasureMapper mdUnitMeasureMapper; + + /** + * 查询单位 + * + * @param measureId 单位主键 + * @return 单位 + */ + @Override + public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId) + { + return mdUnitMeasureMapper.selectMdUnitMeasureByMeasureId(measureId); + } + + /** + * 查询单位列表 + * + * @param mdUnitMeasure 单位 + * @return 单位 + */ + @Override + public List selectMdUnitMeasureList(MdUnitMeasure mdUnitMeasure) + { + return mdUnitMeasureMapper.selectMdUnitMeasureList(mdUnitMeasure); + } + + @Override + public MdUnitMeasure selectMdUnitByCode(String unitCode) { + return mdUnitMeasureMapper.selectMdUnitByCode(unitCode); + } + + /** + * 新增单位 + * + * @param mdUnitMeasure 单位 + * @return 结果 + */ + @Override + public int insertMdUnitMeasure(MdUnitMeasure mdUnitMeasure) + { + mdUnitMeasure.setCreateTime(DateUtils.getNowDate()); + return mdUnitMeasureMapper.insertMdUnitMeasure(mdUnitMeasure); + } + + /** + * 修改单位 + * + * @param mdUnitMeasure 单位 + * @return 结果 + */ + @Override + public int updateMdUnitMeasure(MdUnitMeasure mdUnitMeasure) + { + mdUnitMeasure.setUpdateTime(DateUtils.getNowDate()); + return mdUnitMeasureMapper.updateMdUnitMeasure(mdUnitMeasure); + } + + /** + * 批量删除单位 + * + * @param measureIds 需要删除的单位主键 + * @return 结果 + */ + @Override + public int deleteMdUnitMeasureByMeasureIds(Long[] measureIds) + { + return mdUnitMeasureMapper.deleteMdUnitMeasureByMeasureIds(measureIds); + } + + /** + * 删除单位信息 + * + * @param measureId 单位主键 + * @return 结果 + */ + @Override + public int deleteMdUnitMeasureByMeasureId(Long measureId) + { + return mdUnitMeasureMapper.deleteMdUnitMeasureByMeasureId(measureId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdVendorServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdVendorServiceImpl.java new file mode 100644 index 0000000..2795fc3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdVendorServiceImpl.java @@ -0,0 +1,197 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.bean.BeanValidators; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import com.ktg.system.strategy.AutoCodeUtil; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdVendorMapper; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.service.IMdVendorService; + +import javax.validation.Validator; + +/** + * 供应商Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-06 + */ +@Service +public class MdVendorServiceImpl implements IMdVendorService +{ + @Autowired + private MdVendorMapper mdVendorMapper; + + @Autowired + protected Validator validator; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询供应商 + * + * @param vendorId 供应商主键 + * @return 供应商 + */ + @Override + public MdVendor selectMdVendorByVendorId(Long vendorId) + { + return mdVendorMapper.selectMdVendorByVendorId(vendorId); + } + + /** + * 查询供应商列表 + * + * @param mdVendor 供应商 + * @return 供应商 + */ + @Override + public List selectMdVendorList(MdVendor mdVendor) + { + return mdVendorMapper.selectMdVendorList(mdVendor); + } + + @Override + public String checkVendorCodeUnique(MdVendor mdVendor) { + MdVendor vendor = mdVendorMapper.checkVendorCodeUnique(mdVendor); + Long vendorId = mdVendor.getVendorId()==null?-1L:mdVendor.getVendorId(); + if(StringUtils.isNotNull(vendor) && vendor.getVendorId().longValue() !=vendorId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkVendorNameUnique(MdVendor mdVendor) { + MdVendor vendor = mdVendorMapper.checkVendorNameUnique(mdVendor); + Long vendorId = mdVendor.getVendorId()==null?-1L:mdVendor.getVendorId(); + if(StringUtils.isNotNull(vendor) && vendor.getVendorId().longValue() !=vendorId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkVendorNickUnique(MdVendor mdVendor) { + MdVendor vendor = mdVendorMapper.checkVendorNickUnique(mdVendor); + Long vendorId = mdVendor.getVendorId()==null?-1L:mdVendor.getVendorId(); + if(StringUtils.isNotNull(vendor) && vendor.getVendorId().longValue() !=vendorId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String importVendor(List vendorList, Boolean isUpdateSupport, String operName) { + if (StringUtils.isNull(vendorList) || vendorList.size() == 0) + { + throw new ServiceException("导入供应商数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (MdVendor vendor : vendorList) + { + try{ + //是否存在 + MdVendor v = mdVendorMapper.checkVendorCodeUnique(vendor); + if(StringUtils.isNull(v)){ + BeanValidators.validateWithException(validator, vendor); + String vendorCode = autoCodeUtil.genSerialCode(UserConstants.VENDOR_CODE,""); + vendor.setVendorCode(vendorCode); + this.insertMdVendor(vendor); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_VENDOR,vendor.getVendorId(),vendor.getVendorCode(),vendor.getVendorName()); + successNum++; + }else if (isUpdateSupport){ + BeanValidators.validateWithException(validator, vendor); + vendor.setUpdateBy(operName); + vendor.setVendorId(v.getVendorId()); + this.updateMdVendor(vendor); + successNum++; + }else { + failureNum++; + failureMsg.append("
" + failureNum + "、供应商 " + vendor.getVendorName() + " 已存在"); + } + + }catch (Exception e){ + failureNum++; + String msg = "
" + failureNum + "、供应商 " + vendor.getVendorName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条"); + } + return successMsg.toString(); + } + + /** + * 新增供应商 + * + * @param mdVendor 供应商 + * @return 结果 + */ + @Override + public int insertMdVendor(MdVendor mdVendor) + { + mdVendor.setCreateTime(DateUtils.getNowDate()); + return mdVendorMapper.insertMdVendor(mdVendor); + } + + /** + * 修改供应商 + * + * @param mdVendor 供应商 + * @return 结果 + */ + @Override + public int updateMdVendor(MdVendor mdVendor) + { + mdVendor.setUpdateTime(DateUtils.getNowDate()); + return mdVendorMapper.updateMdVendor(mdVendor); + } + + /** + * 批量删除供应商 + * + * @param vendorIds 需要删除的供应商主键 + * @return 结果 + */ + @Override + public int deleteMdVendorByVendorIds(Long[] vendorIds) + { + return mdVendorMapper.deleteMdVendorByVendorIds(vendorIds); + } + + /** + * 删除供应商信息 + * + * @param vendorId 供应商主键 + * @return 结果 + */ + @Override + public int deleteMdVendorByVendorId(Long vendorId) + { + return mdVendorMapper.deleteMdVendorByVendorId(vendorId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkshopServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkshopServiceImpl.java new file mode 100644 index 0000000..386eb1f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkshopServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdWorkshopMapper; +import com.ktg.mes.md.domain.MdWorkshop; +import com.ktg.mes.md.service.IMdWorkshopService; + +/** + * 车间Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-07 + */ +@Service +public class MdWorkshopServiceImpl implements IMdWorkshopService +{ + @Autowired + private MdWorkshopMapper mdWorkshopMapper; + + /** + * 查询车间 + * + * @param workshopId 车间主键 + * @return 车间 + */ + @Override + public MdWorkshop selectMdWorkshopByWorkshopId(Long workshopId) + { + return mdWorkshopMapper.selectMdWorkshopByWorkshopId(workshopId); + } + + /** + * 查询车间列表 + * + * @param mdWorkshop 车间 + * @return 车间 + */ + @Override + public List selectMdWorkshopList(MdWorkshop mdWorkshop) + { + return mdWorkshopMapper.selectMdWorkshopList(mdWorkshop); + } + + @Override + public String checkWorkshopCodeUnique(MdWorkshop mdWorkshop) { + MdWorkshop workshop = mdWorkshopMapper.checkWorkshopCodeUnique(mdWorkshop); + Long workshopId = mdWorkshop.getWorkshopId()==null?-1L:mdWorkshop.getWorkshopId(); + if(StringUtils.isNotNull(workshop) && workshop.getWorkshopId().longValue() != workshopId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkWorkshopNameUnique(MdWorkshop mdWorkshop) { + MdWorkshop workshop = mdWorkshopMapper.checkWorkshopNameUnique(mdWorkshop); + Long workshopId = mdWorkshop.getWorkshopId()==null?-1L:mdWorkshop.getWorkshopId(); + if(StringUtils.isNotNull(workshop) && workshop.getWorkshopId().longValue() != workshopId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增车间 + * + * @param mdWorkshop 车间 + * @return 结果 + */ + @Override + public int insertMdWorkshop(MdWorkshop mdWorkshop) + { + mdWorkshop.setCreateTime(DateUtils.getNowDate()); + return mdWorkshopMapper.insertMdWorkshop(mdWorkshop); + } + + /** + * 修改车间 + * + * @param mdWorkshop 车间 + * @return 结果 + */ + @Override + public int updateMdWorkshop(MdWorkshop mdWorkshop) + { + mdWorkshop.setUpdateTime(DateUtils.getNowDate()); + return mdWorkshopMapper.updateMdWorkshop(mdWorkshop); + } + + /** + * 批量删除车间 + * + * @param workshopIds 需要删除的车间主键 + * @return 结果 + */ + @Override + public int deleteMdWorkshopByWorkshopIds(Long[] workshopIds) + { + return mdWorkshopMapper.deleteMdWorkshopByWorkshopIds(workshopIds); + } + + /** + * 删除车间信息 + * + * @param workshopId 车间主键 + * @return 结果 + */ + @Override + public int deleteMdWorkshopByWorkshopId(Long workshopId) + { + return mdWorkshopMapper.deleteMdWorkshopByWorkshopId(workshopId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationMachineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationMachineServiceImpl.java new file mode 100644 index 0000000..e6b8c63 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationMachineServiceImpl.java @@ -0,0 +1,116 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdWorkstationMachineMapper; +import com.ktg.mes.md.domain.MdWorkstationMachine; +import com.ktg.mes.md.service.IMdWorkstationMachineService; + +/** + * 设备资源Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-12 + */ +@Service +public class MdWorkstationMachineServiceImpl implements IMdWorkstationMachineService +{ + @Autowired + private MdWorkstationMachineMapper mdWorkstationMachineMapper; + + /** + * 查询设备资源 + * + * @param recordId 设备资源主键 + * @return 设备资源 + */ + @Override + public MdWorkstationMachine selectMdWorkstationMachineByRecordId(Long recordId) + { + return mdWorkstationMachineMapper.selectMdWorkstationMachineByRecordId(recordId); + } + + /** + * 查询设备资源列表 + * + * @param mdWorkstationMachine 设备资源 + * @return 设备资源 + */ + @Override + public List selectMdWorkstationMachineList(MdWorkstationMachine mdWorkstationMachine) + { + return mdWorkstationMachineMapper.selectMdWorkstationMachineList(mdWorkstationMachine); + } + + /** + * 检查机器资源是否已经被占用 + * 一台机器只能被分配到一个工作站中,且只能分配一次 + * @param mdWorkstationMachine + * @return + */ + @Override + public MdWorkstationMachine checkMachineryExists(MdWorkstationMachine mdWorkstationMachine) { + MdWorkstationMachine machine = mdWorkstationMachineMapper.checkMachineryExists(mdWorkstationMachine); + return machine; + } + + /** + * 新增设备资源 + * + * @param mdWorkstationMachine 设备资源 + * @return 结果 + */ + @Override + public int insertMdWorkstationMachine(MdWorkstationMachine mdWorkstationMachine) + { + mdWorkstationMachine.setCreateTime(DateUtils.getNowDate()); + return mdWorkstationMachineMapper.insertMdWorkstationMachine(mdWorkstationMachine); + } + + /** + * 修改设备资源 + * + * @param mdWorkstationMachine 设备资源 + * @return 结果 + */ + @Override + public int updateMdWorkstationMachine(MdWorkstationMachine mdWorkstationMachine) + { + mdWorkstationMachine.setUpdateTime(DateUtils.getNowDate()); + return mdWorkstationMachineMapper.updateMdWorkstationMachine(mdWorkstationMachine); + } + + /** + * 批量删除设备资源 + * + * @param recordIds 需要删除的设备资源主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationMachineByRecordIds(Long[] recordIds) + { + return mdWorkstationMachineMapper.deleteMdWorkstationMachineByRecordIds(recordIds); + } + + /** + * 删除设备资源信息 + * + * @param recordId 设备资源主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationMachineByRecordId(Long recordId) + { + return mdWorkstationMachineMapper.deleteMdWorkstationMachineByRecordId(recordId); + } + + @Override + public int deleteByWorkstationId(Long workstationId) { + return mdWorkstationMachineMapper.deleteByWorkstationId(workstationId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationServiceImpl.java new file mode 100644 index 0000000..df343e7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdWorkstationMapper; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdWorkstationService; + +/** + * 工作站Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-10 + */ +@Service +public class MdWorkstationServiceImpl implements IMdWorkstationService +{ + @Autowired + private MdWorkstationMapper mdWorkstationMapper; + + /** + * 查询工作站 + * + * @param workstationId 工作站主键 + * @return 工作站 + */ + @Override + public MdWorkstation selectMdWorkstationByWorkstationId(Long workstationId) + { + return mdWorkstationMapper.selectMdWorkstationByWorkstationId(workstationId); + } + + /** + * 查询工作站列表 + * + * @param mdWorkstation 工作站 + * @return 工作站 + */ + @Override + public List selectMdWorkstationList(MdWorkstation mdWorkstation) + { + return mdWorkstationMapper.selectMdWorkstationList(mdWorkstation); + } + + @Override + public String checkWorkStationCodeUnique(MdWorkstation mdWorkstation) { + MdWorkstation workstation = mdWorkstationMapper.checkWorkStationCodeUnique(mdWorkstation); + Long workstationId = mdWorkstation.getWorkstationId()==null? -1L:mdWorkstation.getWorkstationId(); + if(StringUtils.isNotNull(workstation) && workstation.getWorkstationId().longValue() != workstationId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkWorkStationNameUnique(MdWorkstation mdWorkstation) { + MdWorkstation workstation = mdWorkstationMapper.checkWorkStationNameUnique(mdWorkstation); + Long workstationId = mdWorkstation.getWorkstationId()==null? -1L:mdWorkstation.getWorkstationId(); + if(StringUtils.isNotNull(workstation) && workstation.getWorkstationId().longValue() != workstationId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增工作站 + * + * @param mdWorkstation 工作站 + * @return 结果 + */ + @Override + public int insertMdWorkstation(MdWorkstation mdWorkstation) + { + mdWorkstation.setCreateTime(DateUtils.getNowDate()); + return mdWorkstationMapper.insertMdWorkstation(mdWorkstation); + } + + /** + * 修改工作站 + * + * @param mdWorkstation 工作站 + * @return 结果 + */ + @Override + public int updateMdWorkstation(MdWorkstation mdWorkstation) + { + mdWorkstation.setUpdateTime(DateUtils.getNowDate()); + return mdWorkstationMapper.updateMdWorkstation(mdWorkstation); + } + + /** + * 批量删除工作站 + * + * @param workstationIds 需要删除的工作站主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationByWorkstationIds(Long[] workstationIds) + { + return mdWorkstationMapper.deleteMdWorkstationByWorkstationIds(workstationIds); + } + + /** + * 删除工作站信息 + * + * @param workstationId 工作站主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationByWorkstationId(Long workstationId) + { + return mdWorkstationMapper.deleteMdWorkstationByWorkstationId(workstationId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationToolServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationToolServiceImpl.java new file mode 100644 index 0000000..f27adfd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationToolServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdWorkstationToolMapper; +import com.ktg.mes.md.domain.MdWorkstationTool; +import com.ktg.mes.md.service.IMdWorkstationToolService; + +/** + * 工装夹具资源Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-12 + */ +@Service +public class MdWorkstationToolServiceImpl implements IMdWorkstationToolService +{ + @Autowired + private MdWorkstationToolMapper mdWorkstationToolMapper; + + /** + * 查询工装夹具资源 + * + * @param recordId 工装夹具资源主键 + * @return 工装夹具资源 + */ + @Override + public MdWorkstationTool selectMdWorkstationToolByRecordId(Long recordId) + { + return mdWorkstationToolMapper.selectMdWorkstationToolByRecordId(recordId); + } + + /** + * 查询工装夹具资源列表 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 工装夹具资源 + */ + @Override + public List selectMdWorkstationToolList(MdWorkstationTool mdWorkstationTool) + { + return mdWorkstationToolMapper.selectMdWorkstationToolList(mdWorkstationTool); + } + + @Override + public String checkToolTypeExists(MdWorkstationTool mdWorkstationTool) { + MdWorkstationTool workstationTool = mdWorkstationToolMapper.checkToolTypeExists(mdWorkstationTool); + Long workstationToolId = mdWorkstationTool.getRecordId()==null?-1L:mdWorkstationTool.getRecordId(); + if(StringUtils.isNotNull(workstationTool)&&workstationTool.getRecordId().longValue()!=workstationToolId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增工装夹具资源 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 结果 + */ + @Override + public int insertMdWorkstationTool(MdWorkstationTool mdWorkstationTool) + { + mdWorkstationTool.setCreateTime(DateUtils.getNowDate()); + return mdWorkstationToolMapper.insertMdWorkstationTool(mdWorkstationTool); + } + + /** + * 修改工装夹具资源 + * + * @param mdWorkstationTool 工装夹具资源 + * @return 结果 + */ + @Override + public int updateMdWorkstationTool(MdWorkstationTool mdWorkstationTool) + { + mdWorkstationTool.setUpdateTime(DateUtils.getNowDate()); + return mdWorkstationToolMapper.updateMdWorkstationTool(mdWorkstationTool); + } + + /** + * 批量删除工装夹具资源 + * + * @param recordIds 需要删除的工装夹具资源主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationToolByRecordIds(Long[] recordIds) + { + return mdWorkstationToolMapper.deleteMdWorkstationToolByRecordIds(recordIds); + } + + /** + * 删除工装夹具资源信息 + * + * @param recordId 工装夹具资源主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationToolByRecordId(Long recordId) + { + return mdWorkstationToolMapper.deleteMdWorkstationToolByRecordId(recordId); + } + + @Override + public int deleteByWorkstationId(Long workstationId) { + return mdWorkstationToolMapper.deleteByWorkstationId(workstationId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationWorkerServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationWorkerServiceImpl.java new file mode 100644 index 0000000..9f789f5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdWorkstationWorkerServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.MdWorkstationWorkerMapper; +import com.ktg.mes.md.domain.MdWorkstationWorker; +import com.ktg.mes.md.service.IMdWorkstationWorkerService; + +/** + * 人力资源Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-12 + */ +@Service +public class MdWorkstationWorkerServiceImpl implements IMdWorkstationWorkerService +{ + @Autowired + private MdWorkstationWorkerMapper mdWorkstationWorkerMapper; + + /** + * 查询人力资源 + * + * @param recordId 人力资源主键 + * @return 人力资源 + */ + @Override + public MdWorkstationWorker selectMdWorkstationWorkerByRecordId(Long recordId) + { + return mdWorkstationWorkerMapper.selectMdWorkstationWorkerByRecordId(recordId); + } + + /** + * 查询人力资源列表 + * + * @param mdWorkstationWorker 人力资源 + * @return 人力资源 + */ + @Override + public List selectMdWorkstationWorkerList(MdWorkstationWorker mdWorkstationWorker) + { + return mdWorkstationWorkerMapper.selectMdWorkstationWorkerList(mdWorkstationWorker); + } + + @Override + public String checkPostExist(MdWorkstationWorker mdWorkstationWorker) { + MdWorkstationWorker post = mdWorkstationWorkerMapper.checkPostExist(mdWorkstationWorker); + Long recordId = mdWorkstationWorker.getRecordId()==null?-1L:mdWorkstationWorker.getRecordId(); + if(StringUtils.isNotNull(post) && post.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增人力资源 + * + * @param mdWorkstationWorker 人力资源 + * @return 结果 + */ + @Override + public int insertMdWorkstationWorker(MdWorkstationWorker mdWorkstationWorker) + { + mdWorkstationWorker.setCreateTime(DateUtils.getNowDate()); + return mdWorkstationWorkerMapper.insertMdWorkstationWorker(mdWorkstationWorker); + } + + /** + * 修改人力资源 + * + * @param mdWorkstationWorker 人力资源 + * @return 结果 + */ + @Override + public int updateMdWorkstationWorker(MdWorkstationWorker mdWorkstationWorker) + { + mdWorkstationWorker.setUpdateTime(DateUtils.getNowDate()); + return mdWorkstationWorkerMapper.updateMdWorkstationWorker(mdWorkstationWorker); + } + + /** + * 批量删除人力资源 + * + * @param recordIds 需要删除的人力资源主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationWorkerByRecordIds(Long[] recordIds) + { + return mdWorkstationWorkerMapper.deleteMdWorkstationWorkerByRecordIds(recordIds); + } + + /** + * 删除人力资源信息 + * + * @param recordId 人力资源主键 + * @return 结果 + */ + @Override + public int deleteMdWorkstationWorkerByRecordId(Long recordId) + { + return mdWorkstationWorkerMapper.deleteMdWorkstationWorkerByRecordId(recordId); + } + + @Override + public int deleteByWorkstationId(Long workstationId) { + return mdWorkstationWorkerMapper.deleteByWorkstationId(workstationId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProFeedbackController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProFeedbackController.java new file mode 100644 index 0000000..571c242 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProFeedbackController.java @@ -0,0 +1,312 @@ +package com.ktg.mes.pro.controller; + +import java.math.BigDecimal; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdWorkstationService; +import com.ktg.mes.pro.domain.*; +import com.ktg.mes.pro.service.IProRouteProcessService; +import com.ktg.mes.pro.service.IProTaskService; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.mes.wm.domain.WmItemConsume; +import com.ktg.mes.wm.domain.WmProductProduce; +import com.ktg.mes.wm.domain.tx.ItemConsumeTxBean; +import com.ktg.mes.wm.domain.tx.ProductProductTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmItemConsumeService; +import com.ktg.mes.wm.service.IWmProductProduceService; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.service.IProFeedbackService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产报工记录Controller + * + * @author yinjinlu + * @date 2022-07-10 + */ +@RestController +@RequestMapping("/mes/pro/feedback") +public class ProFeedbackController extends BaseController +{ + @Autowired + private IProFeedbackService proFeedbackService; + + @Autowired + private IProTaskService proTaskService; + + @Autowired + private IProRouteProcessService proRouteProcessService; + + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private IMdWorkstationService mdWorkstationService; + + @Autowired + private IWmItemConsumeService wmItemConsumeService; + + @Autowired + private IWmProductProduceService wmProductProduceService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询生产报工记录列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProFeedback proFeedback) + { + startPage(); + List list = proFeedbackService.selectProFeedbackList(proFeedback); + return getDataTable(list); + } + + /** + * 导出生产报工记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:export')") + @Log(title = "生产报工记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProFeedback proFeedback) + { + List list = proFeedbackService.selectProFeedbackList(proFeedback); + ExcelUtil util = new ExcelUtil(ProFeedback.class); + util.exportExcel(response, list, "生产报工记录数据"); + } + + /** + * 获取生产报工记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(proFeedbackService.selectProFeedbackByRecordId(recordId)); + } + + /** + * 新增生产报工记录 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:add')") + @Log(title = "生产报工记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProFeedback proFeedback) + { + MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId()); + if(StringUtils.isNotNull(workstation)){ + proFeedback.setProcessId(workstation.getProcessId()); + proFeedback.setProcessCode(workstation.getProcessCode()); + proFeedback.setProcessName(workstation.getProcessName()); + }else { + return AjaxResult.error("当前生产任务对应的工作站不存在!"); + } + //检查对应的工艺路线和工序配置 + if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){ + ProRouteProcess param = new ProRouteProcess(); + param.setRouteId(proFeedback.getRouteId()); + param.setProcessId(proFeedback.getProcessId()); + List processes = proRouteProcessService.selectProRouteProcessList(param); + if(CollectionUtil.isEmpty(processes)){ + return AjaxResult.error("未找到生产任务对应的工艺工序配置!"); + } + }else { + return AjaxResult.error("当前生产任务对应的工艺工序配置无效!"); + } + + //检查数量 + if(UserConstants.YES.equals(proFeedback.getIsCheck())){ + if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){ + return AjaxResult.error("请输入待检测数量!"); + } + }else { + if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){ + return AjaxResult.error("请输入合格品和不良品数量!"); + } + } + String feedbackCode = autoCodeUtil.genSerialCode(UserConstants.FEEDBACK_CODE,""); + proFeedback.setFeedbackCode(feedbackCode); + proFeedback.setCreateBy(getUsername()); + return toAjax(proFeedbackService.insertProFeedback(proFeedback)); + } + + /** + * 修改生产报工记录 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:edit')") + @Log(title = "生产报工记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProFeedback proFeedback) + { + MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId()); + if(StringUtils.isNotNull(workstation)){ + proFeedback.setProcessId(workstation.getProcessId()); + proFeedback.setProcessCode(workstation.getProcessCode()); + proFeedback.setProcessName(workstation.getProcessName()); + }else { + return AjaxResult.error("当前生产任务对应的工作站不存在!"); + } + + //检查对应的工艺路线和工序配置 + if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){ + ProRouteProcess param = new ProRouteProcess(); + param.setRouteId(proFeedback.getRouteId()); + param.setProcessId(proFeedback.getProcessId()); + List processes = proRouteProcessService.selectProRouteProcessList(param); + if(CollectionUtil.isEmpty(processes)){ + return AjaxResult.error("未找到生产任务对应的工艺工序配置!"); + } + }else { + return AjaxResult.error("当前生产任务对应的工艺工序配置无效!"); + } + + //检查数量 + if(UserConstants.YES.equals(proFeedback.getIsCheck())){ + if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){ + return AjaxResult.error("当前工作站报工需要经过质检确认,请输入待检测数量!"); + } + }else { + if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){ + return AjaxResult.error("请输入合格品和不良品数量!"); + } + } + return toAjax(proFeedbackService.updateProFeedback(proFeedback)); + } + + /** + * 删除生产报工记录 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:remove')") + @Log(title = "生产报工记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(proFeedbackService.deleteProFeedbackByRecordIds(recordIds)); + } + + /** + * 执行报工 + * 1.更新生产任务和生产工单的进度 + * 2.物料消耗 + * 3.产品产出 + * @param recordId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:edit')") + @Log(title = "生产报工执行", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{recordId}") + public AjaxResult execute(@PathVariable("recordId") Long recordId){ + + if(!StringUtils.isNotNull(recordId)){ + return AjaxResult.error("请先保存单据"); + } + + ProFeedback feedback= proFeedbackService.selectProFeedbackByRecordId(recordId); + if(feedback.getQuantityFeedback().compareTo(BigDecimal.ZERO) !=1){ + return AjaxResult.error("报工数量必须大于0"); + } + + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(feedback.getWorkorderId()); + + ProTask task = proTaskService.selectProTaskByTaskId(feedback.getTaskId()); + + //判断当前生产任务的状态,如果已经完成则不能再报工 + if(UserConstants.ORDER_STATUS_FINISHED.equals(task.getStatus())){ + return AjaxResult.error("当前生产工单的状态为已完成,不能继续报工,请刷新生产任务列表!"); + } + + //仍旧有待检数量时不能执行 + if(StringUtils.isNotNull(feedback.getQuantityUncheck()) && feedback.getQuantityUncheck().compareTo(BigDecimal.ZERO) >0){ + return AjaxResult.error("当前报工单未完成检验(待检数量大于0),无法执行报工!"); + } + + //更新生产任务的生产数量 + BigDecimal quantityProduced,quantityQuanlify,quantityUnquanlify; + quantityQuanlify = task.getQuantityQuanlify()==null? new BigDecimal(0):task.getQuantityQuanlify(); + quantityUnquanlify = task.getQuantityUnquanlify() ==null? new BigDecimal(0):task.getQuantityUnquanlify(); + quantityProduced = task.getQuantityProduced()==null? new BigDecimal(0):task.getQuantityProduced(); + task.setQuantityProduced(quantityProduced.add(feedback.getQuantityFeedback())); + task.setQuantityQuanlify(quantityQuanlify.add(feedback.getQuantityQualified())); + task.setQuantityUnquanlify(quantityUnquanlify.add(feedback.getQuantityUnquanlified())); + + proTaskService.updateProTask(task); + + //如果是关键工序,则更新当前工单的已生产数量,进行产品产出动作 + if(proRouteProcessService.checkKeyProcess(feedback)){ + //更新生产工单的生产数量 + BigDecimal produced = workorder.getQuantityProduced() == null?new BigDecimal(0):workorder.getQuantityProduced(); + BigDecimal feedBackQuantity = feedback.getQuantityFeedback() ==null?new BigDecimal(0):feedback.getQuantityFeedback(); + workorder.setQuantityProduced( produced.add(feedBackQuantity)); + proWorkorderService.updateProWorkorder(workorder); + + //生成产品产出记录单 + WmProductProduce productRecord = wmProductProduceService.generateProductProduce(feedback); + //执行产品产出入线边库 + executeProductProduce(productRecord); + } + + //根据当前工序的物料BOM配置,进行物料消耗 + //先生成消耗单 + WmItemConsume itemConsume = wmItemConsumeService.generateItemConsume(feedback); + if(StringUtils.isNotNull(itemConsume)){ + //再执行库存消耗动作 + executeItemConsume(itemConsume); + } + + //更新报工单的状态 + feedback.setStatus(UserConstants.ORDER_STATUS_FINISHED); + proFeedbackService.updateProFeedback(feedback); + return AjaxResult.success(); + } + + /** + * 执行产品产出入线边库动作 + * @param record + */ + private void executeProductProduce(WmProductProduce record){ + List beans = wmProductProduceService.getTxBeans(record.getRecordId()); + storageCoreService.processProductProduce(beans); + record.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmProductProduceService.updateWmProductProduce(record); + } + + /** + * 执行物料消耗库存动作 + * @param record + */ + private void executeItemConsume(WmItemConsume record){ + //需要在此处进行分批次领料的线边库扣减 + List beans = wmItemConsumeService.getTxBeans(record.getRecordId()); + storageCoreService.processItemConsume(beans); + record.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmItemConsumeService.updateWmItemConsume(record); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProProcessContentController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProProcessContentController.java new file mode 100644 index 0000000..5e3c32a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProProcessContentController.java @@ -0,0 +1,103 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProProcessContent; +import com.ktg.mes.pro.service.IProProcessContentService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产工序内容Controller + * + * @author yinjinlu + * @date 2022-05-12 + */ +@RestController +@RequestMapping("/mes/pro/processcontent") +public class ProProcessContentController extends BaseController +{ + @Autowired + private IProProcessContentService proProcessContentService; + + /** + * 查询生产工序内容列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProProcessContent proProcessContent) + { + startPage(); + List list = proProcessContentService.selectProProcessContentList(proProcessContent); + return getDataTable(list); + } + + /** + * 导出生产工序内容列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:export')") + @Log(title = "生产工序内容", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProProcessContent proProcessContent) + { + List list = proProcessContentService.selectProProcessContentList(proProcessContent); + ExcelUtil util = new ExcelUtil(ProProcessContent.class); + util.exportExcel(response, list, "生产工序内容数据"); + } + + /** + * 获取生产工序内容详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:query')") + @GetMapping(value = "/{contentId}") + public AjaxResult getInfo(@PathVariable("contentId") Long contentId) + { + return AjaxResult.success(proProcessContentService.selectProProcessContentByContentId(contentId)); + } + + /** + * 新增生产工序内容 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:add')") + @Log(title = "生产工序内容", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProProcessContent proProcessContent) + { + return toAjax(proProcessContentService.insertProProcessContent(proProcessContent)); + } + + /** + * 修改生产工序内容 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:edit')") + @Log(title = "生产工序内容", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProProcessContent proProcessContent) + { + return toAjax(proProcessContentService.updateProProcessContent(proProcessContent)); + } + + /** + * 删除生产工序内容 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:remove')") + @Log(title = "生产工序内容", businessType = BusinessType.DELETE) + @DeleteMapping("/{contentIds}") + public AjaxResult remove(@PathVariable Long[] contentIds) + { + return toAjax(proProcessContentService.deleteProProcessContentByContentIds(contentIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProProcessController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProProcessController.java new file mode 100644 index 0000000..76ef3b8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProProcessController.java @@ -0,0 +1,130 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.aspectj.weaver.loadtime.Aj; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProProcess; +import com.ktg.mes.pro.service.IProProcessService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产工序Controller + * + * @author yinjinlu + * @date 2022-05-11 + */ +@RestController +@RequestMapping("/mes/pro/process") +public class ProProcessController extends BaseController +{ + @Autowired + private IProProcessService proProcessService; + + /** + * 查询生产工序列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProProcess proProcess) + { + startPage(); + List list = proProcessService.selectProProcessList(proProcess); + return getDataTable(list); + } + + /** + * 查询所有可用工序的清单 + * @return + */ + @GetMapping("/listAll") + public AjaxResult listAll(){ + ProProcess process = new ProProcess(); + process.setEnableFlag("Y"); + List list =proProcessService.selectProProcessList(process); + return AjaxResult.success(list); + } + + /** + * 导出生产工序列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:export')") + @Log(title = "生产工序", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProProcess proProcess) + { + List list = proProcessService.selectProProcessList(proProcess); + ExcelUtil util = new ExcelUtil(ProProcess.class); + util.exportExcel(response, list, "生产工序数据"); + } + + /** + * 获取生产工序详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:query')") + @GetMapping(value = "/{processId}") + public AjaxResult getInfo(@PathVariable("processId") Long processId) + { + return AjaxResult.success(proProcessService.selectProProcessByProcessId(processId)); + } + + /** + * 新增生产工序 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:add')") + @Log(title = "生产工序", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProProcess proProcess) + { + if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessCodeUnique(proProcess))){ + return AjaxResult.error("工序编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessNameUnique(proProcess))){ + return AjaxResult.error("工序名称已存在!"); + } + return toAjax(proProcessService.insertProProcess(proProcess)); + } + + /** + * 修改生产工序 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:edit')") + @Log(title = "生产工序", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProProcess proProcess) + { + if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessCodeUnique(proProcess))){ + return AjaxResult.error("工序编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(proProcessService.checkProcessNameUnique(proProcess))){ + return AjaxResult.error("工序名称已存在!"); + } + return toAjax(proProcessService.updateProProcess(proProcess)); + } + + /** + * 删除生产工序 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:remove')") + @Log(title = "生产工序", businessType = BusinessType.DELETE) + @DeleteMapping("/{processIds}") + public AjaxResult remove(@PathVariable Long[] processIds) + { + return toAjax(proProcessService.deleteProProcessByProcessIds(processIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteController.java new file mode 100644 index 0000000..d99aeb5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteController.java @@ -0,0 +1,132 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.service.IProRouteProcessService; +import com.ktg.mes.pro.service.IProRouteProductBomService; +import com.ktg.mes.pro.service.IProRouteProductService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProRoute; +import com.ktg.mes.pro.service.IProRouteService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工艺路线Controller + * + * @author yinjinlu + * @date 2022-05-12 + */ +@RestController +@RequestMapping("/mes/pro/proroute") +public class ProRouteController extends BaseController +{ + @Autowired + private IProRouteService proRouteService; + + @Autowired + private IProRouteProcessService proRouteProcessService; + + @Autowired + private IProRouteProductService proRouteProductService; + + @Autowired + private IProRouteProductBomService proRouteProductBomService; + + /** + * 查询工艺路线列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProRoute proRoute) + { + startPage(); + List list = proRouteService.selectProRouteList(proRoute); + return getDataTable(list); + } + + /** + * 导出工艺路线列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')") + @Log(title = "工艺路线", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProRoute proRoute) + { + List list = proRouteService.selectProRouteList(proRoute); + ExcelUtil util = new ExcelUtil(ProRoute.class); + util.exportExcel(response, list, "工艺路线数据"); + } + + /** + * 获取工艺路线详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')") + @GetMapping(value = "/{routeId}") + public AjaxResult getInfo(@PathVariable("routeId") Long routeId) + { + return AjaxResult.success(proRouteService.selectProRouteByRouteId(routeId)); + } + + /** + * 新增工艺路线 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')") + @Log(title = "工艺路线", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProRoute proRoute) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteService.checkRouteCodeUnique(proRoute))){ + return AjaxResult.error("工艺路线编号已存在!"); + } + return toAjax(proRouteService.insertProRoute(proRoute)); + } + + /** + * 修改工艺路线 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')") + @Log(title = "工艺路线", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProRoute proRoute) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteService.checkRouteCodeUnique(proRoute))){ + return AjaxResult.error("工艺路线编号已存在!"); + } + return toAjax(proRouteService.updateProRoute(proRoute)); + } + + /** + * 删除工艺路线 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')") + @Log(title = "工艺路线", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{routeIds}") + public AjaxResult remove(@PathVariable Long[] routeIds) + { + for (Long routeId:routeIds + ) { + proRouteProcessService.deleteByRouteId(routeId); + proRouteProductService.deleteByRouteId(routeId); + proRouteProductBomService.deleteByRouteId(routeId); + } + return toAjax(proRouteService.deleteProRouteByRouteIds(routeIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProcessController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProcessController.java new file mode 100644 index 0000000..215ef4a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProcessController.java @@ -0,0 +1,205 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProProcess; +import com.ktg.mes.pro.domain.ProRouteProduct; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProProcessService; +import com.ktg.mes.pro.service.IProRouteProductService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProRouteProcess; +import com.ktg.mes.pro.service.IProRouteProcessService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工艺组成Controller + * + * @author yinjinlu + * @date 2022-05-13 + */ +@RestController +@RequestMapping("/mes/pro/routeprocess") +public class ProRouteProcessController extends BaseController +{ + @Autowired + private IProRouteProcessService proRouteProcessService; + + @Autowired + private IProRouteProductService proRouteProductService; + + @Autowired + private IProProcessService proProcessService; + + /** + * 查询工艺组成列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProRouteProcess proRouteProcess) + { + startPage(); + List list = proRouteProcessService.selectProRouteProcessList(proRouteProcess); + return getDataTable(list); + } + + + /** + * 查询指定产品的工艺组成 + * @return + */ + @GetMapping("/listProductProcess/{productId}") + public AjaxResult listProductProcess(@PathVariable("productId") Long productId){ + ProRouteProduct proRouteProduct = new ProRouteProduct(); + proRouteProduct.setItemId(productId); + List products = proRouteProductService.selectProRouteProductList(proRouteProduct); + if(CollUtil.isNotEmpty(products)){ + ProRouteProduct product = products.get(0); + ProRouteProcess param = new ProRouteProcess(); + param.setRouteId(product.getRouteId()); + return AjaxResult.success(proRouteProcessService.selectProRouteProcessList(param)); + }else { + return AjaxResult.error("当前产品未配置工艺路线!"); + } + } + + + /** + * 导出工艺组成列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')") + @Log(title = "工艺组成", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProRouteProcess proRouteProcess) + { + List list = proRouteProcessService.selectProRouteProcessList(proRouteProcess); + ExcelUtil util = new ExcelUtil(ProRouteProcess.class); + util.exportExcel(response, list, "工艺组成数据"); + } + + /** + * 获取工艺组成详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(proRouteProcessService.selectProRouteProcessByRecordId(recordId)); + } + + /** + * 新增工艺组成 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')") + @Log(title = "工艺组成", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProRouteProcess proRouteProcess) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkOrderNumExists(proRouteProcess))){ + return AjaxResult.error("序号已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkProcessExists(proRouteProcess))){ + return AjaxResult.error("不能重复添加工序!"); + } + if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkUpdateFlagUnique(proRouteProcess))){ + return AjaxResult.error("当前工艺路线已经指定过关键工序"); + } + ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId()); + proRouteProcess.setProcessCode(process.getProcessCode()); + proRouteProcess.setProcessName(process.getProcessName()); + + //更新上一个工序的nextProcess + ProRouteProcess preProcess = proRouteProcessService.findPreProcess(proRouteProcess); + if(StringUtils.isNotNull(preProcess)){ + preProcess.setNextProcessId(proRouteProcess.getProcessId()); + preProcess.setNextProcessCode(proRouteProcess.getProcessCode()); + preProcess.setNextProcessName(proRouteProcess.getProcessName()); + proRouteProcessService.updateProRouteProcess(preProcess); + } + + //设置当前工序的nextProcess + ProRouteProcess nextProcess = proRouteProcessService.findNextProcess(proRouteProcess); + if(StringUtils.isNotNull(nextProcess)){ + proRouteProcess.setNextProcessId(nextProcess.getProcessId()); + proRouteProcess.setNextProcessCode(nextProcess.getProcessCode()); + proRouteProcess.setNextProcessName(nextProcess.getProcessName()); + }else{ + proRouteProcess.setNextProcessId(0L); + proRouteProcess.setNextProcessName("无"); + } + + return toAjax(proRouteProcessService.insertProRouteProcess(proRouteProcess)); + } + + /** + * 修改工艺组成 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')") + @Log(title = "工艺组成", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProRouteProcess proRouteProcess) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkOrderNumExists(proRouteProcess))){ + return AjaxResult.error("序号已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkProcessExists(proRouteProcess))){ + return AjaxResult.error("不能重复添加工序!"); + } + if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && UserConstants.NOT_UNIQUE.equals(proRouteProcessService.checkUpdateFlagUnique(proRouteProcess))){ + return AjaxResult.error("当前工艺路线已经指定过关键工序"); + } + ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId()); + proRouteProcess.setProcessCode(process.getProcessCode()); + proRouteProcess.setProcessName(process.getProcessName()); + + //更新上一个工序的nextProcess + ProRouteProcess preProcess = proRouteProcessService.findPreProcess(proRouteProcess); + if(StringUtils.isNotNull(preProcess)){ + preProcess.setNextProcessId(proRouteProcess.getProcessId()); + preProcess.setNextProcessCode(proRouteProcess.getProcessCode()); + preProcess.setNextProcessName(proRouteProcess.getProcessName()); + proRouteProcessService.updateProRouteProcess(preProcess); + } + + //设置当前工序的nextProcess + ProRouteProcess nextProcess = proRouteProcessService.findNextProcess(proRouteProcess); + if(StringUtils.isNotNull(nextProcess)){ + proRouteProcess.setNextProcessId(nextProcess.getProcessId()); + proRouteProcess.setNextProcessCode(nextProcess.getProcessCode()); + proRouteProcess.setNextProcessName(nextProcess.getProcessName()); + }else{ + proRouteProcess.setNextProcessId(0L); + proRouteProcess.setNextProcessName("无"); + } + + return toAjax(proRouteProcessService.updateProRouteProcess(proRouteProcess)); + } + + /** + * 删除工艺组成 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')") + @Log(title = "工艺组成", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(proRouteProcessService.deleteProRouteProcessByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProductBomController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProductBomController.java new file mode 100644 index 0000000..897a218 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProductBomController.java @@ -0,0 +1,111 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProRouteProductBom; +import com.ktg.mes.pro.service.IProRouteProductBomService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品制程物料BOMController + * + * @author yinjinlu + * @date 2022-09-12 + */ +@RestController +@RequestMapping("/mes/pro/routeproductbom") +public class ProRouteProductBomController extends BaseController +{ + @Autowired + private IProRouteProductBomService proRouteProductBomService; + + /** + * 查询产品制程物料BOM列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProRouteProductBom proRouteProductBom) + { + startPage(); + List list = proRouteProductBomService.selectProRouteProductBomList(proRouteProductBom); + return getDataTable(list); + } + + /** + * 导出产品制程物料BOM列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')") + @Log(title = "产品制程物料BOM", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProRouteProductBom proRouteProductBom) + { + List list = proRouteProductBomService.selectProRouteProductBomList(proRouteProductBom); + ExcelUtil util = new ExcelUtil(ProRouteProductBom.class); + util.exportExcel(response, list, "产品制程物料BOM数据"); + } + + /** + * 获取产品制程物料BOM详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(proRouteProductBomService.selectProRouteProductBomByRecordId(recordId)); + } + + /** + * 新增产品制程物料BOM + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')") + @Log(title = "产品制程物料BOM", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProRouteProductBom proRouteProductBom) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteProductBomService.checkUnique(proRouteProductBom))){ + return AjaxResult.error("当前BOM物料在此工序已经配置过!"); + } + return toAjax(proRouteProductBomService.insertProRouteProductBom(proRouteProductBom)); + } + + /** + * 修改产品制程物料BOM + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')") + @Log(title = "产品制程物料BOM", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProRouteProductBom proRouteProductBom) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteProductBomService.checkUnique(proRouteProductBom))){ + return AjaxResult.error("当前BOM物料在此工序已经配置过!"); + } + return toAjax(proRouteProductBomService.updateProRouteProductBom(proRouteProductBom)); + } + + /** + * 删除产品制程物料BOM + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')") + @Log(title = "产品制程物料BOM", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(proRouteProductBomService.deleteProRouteProductBomByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProductController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProductController.java new file mode 100644 index 0000000..287b58b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProRouteProductController.java @@ -0,0 +1,150 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.pro.domain.ProRouteProductBom; +import com.ktg.mes.pro.service.IProRouteProductBomService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProRouteProduct; +import com.ktg.mes.pro.service.IProRouteProductService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品制程Controller + * + * @author yinjinlu + * @date 2022-05-14 + */ +@RestController +@RequestMapping("/mes/pro/routeproduct") +public class ProRouteProductController extends BaseController +{ + @Autowired + private IProRouteProductService proRouteProductService; + + @Autowired + private IProRouteProductBomService proRouteProductBomService; + + /** + * 查询产品制程列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProRouteProduct proRouteProduct) + { + startPage(); + List list = proRouteProductService.selectProRouteProductList(proRouteProduct); + return getDataTable(list); + } + + + /** + * 导出产品制程列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:export')") + @Log(title = "产品制程", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProRouteProduct proRouteProduct) + { + List list = proRouteProductService.selectProRouteProductList(proRouteProduct); + ExcelUtil util = new ExcelUtil(ProRouteProduct.class); + util.exportExcel(response, list, "产品制程数据"); + } + + /** + * 获取产品制程详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(proRouteProductService.selectProRouteProductByRecordId(recordId)); + } + + /** + * 新增产品制程 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:add')") + @Log(title = "产品制程", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProRouteProduct proRouteProduct) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteProductService.checkItemUnique(proRouteProduct))){ + return AjaxResult.error("此产品已配置了工艺路线!"); + } + return toAjax(proRouteProductService.insertProRouteProduct(proRouteProduct)); + } + + /** + * 修改产品制程 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')") + @Log(title = "产品制程", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProRouteProduct proRouteProduct) + { + if(UserConstants.NOT_UNIQUE.equals(proRouteProductService.checkItemUnique(proRouteProduct))){ + return AjaxResult.error("此产品已配置了工艺路线!"); + } + return toAjax(proRouteProductService.updateProRouteProduct(proRouteProduct)); + } + + /** + * 更改产品的生产路线 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:edit')") + @Log(title = "产品制程", businessType = BusinessType.UPDATE) + @PutMapping("/move") + public AjaxResult move(@RequestBody ProRouteProduct proRouteProduct){ + ProRouteProduct param = new ProRouteProduct(); + param.setItemId(proRouteProduct.getItemId()); + param.setRouteId(proRouteProduct.getRouteId()); + List products = proRouteProductService.selectProRouteProductList(param); + int ret =1; + if(CollUtil.isNotEmpty(products)){ + ProRouteProduct product = products.get(0); + product.setRouteId(proRouteProduct.getRouteId()); + ret =proRouteProductService.updateProRouteProduct(product); + } + return toAjax(ret); + } + + + /** + * 删除产品制程 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')") + @Log(title = "产品制程", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + for (Long recordId:recordIds + ) { + ProRouteProduct product = proRouteProductService.selectProRouteProductByRecordId(recordId); + ProRouteProductBom bom = new ProRouteProductBom(); + bom.setRouteId(product.getRouteId()); + bom.setProductId(product.getItemId()); + proRouteProductBomService.deleteByRouteIdAndProductId(bom); + } + + return toAjax(proRouteProductService.deleteProRouteProductByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTaskController.java new file mode 100644 index 0000000..6c4f589 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTaskController.java @@ -0,0 +1,339 @@ +package com.ktg.mes.pro.controller; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.*; +import com.ktg.mes.pro.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产任务Controller + * + * @author yinjinlu + * @date 2022-05-14 + */ +@RestController +@RequestMapping("/mes/pro/protask") +public class ProTaskController extends BaseController +{ + @Autowired + private IProTaskService proTaskService; + + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private IProRouteProductService proRouteProductService; + + @Autowired + private IProProcessService proProcessService; + + @Autowired + private IProRouteService proRouteService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询生产任务列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProTask proTask) + { + startPage(); + List list = proTaskService.selectProTaskList(proTask); + return getDataTable(list); + } + + /** + * 导出生产任务列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:export')") + @Log(title = "生产任务", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProTask proTask) + { + List list = proTaskService.selectProTaskList(proTask); + ExcelUtil util = new ExcelUtil(ProTask.class); + util.exportExcel(response, list, "生产任务数据"); + } + + /** + * 获取生产任务详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:query')") + @GetMapping(value = "/{taskId}") + public AjaxResult getInfo(@PathVariable("taskId") Long taskId) + { + return AjaxResult.success(proTaskService.selectProTaskByTaskId(taskId)); + } + + /** + * 获取甘特图中需要显示的TASK,包括三种类型的内容: + * 1.Project:基于时间范围搜索的生产工单转换而来的Project。 + * 搜索逻辑为:默认使用当前日期作为开始时间,搜索所有需求时间大于当前时间的生产工单 + * 2.Task:基于生产工单拆分到具体工作站后的生产任务转换而来的Task。 + * 3.Link:根据工序与工序之间的依赖关系转换而来的Link。 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:list')") + @GetMapping("/listGanttTaskList") + public AjaxResult getGanttTaskList(ProWorkorder proWorkorder){ + GanttTask ganttTask = new GanttTask(); + List ganttData = new ArrayList(); + List ganttLinks = new ArrayList(); + + //查询所有的WorkOrder + List workorders = proWorkorderService.selectProWorkorderList(proWorkorder); + + //为每个workOrder生成type=project的GanttData + //为每个proTask生产type=task的GanttData + ProTask param = new ProTask(); + if(CollUtil.isNotEmpty(workorders)){ + for (ProWorkorder workorder: workorders + ) { + //先添加当前的生产工单TASK + GanttData wdata = new GanttData(); + wdata.setId("MO"+workorder.getWorkorderId().toString()); + wdata.setText(new StringBuilder().append(workorder.getProductName()).append(workorder.getQuantity().stripTrailingZeros().toPlainString()).append(workorder.getUnitOfMeasure()).toString());//默认使用“[产品]+[数量]+[单位]”格式。 + wdata.setProduct(workorder.getProductName()); + wdata.setQuantity(workorder.getQuantity()); + if(workorder.getParentId().longValue()!=0L){ + wdata.setParent("MO"+workorder.getParentId().toString()); + } + BigDecimal produced = workorder.getQuantityProduced(); + BigDecimal quantitiy = workorder.getQuantity(); + wdata.setProgress( produced.divide(quantitiy,BigDecimal.ROUND_HALF_UP).floatValue()); + wdata.setDuration(0L); + wdata.setType(UserConstants.GANTT_TASK_TYPE_PROJECT); + ganttData.add(wdata); + + //查询当前生产工单下所有的生产任务 + param.setWorkorderId(workorder.getWorkorderId()); + List proTasks = proTaskService.selectProTaskList(param); + if(CollUtil.isNotEmpty(proTasks)){ + for (ProTask task:proTasks + ) { + GanttData data = new GanttData(); + data.setId(task.getTaskId().toString());//使用生产任务的ID作为甘特图TASK的ID + data.setText(new StringBuilder().append(task.getItemName()).append(task.getQuantity().stripTrailingZeros().toPlainString()).append(task.getUnitOfMeasure()).toString()); //默认使用“[产品]+[数量]+[单位]”格式。 + data.setColor(task.getColorCode()); + data.setDuration(task.getDuration()); + data.setStart_date(task.getStartTime()); + data.setParent("MO"+workorder.getWorkorderId().toString());//这里要设置为"MO+生产工单ID"的格式 + data.setProduct(task.getItemName()); + data.setQuantity(task.getQuantity()); + data.setProcess(task.getProcessName()); + data.setWorkstation(task.getWorkstationName()); + BigDecimal taskproduced = task.getQuantityProduced(); + BigDecimal taskquantitiy = task.getQuantity(); + data.setProgress(taskproduced.divide(taskquantitiy).setScale(4,BigDecimal.ROUND_HALF_UP).floatValue()); + data.setType(UserConstants.GANTT_TASK_TYPE_TASK); + ganttData.add(data); + } + } + } + } + + ganttTask.setData(ganttData); + ganttTask.setLinks(ganttLinks); + return AjaxResult.success(ganttTask); + } + + + /** + * 按照最新的模式只展示工序级别的生产进度 + * @return + */ + @GetMapping("/listTaskListByWorkorder") + public AjaxResult getWorkorderProcessTypeTaskList(ProWorkorder proWorkorder){ + if(!StringUtils.isNotNull(proWorkorder.getWorkorderId())){ + return AjaxResult.error("请选择具体的生产工单!"); + } + + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(proWorkorder.getWorkorderId()); + if(StringUtils.isNotNull(workorder)){ + //检查当前的产品是否配置了对应的工艺路线 + ProRouteProduct param = new ProRouteProduct(); + param.setItemId(workorder.getProductId()); + List routes = proRouteProductService.selectProRouteProductList(param); + if(CollectionUtils.isEmpty(routes)){ + return AjaxResult.error("当前工单生产的产品,未配置对应的生产工艺流程!"); + } + } + + //根据生产工单查询每个工序的生产情况 + List tasks = proTaskService.selectProTaskProcessViewByWorkorder(proWorkorder.getWorkorderId()); + return AjaxResult.success(tasks); + } + + + /** + * 新增生产任务 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:add')") + @Log(title = "生产任务", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProTask proTask) + { + if(proTask.getQuantity().compareTo(BigDecimal.ZERO) !=1){ + return AjaxResult.error("排产数量必须大于0!"); + } + + if(!StringUtils.isNotNull(proTask.getWorkstationId())){ + return AjaxResult.error("请选择工作站!"); + } + + if(proTask.getDuration()<=0){ + return AjaxResult.error("生产时长必须大于0!"); + } + + //生产工单 + ProWorkorder order = proWorkorderService.selectProWorkorderByWorkorderId(proTask.getWorkorderId()); + proTask.setWorkorderCode(order.getWorkorderCode()); + proTask.setWorkorderName(order.getWorkorderName()); + proTask.setItemId(order.getProductId()); + proTask.setItemCode(order.getProductCode()); + proTask.setItemName(order.getProductName()); + proTask.setSpecification(order.getProductSpc()); + proTask.setUnitOfMeasure(order.getUnitOfMeasure()); + proTask.setClientId(order.getClientId()); + proTask.setClientCode(order.getClientCode()); + proTask.setClientName(order.getClientName()); + + //工艺信息 + if(StringUtils.isNotNull(proTask.getRouteId())){ + ProRoute route = proRouteService.selectProRouteByRouteId(proTask.getRouteId()); + if(StringUtils.isNotNull(route)){ + proTask.setRouteCode(route.getRouteCode()); + }else { + return AjaxResult.error("当前生产任务对应的工艺路线信息无效!"+proTask.getRouteId()); + } + } + + //工序信息 + ProProcess process = proProcessService.selectProProcessByProcessId(proTask.getProcessId()); + if(StringUtils.isNotNull(process)){ + proTask.setProcessId(process.getProcessId()); + proTask.setProcessCode(process.getProcessCode()); + proTask.setProcessName(process.getProcessName()); + }else{ + return AjaxResult.error("当前生产任务对应的工序信息无效!"+proTask.getProcessId()); + } + + + //自动生成任务编号和名称 + proTask.setTaskCode(autoCodeUtil.genSerialCode(UserConstants.TASK_CODE,null)); + proTask.setTaskName(new StringBuilder().append(proTask.getItemName()).append("【").append(proTask.getQuantity().toString()).append("】").append(proTask.getUnitOfMeasure()).toString()); + + + + return toAjax(proTaskService.insertProTask(proTask)); + } + + /** + * 修改生产任务 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:edit')") + @Log(title = "生产任务", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProTask proTask) + { + ProTask theTask = proTaskService.selectProTaskByTaskId(proTask.getTaskId()); + + if(proTask.getQuantity().compareTo(BigDecimal.ZERO) !=1){ + return AjaxResult.error("排产数量必须大于0!"); + } + + if(!StringUtils.isNotNull(proTask.getWorkstationId())){ + proTask.setWorkstationId(theTask.getWorkstationId()); + } + + if(!StringUtils.isNotNull(proTask.getWorkorderId())){ + proTask.setWorkorderId(theTask.getWorkorderId()); + } + + if(!StringUtils.isNotNull(proTask.getProcessId())){ + proTask.setProcessId(theTask.getProcessId()); + } + + if(!StringUtils.isNotNull(proTask.getRouteId())){ + proTask.setRouteId(theTask.getRouteId()); + } + + if(proTask.getDuration()<=0){ + proTask.setDuration(theTask.getDuration()); + } + + //生产工单 + ProWorkorder order = proWorkorderService.selectProWorkorderByWorkorderId(proTask.getWorkorderId()); + if(!StringUtils.isNotNull(order)){ + return AjaxResult.error("生产工单不存在!"); + } + proTask.setWorkorderCode(order.getWorkorderCode()); + proTask.setWorkorderName(order.getWorkorderName()); + proTask.setItemId(order.getProductId()); + proTask.setItemCode(order.getProductCode()); + proTask.setItemName(order.getProductName()); + proTask.setSpecification(order.getProductSpc()); + proTask.setUnitOfMeasure(order.getUnitOfMeasure()); + proTask.setClientId(order.getClientId()); + proTask.setClientCode(order.getClientCode()); + proTask.setClientName(order.getClientName()); + + //工艺信息 + if(StringUtils.isNotNull(proTask.getRouteId())){ + ProRoute route = proRouteService.selectProRouteByRouteId(proTask.getRouteId()); + if(StringUtils.isNotNull(route)){ + proTask.setRouteCode(route.getRouteCode()); + }else { + return AjaxResult.error("当前生产任务对应的工艺路线信息无效!"+proTask.getRouteId()); + } + } + + //工序信息 + ProProcess process = proProcessService.selectProProcessByProcessId(proTask.getProcessId()); + if(StringUtils.isNotNull(process)){ + proTask.setProcessId(process.getProcessId()); + proTask.setProcessCode(process.getProcessCode()); + proTask.setProcessName(process.getProcessName()); + }else{ + return AjaxResult.error("当前生产任务对应的工序信息无效!"+proTask.getProcessId()); + } + + return toAjax(proTaskService.updateProTask(proTask)); + } + + /** + * 删除生产任务 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:remove')") + @Log(title = "生产任务", businessType = BusinessType.DELETE) + @DeleteMapping("/{taskIds}") + public AjaxResult remove(@PathVariable Long[] taskIds) + { + return toAjax(proTaskService.deleteProTaskByTaskIds(taskIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTaskIssueController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTaskIssueController.java new file mode 100644 index 0000000..a8d5e87 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTaskIssueController.java @@ -0,0 +1,107 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.mes.md.domain.MdProductSop; +import com.ktg.mes.md.service.IMdProductSopService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProTaskIssue; +import com.ktg.mes.pro.service.IProTaskIssueService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产任务投料Controller + * + * @author yinjinlu + * @date 2022-07-22 + */ +@RestController +@RequestMapping("/mes/pro/taskissue") +public class ProTaskIssueController extends BaseController +{ + @Autowired + private IProTaskIssueService proTaskIssueService; + + + /** + * 查询生产任务投料列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProTaskIssue proTaskIssue) + { + startPage(); + List list = proTaskIssueService.selectProTaskIssueList(proTaskIssue); + return getDataTable(list); + } + + /** + * 导出生产任务投料列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:export')") + @Log(title = "生产任务投料", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProTaskIssue proTaskIssue) + { + List list = proTaskIssueService.selectProTaskIssueList(proTaskIssue); + ExcelUtil util = new ExcelUtil(ProTaskIssue.class); + util.exportExcel(response, list, "生产任务投料数据"); + } + + /** + * 获取生产任务投料详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(proTaskIssueService.selectProTaskIssueByRecordId(recordId)); + } + + /** + * 新增生产任务投料 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:add')") + @Log(title = "生产任务投料", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProTaskIssue proTaskIssue) + { + return toAjax(proTaskIssueService.insertProTaskIssue(proTaskIssue)); + } + + /** + * 修改生产任务投料 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:edit')") + @Log(title = "生产任务投料", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProTaskIssue proTaskIssue) + { + return toAjax(proTaskIssueService.updateProTaskIssue(proTaskIssue)); + } + + /** + * 删除生产任务投料 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:protask:remove')") + @Log(title = "生产任务投料", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(proTaskIssueService.deleteProTaskIssueByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTransConsumeController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTransConsumeController.java new file mode 100644 index 0000000..8740b69 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTransConsumeController.java @@ -0,0 +1,103 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProTransConsume; +import com.ktg.mes.pro.service.IProTransConsumeService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 物料消耗记录Controller + * + * @author yinjinlu + * @date 2022-07-24 + */ +@RestController +@RequestMapping("/mes/pro/transconsume") +public class ProTransConsumeController extends BaseController +{ + @Autowired + private IProTransConsumeService proTransConsumeService; + + /** + * 查询物料消耗记录列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProTransConsume proTransConsume) + { + startPage(); + List list = proTransConsumeService.selectProTransConsumeList(proTransConsume); + return getDataTable(list); + } + + /** + * 导出物料消耗记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:export')") + @Log(title = "物料消耗记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProTransConsume proTransConsume) + { + List list = proTransConsumeService.selectProTransConsumeList(proTransConsume); + ExcelUtil util = new ExcelUtil(ProTransConsume.class); + util.exportExcel(response, list, "物料消耗记录数据"); + } + + /** + * 获取物料消耗记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(proTransConsumeService.selectProTransConsumeByRecordId(recordId)); + } + + /** + * 新增物料消耗记录 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:add')") + @Log(title = "物料消耗记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProTransConsume proTransConsume) + { + return toAjax(proTransConsumeService.insertProTransConsume(proTransConsume)); + } + + /** + * 修改物料消耗记录 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:edit')") + @Log(title = "物料消耗记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProTransConsume proTransConsume) + { + return toAjax(proTransConsumeService.updateProTransConsume(proTransConsume)); + } + + /** + * 删除物料消耗记录 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transconsume:remove')") + @Log(title = "物料消耗记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(proTransConsumeService.deleteProTransConsumeByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTransOrderController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTransOrderController.java new file mode 100644 index 0000000..a717e19 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProTransOrderController.java @@ -0,0 +1,112 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProTransOrder; +import com.ktg.mes.pro.service.IProTransOrderService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 流转单Controller + * + * @author yinjinlu + * @date 2022-07-24 + */ +@RestController +@RequestMapping("/mes/pro/transorder") +public class ProTransOrderController extends BaseController +{ + @Autowired + private IProTransOrderService proTransOrderService; + + @Autowired + private WmBarCodeUtil wmBarCodeUtil; + + /** + * 查询流转单列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProTransOrder proTransOrder) + { + startPage(); + List list = proTransOrderService.selectProTransOrderList(proTransOrder); + return getDataTable(list); + } + + /** + * 导出流转单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:export')") + @Log(title = "流转单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProTransOrder proTransOrder) + { + List list = proTransOrderService.selectProTransOrderList(proTransOrder); + ExcelUtil util = new ExcelUtil(ProTransOrder.class); + util.exportExcel(response, list, "流转单数据"); + } + + /** + * 获取流转单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:query')") + @GetMapping(value = "/{transOrderId}") + public AjaxResult getInfo(@PathVariable("transOrderId") Long transOrderId) + { + return AjaxResult.success(proTransOrderService.selectProTransOrderByTransOrderId(transOrderId)); + } + + /** + * 新增流转单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:add')") + @Log(title = "流转单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProTransOrder proTransOrder) + { + proTransOrderService.insertProTransOrder(proTransOrder); + wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_TRANSORDER,proTransOrder.getTransOrderId(),proTransOrder.getTransOrderCode(),null); + proTransOrder.setCreateBy(getUsername()); + return AjaxResult.success(proTransOrder.getTransOrderId()); + } + + /** + * 修改流转单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:edit')") + @Log(title = "流转单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProTransOrder proTransOrder) + { + return toAjax(proTransOrderService.updateProTransOrder(proTransOrder)); + } + + /** + * 删除流转单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:remove')") + @Log(title = "流转单", businessType = BusinessType.DELETE) + @DeleteMapping("/{transOrderIds}") + public AjaxResult remove(@PathVariable Long[] transOrderIds) + { + return toAjax(proTransOrderService.deleteProTransOrderByTransOrderIds(transOrderIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProWorkorderBomController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProWorkorderBomController.java new file mode 100644 index 0000000..b9465ce --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProWorkorderBomController.java @@ -0,0 +1,103 @@ +package com.ktg.mes.pro.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProWorkorderBom; +import com.ktg.mes.pro.service.IProWorkorderBomService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产工单BOM组成Controller + * + * @author yinjinlu + * @date 2022-05-09 + */ +@RestController +@RequestMapping("/mes/pro/workorderbom") +public class ProWorkorderBomController extends BaseController +{ + @Autowired + private IProWorkorderBomService proWorkorderBomService; + + /** + * 查询生产工单BOM组成列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProWorkorderBom proWorkorderBom) + { + startPage(); + List list = proWorkorderBomService.selectProWorkorderBomList(proWorkorderBom); + return getDataTable(list); + } + + /** + * 导出生产工单BOM组成列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:export')") + @Log(title = "生产工单BOM组成", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProWorkorderBom proWorkorderBom) + { + List list = proWorkorderBomService.selectProWorkorderBomList(proWorkorderBom); + ExcelUtil util = new ExcelUtil(ProWorkorderBom.class); + util.exportExcel(response, list, "生产工单BOM组成数据"); + } + + /** + * 获取生产工单BOM组成详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(proWorkorderBomService.selectProWorkorderBomByLineId(lineId)); + } + + /** + * 新增生产工单BOM组成 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:add')") + @Log(title = "生产工单BOM组成", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProWorkorderBom proWorkorderBom) + { + return toAjax(proWorkorderBomService.insertProWorkorderBom(proWorkorderBom)); + } + + /** + * 修改生产工单BOM组成 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") + @Log(title = "生产工单BOM组成", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProWorkorderBom proWorkorderBom) + { + return toAjax(proWorkorderBomService.updateProWorkorderBom(proWorkorderBom)); + } + + /** + * 删除生产工单BOM组成 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:remove')") + @Log(title = "生产工单BOM组成", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(proWorkorderBomService.deleteProWorkorderBomByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProWorkorderController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProWorkorderController.java new file mode 100644 index 0000000..1fea0d3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProWorkorderController.java @@ -0,0 +1,291 @@ +package com.ktg.mes.pro.controller; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.domain.MdProductBom; +import com.ktg.mes.md.service.IMdProductBomService; +import com.ktg.mes.pro.domain.ProTask; +import com.ktg.mes.pro.domain.ProWorkorderBom; +import com.ktg.mes.pro.service.IProTaskService; +import com.ktg.mes.pro.service.IProWorkorderBomService; +import com.ktg.mes.wm.domain.WmRtIssue; +import com.ktg.mes.wm.domain.WmRtIssueLine; +import com.ktg.mes.wm.domain.tx.RtIssueTxBean; +import io.minio.messages.Item; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.common.utils.poi.ExcelUtil; + +/** + * 生产工单Controller + * + * @author yinjinlu + * @date 2022-05-09 + */ +@RestController +@RequestMapping("/mes/pro/workorder") +public class ProWorkorderController extends BaseController +{ + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private IProWorkorderBomService proWorkorderBomService; + + @Autowired + private IMdProductBomService mdProductBomService; + + @Autowired + private IProTaskService proTaskService; + + /** + * 查询生产工单列表 + */ + @GetMapping("/list") + public TableDataInfo list(ProWorkorder proWorkorder) + { + startPage(); + List list = proWorkorderService.selectProWorkorderList(proWorkorder); + return getDataTable(list); + } + + @GetMapping("/listWithTaskJson") + public TableDataInfo listWithTaskJson(ProWorkorder proWorkorder){ + startPage(); + List list = proWorkorderService.selectProWorkorderList(proWorkorder); + Iterator iterator = list.iterator(); + while (iterator.hasNext()){ + ProWorkorder workorder = iterator.next(); + List tasks = proTaskService.selectProTaskProcessViewByWorkorder(workorder.getWorkorderId()); + workorder.setTasks(tasks); + } + return getDataTable(list); + } + + /** + * 导出生产工单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:export')") + @Log(title = "生产工单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProWorkorder proWorkorder) + { + List list = proWorkorderService.selectProWorkorderList(proWorkorder); + ExcelUtil util = new ExcelUtil(ProWorkorder.class); + util.exportExcel(response, list, "生产工单数据"); + } + + /** + * 获取生产工单详细信息 + */ + @GetMapping(value = "/{workorderId}") + public AjaxResult getInfo(@PathVariable("workorderId") Long workorderId) + { + return AjaxResult.success(proWorkorderService.selectProWorkorderByWorkorderId(workorderId)); + } + + /** + * 新增生产工单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:add')") + @Log(title = "生产工单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProWorkorder proWorkorder) + { + if(UserConstants.NOT_UNIQUE.equals(proWorkorderService.checkWorkorderCodeUnique(proWorkorder))){ + return AjaxResult.error("生产工单编号已存在!"); + } + + if(proWorkorder.getParentId()==null || proWorkorder.getParentId()==0){ + proWorkorder.setAncestors("0"); + } + proWorkorderService.insertProWorkorder(proWorkorder); + + Long workorderId = proWorkorder.getWorkorderId(); + generateBomLine(workorderId); + proWorkorder.setCreateBy(getUsername()); + return AjaxResult.success(workorderId); + } + + /** + * 修改生产工单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProWorkorder proWorkorder) + { + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(proWorkorder.getWorkorderId()); + int ret =proWorkorderService.updateProWorkorder(proWorkorder); + //如果是产品和数量发生变化则需要重新生成BOM组成 + if(ret >0){ + if(workorder.getProductId().longValue() != proWorkorder.getProductId().longValue() || + workorder.getQuantity().compareTo(proWorkorder.getQuantity())!=0){ + removeBomLine(proWorkorder.getWorkorderId()); + generateBomLine(proWorkorder.getWorkorderId()); + } + } + return toAjax(ret); + } + + /** + * 删除生产工单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:remove')") + @Log(title = "生产工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{workorderIds}") + public AjaxResult remove(@PathVariable Long[] workorderIds) + { + for (Long id:workorderIds + ) { + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(id); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(workorder.getStatus())){ + return AjaxResult.error("只能删除草稿状态单据!"); + } + removeBomLine(id); + } + return toAjax(proWorkorderService.deleteProWorkorderByWorkorderIds(workorderIds)); + } + + /** + * 根据生产工单中的产品生成BOM物料行 + * @param workorderId + */ + private void generateBomLine(Long workorderId){ + //先根据ID找到对应的产品 + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(workorderId); + + //根据产品找到BOM组成 + MdProductBom param = new MdProductBom(); + param.setItemId(workorder.getProductId()); + List boms = mdProductBomService.selectMdProductBomList(param); + + //生成BOM数据 + BigDecimal orderQuantitiy = workorder.getQuantity(); + ProWorkorderBom workorderBom = new ProWorkorderBom(); + if(CollUtil.isNotEmpty(boms)){ + for (MdProductBom bom:boms + ) { + workorderBom.setWorkorderId(workorderId); + workorderBom.setItemId(bom.getBomItemId()); + workorderBom.setItemCode(bom.getBomItemCode()); + workorderBom.setItemName(bom.getBomItemName()); + workorderBom.setItemSpc(bom.getBomItemSpec()); + workorderBom.setItemOrProduct(bom.getItemOrProduct()); + workorderBom.setUnitOfMeasure(bom.getUnitOfMeasure()); + workorderBom.setQuantity(orderQuantitiy.multiply(bom.getQuantity())); + proWorkorderBomService.insertProWorkorderBom(workorderBom); + } + } + } + + /** + * 删除当前工单下所有BOM组成 + * @param workorderId + */ + private void removeBomLine(Long workorderId){ + ProWorkorderBom param = new ProWorkorderBom(); + param.setWorkorderId(workorderId); + proWorkorderBomService.deleteProWorkorderBomByWorkorderId(workorderId); + } + + /** + * 获取当前工单的物料需求清单 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:list')") + @GetMapping("/listItems") + public TableDataInfo listItemss(ProWorkorder proWorkorder) + { + List result = new ArrayList(); + ProWorkorderBom param = new ProWorkorderBom(); + param.setWorkorderId(proWorkorder.getWorkorderId()); + List boms = proWorkorderBomService.selectProWorkorderBomList(param); + if(!CollectionUtils.isEmpty(boms)){ + for ( ProWorkorderBom bom: boms + ) { + MdProductBom theBom = new MdProductBom(); + theBom.setBomItemId(bom.getItemId()); + result.addAll(getBoms(theBom,bom.getQuantity(),0)); + } + } + return getDataTable(result); + } + + private List getBoms(MdProductBom item,BigDecimal quantity,int count){ + MdProductBom param = new MdProductBom(); + List results = new ArrayList(); + if(count >20){ + return results; + } + param.setItemId(item.getBomItemId()); + List boms = mdProductBomService.selectMdProductBomList(param); + if(CollUtil.isNotEmpty(boms)){ + //最多20层依赖 + count ++; + for (MdProductBom bomItem: boms + ) { + bomItem.setQuantity(quantity.multiply(bomItem.getQuantity())); + results.addAll(getBoms(bomItem,bomItem.getQuantity(),count)); + } + }else{ + results.add(item); + } + return results; + } + + + /** + * 完成工单 + * @param workorderId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{workorderId}") + public AjaxResult dofinish(@PathVariable Long workorderId){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(workorderId); + + //将此工单下所有的生产任务状态设置为已完成 + ProTask param = new ProTask(); + param.setWorkorderId(workorderId); + List tasks = proTaskService.selectProTaskList(param); + if(!CollectionUtils.isEmpty(tasks)){ + for (ProTask task:tasks + ) { + task.setStatus(UserConstants.ORDER_STATUS_FINISHED); + proTaskService.updateProTask(task); + } + } + + workorder.setStatus(UserConstants.ORDER_STATUS_FINISHED); //更新工单的状态 + proWorkorderService.updateProWorkorder(workorder); + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProFeedBackMobController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProFeedBackMobController.java new file mode 100644 index 0000000..67f2f84 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProFeedBackMobController.java @@ -0,0 +1,188 @@ +package com.ktg.mes.pro.controller.mobile; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdWorkstationService; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProRouteProcess; +import com.ktg.mes.pro.service.IProFeedbackService; +import com.ktg.mes.pro.service.IProRouteProcessService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@Api("生产报工") +@RestController +@RequestMapping("/mobile/pro/feedback") +public class ProFeedBackMobController extends BaseController { + + @Autowired + private IProFeedbackService proFeedbackService; + + @Autowired + private IMdWorkstationService mdWorkstationService; + + @Autowired + private IProRouteProcessService proRouteProcessService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 新增生产报工记录 + */ + @ApiOperation("新增报工单接口") + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:add')") + @Log(title = "生产报工记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProFeedback proFeedback) + { + MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId()); + if(StringUtils.isNotNull(workstation)){ + proFeedback.setProcessId(workstation.getProcessId()); + proFeedback.setProcessCode(workstation.getProcessCode()); + proFeedback.setProcessName(workstation.getProcessName()); + }else { + return AjaxResult.error("当前生产任务对应的工作站不存在!"); + } + + //检查对应的工艺路线和工序配置 + if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){ + ProRouteProcess param = new ProRouteProcess(); + param.setRouteId(proFeedback.getRouteId()); + param.setProcessId(proFeedback.getProcessId()); + List processes = proRouteProcessService.selectProRouteProcessList(param); + if(CollectionUtil.isEmpty(processes)){ + return AjaxResult.error("未找到生产任务对应的工艺工序配置!"); + } + }else { + return AjaxResult.error("当前生产任务对应的工艺工序配置无效!"); + } + + //检查数量 + if(UserConstants.YES.equals(proFeedback.getIsCheck())){ + if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){ + return AjaxResult.error("当前工作站报工需要经过质检确认,请输入待检测数量!"); + } + }else { + if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){ + return AjaxResult.error("请输入合格品和不良品数量!"); + } + } + String feedbackCode = autoCodeUtil.genSerialCode(UserConstants.FEEDBACK_CODE,""); + proFeedback.setFeedbackCode(feedbackCode); + proFeedback.setCreateBy(getUsername()); + proFeedbackService.insertProFeedback(proFeedback); + return AjaxResult.success(proFeedback); + } + + /** + * 查询生产报工记录列表 + */ + @ApiOperation("查询报工单清单-全部") + @GetMapping("/list") + public TableDataInfo list(ProFeedback proFeedback) + { + List list = proFeedbackService.selectProFeedbackList(proFeedback); + return getDataTable(list); + } + + /** + * 查询生产报工记录列表 + */ + @ApiOperation("查询报工单清单-未审批通过的") + @GetMapping("/listUnApproved") + public TableDataInfo listUnApproved(ProFeedback proFeedback) + { + List all = new ArrayList(); + proFeedback.setStatus(UserConstants.ORDER_STATUS_PREPARE); + List list1 = proFeedbackService.selectProFeedbackList(proFeedback); + all.addAll(list1); + proFeedback.setStatus(UserConstants.ORDER_STATUS_APPROVING); + List list2 = proFeedbackService.selectProFeedbackList(proFeedback); + all.addAll(list2); + return getDataTable(all); + } + + + /** + * 查询生产报工记录列表 + */ + @ApiOperation("查询报工单清单-已审批通过的") + @GetMapping("/listApproved") + public TableDataInfo listApproved(ProFeedback proFeedback) + { + proFeedback.setStatus(UserConstants.ORDER_STATUS_FINISHED); + List list = proFeedbackService.selectProFeedbackList(proFeedback); + return getDataTable(list); + } + + /** + * 修改生产报工记录 + */ + @ApiOperation("报工修改接口") + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:edit')") + @Log(title = "生产报工记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProFeedback proFeedback) + { + MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId()); + if(StringUtils.isNotNull(workstation)){ + proFeedback.setProcessId(workstation.getProcessId()); + proFeedback.setProcessCode(workstation.getProcessCode()); + proFeedback.setProcessName(workstation.getProcessName()); + }else { + return AjaxResult.error("当前生产任务对应的工作站不存在!"); + } + + //检查对应的工艺路线和工序配置 + if(StringUtils.isNotNull(proFeedback.getRouteId())&& StringUtils.isNotNull(proFeedback.getProcessId())){ + ProRouteProcess param = new ProRouteProcess(); + param.setRouteId(proFeedback.getRouteId()); + param.setProcessId(proFeedback.getProcessId()); + List processes = proRouteProcessService.selectProRouteProcessList(param); + if(CollectionUtil.isEmpty(processes)){ + return AjaxResult.error("未找到生产任务对应的工艺工序配置!"); + } + }else { + return AjaxResult.error("当前生产任务对应的工艺工序配置无效!"); + } + + //检查数量 + if(UserConstants.YES.equals(proFeedback.getIsCheck())){ + if(!StringUtils.isNotNull(proFeedback.getQuantityUncheck())){ + return AjaxResult.error("当前工作站报工需要经过质检确认,请输入待检测数量!"); + } + }else { + if(!StringUtils.isNotNull(proFeedback.getQuantityQualified()) || !StringUtils.isNotNull(proFeedback.getQuantityUnquanlified())){ + return AjaxResult.error("请输入合格品和不良品数量!"); + } + } + + return toAjax(proFeedbackService.updateProFeedback(proFeedback)); + } + + /** + * 删除生产报工记录 + */ + @ApiOperation("删除报工单") + @PreAuthorize("@ss.hasPermi('mes:pro:feedback:remove')") + @Log(title = "生产报工记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(proFeedbackService.deleteProFeedbackByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProProcessMobController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProProcessMobController.java new file mode 100644 index 0000000..dc94c28 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProProcessMobController.java @@ -0,0 +1,48 @@ +package com.ktg.mes.pro.controller.mobile; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProProcess; +import com.ktg.mes.pro.service.IProProcessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/mobile/pro/process") +public class ProProcessMobController extends BaseController { + + @Autowired + private IProProcessService proProcessService; + + @GetMapping("/getProcessList") + public AjaxResult getProcessList(){ + ProProcess proProcess = new ProProcess(); + proProcess.setEnableFlag(UserConstants.YES); + List list = proProcessService.selectProProcessList(proProcess); + return AjaxResult.success(list); + } + + /** + * 获取工序详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:process:query')") + @GetMapping(value = "/{processId}") + public AjaxResult getInfo(@PathVariable("processId") Long processId) + { + ProProcess p = proProcessService.selectProProcessByProcessId(processId); + if(StringUtils.isNotNull(p)){ + return AjaxResult.success(p); + }else{ + return AjaxResult.error("未查询到当前工序信息"); + } + + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTaskIssueMobController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTaskIssueMobController.java new file mode 100644 index 0000000..eea06a7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTaskIssueMobController.java @@ -0,0 +1,228 @@ +package com.ktg.mes.pro.controller.mobile; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdProductSop; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdProductSopService; +import com.ktg.mes.md.service.IMdWorkstationService; +import com.ktg.mes.pro.domain.ProTask; +import com.ktg.mes.pro.domain.ProTaskIssue; +import com.ktg.mes.pro.domain.ProTransOrder; +import com.ktg.mes.pro.service.IProTaskIssueService; +import com.ktg.mes.pro.service.IProTaskService; +import com.ktg.mes.pro.service.IProTransOrderService; +import com.ktg.mes.wm.domain.WmIssueHeader; +import com.ktg.mes.wm.domain.WmIssueLine; +import com.ktg.mes.wm.service.IWmIssueHeaderService; +import com.ktg.mes.wm.service.IWmIssueLineService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/mobile/pro/taskissue") +public class ProTaskIssueMobController extends BaseController { + + @Autowired + private IProTaskIssueService proTaskIssueService; + + @Autowired + private IProTaskService proTaskService; + + @Autowired + private IProTransOrderService proTransOrderService; + + + @Autowired + private IWmIssueHeaderService wmIssueHeaderService; + + @Autowired + private IWmIssueLineService wmIssueLineService; + + @Autowired + private IMdProductSopService mdProductSopService; + + /** + * 获取当前产品的SOP + * @param mdProdutSop + * @return + */ + @GetMapping("getSopList") + public AjaxResult getSopList(MdProductSop mdProdutSop){ + List list = mdProductSopService.selectMdProductSopList(mdProdutSop); + return AjaxResult.success(list); + } + + /** + * 查询当前工作站、当前任务的投料清单 + * 至少提供workstationId、taskId两个参数 + */ + ///@PreAuthorize("@ss.hasPermi('mes:pro:taskissue:list')") + @GetMapping("/getlist") + public AjaxResult getIssueList(ProTaskIssue proTaskIssue) { + List list = proTaskIssueService.selectProTaskIssueList(proTaskIssue); + return AjaxResult.success(list); + } + + /** + * 查询当前工作站、当前任务可用的的领料清单 + * 如果某个领料单是领出到当前工作站或者当前任务的,则可以查询到 + */ + @GetMapping("/getReserveIssueList") + public AjaxResult getReserveIssueList(ProTaskIssue proTaskIssue){ + WmIssueHeader param = new WmIssueHeader(); + //领料单上指定了工作站 + if(StringUtils.isNotNull(proTaskIssue.getWorkstationId())){ + param.setWorkstationId(proTaskIssue.getWorkstationId()); + } + + //领料单上指定了生产工单 + if(StringUtils.isNotNull(proTaskIssue.getWorkorderId())){ + param.setWorkorderId(proTaskIssue.getWorkorderId()); + } + + //领料单上指定了生产任务 + if(StringUtils.isNotNull(proTaskIssue.getTaskId())){ + param.setTaskId(proTaskIssue.getTaskId()); + } + + List issueList = wmIssueHeaderService.selectWmIssueHeaderList(param); + + List lines = new ArrayList(); + if(CollUtil.isNotEmpty(issueList)){ + WmIssueLine p = new WmIssueLine(); + for (WmIssueHeader header: issueList + ) { + p.setIssueId(header.getIssueId()); + lines.addAll(wmIssueLineService.selectWmIssueLineList(p)); + } + } + + return AjaxResult.success(lines); + } + + /** + * 通过新增或者扫码的方式添加某个流转单或者领料单到当前工作站、当前任务的投料清单中 + * 此接口只支持一次性添加一行物料。如果要添加整个领料单,则可在领料单上指定工作站和任务;或者使用addIssue接口 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:taskissue:add')") + @Log(title = "生产任务投料", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult add(ProTaskIssue proTaskIssue) + { + //前端至少会传递taskId、workstationId、sourceLineId、sourceDocType几个字段过来 + ProTask task = proTaskService.selectProTaskByTaskId(proTaskIssue.getTaskId()); + proTaskIssue.setWorkorderId(task.getWorkorderId()); + + //如果是领料单 + if(UserConstants.TASK_ISSUE_DOC_TYPE_ISSUE.equals(proTaskIssue.getSourceDocType())){ + WmIssueLine line = wmIssueLineService.selectWmIssueLineByLineId(proTaskIssue.getSourceLineId()); + WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(line.getIssueId()); + proTaskIssue.setSourceDocId(line.getIssueId());//设置领料单ID + proTaskIssue.setSourceDocCode(header.getIssueCode());//设置领料单编号 + proTaskIssue.setBatchCode(line.getBatchCode()); + proTaskIssue.setItemId(line.getItemId()); + proTaskIssue.setItemCode(line.getItemCode()); + proTaskIssue.setItemName(line.getItemName()); + proTaskIssue.setSpecification(line.getSpecification()); + proTaskIssue.setUnitOfMeasure(line.getUnitOfMeasure()); + proTaskIssue.setQuantityIssued(line.getQuantityIssued()); + }else{ + //如果是流转单 + ProTransOrder transOrder = proTransOrderService.selectProTransOrderByTransOrderId(proTaskIssue.getSourceDocId()); + proTaskIssue.setTaskId(transOrder.getTaskId()); + proTaskIssue.setWorkorderId(transOrder.getWorkorderId()); + proTaskIssue.setSourceDocCode(transOrder.getTransOrderCode()); + proTaskIssue.setBatchCode(transOrder.getBatchCode()); + proTaskIssue.setSourceLineId(transOrder.getTransOrderId());//这里直接使用头ID作为source_line_id,因为流转单不是头行结构 + proTaskIssue.setItemId(transOrder.getItemId()); + proTaskIssue.setItemCode(transOrder.getItemCode()); + proTaskIssue.setItemName(transOrder.getItemName()); + proTaskIssue.setUnitOfMeasure(transOrder.getUnitOfMeasure()); + proTaskIssue.setQuantityIssued(transOrder.getQuantityTransfered());//流转单的流转数量作为投料数量 + } + //不能重复添加 + if(UserConstants.NOT_UNIQUE.equals(proTaskIssueService.checkUnique(proTaskIssue))){ + return AjaxResult.error("物料已添加过"); + } + return toAjax(proTaskIssueService.insertProTaskIssue(proTaskIssue)); + } + + + /** + * 通过新增或者扫码的方式添加某个流转单或者领料单到当前工作站、当前任务的投料清单中 + * 此接口专门用于一次性添加整个领料单的场景,传递的proTaskIssue参数需要source_doc_id为对应的领料单头ID + */ + @PreAuthorize("@ss.hasPermi('mes:pro:taskissue:add')") + @Log(title = "生产任务投料", businessType = BusinessType.INSERT) + @PostMapping("/addIssue") + public AjaxResult addIssue(@RequestBody ProTaskIssue proTaskIssue) + { + if(!UserConstants.TASK_ISSUE_DOC_TYPE_ISSUE.equals(proTaskIssue.getSourceDocType())){ + return AjaxResult.error("请选择或扫描生产领料单!");//这里只支持添加整个领料单 + } + Long issueId = proTaskIssue.getSourceDocId(); + + WmIssueLine param = new WmIssueLine(); + param.setIssueId(issueId); + List issueLines = wmIssueLineService.selectWmIssueLineList(param); + + if(CollUtil.isEmpty(issueLines)){ + return AjaxResult.error("领料单行为空"); + } + + for (WmIssueLine line: issueLines + ) { + ProTaskIssue taskIssue = new ProTaskIssue(); + taskIssue.setTaskId(proTaskIssue.getTaskId()); + taskIssue.setWorkstationId(proTaskIssue.getWorkstationId()); + taskIssue.setWorkorderId(proTaskIssue.getWorkorderId()); + taskIssue.setSourceDocType(UserConstants.TASK_ISSUE_DOC_TYPE_ISSUE); + taskIssue.setSourceDocId(issueId); + //taskIssue.setSourceDocCode(); //领料单编号先不设置,需要的时候关联查询即可 + taskIssue.setBatchCode(line.getBatchCode()); + taskIssue.setSourceLineId(line.getLineId()); + taskIssue.setItemId(line.getItemId()); + taskIssue.setItemCode(line.getItemCode()); + taskIssue.setItemName(line.getItemName()); + taskIssue.setSpecification(line.getSpecification()); + taskIssue.setUnitOfMeasure(line.getUnitOfMeasure()); + taskIssue.setQuantityIssued(line.getQuantityIssued()); + //taskIssue.setQuantityAvailable(); //可用数量,如果需要则要实时计算 + taskIssue.setQuantityUsed(new BigDecimal(0)); //新添加的都默认为0;添加后删除再次添加也是0;实际使用量应该根据流转单计算 + + //不能重复添加 + if(UserConstants.NOT_UNIQUE.equals(proTaskIssueService.checkUnique(taskIssue))){ + return AjaxResult.error("物料已添加过"); + } + proTaskIssueService.insertProTaskIssue(taskIssue); + } + + return AjaxResult.success(); + } + + /** + * 删除生产任务投料 + */ + @PreAuthorize("@ss.hasPermi('mes:pro:taskissue:remove')") + @Log(title = "生产任务投料", businessType = BusinessType.DELETE) + @PostMapping("/{recordId}") + @ResponseBody + public AjaxResult remove(@PathVariable Long recordId) + { + return toAjax(proTaskIssueService.deleteProTaskIssueByRecordId(recordId)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTaskMobController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTaskMobController.java new file mode 100644 index 0000000..1a7228f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTaskMobController.java @@ -0,0 +1,123 @@ +package com.ktg.mes.pro.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.service.IMdWorkstationService; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProTask; +import com.ktg.mes.pro.domain.ProTaskIssue; +import com.ktg.mes.pro.service.IProFeedbackService; +import com.ktg.mes.pro.service.IProTaskIssueService; +import com.ktg.mes.pro.service.IProTaskService; +import com.ktg.mes.wm.service.IWmIssueHeaderService; +import com.ktg.mes.wm.service.IWmIssueLineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Api +@RestController +@RequestMapping("/mobile/pro/protask") +public class ProTaskMobController extends BaseController { + + @Autowired + private IProTaskService proTaskService; + + @Autowired + private IProFeedbackService proFeedbackService; + + @Autowired + private IMdWorkstationService mdWorkstationService; + + @Autowired + private IProTaskIssueService proTaskIssueService; + + @Autowired + private IWmIssueHeaderService wmIssueHeaderService; + + @Autowired + private IWmIssueLineService wmIssueLineService; + + + @GetMapping("/getlist") + public AjaxResult getIssueList(ProTaskIssue proTaskIssue) { + List list = proTaskIssueService.selectProTaskIssueList(proTaskIssue); + return AjaxResult.success(list); + } + + /** + * 查询工作站的生产任务 + */ + @ApiOperation("查询状态未完成的生产任务接口") + @GetMapping("/getTaskList") + public TableDataInfo list(ProTask proTask) + { + List list = proTaskService.selectProTaskList(proTask); + List l = list.stream().filter(t ->!"FINISHED".equals(t.getStatus())).collect(Collectors.toList()); + return getDataTable(l); + } + + + /** + * 获取生产任务详细信息 + */ + @ApiOperation("查询生产任务详情接口") + @PreAuthorize("@ss.hasPermi('mes:pro:protask:query')") + @GetMapping(value = "/{taskId}") + public AjaxResult getInfo(@PathVariable("taskId") Long taskId) + { + return AjaxResult.success(proTaskService.selectProTaskByTaskId(taskId)); + } + + + /** + * 修改生产任务状态 + */ + @ApiOperation("修改生产任务状态接口") + @Log(title = "生产任务", businessType = BusinessType.UPDATE) + @PostMapping("/change") + @ResponseBody + public AjaxResult changeStatus(ProTask proTask) + { + return toAjax(proTaskService.updateProTask(proTask)); + } + + @Log(title = "生产报工", businessType = BusinessType.INSERT) + @PostMapping("/feedback") + @ResponseBody + public AjaxResult feedBack( ProFeedback feedback){ + + ProTask task = proTaskService.selectProTaskByTaskId(feedback.getTaskId()); + feedback.setTaskCode(task.getTaskCode()); + feedback.setWorkorderId(task.getWorkorderId()); + feedback.setWorkorderCode(task.getWorkorderCode()); + feedback.setWorkorderName(task.getWorkorderName()); + feedback.setQuantity(task.getQuantity()); + feedback.setFeedbackTime(new Date()); + + if(feedback.getWorkstationId() == null){ + feedback.setWorkstationId(task.getWorkstationId()); + } + + MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(feedback.getWorkstationId()); + feedback.setWorkstationCode(workstation.getWorkstationCode()); + feedback.setWorkstationName(workstation.getWorkstationName()); + + task.setQuantityProduced(task.getQuantityProduced().add(feedback.getQuantityFeedback())); + task.setQuantityQuanlify(task.getQuantityQuanlify().add(feedback.getQuantityQualified())); + task.setQuantityUnquanlify(task.getQuantityUnquanlify().add(feedback.getQuantityUnquanlified())); + proTaskService.updateProTask(task); + return toAjax(proFeedbackService.insertProFeedback(feedback)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTransOrderMobController.java b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTransOrderMobController.java new file mode 100644 index 0000000..858eaa7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/controller/mobile/ProTransOrderMobController.java @@ -0,0 +1,150 @@ +package com.ktg.mes.pro.controller.mobile; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProTask; +import com.ktg.mes.pro.domain.ProTransOrder; +import com.ktg.mes.pro.service.IProTaskService; +import com.ktg.mes.pro.service.IProTransOrderService; +import com.ktg.mes.wm.domain.WmBarcode; +import com.ktg.mes.wm.service.IWmBarcodeService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("流转单接口") +@RestController +@RequestMapping("/mobile/pro/transorder") +public class ProTransOrderMobController extends BaseController { + + @Autowired + private IProTransOrderService proTransOrderService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + @Autowired + private IProTaskService proTaskService; + + @Autowired + private IWmBarcodeService wmBarcodeService; + + @ApiOperation("获取流转单清单") + @GetMapping("/getList") + public AjaxResult getList(ProTransOrder proTransOrder){ + + + return AjaxResult.success(); + } + + /** + * 获取流转单详细信息 + */ + @ApiOperation("流转单详情查询接口") + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:query')") + @GetMapping("/getInfo") + public AjaxResult getInfo(ProTransOrder proTransOrder) + { + ProTransOrder order = null; + if(StringUtils.isNotNull(proTransOrder.getTransOrderId())){ + order = proTransOrderService.selectProTransOrderByTransOrderId(proTransOrder.getTransOrderId()); + } + + if(StringUtils.isNotNull(proTransOrder.getTransOrderCode())){ + ProTransOrder param = new ProTransOrder(); + param.setTransOrderCode(proTransOrder.getTransOrderCode()); + List orders =proTransOrderService.selectProTransOrderList(param); + if(!CollectionUtil.isEmpty(orders)){ + order = orders.get(0); + } + } + + return AjaxResult.success(order); + } + + + /** + * 新增流转单 + */ + @ApiOperation("流转单新增接口") + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:add')") + @Log(title = "流转单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProTransOrder proTransOrder) + { + if(!StringUtils.isNotNull(proTransOrder.getTransOrderCode())){ + String transOrderCdoe = autoCodeUtil.genSerialCode(UserConstants.TRANS_ORDER_CODE,""); + proTransOrder.setTransOrderCode(transOrderCdoe); + } + + if(StringUtils.isNotNull(proTransOrder.getTaskId())){ + ProTask task =proTaskService.selectProTaskByTaskId(proTransOrder.getTaskId()); + proTransOrder.setTaskCode(task.getTaskCode()); + proTransOrder.setWorkstationId(task.getWorkstationId()); + proTransOrder.setWorkstationCode(task.getWorkstationCode()); + proTransOrder.setWorkstationName(task.getWorkstationName()); + proTransOrder.setProcessId(task.getProcessId()); + proTransOrder.setProcessCode(task.getProcessCode()); + proTransOrder.setProcessName(task.getProcessName()); + proTransOrder.setWorkorderId(task.getWorkorderId()); + proTransOrder.setWorkorderCode(task.getWorkorderCode()); + proTransOrder.setWorkorderName(task.getWorkorderName()); + //TODO:批次信息的获取 + proTransOrder.setItemId(task.getItemId()); + proTransOrder.setItemCode(task.getItemCode()); + proTransOrder.setItemName(task.getItemName()); + proTransOrder.setUnitOfMeasure(task.getUnitOfMeasure()); + proTransOrder.setSpecification(task.getSpecification()); + }else{ + return AjaxResult.error("请提供生产任务数据"); + } + + if(StringUtils.isNotNull(proTransOrder.getQuantityTransfered())){ + return AjaxResult.error("请填写报工数量"); + } + proTransOrder.setCreateBy(getUsername()); + proTransOrderService.insertProTransOrder(proTransOrder); + + //自动生成条码 + WmBarcode code = new WmBarcode(); + code.setBarcodeType(UserConstants.BARCODE_TYPE_TRANSORDER); + code.setBarcodeContent("TRANSORDER-"+proTransOrder.getTransOrderCode()); + code.setBarcodeFormart(UserConstants.QR_CODE); + code.setBussinessId(proTransOrder.getTransOrderId()); + code.setBussinessCode(proTransOrder.getTransOrderCode()); + code.setEnableFlag(UserConstants.YES); + String path =wmBarcodeService.generateBarcode(code); + code.setBarcodeUrl(path); + wmBarcodeService.updateWmBarcode(code); + proTransOrder.setBarCodeUrl(path); + proTransOrderService.updateProTransOrder(proTransOrder); + + return AjaxResult.success(proTransOrder); + } + + /** + * 修改流转单 + */ + @ApiOperation("流转单修改接口") + @PreAuthorize("@ss.hasPermi('mes:pro:transorder:edit')") + @Log(title = "流转单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProTransOrder proTransOrder) + { + return toAjax(proTransOrderService.updateProTransOrder(proTransOrder)); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttData.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttData.java new file mode 100644 index 0000000..f550fa4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttData.java @@ -0,0 +1,184 @@ +package com.ktg.mes.pro.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.math.BigDecimal; +import java.util.Date; + +public class GanttData { + + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * TASK 类型:project;task + */ + private String type; + + /** + * 任务名称 + */ + private String text; + + /** + * 工作站名称 + */ + private String workstation; + + /** + * 生产的产品 + */ + private String product; + + /** + * 排产数量 + */ + private BigDecimal quantity; + + /** + * 生产进度 + */ + private float progress; + + /** + * TASK的颜色 + */ + private String color; + + /** + * 工序 + */ + private String process; + + + /** + * 父TASK ID + */ + private String parent; + + + /** 开始生产时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date start_date; + + /** 生产时长 */ + private Long duration; + + /** 完成生产时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date end_date; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getWorkstation() { + return workstation; + } + + public void setWorkstation(String workstation) { + this.workstation = workstation; + } + + public String getProduct() { + return product; + } + + public void setProduct(String product) { + this.product = product; + } + + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(BigDecimal quantity) { + this.quantity = quantity; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getProcess() { + return process; + } + + public void setProcess(String process) { + this.process = process; + } + + public String getParent() { + return parent; + } + + public void setParent(String parent) { + this.parent = parent; + } + + + + public Long getDuration() { + return duration; + } + + public void setDuration(Long duration) { + this.duration = duration; + } + + public Date getStart_date() { + return start_date; + } + + public void setStart_date(Date start_date) { + this.start_date = start_date; + } + + public Date getEnd_date() { + return end_date; + } + + public void setEnd_date(Date end_date) { + this.end_date = end_date; + } + + public float getProgress() { + return progress; + } + + public void setProgress(float progress) { + this.progress = progress; + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttLink.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttLink.java new file mode 100644 index 0000000..4dadd1d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttLink.java @@ -0,0 +1,67 @@ +package com.ktg.mes.pro.domain; + +public class GanttLink { + + private static final long serialVersionUID = 1L; + + private String id; + + private String source; + + private String target; + + private Long type; + + private String color; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public Long getType() { + return type; + } + + public void setType(Long type) { + this.type = type; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + @Override + public String toString() { + return "GanttLink{" + + "id='" + id + '\'' + + ", source='" + source + '\'' + + ", target='" + target + '\'' + + ", type=" + type + + ", color='" + color + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttTask.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttTask.java new file mode 100644 index 0000000..2ad19df --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/GanttTask.java @@ -0,0 +1,32 @@ +package com.ktg.mes.pro.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +public class GanttTask { + private static final long serialVersionUID = 1L; + + private List data; + + private List links; + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProFeedback.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProFeedback.java new file mode 100644 index 0000000..386b199 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProFeedback.java @@ -0,0 +1,531 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产报工记录对象 pro_feedback + * + * @author yinjinlu + * @date 2022-07-10 + */ +public class ProFeedback extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** + * 报工单编号 + */ + private String feedbackCode; + + /** 报工类型*/ + private String feedbackType; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + private Long routeId; + + private String routeCode; + + /** 工序ID */ + private Long processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + private String isCheck; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编号 */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 生产工单名称 */ + @Excel(name = "生产工单名称") + private String workorderName; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 生产任务编号 */ + @Excel(name = "生产任务编号") + private String taskCode; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + + /** 排产数量 */ + @Excel(name = "排产数量") + private BigDecimal quantity; + + /** 本次报工数量 */ + @Excel(name = "本次报工数量") + private BigDecimal quantityFeedback; + + /** 合格品数量 */ + @Excel(name = "合格品数量") + private BigDecimal quantityQualified; + + /** 不良品数量 */ + @Excel(name = "不良品数量") + private BigDecimal quantityUnquanlified; + + @Excel(name = "待检测数量") + private BigDecimal quantityUncheck; + + /** 报工用户名 */ + @Excel(name = "报工用户名") + private String userName; + + /** 昵称 */ + @Excel(name = "昵称") + private String nickName; + + /** 报工途径 */ + @Excel(name = "报工途径") + private String feedbackChannel; + + /** 报工时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "报工时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date feedbackTime; + + /** 审批人员 */ + @Excel(name = "审批人员") + private String recordUser; + + /** 审批人员名称 */ + @Excel(name = "审批人员名称") + private String recordNick; + + /** 状态 */ + @Excel(name = "状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public String getFeedbackCode() { + return feedbackCode; + } + + public void setFeedbackCode(String feedbackCode) { + this.feedbackCode = feedbackCode; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getProcessId() { + return processId; + } + + public void setProcessId(Long processId) { + this.processId = processId; + } + + public String getProcessCode() { + return processCode; + } + + public void setProcessCode(String processCode) { + this.processCode = processCode; + } + + public String getProcessName() { + return processName; + } + + public void setProcessName(String processName) { + this.processName = processName; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + public void setQuantityFeedback(BigDecimal quantityFeedback) + { + this.quantityFeedback = quantityFeedback; + } + + public BigDecimal getQuantityFeedback() + { + return quantityFeedback; + } + public void setQuantityQualified(BigDecimal quantityQualified) + { + this.quantityQualified = quantityQualified; + } + + public BigDecimal getQuantityQualified() + { + return quantityQualified; + } + public void setQuantityUnquanlified(BigDecimal quantityUnquanlified) + { + this.quantityUnquanlified = quantityUnquanlified; + } + + public BigDecimal getQuantityUnquanlified() + { + return quantityUnquanlified; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + public void setFeedbackChannel(String feedbackChannel) + { + this.feedbackChannel = feedbackChannel; + } + + public String getFeedbackChannel() + { + return feedbackChannel; + } + public void setFeedbackTime(Date feedbackTime) + { + this.feedbackTime = feedbackTime; + } + + public Date getFeedbackTime() + { + return feedbackTime; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public String getFeedbackType() { + return feedbackType; + } + + public void setFeedbackType(String feedbackType) { + this.feedbackType = feedbackType; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getRecordUser() { + return recordUser; + } + + public void setRecordUser(String recordUser) { + this.recordUser = recordUser; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRecordNick() { + return recordNick; + } + + public void setRecordNick(String recordNick) { + this.recordNick = recordNick; + } + + public BigDecimal getQuantityUncheck() { + return quantityUncheck; + } + + public void setQuantityUncheck(BigDecimal quantityUncheck) { + this.quantityUncheck = quantityUncheck; + } + + public String getIsCheck() { + return isCheck; + } + + public void setIsCheck(String isCheck) { + this.isCheck = isCheck; + } + + public Long getRouteId() { + return routeId; + } + + public void setRouteId(Long routeId) { + this.routeId = routeId; + } + + public String getRouteCode() { + return routeCode; + } + + public void setRouteCode(String routeCode) { + this.routeCode = routeCode; + } + + @Override + public String toString() { + return "ProFeedback{" + + "recordId=" + recordId + + ", feedbackCode='" + feedbackCode + '\'' + + ", feedbackType='" + feedbackType + '\'' + + ", workstationId=" + workstationId + + ", workstationCode='" + workstationCode + '\'' + + ", workstationName='" + workstationName + '\'' + + ", routeId=" + routeId + + ", routeCode='" + routeCode + '\'' + + ", processId=" + processId + + ", processCode='" + processCode + '\'' + + ", processName='" + processName + '\'' + + ", isCheck='" + isCheck + '\'' + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", workorderName='" + workorderName + '\'' + + ", taskId=" + taskId + + ", taskCode='" + taskCode + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantity=" + quantity + + ", quantityFeedback=" + quantityFeedback + + ", quantityQualified=" + quantityQualified + + ", quantityUnquanlified=" + quantityUnquanlified + + ", quantityUncheck=" + quantityUncheck + + ", userName='" + userName + '\'' + + ", nickName='" + nickName + '\'' + + ", feedbackChannel='" + feedbackChannel + '\'' + + ", feedbackTime=" + feedbackTime + + ", recordUser='" + recordUser + '\'' + + ", recordNick='" + recordNick + '\'' + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProProcess.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProProcess.java new file mode 100644 index 0000000..e40e56c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProProcess.java @@ -0,0 +1,150 @@ +package com.ktg.mes.pro.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产工序对象 pro_process + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class ProProcess extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工序ID */ + private Long processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 工艺要求 */ + @Excel(name = "工艺要求") + private String attention; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setAttention(String attention) + { + this.attention = attention; + } + + public String getAttention() + { + return attention; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("attention", getAttention()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProProcessContent.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProProcessContent.java new file mode 100644 index 0000000..08b5e3b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProProcessContent.java @@ -0,0 +1,178 @@ +package com.ktg.mes.pro.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产工序内容对象 pro_process_content + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class ProProcessContent extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 内容ID */ + private Long contentId; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 顺序编号 */ + @Excel(name = "顺序编号") + private Integer orderNum; + + /** 内容说明 */ + @Excel(name = "内容说明") + private String contentText; + + /** 辅助设备 */ + @Excel(name = "辅助设备") + private String device; + + /** 辅助材料 */ + @Excel(name = "辅助材料") + private String material; + + /** 材料URL */ + @Excel(name = "材料URL") + private String docUrl; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setContentId(Long contentId) + { + this.contentId = contentId; + } + + public Long getContentId() + { + return contentId; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public Integer getOrderNum() + { + return orderNum; + } + public void setContentText(String contentText) + { + this.contentText = contentText; + } + + public String getContentText() + { + return contentText; + } + public void setDevice(String device) + { + this.device = device; + } + + public String getDevice() + { + return device; + } + public void setMaterial(String material) + { + this.material = material; + } + + public String getMaterial() + { + return material; + } + public void setDocUrl(String docUrl) + { + this.docUrl = docUrl; + } + + public String getDocUrl() + { + return docUrl; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("contentId", getContentId()) + .append("processId", getProcessId()) + .append("orderNum", getOrderNum()) + .append("contentText", getContentText()) + .append("device", getDevice()) + .append("material", getMaterial()) + .append("docUrl", getDocUrl()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRoute.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRoute.java new file mode 100644 index 0000000..96617af --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRoute.java @@ -0,0 +1,150 @@ +package com.ktg.mes.pro.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 工艺路线对象 pro_route + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class ProRoute extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工艺路线ID */ + private Long routeId; + + /** 工艺路线编号 */ + @Excel(name = "工艺路线编号") + private String routeCode; + + /** 工艺路线名称 */ + @Excel(name = "工艺路线名称") + private String routeName; + + /** 工艺路线说明 */ + @Excel(name = "工艺路线说明") + private String routeDesc; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRouteId(Long routeId) + { + this.routeId = routeId; + } + + public Long getRouteId() + { + return routeId; + } + public void setRouteCode(String routeCode) + { + this.routeCode = routeCode; + } + + public String getRouteCode() + { + return routeCode; + } + public void setRouteName(String routeName) + { + this.routeName = routeName; + } + + public String getRouteName() + { + return routeName; + } + public void setRouteDesc(String routeDesc) + { + this.routeDesc = routeDesc; + } + + public String getRouteDesc() + { + return routeDesc; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("routeId", getRouteId()) + .append("routeCode", getRouteCode()) + .append("routeName", getRouteName()) + .append("routeDesc", getRouteDesc()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProcess.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProcess.java new file mode 100644 index 0000000..b2d0e63 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProcess.java @@ -0,0 +1,284 @@ +package com.ktg.mes.pro.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 工艺组成对象 pro_route_process + * + * @author yinjinlu + * @date 2022-05-13 + */ +public class ProRouteProcess extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 工艺路线ID */ + @Excel(name = "工艺路线ID") + private Long routeId; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 序号 */ + @Excel(name = "序号") + private Integer orderNum; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long nextProcessId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String nextProcessCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String nextProcessName; + + /** 与下一道工序关系 */ + @Excel(name = "与下一道工序关系") + private String linkType; + + /** 准备时间 */ + @Excel(name = "准备时间") + private Long defaultPreTime; + + /** 等待时间 */ + @Excel(name = "等待时间") + private Long defaultSufTime; + + /** 甘特图显示颜色 */ + @Excel(name = "甘特图显示颜色") + private String colorCode; + + /** 是否关键工序 */ + private String keyFlag; + + /** 是否质检 */ + private String isCheck; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setRouteId(Long routeId) + { + this.routeId = routeId; + } + + public Long getRouteId() + { + return routeId; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public Integer getOrderNum() + { + return orderNum; + } + public void setNextProcessId(Long nextProcessId) + { + this.nextProcessId = nextProcessId; + } + + public Long getNextProcessId() + { + return nextProcessId; + } + public void setNextProcessCode(String nextProcessCode) + { + this.nextProcessCode = nextProcessCode; + } + + public String getNextProcessCode() + { + return nextProcessCode; + } + public void setNextProcessName(String nextProcessName) + { + this.nextProcessName = nextProcessName; + } + + public String getNextProcessName() + { + return nextProcessName; + } + public void setLinkType(String linkType) + { + this.linkType = linkType; + } + + public String getLinkType() + { + return linkType; + } + public void setDefaultPreTime(Long defaultPreTime) + { + this.defaultPreTime = defaultPreTime; + } + + public Long getDefaultPreTime() + { + return defaultPreTime; + } + public void setDefaultSufTime(Long defaultSufTime) + { + this.defaultSufTime = defaultSufTime; + } + + public String getKeyFlag() { + return keyFlag; + } + + public void setKeyFlag(String keyFlag) { + this.keyFlag = keyFlag; + } + + public Long getDefaultSufTime() + { + return defaultSufTime; + } + public void setColorCode(String colorCode) + { + this.colorCode = colorCode; + } + + public String getColorCode() + { + return colorCode; + } + + public String getIsCheck() { + return isCheck; + } + + public void setIsCheck(String isCheck) { + this.isCheck = isCheck; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "ProRouteProcess{" + + "recordId=" + recordId + + ", routeId=" + routeId + + ", processId=" + processId + + ", processCode='" + processCode + '\'' + + ", processName='" + processName + '\'' + + ", orderNum=" + orderNum + + ", nextProcessId=" + nextProcessId + + ", nextProcessCode='" + nextProcessCode + '\'' + + ", nextProcessName='" + nextProcessName + '\'' + + ", linkType='" + linkType + '\'' + + ", defaultPreTime=" + defaultPreTime + + ", defaultSufTime=" + defaultSufTime + + ", colorCode='" + colorCode + '\'' + + ", keyFlag='" + keyFlag + '\'' + + ", isCheck='" + isCheck + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProduct.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProduct.java new file mode 100644 index 0000000..b7a0b44 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProduct.java @@ -0,0 +1,221 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品制程对象 pro_route_product + * + * @author yinjinlu + * @date 2022-05-14 + */ +public class ProRouteProduct extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 工艺路线ID */ + @Excel(name = "工艺路线ID") + private Long routeId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 生产数量 */ + @Excel(name = "生产数量") + private Long quantity; + + /** 生产用时 */ + @Excel(name = "生产用时") + private BigDecimal productionTime; + + /** 时间单位 */ + @Excel(name = "时间单位") + private String timeUnitType; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setRouteId(Long routeId) + { + this.routeId = routeId; + } + + public Long getRouteId() + { + return routeId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantity(Long quantity) + { + this.quantity = quantity; + } + + public Long getQuantity() + { + return quantity; + } + public void setProductionTime(BigDecimal productionTime) + { + this.productionTime = productionTime; + } + + public BigDecimal getProductionTime() + { + return productionTime; + } + public void setTimeUnitType(String timeUnitType) + { + this.timeUnitType = timeUnitType; + } + + public String getTimeUnitType() + { + return timeUnitType; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("routeId", getRouteId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantity", getQuantity()) + .append("productionTime", getProductionTime()) + .append("timeUnitType", getTimeUnitType()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProductBom.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProductBom.java new file mode 100644 index 0000000..76a8749 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProRouteProductBom.java @@ -0,0 +1,222 @@ +package com.ktg.mes.pro.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; + +/** + * 产品制程物料BOM对象 pro_route_product_bom + * + * @author yinjinlu + * @date 2022-09-12 + */ +public class ProRouteProductBom extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 工艺路线ID */ + @Excel(name = "工艺路线ID") + private Long routeId; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long productId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 用料比例 */ + @Excel(name = "用料比例") + private BigDecimal quantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setRouteId(Long routeId) + { + this.routeId = routeId; + } + + public Long getRouteId() + { + return routeId; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProductId(Long productId) + { + this.productId = productId; + } + + public Long getProductId() + { + return productId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("routeId", getRouteId()) + .append("processId", getProcessId()) + .append("productId", getProductId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantity", getQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTask.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTask.java new file mode 100644 index 0000000..d4f141a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTask.java @@ -0,0 +1,554 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产任务对象 pro_task + * + * @author yinjinlu + * @date 2022-05-15 + */ +public class ProTask extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 任务ID */ + private Long taskId; + + /** 任务编号 */ + @Excel(name = "任务编号") + private String taskCode; + + /** 任务名称 */ + @Excel(name = "任务名称") + private String taskName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编号 */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 工单名称 */ + @Excel(name = "工单名称") + private String workorderName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + private Long routeId; + + private String routeCode; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + private String isCheck; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 排产数量 */ + @Excel(name = "排产数量") + private BigDecimal quantity; + + /** 已生产数量 */ + @Excel(name = "已生产数量") + private BigDecimal quantityProduced; + + private BigDecimal quantityQuanlify; + + private BigDecimal quantityUnquanlify; + + /** 调整数量 */ + @Excel(name = "调整数量") + private BigDecimal quantityChanged; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 客户简称 */ + @Excel(name = "客户简称") + private String clientNick; + + /** 开始生产时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "开始生产时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** 生产时长 */ + @Excel(name = "生产时长") + private Long duration; + + /** 完成生产时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "完成生产时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + /** 甘特图显示颜色 */ + @Excel(name = "甘特图显示颜色") + private String colorCode; + + /** 需求日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @Excel(name = "需求日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date requestDate; + + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setTaskName(String taskName) + { + this.taskName = taskName; + } + + public String getTaskName() + { + return taskName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + public void setQuantityProduced(BigDecimal quantityProduced) + { + this.quantityProduced = quantityProduced; + } + + public BigDecimal getQuantityProduced() + { + return quantityProduced; + } + public void setQuantityChanged(BigDecimal quantityChanged) + { + this.quantityChanged = quantityChanged; + } + + public BigDecimal getQuantityQuanlify() { + return quantityQuanlify; + } + + public void setQuantityQuanlify(BigDecimal quantityQuanlify) { + this.quantityQuanlify = quantityQuanlify; + } + + public BigDecimal getQuantityUnquanlify() { + return quantityUnquanlify; + } + + public void setQuantityUnquanlify(BigDecimal quantityUnquanlify) { + this.quantityUnquanlify = quantityUnquanlify; + } + + public BigDecimal getQuantityChanged() + { + return quantityChanged; + } + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setClientNick(String clientNick) + { + this.clientNick = clientNick; + } + + public String getClientNick() + { + return clientNick; + } + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStartTime() + { + return startTime; + } + public void setDuration(Long duration) + { + this.duration = duration; + } + + public Long getDuration() + { + return duration; + } + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + public void setColorCode(String colorCode) + { + this.colorCode = colorCode; + } + + public String getColorCode() + { + return colorCode; + } + public void setRequestDate(Date requestDate) + { + this.requestDate = requestDate; + } + + public Date getRequestDate() + { + return requestDate; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public Long getRouteId() { + return routeId; + } + + public void setRouteId(Long routeId) { + this.routeId = routeId; + } + + public String getRouteCode() { + return routeCode; + } + + public void setRouteCode(String routeCode) { + this.routeCode = routeCode; + } + + public String getIsCheck() { + return isCheck; + } + + public void setIsCheck(String isCheck) { + this.isCheck = isCheck; + } + + @Override + public String toString() { + return "ProTask{" + + "taskId=" + taskId + + ", taskCode='" + taskCode + '\'' + + ", taskName='" + taskName + '\'' + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", workorderName='" + workorderName + '\'' + + ", workstationId=" + workstationId + + ", workstationCode='" + workstationCode + '\'' + + ", workstationName='" + workstationName + '\'' + + ", routeId=" + routeId + + ", routeCode='" + routeCode + '\'' + + ", processId=" + processId + + ", processCode='" + processCode + '\'' + + ", processName='" + processName + '\'' + + ", isCheck='" + isCheck + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantity=" + quantity + + ", quantityProduced=" + quantityProduced + + ", quantityQuanlify=" + quantityQuanlify + + ", quantityUnquanlify=" + quantityUnquanlify + + ", quantityChanged=" + quantityChanged + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", clientNick='" + clientNick + '\'' + + ", startTime=" + startTime + + ", duration=" + duration + + ", endTime=" + endTime + + ", colorCode='" + colorCode + '\'' + + ", requestDate=" + requestDate + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTaskIssue.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTaskIssue.java new file mode 100644 index 0000000..d7eaeb9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTaskIssue.java @@ -0,0 +1,319 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产任务投料对象 pro_task_issue + * + * @author yinjinlu + * @date 2022-07-22 + */ +public class ProTaskIssue extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 单据ID */ + @Excel(name = "单据ID") + private Long sourceDocId; + + /** 单据编号 */ + @Excel(name = "单据编号") + private String sourceDocCode; + + /** 单据类型 */ + @Excel(name = "单据类型") + private String sourceDocType; + + /** 投料批次 */ + @Excel(name = "投料批次") + private String batchCode; + + /** 行ID */ + @Excel(name = "行ID") + private Long sourceLineId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 总的投料数量 */ + @Excel(name = "总的投料数量") + private BigDecimal quantityIssued; + + /** 当前可用数量 */ + @Excel(name = "当前可用数量") + private BigDecimal quantityAvailable; + + /** 当前使用数量 */ + @Excel(name = "当前使用数量") + private BigDecimal quantityUsed; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setSourceDocId(Long sourceDocId) + { + this.sourceDocId = sourceDocId; + } + + public Long getSourceDocId() + { + return sourceDocId; + } + public void setSourceDocCode(String sourceDocCode) + { + this.sourceDocCode = sourceDocCode; + } + + public String getSourceDocCode() + { + return sourceDocCode; + } + public void setSourceDocType(String sourceDocType) + { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocType() + { + return sourceDocType; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setSourceLineId(Long sourceLineId) + { + this.sourceLineId = sourceLineId; + } + + public Long getSourceLineId() + { + return sourceLineId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityIssued(BigDecimal quantityIssued) + { + this.quantityIssued = quantityIssued; + } + + public BigDecimal getQuantityIssued() + { + return quantityIssued; + } + public void setQuantityAvailable(BigDecimal quantityAvailable) + { + this.quantityAvailable = quantityAvailable; + } + + public BigDecimal getQuantityAvailable() + { + return quantityAvailable; + } + public void setQuantityUsed(BigDecimal quantityUsed) + { + this.quantityUsed = quantityUsed; + } + + public BigDecimal getQuantityUsed() + { + return quantityUsed; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("taskId", getTaskId()) + .append("workorderId", getWorkorderId()) + .append("workstationId", getWorkstationId()) + .append("sourceDocId", getSourceDocId()) + .append("sourceDocCode", getSourceDocCode()) + .append("sourceDocType", getSourceDocType()) + .append("batchCode", getBatchCode()) + .append("sourceLineId", getSourceLineId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityIssued", getQuantityIssued()) + .append("quantityAvailable", getQuantityAvailable()) + .append("quantityUsed", getQuantityUsed()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTransConsume.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTransConsume.java new file mode 100644 index 0000000..aa1df7b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTransConsume.java @@ -0,0 +1,364 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 物料消耗记录对象 pro_trans_consume + * + * @author yinjinlu + * @date 2022-07-24 + */ +public class ProTransConsume extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 流转单ID */ + @Excel(name = "流转单ID") + private Long transOrderId; + + /** 流转单编号 */ + @Excel(name = "流转单编号") + private String transOrderCode; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 被消耗单据ID */ + @Excel(name = "被消耗单据ID") + private Long sourceDocId; + + /** 被消耗单据编号 */ + @Excel(name = "被消耗单据编号") + private String sourceDocCode; + + /** 被消耗单据类型 */ + @Excel(name = "被消耗单据类型") + private String sourceDocType; + + /** 被消耗单据行ID */ + @Excel(name = "被消耗单据行ID") + private Long sourceLineId; + + /** 被消耗物料批次号 */ + @Excel(name = "被消耗物料批次号") + private String sourceBatchCode; + + /** 被消耗产品物料ID */ + @Excel(name = "被消耗产品物料ID") + private Long itemId; + + /** 被消耗产品物料编码 */ + @Excel(name = "被消耗产品物料编码") + private String itemCode; + + /** 被消耗产品物料名称 */ + @Excel(name = "被消耗产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 消耗数量 */ + @Excel(name = "消耗数量") + private BigDecimal quantityConsumed; + + /** 消耗时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "消耗时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date consumeDate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setTransOrderId(Long transOrderId) + { + this.transOrderId = transOrderId; + } + + public Long getTransOrderId() + { + return transOrderId; + } + public void setTransOrderCode(String transOrderCode) + { + this.transOrderCode = transOrderCode; + } + + public String getTransOrderCode() + { + return transOrderCode; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setSourceDocId(Long sourceDocId) + { + this.sourceDocId = sourceDocId; + } + + public Long getSourceDocId() + { + return sourceDocId; + } + public void setSourceDocCode(String sourceDocCode) + { + this.sourceDocCode = sourceDocCode; + } + + public String getSourceDocCode() + { + return sourceDocCode; + } + public void setSourceDocType(String sourceDocType) + { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocType() + { + return sourceDocType; + } + public void setSourceLineId(Long sourceLineId) + { + this.sourceLineId = sourceLineId; + } + + public Long getSourceLineId() + { + return sourceLineId; + } + public void setSourceBatchCode(String sourceBatchCode) + { + this.sourceBatchCode = sourceBatchCode; + } + + public String getSourceBatchCode() + { + return sourceBatchCode; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityConsumed(BigDecimal quantityConsumed) + { + this.quantityConsumed = quantityConsumed; + } + + public BigDecimal getQuantityConsumed() + { + return quantityConsumed; + } + public void setConsumeDate(Date consumeDate) + { + this.consumeDate = consumeDate; + } + + public Date getConsumeDate() + { + return consumeDate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("transOrderId", getTransOrderId()) + .append("transOrderCode", getTransOrderCode()) + .append("taskId", getTaskId()) + .append("workstationId", getWorkstationId()) + .append("processId", getProcessId()) + .append("workorderId", getWorkorderId()) + .append("batchCode", getBatchCode()) + .append("sourceDocId", getSourceDocId()) + .append("sourceDocCode", getSourceDocCode()) + .append("sourceDocType", getSourceDocType()) + .append("sourceLineId", getSourceLineId()) + .append("sourceBatchCode", getSourceBatchCode()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityConsumed", getQuantityConsumed()) + .append("consumeDate", getConsumeDate()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTransOrder.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTransOrder.java new file mode 100644 index 0000000..3a8ee1e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProTransOrder.java @@ -0,0 +1,384 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 流转单对象 pro_trans_order + * + * @author yinjinlu + * @date 2022-07-24 + */ +public class ProTransOrder extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流转单ID */ + private Long transOrderId; + + /** 流转单编号 */ + @Excel(name = "流转单编号") + private String transOrderCode; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 生产任务编号 */ + @Excel(name = "生产任务编号") + private String taskCode; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编号 */ + @Excel(name = "工序编号") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编号 */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 生产工单名称 */ + @Excel(name = "生产工单名称") + private String workorderName; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + private String barCodeUrl; + + /** 流转数量 */ + @Excel(name = "流转数量") + private BigDecimal quantityTransfered; + + /** 生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date produceDate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTransOrderId(Long transOrderId) + { + this.transOrderId = transOrderId; + } + + public Long getTransOrderId() + { + return transOrderId; + } + public void setTransOrderCode(String transOrderCode) + { + this.transOrderCode = transOrderCode; + } + + public String getTransOrderCode() + { + return transOrderCode; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityTransfered(BigDecimal quantityTransfered) + { + this.quantityTransfered = quantityTransfered; + } + + public BigDecimal getQuantityTransfered() + { + return quantityTransfered; + } + public void setProduceDate(Date produceDate) + { + this.produceDate = produceDate; + } + + public Date getProduceDate() + { + return produceDate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public String getBarCodeUrl() { + return barCodeUrl; + } + + public void setBarCodeUrl(String barCodeUrl) { + this.barCodeUrl = barCodeUrl; + } + + @Override + public String toString() { + return "ProTransOrder{" + + "transOrderId=" + transOrderId + + ", transOrderCode='" + transOrderCode + '\'' + + ", taskId=" + taskId + + ", taskCode='" + taskCode + '\'' + + ", workstationId=" + workstationId + + ", workstationCode='" + workstationCode + '\'' + + ", workstationName='" + workstationName + '\'' + + ", processId=" + processId + + ", processCode='" + processCode + '\'' + + ", processName='" + processName + '\'' + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", workorderName='" + workorderName + '\'' + + ", batchCode='" + batchCode + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", barCodeUrl='" + barCodeUrl + '\'' + + ", quantityTransfered=" + quantityTransfered + + ", produceDate=" + produceDate + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProUserWorkstation.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProUserWorkstation.java new file mode 100644 index 0000000..4b501ba --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProUserWorkstation.java @@ -0,0 +1,199 @@ +package com.ktg.mes.pro.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 用户工作站绑定关系对象 pro_user_workstation + * + * @author yinjinlu + * @date 2023-02-20 + */ +public class ProUserWorkstation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + /** 用户名 */ + @Excel(name = "用户名") + private String userName; + + /** 名称 */ + @Excel(name = "名称") + private Long nickName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date operationTime; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(Long nickName) + { + this.nickName = nickName; + } + + public Long getNickName() + { + return nickName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setOperationTime(Date operationTime) + { + this.operationTime = operationTime; + } + + public Date getOperationTime() + { + return operationTime; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("workstationId", getWorkstationId()) + .append("workstationCode", getWorkstationCode()) + .append("workstationName", getWorkstationName()) + .append("operationTime", getOperationTime()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkorder.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkorder.java new file mode 100644 index 0000000..7554e91 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkorder.java @@ -0,0 +1,439 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.TreeEntity; + +/** + * 生产工单对象 pro_workorder + * + * @author yinjinlu + * @date 2022-05-15 + */ +public class ProWorkorder extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 工单ID */ + private Long workorderId; + + /** 工单编码 */ + @Excel(name = "工单编码") + private String workorderCode; + + /** 工单名称 */ + @Excel(name = "工单名称") + private String workorderName; + + /** 工单类型 */ + @Excel(name = "工单类型") + private String workorderType; + + /** 来源类型 */ + @Excel(name = "来源类型") + private String orderSource; + + /** 来源单据 */ + @Excel(name = "来源单据") + private String sourceCode; + + /** 产品ID */ + @Excel(name = "产品ID") + private Long productId; + + /** 产品编号 */ + @Excel(name = "产品编号") + private String productCode; + + /** 产品名称 */ + @Excel(name = "产品名称") + private String productName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String productSpc; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 生产数量 */ + @Excel(name = "生产数量") + private BigDecimal quantity; + + /** 已生产数量 */ + @Excel(name = "已生产数量") + private BigDecimal quantityProduced; + + /** 调整数量 */ + @Excel(name = "调整数量") + private BigDecimal quantityChanged; + + /** 已排产数量 */ + @Excel(name = "已排产数量") + private BigDecimal quantityScheduled; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编号 */ + @Excel(name = "供应商编号") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + + /** 需求日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "需求日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date requestDate; + + /** 完成时间 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss") + private Date finishDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + private List tasks; + + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + + public String getWorkorderType() { + return workorderType; + } + + public void setWorkorderType(String workorderType) { + this.workorderType = workorderType; + } + + public void setOrderSource(String orderSource) + { + this.orderSource = orderSource; + } + + public String getOrderSource() + { + return orderSource; + } + public void setSourceCode(String sourceCode) + { + this.sourceCode = sourceCode; + } + + public String getSourceCode() + { + return sourceCode; + } + public void setProductId(Long productId) + { + this.productId = productId; + } + + public Long getProductId() + { + return productId; + } + public void setProductCode(String productCode) + { + this.productCode = productCode; + } + + public String getProductCode() + { + return productCode; + } + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getProductName() + { + return productName; + } + public void setProductSpc(String productSpc) + { + this.productSpc = productSpc; + } + + public String getProductSpc() + { + return productSpc; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + public void setQuantityProduced(BigDecimal quantityProduced) + { + this.quantityProduced = quantityProduced; + } + + public BigDecimal getQuantityProduced() + { + return quantityProduced; + } + public void setQuantityChanged(BigDecimal quantityChanged) + { + this.quantityChanged = quantityChanged; + } + + public BigDecimal getQuantityChanged() + { + return quantityChanged; + } + public void setQuantityScheduled(BigDecimal quantityScheduled) + { + this.quantityScheduled = quantityScheduled; + } + + public BigDecimal getQuantityScheduled() + { + return quantityScheduled; + } + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public void setRequestDate(Date requestDate) + { + this.requestDate = requestDate; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Date getRequestDate() + { + return requestDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public Date getFinishDate() { + return finishDate; + } + + public void setFinishDate(Date finishDate) { + this.finishDate = finishDate; + } + + public List getTasks() { + return tasks; + } + + public void setTasks(List tasks) { + this.tasks = tasks; + } + + @Override + public String toString() { + return "ProWorkorder{" + + "workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", workorderName='" + workorderName + '\'' + + ", workorderType='" + workorderType + '\'' + + ", orderSource='" + orderSource + '\'' + + ", sourceCode='" + sourceCode + '\'' + + ", productId=" + productId + + ", productCode='" + productCode + '\'' + + ", productName='" + productName + '\'' + + ", productSpc='" + productSpc + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", quantity=" + quantity + + ", quantityProduced=" + quantityProduced + + ", quantityChanged=" + quantityChanged + + ", quantityScheduled=" + quantityScheduled + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", requestDate=" + requestDate + + ", finishDate=" + finishDate + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkorderBom.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkorderBom.java new file mode 100644 index 0000000..562a668 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkorderBom.java @@ -0,0 +1,207 @@ +package com.ktg.mes.pro.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产工单BOM组成对象 pro_workorder_bom + * + * @author yinjinlu + * @date 2022-05-09 + */ +public class ProWorkorderBom extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** BOM行ID */ + private Long lineId; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** BOM物料ID */ + @Excel(name = "BOM物料ID") + private Long itemId; + + /** BOM物料编号 */ + @Excel(name = "BOM物料编号") + private String itemCode; + + /** BOM物料名称 */ + @Excel(name = "BOM物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String itemSpc; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 物料产品标识 */ + @Excel(name = "物料产品标识") + private String itemOrProduct; + + /** 预计使用量 */ + @Excel(name = "预计使用量") + private BigDecimal quantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setItemSpc(String itemSpc) + { + this.itemSpc = itemSpc; + } + + public String getItemSpc() + { + return itemSpc; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setItemOrProduct(String itemOrProduct) + { + this.itemOrProduct = itemOrProduct; + } + + public String getItemOrProduct() + { + return itemOrProduct; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return quantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("workorderId", getWorkorderId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("itemSpc", getItemSpc()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("itemOrProduct", getItemOrProduct()) + .append("quantity", getQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkrecord.java b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkrecord.java new file mode 100644 index 0000000..075641b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProWorkrecord.java @@ -0,0 +1,209 @@ +package com.ktg.mes.pro.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 上下工记录对象 pro_workrecord + * + * @author yinjinlu + * @date 2023-02-20 + */ +public class ProWorkrecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + /** 用户名 */ + @Excel(name = "用户名") + private String userName; + + /** 名称 */ + @Excel(name = "名称") + private Long nickName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 操作类型 */ + @Excel(name = "操作类型") + private String operationFlag; + + /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date operationTime; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(Long nickName) + { + this.nickName = nickName; + } + + public Long getNickName() + { + return nickName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setOperationFlag(String operationFlag) + { + this.operationFlag = operationFlag; + } + + public String getOperationFlag() + { + return operationFlag; + } + public void setOperationTime(Date operationTime) + { + this.operationTime = operationTime; + } + + public Date getOperationTime() + { + return operationTime; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("workstationId", getWorkstationId()) + .append("workstationCode", getWorkstationCode()) + .append("workstationName", getWorkstationName()) + .append("operationFlag", getOperationFlag()) + .append("operationTime", getOperationTime()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProFeedbackMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProFeedbackMapper.java new file mode 100644 index 0000000..17dcbe7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProFeedbackMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProFeedback; + +/** + * 生产报工记录Mapper接口 + * + * @author yinjinlu + * @date 2022-07-10 + */ +public interface ProFeedbackMapper +{ + /** + * 查询生产报工记录 + * + * @param recordId 生产报工记录主键 + * @return 生产报工记录 + */ + public ProFeedback selectProFeedbackByRecordId(Long recordId); + + /** + * 查询生产报工记录列表 + * + * @param proFeedback 生产报工记录 + * @return 生产报工记录集合 + */ + public List selectProFeedbackList(ProFeedback proFeedback); + + /** + * 新增生产报工记录 + * + * @param proFeedback 生产报工记录 + * @return 结果 + */ + public int insertProFeedback(ProFeedback proFeedback); + + /** + * 修改生产报工记录 + * + * @param proFeedback 生产报工记录 + * @return 结果 + */ + public int updateProFeedback(ProFeedback proFeedback); + + /** + * 删除生产报工记录 + * + * @param recordId 生产报工记录主键 + * @return 结果 + */ + public int deleteProFeedbackByRecordId(Long recordId); + + /** + * 批量删除生产报工记录 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProFeedbackByRecordIds(Long[] recordIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProProcessContentMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProProcessContentMapper.java new file mode 100644 index 0000000..8c936c9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProProcessContentMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProProcessContent; + +/** + * 生产工序内容Mapper接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface ProProcessContentMapper +{ + /** + * 查询生产工序内容 + * + * @param contentId 生产工序内容主键 + * @return 生产工序内容 + */ + public ProProcessContent selectProProcessContentByContentId(Long contentId); + + /** + * 查询生产工序内容列表 + * + * @param proProcessContent 生产工序内容 + * @return 生产工序内容集合 + */ + public List selectProProcessContentList(ProProcessContent proProcessContent); + + /** + * 新增生产工序内容 + * + * @param proProcessContent 生产工序内容 + * @return 结果 + */ + public int insertProProcessContent(ProProcessContent proProcessContent); + + /** + * 修改生产工序内容 + * + * @param proProcessContent 生产工序内容 + * @return 结果 + */ + public int updateProProcessContent(ProProcessContent proProcessContent); + + /** + * 删除生产工序内容 + * + * @param contentId 生产工序内容主键 + * @return 结果 + */ + public int deleteProProcessContentByContentId(Long contentId); + + /** + * 批量删除生产工序内容 + * + * @param contentIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProProcessContentByContentIds(Long[] contentIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProProcessMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProProcessMapper.java new file mode 100644 index 0000000..6bbba34 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProProcessMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProProcess; + +/** + * 生产工序Mapper接口 + * + * @author yinjinlu + * @date 2022-05-11 + */ +public interface ProProcessMapper +{ + /** + * 查询生产工序 + * + * @param processId 生产工序主键 + * @return 生产工序 + */ + public ProProcess selectProProcessByProcessId(Long processId); + + /** + * 查询生产工序列表 + * + * @param proProcess 生产工序 + * @return 生产工序集合 + */ + public List selectProProcessList(ProProcess proProcess); + + public ProProcess checkProcessCodeUnique(ProProcess proProcess); + public ProProcess checkProcessNameUnique(ProProcess proProcess); + + + /** + * 新增生产工序 + * + * @param proProcess 生产工序 + * @return 结果 + */ + public int insertProProcess(ProProcess proProcess); + + /** + * 修改生产工序 + * + * @param proProcess 生产工序 + * @return 结果 + */ + public int updateProProcess(ProProcess proProcess); + + /** + * 删除生产工序 + * + * @param processId 生产工序主键 + * @return 结果 + */ + public int deleteProProcessByProcessId(Long processId); + + /** + * 批量删除生产工序 + * + * @param processIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProProcessByProcessIds(Long[] processIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteMapper.java new file mode 100644 index 0000000..b31b218 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteMapper.java @@ -0,0 +1,70 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProRoute; + +/** + * 工艺路线Mapper接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface ProRouteMapper +{ + /** + * 查询工艺路线 + * + * @param routeId 工艺路线主键 + * @return 工艺路线 + */ + public ProRoute selectProRouteByRouteId(Long routeId); + + /** + * 查询工艺路线列表 + * + * @param proRoute 工艺路线 + * @return 工艺路线集合 + */ + public List selectProRouteList(ProRoute proRoute); + + /** + * 根据物料查找生效的工艺路线 + * @param itemId + * @return + */ + public ProRoute getRouteByProductId(Long itemId); + + public ProRoute checkRouteCodeUnique(ProRoute proRoute); + + /** + * 新增工艺路线 + * + * @param proRoute 工艺路线 + * @return 结果 + */ + public int insertProRoute(ProRoute proRoute); + + /** + * 修改工艺路线 + * + * @param proRoute 工艺路线 + * @return 结果 + */ + public int updateProRoute(ProRoute proRoute); + + /** + * 删除工艺路线 + * + * @param routeId 工艺路线主键 + * @return 结果 + */ + public int deleteProRouteByRouteId(Long routeId); + + /** + * 批量删除工艺路线 + * + * @param routeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProRouteByRouteIds(Long[] routeIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProcessMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProcessMapper.java new file mode 100644 index 0000000..6500640 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProcessMapper.java @@ -0,0 +1,76 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProRouteProcess; +import org.springframework.security.core.parameters.P; + +/** + * 工艺组成Mapper接口 + * + * @author yinjinlu + * @date 2022-05-13 + */ +public interface ProRouteProcessMapper +{ + /** + * 查询工艺组成 + * + * @param recordId 工艺组成主键 + * @return 工艺组成 + */ + public ProRouteProcess selectProRouteProcessByRecordId(Long recordId); + + /** + * 查询工艺组成列表 + * + * @param proRouteProcess 工艺组成 + * @return 工艺组成集合 + */ + public List selectProRouteProcessList(ProRouteProcess proRouteProcess); + + public ProRouteProcess checkOrderNumExists(ProRouteProcess proRouteProcess); + public ProRouteProcess checkProcessExists(ProRouteProcess proRouteProcess); + public ProRouteProcess checkUpdateFlagUnique(ProRouteProcess proRouteProcess); + + public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess); + + public ProRouteProcess findNextProcess(ProRouteProcess proRouteProcess); + /** + * 新增工艺组成 + * + * @param proRouteProcess 工艺组成 + * @return 结果 + */ + public int insertProRouteProcess(ProRouteProcess proRouteProcess); + + /** + * 修改工艺组成 + * + * @param proRouteProcess 工艺组成 + * @return 结果 + */ + public int updateProRouteProcess(ProRouteProcess proRouteProcess); + + /** + * 删除工艺组成 + * + * @param recordId 工艺组成主键 + * @return 结果 + */ + public int deleteProRouteProcessByRecordId(Long recordId); + + /** + * 批量删除工艺组成 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProRouteProcessByRecordIds(Long[] recordIds); + + /** + * 根据工艺路线ID删除所有工序配置 + * @param routeId + * @return + */ + public int deleteByRouteId(Long routeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProductBomMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProductBomMapper.java new file mode 100644 index 0000000..5b82ce9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProductBomMapper.java @@ -0,0 +1,83 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProRouteProductBom; + +/** + * 产品制程物料BOMMapper接口 + * + * @author yinjinlu + * @date 2022-09-12 + */ +public interface ProRouteProductBomMapper +{ + /** + * 查询产品制程物料BOM + * + * @param recordId 产品制程物料BOM主键 + * @return 产品制程物料BOM + */ + public ProRouteProductBom selectProRouteProductBomByRecordId(Long recordId); + + /** + * 查询产品制程物料BOM列表 + * + * @param proRouteProductBom 产品制程物料BOM + * @return 产品制程物料BOM集合 + */ + public List selectProRouteProductBomList(ProRouteProductBom proRouteProductBom); + + + /** + * 检测是否重复配置 + * @param proRouteProductBom + * @return + */ + public ProRouteProductBom checkUnique(ProRouteProductBom proRouteProductBom); + + /** + * 新增产品制程物料BOM + * + * @param proRouteProductBom 产品制程物料BOM + * @return 结果 + */ + public int insertProRouteProductBom(ProRouteProductBom proRouteProductBom); + + /** + * 修改产品制程物料BOM + * + * @param proRouteProductBom 产品制程物料BOM + * @return 结果 + */ + public int updateProRouteProductBom(ProRouteProductBom proRouteProductBom); + + /** + * 删除产品制程物料BOM + * + * @param recordId 产品制程物料BOM主键 + * @return 结果 + */ + public int deleteProRouteProductBomByRecordId(Long recordId); + + /** + * 批量删除产品制程物料BOM + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProRouteProductBomByRecordIds(Long[] recordIds); + + /** + * 根据工艺路线ID删除所有产品BOM设置 + * @param routeId + * @return + */ + public int deleteByRouteId(Long routeId); + + /** + * 根据工艺路线ID和产品ID删除BOM设置 + * @param proRouteProductBom + * @return + */ + public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProductMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProductMapper.java new file mode 100644 index 0000000..c1cdcf6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProRouteProductMapper.java @@ -0,0 +1,70 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProRouteProduct; + +/** + * 产品制程Mapper接口 + * + * @author yinjinlu + * @date 2022-05-14 + */ +public interface ProRouteProductMapper +{ + /** + * 查询产品制程 + * + * @param recordId 产品制程主键 + * @return 产品制程 + */ + public ProRouteProduct selectProRouteProductByRecordId(Long recordId); + + /** + * 查询产品制程列表 + * + * @param proRouteProduct 产品制程 + * @return 产品制程集合 + */ + public List selectProRouteProductList(ProRouteProduct proRouteProduct); + + public ProRouteProduct checkItemUnique(ProRouteProduct proRouteProduct); + + /** + * 新增产品制程 + * + * @param proRouteProduct 产品制程 + * @return 结果 + */ + public int insertProRouteProduct(ProRouteProduct proRouteProduct); + + /** + * 修改产品制程 + * + * @param proRouteProduct 产品制程 + * @return 结果 + */ + public int updateProRouteProduct(ProRouteProduct proRouteProduct); + + /** + * 删除产品制程 + * + * @param recordId 产品制程主键 + * @return 结果 + */ + public int deleteProRouteProductByRecordId(Long recordId); + + /** + * 批量删除产品制程 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProRouteProductByRecordIds(Long[] recordIds); + + /** + * 根据工艺路线ID删除对应的产品配置 + * @param routeId + * @return + */ + public int deleteByRouteId(Long routeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTaskIssueMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTaskIssueMapper.java new file mode 100644 index 0000000..0b27c1c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTaskIssueMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTaskIssue; + +/** + * 生产任务投料Mapper接口 + * + * @author yinjinlu + * @date 2022-07-22 + */ +public interface ProTaskIssueMapper +{ + /** + * 查询生产任务投料 + * + * @param recordId 生产任务投料主键 + * @return 生产任务投料 + */ + public ProTaskIssue selectProTaskIssueByRecordId(Long recordId); + + /** + * 查询生产任务投料列表 + * + * @param proTaskIssue 生产任务投料 + * @return 生产任务投料集合 + */ + public List selectProTaskIssueList(ProTaskIssue proTaskIssue); + + public ProTaskIssue checkUnique(ProTaskIssue proTaskIssue); + + /** + * 新增生产任务投料 + * + * @param proTaskIssue 生产任务投料 + * @return 结果 + */ + public int insertProTaskIssue(ProTaskIssue proTaskIssue); + + /** + * 修改生产任务投料 + * + * @param proTaskIssue 生产任务投料 + * @return 结果 + */ + public int updateProTaskIssue(ProTaskIssue proTaskIssue); + + /** + * 删除生产任务投料 + * + * @param recordId 生产任务投料主键 + * @return 结果 + */ + public int deleteProTaskIssueByRecordId(Long recordId); + + /** + * 批量删除生产任务投料 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProTaskIssueByRecordIds(Long[] recordIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTaskMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTaskMapper.java new file mode 100644 index 0000000..1efff2e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTaskMapper.java @@ -0,0 +1,69 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTask; + +/** + * 生产任务Mapper接口 + * + * @author yinjinlu + * @date 2022-05-14 + */ +public interface ProTaskMapper +{ + /** + * 查询生产任务 + * + * @param taskId 生产任务主键 + * @return 生产任务 + */ + public ProTask selectProTaskByTaskId(Long taskId); + + /** + * 查询生产任务列表 + * + * @param proTask 生产任务 + * @return 生产任务集合 + */ + public List selectProTaskList(ProTask proTask); + + + /** + * 查询某个工单的各个工序生产进度 + * @param workorderId + * @return + */ + public List selectProTaskProcessViewByWorkorder(Long workorderId); + + /** + * 新增生产任务 + * + * @param proTask 生产任务 + * @return 结果 + */ + public int insertProTask(ProTask proTask); + + /** + * 修改生产任务 + * + * @param proTask 生产任务 + * @return 结果 + */ + public int updateProTask(ProTask proTask); + + /** + * 删除生产任务 + * + * @param taskId 生产任务主键 + * @return 结果 + */ + public int deleteProTaskByTaskId(Long taskId); + + /** + * 批量删除生产任务 + * + * @param taskIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProTaskByTaskIds(Long[] taskIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTransConsumeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTransConsumeMapper.java new file mode 100644 index 0000000..9599976 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTransConsumeMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTransConsume; + +/** + * 物料消耗记录Mapper接口 + * + * @author yinjinlu + * @date 2022-07-24 + */ +public interface ProTransConsumeMapper +{ + /** + * 查询物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 物料消耗记录 + */ + public ProTransConsume selectProTransConsumeByRecordId(Long recordId); + + /** + * 查询物料消耗记录列表 + * + * @param proTransConsume 物料消耗记录 + * @return 物料消耗记录集合 + */ + public List selectProTransConsumeList(ProTransConsume proTransConsume); + + /** + * 新增物料消耗记录 + * + * @param proTransConsume 物料消耗记录 + * @return 结果 + */ + public int insertProTransConsume(ProTransConsume proTransConsume); + + /** + * 修改物料消耗记录 + * + * @param proTransConsume 物料消耗记录 + * @return 结果 + */ + public int updateProTransConsume(ProTransConsume proTransConsume); + + /** + * 删除物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 结果 + */ + public int deleteProTransConsumeByRecordId(Long recordId); + + /** + * 批量删除物料消耗记录 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProTransConsumeByRecordIds(Long[] recordIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTransOrderMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTransOrderMapper.java new file mode 100644 index 0000000..03abab2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProTransOrderMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTransOrder; + +/** + * 流转单Mapper接口 + * + * @author yinjinlu + * @date 2022-07-24 + */ +public interface ProTransOrderMapper +{ + /** + * 查询流转单 + * + * @param transOrderId 流转单主键 + * @return 流转单 + */ + public ProTransOrder selectProTransOrderByTransOrderId(Long transOrderId); + + /** + * 查询流转单列表 + * + * @param proTransOrder 流转单 + * @return 流转单集合 + */ + public List selectProTransOrderList(ProTransOrder proTransOrder); + + /** + * 新增流转单 + * + * @param proTransOrder 流转单 + * @return 结果 + */ + public int insertProTransOrder(ProTransOrder proTransOrder); + + /** + * 修改流转单 + * + * @param proTransOrder 流转单 + * @return 结果 + */ + public int updateProTransOrder(ProTransOrder proTransOrder); + + /** + * 删除流转单 + * + * @param transOrderId 流转单主键 + * @return 结果 + */ + public int deleteProTransOrderByTransOrderId(Long transOrderId); + + /** + * 批量删除流转单 + * + * @param transOrderIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProTransOrderByTransOrderIds(Long[] transOrderIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProUserWorkstationMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProUserWorkstationMapper.java new file mode 100644 index 0000000..c05163e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProUserWorkstationMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProUserWorkstation; + +/** + * 用户工作站绑定关系Mapper接口 + * + * @author yinjinlu + * @date 2023-02-20 + */ +public interface ProUserWorkstationMapper +{ + /** + * 查询用户工作站绑定关系 + * + * @param recordId 用户工作站绑定关系主键 + * @return 用户工作站绑定关系 + */ + public ProUserWorkstation selectProUserWorkstationByRecordId(Long recordId); + + /** + * 查询用户工作站绑定关系列表 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 用户工作站绑定关系集合 + */ + public List selectProUserWorkstationList(ProUserWorkstation proUserWorkstation); + + /** + * 新增用户工作站绑定关系 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 结果 + */ + public int insertProUserWorkstation(ProUserWorkstation proUserWorkstation); + + /** + * 修改用户工作站绑定关系 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 结果 + */ + public int updateProUserWorkstation(ProUserWorkstation proUserWorkstation); + + /** + * 删除用户工作站绑定关系 + * + * @param recordId 用户工作站绑定关系主键 + * @return 结果 + */ + public int deleteProUserWorkstationByRecordId(Long recordId); + + /** + * 批量删除用户工作站绑定关系 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProUserWorkstationByRecordIds(Long[] recordIds); + + /** + * 根据用户名删除所有对应关系 + * @param userName + * @return + */ + public int deleteByUserName(String userName); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkorderBomMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkorderBomMapper.java new file mode 100644 index 0000000..0b626f7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkorderBomMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProWorkorderBom; + +/** + * 生产工单BOM组成Mapper接口 + * + * @author yinjinlu + * @date 2022-05-09 + */ +public interface ProWorkorderBomMapper +{ + /** + * 查询生产工单BOM组成 + * + * @param lineId 生产工单BOM组成主键 + * @return 生产工单BOM组成 + */ + public ProWorkorderBom selectProWorkorderBomByLineId(Long lineId); + + /** + * 查询生产工单BOM组成列表 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 生产工单BOM组成集合 + */ + public List selectProWorkorderBomList(ProWorkorderBom proWorkorderBom); + + /** + * 新增生产工单BOM组成 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 结果 + */ + public int insertProWorkorderBom(ProWorkorderBom proWorkorderBom); + + /** + * 修改生产工单BOM组成 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 结果 + */ + public int updateProWorkorderBom(ProWorkorderBom proWorkorderBom); + + /** + * 删除生产工单BOM组成 + * + * @param lineId 生产工单BOM组成主键 + * @return 结果 + */ + public int deleteProWorkorderBomByLineId(Long lineId); + + /** + * 批量删除生产工单BOM组成 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProWorkorderBomByLineIds(Long[] lineIds); + + public int deleteProWorkorderBomByWorkorderId(Long workorderId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkorderMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkorderMapper.java new file mode 100644 index 0000000..8264a40 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkorderMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProWorkorder; + +/** + * 生产工单Mapper接口 + * + * @author yinjinlu + * @date 2022-05-09 + */ +public interface ProWorkorderMapper +{ + /** + * 查询生产工单 + * + * @param workorderId 生产工单主键 + * @return 生产工单 + */ + public ProWorkorder selectProWorkorderByWorkorderId(Long workorderId); + + /** + * 查询生产工单列表 + * + * @param proWorkorder 生产工单 + * @return 生产工单集合 + */ + public List selectProWorkorderList(ProWorkorder proWorkorder); + + public ProWorkorder checkWorkorderCodeUnique(ProWorkorder proWorkorder); + + /** + * 新增生产工单 + * + * @param proWorkorder 生产工单 + * @return 结果 + */ + public int insertProWorkorder(ProWorkorder proWorkorder); + + /** + * 修改生产工单 + * + * @param proWorkorder 生产工单 + * @return 结果 + */ + public int updateProWorkorder(ProWorkorder proWorkorder); + + /** + * 删除生产工单 + * + * @param workorderId 生产工单主键 + * @return 结果 + */ + public int deleteProWorkorderByWorkorderId(Long workorderId); + + /** + * 批量删除生产工单 + * + * @param workorderIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProWorkorderByWorkorderIds(Long[] workorderIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkrecordMapper.java b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkrecordMapper.java new file mode 100644 index 0000000..703760b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProWorkrecordMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.mapper; + +import java.util.List; +import com.ktg.mes.pro.domain.ProWorkrecord; + +/** + * 上下工记录Mapper接口 + * + * @author yinjinlu + * @date 2023-02-20 + */ +public interface ProWorkrecordMapper +{ + /** + * 查询上下工记录 + * + * @param recordId 上下工记录主键 + * @return 上下工记录 + */ + public ProWorkrecord selectProWorkrecordByRecordId(Long recordId); + + /** + * 查询上下工记录列表 + * + * @param proWorkrecord 上下工记录 + * @return 上下工记录集合 + */ + public List selectProWorkrecordList(ProWorkrecord proWorkrecord); + + /** + * 新增上下工记录 + * + * @param proWorkrecord 上下工记录 + * @return 结果 + */ + public int insertProWorkrecord(ProWorkrecord proWorkrecord); + + /** + * 修改上下工记录 + * + * @param proWorkrecord 上下工记录 + * @return 结果 + */ + public int updateProWorkrecord(ProWorkrecord proWorkrecord); + + /** + * 删除上下工记录 + * + * @param recordId 上下工记录主键 + * @return 结果 + */ + public int deleteProWorkrecordByRecordId(Long recordId); + + /** + * 批量删除上下工记录 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProWorkrecordByRecordIds(Long[] recordIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProFeedbackService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProFeedbackService.java new file mode 100644 index 0000000..5ea7b9a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProFeedbackService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProFeedback; + +/** + * 生产报工记录Service接口 + * + * @author yinjinlu + * @date 2022-07-10 + */ +public interface IProFeedbackService +{ + /** + * 查询生产报工记录 + * + * @param recordId 生产报工记录主键 + * @return 生产报工记录 + */ + public ProFeedback selectProFeedbackByRecordId(Long recordId); + + /** + * 查询生产报工记录列表 + * + * @param proFeedback 生产报工记录 + * @return 生产报工记录集合 + */ + public List selectProFeedbackList(ProFeedback proFeedback); + + /** + * 新增生产报工记录 + * + * @param proFeedback 生产报工记录 + * @return 结果 + */ + public int insertProFeedback(ProFeedback proFeedback); + + /** + * 修改生产报工记录 + * + * @param proFeedback 生产报工记录 + * @return 结果 + */ + public int updateProFeedback(ProFeedback proFeedback); + + /** + * 批量删除生产报工记录 + * + * @param recordIds 需要删除的生产报工记录主键集合 + * @return 结果 + */ + public int deleteProFeedbackByRecordIds(Long[] recordIds); + + /** + * 删除生产报工记录信息 + * + * @param recordId 生产报工记录主键 + * @return 结果 + */ + public int deleteProFeedbackByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProProcessContentService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProProcessContentService.java new file mode 100644 index 0000000..bcb24ff --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProProcessContentService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProProcessContent; + +/** + * 生产工序内容Service接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface IProProcessContentService +{ + /** + * 查询生产工序内容 + * + * @param contentId 生产工序内容主键 + * @return 生产工序内容 + */ + public ProProcessContent selectProProcessContentByContentId(Long contentId); + + /** + * 查询生产工序内容列表 + * + * @param proProcessContent 生产工序内容 + * @return 生产工序内容集合 + */ + public List selectProProcessContentList(ProProcessContent proProcessContent); + + /** + * 新增生产工序内容 + * + * @param proProcessContent 生产工序内容 + * @return 结果 + */ + public int insertProProcessContent(ProProcessContent proProcessContent); + + /** + * 修改生产工序内容 + * + * @param proProcessContent 生产工序内容 + * @return 结果 + */ + public int updateProProcessContent(ProProcessContent proProcessContent); + + /** + * 批量删除生产工序内容 + * + * @param contentIds 需要删除的生产工序内容主键集合 + * @return 结果 + */ + public int deleteProProcessContentByContentIds(Long[] contentIds); + + /** + * 删除生产工序内容信息 + * + * @param contentId 生产工序内容主键 + * @return 结果 + */ + public int deleteProProcessContentByContentId(Long contentId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProProcessService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProProcessService.java new file mode 100644 index 0000000..6445670 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProProcessService.java @@ -0,0 +1,64 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProProcess; + +/** + * 生产工序Service接口 + * + * @author yinjinlu + * @date 2022-05-11 + */ +public interface IProProcessService +{ + /** + * 查询生产工序 + * + * @param processId 生产工序主键 + * @return 生产工序 + */ + public ProProcess selectProProcessByProcessId(Long processId); + + /** + * 查询生产工序列表 + * + * @param proProcess 生产工序 + * @return 生产工序集合 + */ + public List selectProProcessList(ProProcess proProcess); + + public String checkProcessCodeUnique(ProProcess proProcess); + public String checkProcessNameUnique(ProProcess proProcess); + + /** + * 新增生产工序 + * + * @param proProcess 生产工序 + * @return 结果 + */ + public int insertProProcess(ProProcess proProcess); + + /** + * 修改生产工序 + * + * @param proProcess 生产工序 + * @return 结果 + */ + public int updateProProcess(ProProcess proProcess); + + /** + * 批量删除生产工序 + * + * @param processIds 需要删除的生产工序主键集合 + * @return 结果 + */ + public int deleteProProcessByProcessIds(Long[] processIds); + + /** + * 删除生产工序信息 + * + * @param processId 生产工序主键 + * @return 结果 + */ + public int deleteProProcessByProcessId(Long processId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProcessService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProcessService.java new file mode 100644 index 0000000..1be8850 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProcessService.java @@ -0,0 +1,112 @@ +package com.ktg.mes.pro.service; + +import java.util.List; + +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProRouteProcess; + +/** + * 工艺组成Service接口 + * + * @author yinjinlu + * @date 2022-05-13 + */ +public interface IProRouteProcessService +{ + /** + * 查询工艺组成 + * + * @param recordId 工艺组成主键 + * @return 工艺组成 + */ + public ProRouteProcess selectProRouteProcessByRecordId(Long recordId); + + /** + * 查询工艺组成列表 + * + * @param proRouteProcess 工艺组成 + * @return 工艺组成集合 + */ + public List selectProRouteProcessList(ProRouteProcess proRouteProcess); + + /** + * 检查序号是否已经存在 + * @param proRouteProcess + * @return + */ + public String checkOrderNumExists(ProRouteProcess proRouteProcess); + + /** + * 检查工序是否已经存在 + * @param proRouteProcess + * @return + */ + public String checkProcessExists(ProRouteProcess proRouteProcess); + + /** + * 检查当前工艺路线中是否已经有某个工序配置了update_flag=Y + * @param proRouteProcess + * @return + */ + public String checkUpdateFlagUnique(ProRouteProcess proRouteProcess); + + /** + * 检查某个报工单对应的工序是否是关键工序 + * @param feedback + * @return + */ + public boolean checkKeyProcess(ProFeedback feedback); + + /** + * 查找上一个工序 + * @param proRouteProcess + * @return + */ + public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess); + + /** + * 查找下一个工序 + * @param proRouteProcess + * @return + */ + public ProRouteProcess findNextProcess(ProRouteProcess proRouteProcess); + + /** + * 新增工艺组成 + * + * @param proRouteProcess 工艺组成 + * @return 结果 + */ + public int insertProRouteProcess(ProRouteProcess proRouteProcess); + + /** + * 修改工艺组成 + * + * @param proRouteProcess 工艺组成 + * @return 结果 + */ + public int updateProRouteProcess(ProRouteProcess proRouteProcess); + + /** + * 批量删除工艺组成 + * + * @param recordIds 需要删除的工艺组成主键集合 + * @return 结果 + */ + public int deleteProRouteProcessByRecordIds(Long[] recordIds); + + /** + * 删除工艺组成信息 + * + * @param recordId 工艺组成主键 + * @return 结果 + */ + public int deleteProRouteProcessByRecordId(Long recordId); + + /** + * 根据工艺路线ID删除所有工序配置 + * @param routeId + * @return + */ + public int deleteByRouteId(Long routeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProductBomService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProductBomService.java new file mode 100644 index 0000000..20e307a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProductBomService.java @@ -0,0 +1,88 @@ +package com.ktg.mes.pro.service; + +import java.util.List; + +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProRouteProductBom; +import com.ktg.mes.wm.domain.WmItemConsume; + +/** + * 产品制程物料BOMService接口 + * + * @author yinjinlu + * @date 2022-09-12 + */ +public interface IProRouteProductBomService +{ + /** + * 查询产品制程物料BOM + * + * @param recordId 产品制程物料BOM主键 + * @return 产品制程物料BOM + */ + public ProRouteProductBom selectProRouteProductBomByRecordId(Long recordId); + + /** + * 查询产品制程物料BOM列表 + * + * @param proRouteProductBom 产品制程物料BOM + * @return 产品制程物料BOM集合 + */ + public List selectProRouteProductBomList(ProRouteProductBom proRouteProductBom); + + + /** + * 检测是否重复配置 + * @param proRouteProductBom + * @return + */ + public String checkUnique(ProRouteProductBom proRouteProductBom); + + /** + * 新增产品制程物料BOM + * + * @param proRouteProductBom 产品制程物料BOM + * @return 结果 + */ + public int insertProRouteProductBom(ProRouteProductBom proRouteProductBom); + + /** + * 修改产品制程物料BOM + * + * @param proRouteProductBom 产品制程物料BOM + * @return 结果 + */ + public int updateProRouteProductBom(ProRouteProductBom proRouteProductBom); + + /** + * 批量删除产品制程物料BOM + * + * @param recordIds 需要删除的产品制程物料BOM主键集合 + * @return 结果 + */ + public int deleteProRouteProductBomByRecordIds(Long[] recordIds); + + /** + * 删除产品制程物料BOM信息 + * + * @param recordId 产品制程物料BOM主键 + * @return 结果 + */ + public int deleteProRouteProductBomByRecordId(Long recordId); + + /** + * 根据工艺路线ID删除所有产品BOM设置 + * @param routeId + * @return + */ + public int deleteByRouteId(Long routeId); + + /** + * 根据工艺路线ID和产品ID删除BOM设置 + * @param proRouteProductBom + * @return + */ + public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom); + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProductService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProductService.java new file mode 100644 index 0000000..11d3ca4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteProductService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProRouteProduct; + +/** + * 产品制程Service接口 + * + * @author yinjinlu + * @date 2022-05-14 + */ +public interface IProRouteProductService +{ + /** + * 查询产品制程 + * + * @param recordId 产品制程主键 + * @return 产品制程 + */ + public ProRouteProduct selectProRouteProductByRecordId(Long recordId); + + /** + * 查询产品制程列表 + * + * @param proRouteProduct 产品制程 + * @return 产品制程集合 + */ + public List selectProRouteProductList(ProRouteProduct proRouteProduct); + + /** + * 检查物料是否已经存在 + * @param proRouteProduct + * @return + */ + public String checkItemUnique(ProRouteProduct proRouteProduct); + + /** + * 新增产品制程 + * + * @param proRouteProduct 产品制程 + * @return 结果 + */ + public int insertProRouteProduct(ProRouteProduct proRouteProduct); + + /** + * 修改产品制程 + * + * @param proRouteProduct 产品制程 + * @return 结果 + */ + public int updateProRouteProduct(ProRouteProduct proRouteProduct); + + /** + * 批量删除产品制程 + * + * @param recordIds 需要删除的产品制程主键集合 + * @return 结果 + */ + public int deleteProRouteProductByRecordIds(Long[] recordIds); + + /** + * 删除产品制程信息 + * + * @param recordId 产品制程主键 + * @return 结果 + */ + public int deleteProRouteProductByRecordId(Long recordId); + + /** + * 根据工艺路线ID删除对应的产品配置 + * @param routeId + * @return + */ + public int deleteByRouteId(Long routeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteService.java new file mode 100644 index 0000000..0bb23e5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProRouteService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProRoute; + +/** + * 工艺路线Service接口 + * + * @author yinjinlu + * @date 2022-05-12 + */ +public interface IProRouteService +{ + /** + * 查询工艺路线 + * + * @param routeId 工艺路线主键 + * @return 工艺路线 + */ + public ProRoute selectProRouteByRouteId(Long routeId); + + /** + * 查询工艺路线列表 + * + * @param proRoute 工艺路线 + * @return 工艺路线集合 + */ + public List selectProRouteList(ProRoute proRoute); + + /** + * 根据物料查找生效的工艺路线 + * @param itemId + * @return + */ + public ProRoute getRouteByProductId(Long itemId); + + public String checkRouteCodeUnique(ProRoute proRoute); + + /** + * 新增工艺路线 + * + * @param proRoute 工艺路线 + * @return 结果 + */ + public int insertProRoute(ProRoute proRoute); + + /** + * 修改工艺路线 + * + * @param proRoute 工艺路线 + * @return 结果 + */ + public int updateProRoute(ProRoute proRoute); + + /** + * 批量删除工艺路线 + * + * @param routeIds 需要删除的工艺路线主键集合 + * @return 结果 + */ + public int deleteProRouteByRouteIds(Long[] routeIds); + + /** + * 删除工艺路线信息 + * + * @param routeId 工艺路线主键 + * @return 结果 + */ + public int deleteProRouteByRouteId(Long routeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTaskIssueService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTaskIssueService.java new file mode 100644 index 0000000..3110284 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTaskIssueService.java @@ -0,0 +1,63 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTaskIssue; + +/** + * 生产任务投料Service接口 + * + * @author yinjinlu + * @date 2022-07-22 + */ +public interface IProTaskIssueService +{ + /** + * 查询生产任务投料 + * + * @param recordId 生产任务投料主键 + * @return 生产任务投料 + */ + public ProTaskIssue selectProTaskIssueByRecordId(Long recordId); + + /** + * 查询生产任务投料列表 + * + * @param proTaskIssue 生产任务投料 + * @return 生产任务投料集合 + */ + public List selectProTaskIssueList(ProTaskIssue proTaskIssue); + + public String checkUnique(ProTaskIssue proTaskIssue); + + /** + * 新增生产任务投料 + * + * @param proTaskIssue 生产任务投料 + * @return 结果 + */ + public int insertProTaskIssue(ProTaskIssue proTaskIssue); + + /** + * 修改生产任务投料 + * + * @param proTaskIssue 生产任务投料 + * @return 结果 + */ + public int updateProTaskIssue(ProTaskIssue proTaskIssue); + + /** + * 批量删除生产任务投料 + * + * @param recordIds 需要删除的生产任务投料主键集合 + * @return 结果 + */ + public int deleteProTaskIssueByRecordIds(Long[] recordIds); + + /** + * 删除生产任务投料信息 + * + * @param recordId 生产任务投料主键 + * @return 结果 + */ + public int deleteProTaskIssueByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTaskService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTaskService.java new file mode 100644 index 0000000..de4ee78 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTaskService.java @@ -0,0 +1,69 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTask; + +/** + * 生产任务Service接口 + * + * @author yinjinlu + * @date 2022-05-14 + */ +public interface IProTaskService +{ + /** + * 查询生产任务 + * + * @param taskId 生产任务主键 + * @return 生产任务 + */ + public ProTask selectProTaskByTaskId(Long taskId); + + /** + * 查询生产任务列表 + * + * @param proTask 生产任务 + * @return 生产任务集合 + */ + public List selectProTaskList(ProTask proTask); + + + /** + * 查询某个工单的各个工序生产进度 + * @param workorderId + * @return + */ + public List selectProTaskProcessViewByWorkorder(Long workorderId); + + /** + * 新增生产任务 + * + * @param proTask 生产任务 + * @return 结果 + */ + public int insertProTask(ProTask proTask); + + /** + * 修改生产任务 + * + * @param proTask 生产任务 + * @return 结果 + */ + public int updateProTask(ProTask proTask); + + /** + * 批量删除生产任务 + * + * @param taskIds 需要删除的生产任务主键集合 + * @return 结果 + */ + public int deleteProTaskByTaskIds(Long[] taskIds); + + /** + * 删除生产任务信息 + * + * @param taskId 生产任务主键 + * @return 结果 + */ + public int deleteProTaskByTaskId(Long taskId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTransConsumeService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTransConsumeService.java new file mode 100644 index 0000000..5befab7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTransConsumeService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTransConsume; + +/** + * 物料消耗记录Service接口 + * + * @author yinjinlu + * @date 2022-07-24 + */ +public interface IProTransConsumeService +{ + /** + * 查询物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 物料消耗记录 + */ + public ProTransConsume selectProTransConsumeByRecordId(Long recordId); + + /** + * 查询物料消耗记录列表 + * + * @param proTransConsume 物料消耗记录 + * @return 物料消耗记录集合 + */ + public List selectProTransConsumeList(ProTransConsume proTransConsume); + + /** + * 新增物料消耗记录 + * + * @param proTransConsume 物料消耗记录 + * @return 结果 + */ + public int insertProTransConsume(ProTransConsume proTransConsume); + + /** + * 修改物料消耗记录 + * + * @param proTransConsume 物料消耗记录 + * @return 结果 + */ + public int updateProTransConsume(ProTransConsume proTransConsume); + + /** + * 批量删除物料消耗记录 + * + * @param recordIds 需要删除的物料消耗记录主键集合 + * @return 结果 + */ + public int deleteProTransConsumeByRecordIds(Long[] recordIds); + + /** + * 删除物料消耗记录信息 + * + * @param recordId 物料消耗记录主键 + * @return 结果 + */ + public int deleteProTransConsumeByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTransOrderService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTransOrderService.java new file mode 100644 index 0000000..92c105e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProTransOrderService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProTransOrder; + +/** + * 流转单Service接口 + * + * @author yinjinlu + * @date 2022-07-24 + */ +public interface IProTransOrderService +{ + /** + * 查询流转单 + * + * @param transOrderId 流转单主键 + * @return 流转单 + */ + public ProTransOrder selectProTransOrderByTransOrderId(Long transOrderId); + + /** + * 查询流转单列表 + * + * @param proTransOrder 流转单 + * @return 流转单集合 + */ + public List selectProTransOrderList(ProTransOrder proTransOrder); + + /** + * 新增流转单 + * + * @param proTransOrder 流转单 + * @return 结果 + */ + public int insertProTransOrder(ProTransOrder proTransOrder); + + /** + * 修改流转单 + * + * @param proTransOrder 流转单 + * @return 结果 + */ + public int updateProTransOrder(ProTransOrder proTransOrder); + + /** + * 批量删除流转单 + * + * @param transOrderIds 需要删除的流转单主键集合 + * @return 结果 + */ + public int deleteProTransOrderByTransOrderIds(Long[] transOrderIds); + + /** + * 删除流转单信息 + * + * @param transOrderId 流转单主键 + * @return 结果 + */ + public int deleteProTransOrderByTransOrderId(Long transOrderId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProUserWorkstationService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProUserWorkstationService.java new file mode 100644 index 0000000..58e8402 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProUserWorkstationService.java @@ -0,0 +1,69 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProUserWorkstation; + +/** + * 用户工作站绑定关系Service接口 + * + * @author yinjinlu + * @date 2023-02-20 + */ +public interface IProUserWorkstationService +{ + /** + * 查询用户工作站绑定关系 + * + * @param recordId 用户工作站绑定关系主键 + * @return 用户工作站绑定关系 + */ + public ProUserWorkstation selectProUserWorkstationByRecordId(Long recordId); + + /** + * 查询用户工作站绑定关系列表 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 用户工作站绑定关系集合 + */ + public List selectProUserWorkstationList(ProUserWorkstation proUserWorkstation); + + /** + * 新增用户工作站绑定关系 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 结果 + */ + public int insertProUserWorkstation(ProUserWorkstation proUserWorkstation); + + /** + * 修改用户工作站绑定关系 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 结果 + */ + public int updateProUserWorkstation(ProUserWorkstation proUserWorkstation); + + /** + * 批量删除用户工作站绑定关系 + * + * @param recordIds 需要删除的用户工作站绑定关系主键集合 + * @return 结果 + */ + public int deleteProUserWorkstationByRecordIds(Long[] recordIds); + + /** + * 删除用户工作站绑定关系信息 + * + * @param recordId 用户工作站绑定关系主键 + * @return 结果 + */ + public int deleteProUserWorkstationByRecordId(Long recordId); + + + /** + * 根据用户名删除所有对应关系 + * @param userName + * @return + */ + public int deleteByUserName(String userName); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkorderBomService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkorderBomService.java new file mode 100644 index 0000000..588ea5c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkorderBomService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProWorkorderBom; + +/** + * 生产工单BOM组成Service接口 + * + * @author yinjinlu + * @date 2022-05-09 + */ +public interface IProWorkorderBomService +{ + /** + * 查询生产工单BOM组成 + * + * @param lineId 生产工单BOM组成主键 + * @return 生产工单BOM组成 + */ + public ProWorkorderBom selectProWorkorderBomByLineId(Long lineId); + + /** + * 查询生产工单BOM组成列表 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 生产工单BOM组成集合 + */ + public List selectProWorkorderBomList(ProWorkorderBom proWorkorderBom); + + /** + * 新增生产工单BOM组成 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 结果 + */ + public int insertProWorkorderBom(ProWorkorderBom proWorkorderBom); + + /** + * 修改生产工单BOM组成 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 结果 + */ + public int updateProWorkorderBom(ProWorkorderBom proWorkorderBom); + + /** + * 批量删除生产工单BOM组成 + * + * @param lineIds 需要删除的生产工单BOM组成主键集合 + * @return 结果 + */ + public int deleteProWorkorderBomByLineIds(Long[] lineIds); + + /** + * 删除生产工单BOM组成信息 + * + * @param lineId 生产工单BOM组成主键 + * @return 结果 + */ + public int deleteProWorkorderBomByLineId(Long lineId); + + + /** + * 批量删除工单下所有的BOM组成数据 + * @param workorderId + * @return + */ + public int deleteProWorkorderBomByWorkorderId(Long workorderId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkorderService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkorderService.java new file mode 100644 index 0000000..9432ce2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkorderService.java @@ -0,0 +1,67 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProWorkorder; + +/** + * 生产工单Service接口 + * + * @author yinjinlu + * @date 2022-05-09 + */ +public interface IProWorkorderService +{ + /** + * 查询生产工单 + * + * @param workorderId 生产工单主键 + * @return 生产工单 + */ + public ProWorkorder selectProWorkorderByWorkorderId(Long workorderId); + + /** + * 查询生产工单列表 + * + * @param proWorkorder 生产工单 + * @return 生产工单集合 + */ + public List selectProWorkorderList(ProWorkorder proWorkorder); + + + public String checkWorkorderCodeUnique(ProWorkorder proWorkorder); + + /** + * 新增生产工单 + * + * @param proWorkorder 生产工单 + * @return 结果 + */ + public int insertProWorkorder(ProWorkorder proWorkorder); + + /** + * 修改生产工单 + * + * @param proWorkorder 生产工单 + * @return 结果 + */ + public int updateProWorkorder(ProWorkorder proWorkorder); + + /** + * 批量删除生产工单 + * + * @param workorderIds 需要删除的生产工单主键集合 + * @return 结果 + */ + public int deleteProWorkorderByWorkorderIds(Long[] workorderIds); + + /** + * 删除生产工单信息 + * + * @param workorderId 生产工单主键 + * @return 结果 + */ + public int deleteProWorkorderByWorkorderId(Long workorderId); + + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkrecordService.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkrecordService.java new file mode 100644 index 0000000..7540d67 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProWorkrecordService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.pro.service; + +import java.util.List; +import com.ktg.mes.pro.domain.ProWorkrecord; + +/** + * 上下工记录Service接口 + * + * @author yinjinlu + * @date 2023-02-20 + */ +public interface IProWorkrecordService +{ + /** + * 查询上下工记录 + * + * @param recordId 上下工记录主键 + * @return 上下工记录 + */ + public ProWorkrecord selectProWorkrecordByRecordId(Long recordId); + + /** + * 查询上下工记录列表 + * + * @param proWorkrecord 上下工记录 + * @return 上下工记录集合 + */ + public List selectProWorkrecordList(ProWorkrecord proWorkrecord); + + /** + * 新增上下工记录 + * + * @param proWorkrecord 上下工记录 + * @return 结果 + */ + public int insertProWorkrecord(ProWorkrecord proWorkrecord); + + /** + * 修改上下工记录 + * + * @param proWorkrecord 上下工记录 + * @return 结果 + */ + public int updateProWorkrecord(ProWorkrecord proWorkrecord); + + /** + * 批量删除上下工记录 + * + * @param recordIds 需要删除的上下工记录主键集合 + * @return 结果 + */ + public int deleteProWorkrecordByRecordIds(Long[] recordIds); + + /** + * 删除上下工记录信息 + * + * @param recordId 上下工记录主键 + * @return 结果 + */ + public int deleteProWorkrecordByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProFeedbackServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProFeedbackServiceImpl.java new file mode 100644 index 0000000..bb817e9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProFeedbackServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProFeedbackMapper; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.service.IProFeedbackService; + +/** + * 生产报工记录Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-10 + */ +@Service +public class ProFeedbackServiceImpl implements IProFeedbackService +{ + @Autowired + private ProFeedbackMapper proFeedbackMapper; + + /** + * 查询生产报工记录 + * + * @param recordId 生产报工记录主键 + * @return 生产报工记录 + */ + @Override + public ProFeedback selectProFeedbackByRecordId(Long recordId) + { + return proFeedbackMapper.selectProFeedbackByRecordId(recordId); + } + + /** + * 查询生产报工记录列表 + * + * @param proFeedback 生产报工记录 + * @return 生产报工记录 + */ + @Override + public List selectProFeedbackList(ProFeedback proFeedback) + { + return proFeedbackMapper.selectProFeedbackList(proFeedback); + } + + /** + * 新增生产报工记录 + * + * @param proFeedback 生产报工记录 + * @return 结果 + */ + @Override + public int insertProFeedback(ProFeedback proFeedback) + { + proFeedback.setCreateTime(DateUtils.getNowDate()); + return proFeedbackMapper.insertProFeedback(proFeedback); + } + + /** + * 修改生产报工记录 + * + * @param proFeedback 生产报工记录 + * @return 结果 + */ + @Override + public int updateProFeedback(ProFeedback proFeedback) + { + proFeedback.setUpdateTime(DateUtils.getNowDate()); + return proFeedbackMapper.updateProFeedback(proFeedback); + } + + /** + * 批量删除生产报工记录 + * + * @param recordIds 需要删除的生产报工记录主键 + * @return 结果 + */ + @Override + public int deleteProFeedbackByRecordIds(Long[] recordIds) + { + return proFeedbackMapper.deleteProFeedbackByRecordIds(recordIds); + } + + /** + * 删除生产报工记录信息 + * + * @param recordId 生产报工记录主键 + * @return 结果 + */ + @Override + public int deleteProFeedbackByRecordId(Long recordId) + { + return proFeedbackMapper.deleteProFeedbackByRecordId(recordId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProProcessContentServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProProcessContentServiceImpl.java new file mode 100644 index 0000000..30d2bab --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProProcessContentServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProProcessContentMapper; +import com.ktg.mes.pro.domain.ProProcessContent; +import com.ktg.mes.pro.service.IProProcessContentService; + +/** + * 生产工序内容Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-12 + */ +@Service +public class ProProcessContentServiceImpl implements IProProcessContentService +{ + @Autowired + private ProProcessContentMapper proProcessContentMapper; + + /** + * 查询生产工序内容 + * + * @param contentId 生产工序内容主键 + * @return 生产工序内容 + */ + @Override + public ProProcessContent selectProProcessContentByContentId(Long contentId) + { + return proProcessContentMapper.selectProProcessContentByContentId(contentId); + } + + /** + * 查询生产工序内容列表 + * + * @param proProcessContent 生产工序内容 + * @return 生产工序内容 + */ + @Override + public List selectProProcessContentList(ProProcessContent proProcessContent) + { + return proProcessContentMapper.selectProProcessContentList(proProcessContent); + } + + /** + * 新增生产工序内容 + * + * @param proProcessContent 生产工序内容 + * @return 结果 + */ + @Override + public int insertProProcessContent(ProProcessContent proProcessContent) + { + proProcessContent.setCreateTime(DateUtils.getNowDate()); + return proProcessContentMapper.insertProProcessContent(proProcessContent); + } + + /** + * 修改生产工序内容 + * + * @param proProcessContent 生产工序内容 + * @return 结果 + */ + @Override + public int updateProProcessContent(ProProcessContent proProcessContent) + { + proProcessContent.setUpdateTime(DateUtils.getNowDate()); + return proProcessContentMapper.updateProProcessContent(proProcessContent); + } + + /** + * 批量删除生产工序内容 + * + * @param contentIds 需要删除的生产工序内容主键 + * @return 结果 + */ + @Override + public int deleteProProcessContentByContentIds(Long[] contentIds) + { + return proProcessContentMapper.deleteProProcessContentByContentIds(contentIds); + } + + /** + * 删除生产工序内容信息 + * + * @param contentId 生产工序内容主键 + * @return 结果 + */ + @Override + public int deleteProProcessContentByContentId(Long contentId) + { + return proProcessContentMapper.deleteProProcessContentByContentId(contentId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProProcessServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProProcessServiceImpl.java new file mode 100644 index 0000000..8512e3a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProProcessServiceImpl.java @@ -0,0 +1,130 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProProcessMapper; +import com.ktg.mes.pro.domain.ProProcess; +import com.ktg.mes.pro.service.IProProcessService; + +/** + * 生产工序Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-11 + */ +@Service +public class ProProcessServiceImpl implements IProProcessService +{ + @Autowired + private ProProcessMapper proProcessMapper; + + /** + * 查询生产工序 + * + * @param processId 生产工序主键 + * @return 生产工序 + */ + @Override + public ProProcess selectProProcessByProcessId(Long processId) + { + return proProcessMapper.selectProProcessByProcessId(processId); + } + + /** + * 查询生产工序列表 + * + * @param proProcess 生产工序 + * @return 生产工序 + */ + @Override + public List selectProProcessList(ProProcess proProcess) + { + return proProcessMapper.selectProProcessList(proProcess); + } + + /** + * 检查工序编码是否唯一 + * @param proProcess + * @return + */ + @Override + public String checkProcessCodeUnique(ProProcess proProcess) { + ProProcess process = proProcessMapper.checkProcessCodeUnique(proProcess); + Long processId = proProcess.getProcessId()==null?-1L:proProcess.getProcessId(); + if(StringUtils.isNotNull(process) && process.getProcessId().longValue() != processId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + + /** + * 检查工序名称是否唯一 + * @param proProcess + * @return + */ + @Override + public String checkProcessNameUnique(ProProcess proProcess) { + ProProcess process = proProcessMapper.checkProcessNameUnique(proProcess); + Long processId = proProcess.getProcessId()==null?-1L:proProcess.getProcessId(); + if(StringUtils.isNotNull(process) && process.getProcessId().longValue() != processId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增生产工序 + * + * @param proProcess 生产工序 + * @return 结果 + */ + @Override + public int insertProProcess(ProProcess proProcess) + { + proProcess.setCreateTime(DateUtils.getNowDate()); + return proProcessMapper.insertProProcess(proProcess); + } + + /** + * 修改生产工序 + * + * @param proProcess 生产工序 + * @return 结果 + */ + @Override + public int updateProProcess(ProProcess proProcess) + { + proProcess.setUpdateTime(DateUtils.getNowDate()); + return proProcessMapper.updateProProcess(proProcess); + } + + /** + * 批量删除生产工序 + * + * @param processIds 需要删除的生产工序主键 + * @return 结果 + */ + @Override + public int deleteProProcessByProcessIds(Long[] processIds) + { + return proProcessMapper.deleteProProcessByProcessIds(processIds); + } + + /** + * 删除生产工序信息 + * + * @param processId 生产工序主键 + * @return 结果 + */ + @Override + public int deleteProProcessByProcessId(Long processId) + { + return proProcessMapper.deleteProProcessByProcessId(processId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProcessServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProcessServiceImpl.java new file mode 100644 index 0000000..1297d1c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProcessServiceImpl.java @@ -0,0 +1,191 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.mapper.MdWorkstationMapper; +import com.ktg.mes.pro.domain.*; +import com.ktg.mes.pro.mapper.ProRouteMapper; +import com.ktg.mes.pro.mapper.ProRouteProductMapper; +import com.ktg.mes.pro.mapper.ProWorkorderMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProRouteProcessMapper; +import com.ktg.mes.pro.service.IProRouteProcessService; + +/** + * 工艺组成Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-13 + */ +@Service +public class ProRouteProcessServiceImpl implements IProRouteProcessService +{ + @Autowired + private ProRouteMapper proRouteMapper; + + @Autowired + private ProRouteProcessMapper proRouteProcessMapper; + + + @Autowired + private ProRouteProductMapper proRouteProductMapper; + + @Autowired + private MdWorkstationMapper mdWorkstationMapper; + + /** + * 查询工艺组成 + * + * @param recordId 工艺组成主键 + * @return 工艺组成 + */ + @Override + public ProRouteProcess selectProRouteProcessByRecordId(Long recordId) + { + return proRouteProcessMapper.selectProRouteProcessByRecordId(recordId); + } + + /** + * 查询工艺组成列表 + * + * @param proRouteProcess 工艺组成 + * @return 工艺组成 + */ + @Override + public List selectProRouteProcessList(ProRouteProcess proRouteProcess) + { + return proRouteProcessMapper.selectProRouteProcessList(proRouteProcess); + } + + @Override + public String checkOrderNumExists(ProRouteProcess proRouteProcess) { + ProRouteProcess process = proRouteProcessMapper.checkOrderNumExists(proRouteProcess); + Long recordId = proRouteProcess.getRecordId()==null?-1L:proRouteProcess.getRecordId(); + if(StringUtils.isNotNull(process) && process.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkProcessExists(ProRouteProcess proRouteProcess) { + ProRouteProcess process = proRouteProcessMapper.checkProcessExists(proRouteProcess); + Long recordId = proRouteProcess.getRecordId()==null?-1L:proRouteProcess.getRecordId(); + if(StringUtils.isNotNull(process) && process.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkUpdateFlagUnique(ProRouteProcess proRouteProcess) { + ProRouteProcess process = proRouteProcessMapper.checkUpdateFlagUnique(proRouteProcess); + Long recordId = proRouteProcess.getRecordId()==null?-1L:proRouteProcess.getRecordId(); + if(StringUtils.isNotNull(process) && process.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public boolean checkKeyProcess(ProFeedback feedback) { + //根据当前生产的产品获取对应的工艺路线 + Long routeId =-1L,processId = -1L; + ProRouteProduct param = new ProRouteProduct(); + param.setItemId(feedback.getItemId()); + List products = proRouteProductMapper.selectProRouteProductList(param); + if(CollectionUtil.isNotEmpty(products)){ + products = products.stream().filter(item -> proRouteMapper.selectProRouteByRouteId(item.getRouteId()).getEnableFlag().equals(UserConstants.YES)).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(products)){ + routeId = products.get(0).getRouteId(); + } + } + + //根据工作站获取工序 + MdWorkstation workstation = mdWorkstationMapper.selectMdWorkstationByWorkstationId(feedback.getWorkstationId()); + processId = workstation.getProcessId(); + + //再判断当前的工序在此工艺路线中是否是关键工序 + ProRouteProcess param2 = new ProRouteProcess(); + param2.setRouteId(routeId); + param2.setProcessId(processId); + param2.setKeyFlag(UserConstants.YES); + List processes = proRouteProcessMapper.selectProRouteProcessList(param2); + if(CollectionUtil.isNotEmpty(processes)){ + return true; + } + return false; + } + + @Override + public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess) { + return proRouteProcessMapper.findPreProcess(proRouteProcess); + } + + @Override + public ProRouteProcess findNextProcess(ProRouteProcess proRouteProcess) { + return proRouteProcessMapper.findNextProcess(proRouteProcess); + } + + /** + * 新增工艺组成 + * + * @param proRouteProcess 工艺组成 + * @return 结果 + */ + @Override + public int insertProRouteProcess(ProRouteProcess proRouteProcess) + { + proRouteProcess.setCreateTime(DateUtils.getNowDate()); + return proRouteProcessMapper.insertProRouteProcess(proRouteProcess); + } + + /** + * 修改工艺组成 + * + * @param proRouteProcess 工艺组成 + * @return 结果 + */ + @Override + public int updateProRouteProcess(ProRouteProcess proRouteProcess) + { + proRouteProcess.setUpdateTime(DateUtils.getNowDate()); + return proRouteProcessMapper.updateProRouteProcess(proRouteProcess); + } + + /** + * 批量删除工艺组成 + * + * @param recordIds 需要删除的工艺组成主键 + * @return 结果 + */ + @Override + public int deleteProRouteProcessByRecordIds(Long[] recordIds) + { + return proRouteProcessMapper.deleteProRouteProcessByRecordIds(recordIds); + } + + /** + * 删除工艺组成信息 + * + * @param recordId 工艺组成主键 + * @return 结果 + */ + @Override + public int deleteProRouteProcessByRecordId(Long recordId) + { + return proRouteProcessMapper.deleteProRouteProcessByRecordId(recordId); + } + + @Override + public int deleteByRouteId(Long routeId) { + return proRouteProcessMapper.deleteByRouteId(routeId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProductBomServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProductBomServiceImpl.java new file mode 100644 index 0000000..9cf655b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProductBomServiceImpl.java @@ -0,0 +1,121 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.wm.domain.WmItemConsume; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProRouteProductBomMapper; +import com.ktg.mes.pro.domain.ProRouteProductBom; +import com.ktg.mes.pro.service.IProRouteProductBomService; + +/** + * 产品制程物料BOMService业务层处理 + * + * @author yinjinlu + * @date 2022-09-12 + */ +@Service +public class ProRouteProductBomServiceImpl implements IProRouteProductBomService +{ + @Autowired + private ProRouteProductBomMapper proRouteProductBomMapper; + + /** + * 查询产品制程物料BOM + * + * @param recordId 产品制程物料BOM主键 + * @return 产品制程物料BOM + */ + @Override + public ProRouteProductBom selectProRouteProductBomByRecordId(Long recordId) + { + return proRouteProductBomMapper.selectProRouteProductBomByRecordId(recordId); + } + + /** + * 查询产品制程物料BOM列表 + * + * @param proRouteProductBom 产品制程物料BOM + * @return 产品制程物料BOM + */ + @Override + public List selectProRouteProductBomList(ProRouteProductBom proRouteProductBom) + { + return proRouteProductBomMapper.selectProRouteProductBomList(proRouteProductBom); + } + + @Override + public String checkUnique(ProRouteProductBom proRouteProductBom) { + ProRouteProductBom bom = proRouteProductBomMapper.checkUnique(proRouteProductBom); + Long recordId = proRouteProductBom.getRecordId() == null? -1L: proRouteProductBom.getRecordId(); + if(StringUtils.isNotNull(bom) && bom.getRecordId().longValue() != recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增产品制程物料BOM + * + * @param proRouteProductBom 产品制程物料BOM + * @return 结果 + */ + @Override + public int insertProRouteProductBom(ProRouteProductBom proRouteProductBom) + { + proRouteProductBom.setCreateTime(DateUtils.getNowDate()); + return proRouteProductBomMapper.insertProRouteProductBom(proRouteProductBom); + } + + /** + * 修改产品制程物料BOM + * + * @param proRouteProductBom 产品制程物料BOM + * @return 结果 + */ + @Override + public int updateProRouteProductBom(ProRouteProductBom proRouteProductBom) + { + proRouteProductBom.setUpdateTime(DateUtils.getNowDate()); + return proRouteProductBomMapper.updateProRouteProductBom(proRouteProductBom); + } + + /** + * 批量删除产品制程物料BOM + * + * @param recordIds 需要删除的产品制程物料BOM主键 + * @return 结果 + */ + @Override + public int deleteProRouteProductBomByRecordIds(Long[] recordIds) + { + return proRouteProductBomMapper.deleteProRouteProductBomByRecordIds(recordIds); + } + + /** + * 删除产品制程物料BOM信息 + * + * @param recordId 产品制程物料BOM主键 + * @return 结果 + */ + @Override + public int deleteProRouteProductBomByRecordId(Long recordId) + { + return proRouteProductBomMapper.deleteProRouteProductBomByRecordId(recordId); + } + + @Override + public int deleteByRouteId(Long routeId) { + return proRouteProductBomMapper.deleteByRouteId(routeId); + } + + @Override + public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom) { + return proRouteProductBomMapper.deleteByRouteIdAndProductId(proRouteProductBom); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProductServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProductServiceImpl.java new file mode 100644 index 0000000..c09453e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteProductServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProRouteProductMapper; +import com.ktg.mes.pro.domain.ProRouteProduct; +import com.ktg.mes.pro.service.IProRouteProductService; + +/** + * 产品制程Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-14 + */ +@Service +public class ProRouteProductServiceImpl implements IProRouteProductService +{ + @Autowired + private ProRouteProductMapper proRouteProductMapper; + + /** + * 查询产品制程 + * + * @param recordId 产品制程主键 + * @return 产品制程 + */ + @Override + public ProRouteProduct selectProRouteProductByRecordId(Long recordId) + { + return proRouteProductMapper.selectProRouteProductByRecordId(recordId); + } + + /** + * 查询产品制程列表 + * + * @param proRouteProduct 产品制程 + * @return 产品制程 + */ + @Override + public List selectProRouteProductList(ProRouteProduct proRouteProduct) + { + return proRouteProductMapper.selectProRouteProductList(proRouteProduct); + } + + @Override + public String checkItemUnique(ProRouteProduct proRouteProduct) { + ProRouteProduct product = proRouteProductMapper.checkItemUnique(proRouteProduct); + Long productId = proRouteProduct.getRecordId()==null?-1L:proRouteProduct.getRecordId(); + if(StringUtils.isNotNull(product) && product.getRecordId().longValue() != productId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增产品制程 + * + * @param proRouteProduct 产品制程 + * @return 结果 + */ + @Override + public int insertProRouteProduct(ProRouteProduct proRouteProduct) + { + proRouteProduct.setCreateTime(DateUtils.getNowDate()); + return proRouteProductMapper.insertProRouteProduct(proRouteProduct); + } + + /** + * 修改产品制程 + * + * @param proRouteProduct 产品制程 + * @return 结果 + */ + @Override + public int updateProRouteProduct(ProRouteProduct proRouteProduct) + { + proRouteProduct.setUpdateTime(DateUtils.getNowDate()); + return proRouteProductMapper.updateProRouteProduct(proRouteProduct); + } + + /** + * 批量删除产品制程 + * + * @param recordIds 需要删除的产品制程主键 + * @return 结果 + */ + @Override + public int deleteProRouteProductByRecordIds(Long[] recordIds) + { + return proRouteProductMapper.deleteProRouteProductByRecordIds(recordIds); + } + + /** + * 删除产品制程信息 + * + * @param recordId 产品制程主键 + * @return 结果 + */ + @Override + public int deleteProRouteProductByRecordId(Long recordId) + { + return proRouteProductMapper.deleteProRouteProductByRecordId(recordId); + } + + @Override + public int deleteByRouteId(Long routeId) { + return proRouteProductMapper.deleteByRouteId(routeId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteServiceImpl.java new file mode 100644 index 0000000..14e195c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProRouteServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProRouteMapper; +import com.ktg.mes.pro.domain.ProRoute; +import com.ktg.mes.pro.service.IProRouteService; + +/** + * 工艺路线Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-12 + */ +@Service +public class ProRouteServiceImpl implements IProRouteService +{ + @Autowired + private ProRouteMapper proRouteMapper; + + /** + * 查询工艺路线 + * + * @param routeId 工艺路线主键 + * @return 工艺路线 + */ + @Override + public ProRoute selectProRouteByRouteId(Long routeId) + { + return proRouteMapper.selectProRouteByRouteId(routeId); + } + + /** + * 查询工艺路线列表 + * + * @param proRoute 工艺路线 + * @return 工艺路线 + */ + @Override + public List selectProRouteList(ProRoute proRoute) + { + return proRouteMapper.selectProRouteList(proRoute); + } + + @Override + public ProRoute getRouteByProductId(Long itemId) { + return proRouteMapper.getRouteByProductId(itemId); + } + + + @Override + public String checkRouteCodeUnique(ProRoute proRoute) { + ProRoute route = proRouteMapper.checkRouteCodeUnique(proRoute); + Long routeId = proRoute.getRouteId()==null?-1L:proRoute.getRouteId(); + if(StringUtils.isNotNull(route) && route.getRouteId().longValue() != routeId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增工艺路线 + * + * @param proRoute 工艺路线 + * @return 结果 + */ + @Override + public int insertProRoute(ProRoute proRoute) + { + proRoute.setCreateTime(DateUtils.getNowDate()); + return proRouteMapper.insertProRoute(proRoute); + } + + /** + * 修改工艺路线 + * + * @param proRoute 工艺路线 + * @return 结果 + */ + @Override + public int updateProRoute(ProRoute proRoute) + { + proRoute.setUpdateTime(DateUtils.getNowDate()); + return proRouteMapper.updateProRoute(proRoute); + } + + /** + * 批量删除工艺路线 + * + * @param routeIds 需要删除的工艺路线主键 + * @return 结果 + */ + @Override + public int deleteProRouteByRouteIds(Long[] routeIds) + { + return proRouteMapper.deleteProRouteByRouteIds(routeIds); + } + + /** + * 删除工艺路线信息 + * + * @param routeId 工艺路线主键 + * @return 结果 + */ + @Override + public int deleteProRouteByRouteId(Long routeId) + { + return proRouteMapper.deleteProRouteByRouteId(routeId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTaskIssueServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTaskIssueServiceImpl.java new file mode 100644 index 0000000..43ec8b4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTaskIssueServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProTaskIssueMapper; +import com.ktg.mes.pro.domain.ProTaskIssue; +import com.ktg.mes.pro.service.IProTaskIssueService; + +/** + * 生产任务投料Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-22 + */ +@Service +public class ProTaskIssueServiceImpl implements IProTaskIssueService +{ + @Autowired + private ProTaskIssueMapper proTaskIssueMapper; + + /** + * 查询生产任务投料 + * + * @param recordId 生产任务投料主键 + * @return 生产任务投料 + */ + @Override + public ProTaskIssue selectProTaskIssueByRecordId(Long recordId) + { + return proTaskIssueMapper.selectProTaskIssueByRecordId(recordId); + } + + /** + * 查询生产任务投料列表 + * + * @param proTaskIssue 生产任务投料 + * @return 生产任务投料 + */ + @Override + public List selectProTaskIssueList(ProTaskIssue proTaskIssue) + { + return proTaskIssueMapper.selectProTaskIssueList(proTaskIssue); + } + + @Override + public String checkUnique(ProTaskIssue proTaskIssue) { + ProTaskIssue taskIssue = proTaskIssueMapper.checkUnique(proTaskIssue); + if(StringUtils.isNotNull(taskIssue)){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增生产任务投料 + * + * @param proTaskIssue 生产任务投料 + * @return 结果 + */ + @Override + public int insertProTaskIssue(ProTaskIssue proTaskIssue) + { + proTaskIssue.setCreateTime(DateUtils.getNowDate()); + return proTaskIssueMapper.insertProTaskIssue(proTaskIssue); + } + + /** + * 修改生产任务投料 + * + * @param proTaskIssue 生产任务投料 + * @return 结果 + */ + @Override + public int updateProTaskIssue(ProTaskIssue proTaskIssue) + { + proTaskIssue.setUpdateTime(DateUtils.getNowDate()); + return proTaskIssueMapper.updateProTaskIssue(proTaskIssue); + } + + /** + * 批量删除生产任务投料 + * + * @param recordIds 需要删除的生产任务投料主键 + * @return 结果 + */ + @Override + public int deleteProTaskIssueByRecordIds(Long[] recordIds) + { + return proTaskIssueMapper.deleteProTaskIssueByRecordIds(recordIds); + } + + /** + * 删除生产任务投料信息 + * + * @param recordId 生产任务投料主键 + * @return 结果 + */ + @Override + public int deleteProTaskIssueByRecordId(Long recordId) + { + return proTaskIssueMapper.deleteProTaskIssueByRecordId(recordId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTaskServiceImpl.java new file mode 100644 index 0000000..f5b628f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTaskServiceImpl.java @@ -0,0 +1,106 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProTaskMapper; +import com.ktg.mes.pro.domain.ProTask; +import com.ktg.mes.pro.service.IProTaskService; + +/** + * 生产任务Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-14 + */ +@Service +public class ProTaskServiceImpl implements IProTaskService +{ + @Autowired + private ProTaskMapper proTaskMapper; + + /** + * 查询生产任务 + * + * @param taskId 生产任务主键 + * @return 生产任务 + */ + @Override + public ProTask selectProTaskByTaskId(Long taskId) + { + return proTaskMapper.selectProTaskByTaskId(taskId); + } + + /** + * 查询生产任务列表 + * + * @param proTask 生产任务 + * @return 生产任务 + */ + @Override + public List selectProTaskList(ProTask proTask) + { + return proTaskMapper.selectProTaskList(proTask); + } + + /** + * 查询某个工单的各个工序生产进度 + * @param workorderId + * @return + */ + @Override + public List selectProTaskProcessViewByWorkorder(Long workorderId) { + return proTaskMapper.selectProTaskProcessViewByWorkorder(workorderId); + } + + /** + * 新增生产任务 + * + * @param proTask 生产任务 + * @return 结果 + */ + @Override + public int insertProTask(ProTask proTask) + { + proTask.setCreateTime(DateUtils.getNowDate()); + return proTaskMapper.insertProTask(proTask); + } + + /** + * 修改生产任务 + * + * @param proTask 生产任务 + * @return 结果 + */ + @Override + public int updateProTask(ProTask proTask) + { + proTask.setUpdateTime(DateUtils.getNowDate()); + return proTaskMapper.updateProTask(proTask); + } + + /** + * 批量删除生产任务 + * + * @param taskIds 需要删除的生产任务主键 + * @return 结果 + */ + @Override + public int deleteProTaskByTaskIds(Long[] taskIds) + { + return proTaskMapper.deleteProTaskByTaskIds(taskIds); + } + + /** + * 删除生产任务信息 + * + * @param taskId 生产任务主键 + * @return 结果 + */ + @Override + public int deleteProTaskByTaskId(Long taskId) + { + return proTaskMapper.deleteProTaskByTaskId(taskId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTransConsumeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTransConsumeServiceImpl.java new file mode 100644 index 0000000..9d659aa --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTransConsumeServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProTransConsumeMapper; +import com.ktg.mes.pro.domain.ProTransConsume; +import com.ktg.mes.pro.service.IProTransConsumeService; + +/** + * 物料消耗记录Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-24 + */ +@Service +public class ProTransConsumeServiceImpl implements IProTransConsumeService +{ + @Autowired + private ProTransConsumeMapper proTransConsumeMapper; + + /** + * 查询物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 物料消耗记录 + */ + @Override + public ProTransConsume selectProTransConsumeByRecordId(Long recordId) + { + return proTransConsumeMapper.selectProTransConsumeByRecordId(recordId); + } + + /** + * 查询物料消耗记录列表 + * + * @param proTransConsume 物料消耗记录 + * @return 物料消耗记录 + */ + @Override + public List selectProTransConsumeList(ProTransConsume proTransConsume) + { + return proTransConsumeMapper.selectProTransConsumeList(proTransConsume); + } + + /** + * 新增物料消耗记录 + * + * @param proTransConsume 物料消耗记录 + * @return 结果 + */ + @Override + public int insertProTransConsume(ProTransConsume proTransConsume) + { + proTransConsume.setCreateTime(DateUtils.getNowDate()); + return proTransConsumeMapper.insertProTransConsume(proTransConsume); + } + + /** + * 修改物料消耗记录 + * + * @param proTransConsume 物料消耗记录 + * @return 结果 + */ + @Override + public int updateProTransConsume(ProTransConsume proTransConsume) + { + proTransConsume.setUpdateTime(DateUtils.getNowDate()); + return proTransConsumeMapper.updateProTransConsume(proTransConsume); + } + + /** + * 批量删除物料消耗记录 + * + * @param recordIds 需要删除的物料消耗记录主键 + * @return 结果 + */ + @Override + public int deleteProTransConsumeByRecordIds(Long[] recordIds) + { + return proTransConsumeMapper.deleteProTransConsumeByRecordIds(recordIds); + } + + /** + * 删除物料消耗记录信息 + * + * @param recordId 物料消耗记录主键 + * @return 结果 + */ + @Override + public int deleteProTransConsumeByRecordId(Long recordId) + { + return proTransConsumeMapper.deleteProTransConsumeByRecordId(recordId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTransOrderServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTransOrderServiceImpl.java new file mode 100644 index 0000000..f8f4a6f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProTransOrderServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProTransOrderMapper; +import com.ktg.mes.pro.domain.ProTransOrder; +import com.ktg.mes.pro.service.IProTransOrderService; + +/** + * 流转单Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-24 + */ +@Service +public class ProTransOrderServiceImpl implements IProTransOrderService +{ + @Autowired + private ProTransOrderMapper proTransOrderMapper; + + /** + * 查询流转单 + * + * @param transOrderId 流转单主键 + * @return 流转单 + */ + @Override + public ProTransOrder selectProTransOrderByTransOrderId(Long transOrderId) + { + return proTransOrderMapper.selectProTransOrderByTransOrderId(transOrderId); + } + + /** + * 查询流转单列表 + * + * @param proTransOrder 流转单 + * @return 流转单 + */ + @Override + public List selectProTransOrderList(ProTransOrder proTransOrder) + { + return proTransOrderMapper.selectProTransOrderList(proTransOrder); + } + + /** + * 新增流转单 + * + * @param proTransOrder 流转单 + * @return 结果 + */ + @Override + public int insertProTransOrder(ProTransOrder proTransOrder) + { + proTransOrder.setCreateTime(DateUtils.getNowDate()); + return proTransOrderMapper.insertProTransOrder(proTransOrder); + } + + /** + * 修改流转单 + * + * @param proTransOrder 流转单 + * @return 结果 + */ + @Override + public int updateProTransOrder(ProTransOrder proTransOrder) + { + proTransOrder.setUpdateTime(DateUtils.getNowDate()); + return proTransOrderMapper.updateProTransOrder(proTransOrder); + } + + /** + * 批量删除流转单 + * + * @param transOrderIds 需要删除的流转单主键 + * @return 结果 + */ + @Override + public int deleteProTransOrderByTransOrderIds(Long[] transOrderIds) + { + return proTransOrderMapper.deleteProTransOrderByTransOrderIds(transOrderIds); + } + + /** + * 删除流转单信息 + * + * @param transOrderId 流转单主键 + * @return 结果 + */ + @Override + public int deleteProTransOrderByTransOrderId(Long transOrderId) + { + return proTransOrderMapper.deleteProTransOrderByTransOrderId(transOrderId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProUserWorkstationServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProUserWorkstationServiceImpl.java new file mode 100644 index 0000000..4e1b403 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProUserWorkstationServiceImpl.java @@ -0,0 +1,106 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProUserWorkstationMapper; +import com.ktg.mes.pro.domain.ProUserWorkstation; +import com.ktg.mes.pro.service.IProUserWorkstationService; + +/** + * 用户工作站绑定关系Service业务层处理 + * + * @author yinjinlu + * @date 2023-02-20 + */ +@Service +public class ProUserWorkstationServiceImpl implements IProUserWorkstationService +{ + @Autowired + private ProUserWorkstationMapper proUserWorkstationMapper; + + /** + * 查询用户工作站绑定关系 + * + * @param recordId 用户工作站绑定关系主键 + * @return 用户工作站绑定关系 + */ + @Override + public ProUserWorkstation selectProUserWorkstationByRecordId(Long recordId) + { + return proUserWorkstationMapper.selectProUserWorkstationByRecordId(recordId); + } + + /** + * 查询用户工作站绑定关系列表 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 用户工作站绑定关系 + */ + @Override + public List selectProUserWorkstationList(ProUserWorkstation proUserWorkstation) + { + return proUserWorkstationMapper.selectProUserWorkstationList(proUserWorkstation); + } + + /** + * 新增用户工作站绑定关系 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 结果 + */ + @Override + public int insertProUserWorkstation(ProUserWorkstation proUserWorkstation) + { + proUserWorkstation.setCreateTime(DateUtils.getNowDate()); + return proUserWorkstationMapper.insertProUserWorkstation(proUserWorkstation); + } + + /** + * 修改用户工作站绑定关系 + * + * @param proUserWorkstation 用户工作站绑定关系 + * @return 结果 + */ + @Override + public int updateProUserWorkstation(ProUserWorkstation proUserWorkstation) + { + proUserWorkstation.setUpdateTime(DateUtils.getNowDate()); + return proUserWorkstationMapper.updateProUserWorkstation(proUserWorkstation); + } + + /** + * 批量删除用户工作站绑定关系 + * + * @param recordIds 需要删除的用户工作站绑定关系主键 + * @return 结果 + */ + @Override + public int deleteProUserWorkstationByRecordIds(Long[] recordIds) + { + return proUserWorkstationMapper.deleteProUserWorkstationByRecordIds(recordIds); + } + + /** + * 删除用户工作站绑定关系信息 + * + * @param recordId 用户工作站绑定关系主键 + * @return 结果 + */ + @Override + public int deleteProUserWorkstationByRecordId(Long recordId) + { + return proUserWorkstationMapper.deleteProUserWorkstationByRecordId(recordId); + } + + + /** + * 根据用户名删除所有对应关系 + * @param userName + * @return + */ + public int deleteByUserName(String userName){ + return proUserWorkstationMapper.deleteByUserName(userName); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkorderBomServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkorderBomServiceImpl.java new file mode 100644 index 0000000..7fd7a14 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkorderBomServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProWorkorderBomMapper; +import com.ktg.mes.pro.domain.ProWorkorderBom; +import com.ktg.mes.pro.service.IProWorkorderBomService; + +/** + * 生产工单BOM组成Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-09 + */ +@Service +public class ProWorkorderBomServiceImpl implements IProWorkorderBomService +{ + @Autowired + private ProWorkorderBomMapper proWorkorderBomMapper; + + /** + * 查询生产工单BOM组成 + * + * @param lineId 生产工单BOM组成主键 + * @return 生产工单BOM组成 + */ + @Override + public ProWorkorderBom selectProWorkorderBomByLineId(Long lineId) + { + return proWorkorderBomMapper.selectProWorkorderBomByLineId(lineId); + } + + /** + * 查询生产工单BOM组成列表 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 生产工单BOM组成 + */ + @Override + public List selectProWorkorderBomList(ProWorkorderBom proWorkorderBom) + { + return proWorkorderBomMapper.selectProWorkorderBomList(proWorkorderBom); + } + + /** + * 新增生产工单BOM组成 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 结果 + */ + @Override + public int insertProWorkorderBom(ProWorkorderBom proWorkorderBom) + { + proWorkorderBom.setCreateTime(DateUtils.getNowDate()); + return proWorkorderBomMapper.insertProWorkorderBom(proWorkorderBom); + } + + /** + * 修改生产工单BOM组成 + * + * @param proWorkorderBom 生产工单BOM组成 + * @return 结果 + */ + @Override + public int updateProWorkorderBom(ProWorkorderBom proWorkorderBom) + { + proWorkorderBom.setUpdateTime(DateUtils.getNowDate()); + return proWorkorderBomMapper.updateProWorkorderBom(proWorkorderBom); + } + + /** + * 批量删除生产工单BOM组成 + * + * @param lineIds 需要删除的生产工单BOM组成主键 + * @return 结果 + */ + @Override + public int deleteProWorkorderBomByLineIds(Long[] lineIds) + { + return proWorkorderBomMapper.deleteProWorkorderBomByLineIds(lineIds); + } + + /** + * 删除生产工单BOM组成信息 + * + * @param lineId 生产工单BOM组成主键 + * @return 结果 + */ + @Override + public int deleteProWorkorderBomByLineId(Long lineId) + { + return proWorkorderBomMapper.deleteProWorkorderBomByLineId(lineId); + } + + @Override + public int deleteProWorkorderBomByWorkorderId(Long workorderId) { + return proWorkorderBomMapper.deleteProWorkorderBomByWorkorderId(workorderId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkorderServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkorderServiceImpl.java new file mode 100644 index 0000000..2ed534d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkorderServiceImpl.java @@ -0,0 +1,118 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.dv.domain.DvMachineryType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProWorkorderMapper; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProWorkorderService; + +/** + * 生产工单Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-09 + */ +@Service +public class ProWorkorderServiceImpl implements IProWorkorderService +{ + @Autowired + private ProWorkorderMapper proWorkorderMapper; + + /** + * 查询生产工单 + * + * @param workorderId 生产工单主键 + * @return 生产工单 + */ + @Override + public ProWorkorder selectProWorkorderByWorkorderId(Long workorderId) + { + return proWorkorderMapper.selectProWorkorderByWorkorderId(workorderId); + } + + /** + * 查询生产工单列表 + * + * @param proWorkorder 生产工单 + * @return 生产工单 + */ + @Override + public List selectProWorkorderList(ProWorkorder proWorkorder) + { + return proWorkorderMapper.selectProWorkorderList(proWorkorder); + } + + @Override + public String checkWorkorderCodeUnique(ProWorkorder proWorkorder) { + ProWorkorder workorder = proWorkorderMapper.checkWorkorderCodeUnique(proWorkorder); + Long workorderId = proWorkorder.getWorkorderId() == null? -1L: proWorkorder.getWorkorderId(); + if(StringUtils.isNotNull(workorder) && workorder.getWorkorderId().longValue() != workorderId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + + /** + * 新增生产工单 + * + * @param proWorkorder 生产工单 + * @return 结果 + */ + @Override + public int insertProWorkorder(ProWorkorder proWorkorder) + { + if(proWorkorder.getParentId()!= null){ + ProWorkorder parent = proWorkorderMapper.selectProWorkorderByWorkorderId(proWorkorder.getParentId()); + if(StringUtils.isNotNull(parent)){ + proWorkorder.setAncestors(parent.getAncestors()+","+parent.getParentId()); + } + } + + proWorkorder.setCreateTime(DateUtils.getNowDate()); + return proWorkorderMapper.insertProWorkorder(proWorkorder); + } + + /** + * 修改生产工单 + * + * @param proWorkorder 生产工单 + * @return 结果 + */ + @Override + public int updateProWorkorder(ProWorkorder proWorkorder) + { + proWorkorder.setUpdateTime(DateUtils.getNowDate()); + return proWorkorderMapper.updateProWorkorder(proWorkorder); + } + + /** + * 批量删除生产工单 + * + * @param workorderIds 需要删除的生产工单主键 + * @return 结果 + */ + @Override + public int deleteProWorkorderByWorkorderIds(Long[] workorderIds) + { + return proWorkorderMapper.deleteProWorkorderByWorkorderIds(workorderIds); + } + + /** + * 删除生产工单信息 + * + * @param workorderId 生产工单主键 + * @return 结果 + */ + @Override + public int deleteProWorkorderByWorkorderId(Long workorderId) + { + return proWorkorderMapper.deleteProWorkorderByWorkorderId(workorderId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkrecordServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkrecordServiceImpl.java new file mode 100644 index 0000000..93dccf0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProWorkrecordServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.pro.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.pro.mapper.ProWorkrecordMapper; +import com.ktg.mes.pro.domain.ProWorkrecord; +import com.ktg.mes.pro.service.IProWorkrecordService; + +/** + * 上下工记录Service业务层处理 + * + * @author yinjinlu + * @date 2023-02-20 + */ +@Service +public class ProWorkrecordServiceImpl implements IProWorkrecordService +{ + @Autowired + private ProWorkrecordMapper proWorkrecordMapper; + + /** + * 查询上下工记录 + * + * @param recordId 上下工记录主键 + * @return 上下工记录 + */ + @Override + public ProWorkrecord selectProWorkrecordByRecordId(Long recordId) + { + return proWorkrecordMapper.selectProWorkrecordByRecordId(recordId); + } + + /** + * 查询上下工记录列表 + * + * @param proWorkrecord 上下工记录 + * @return 上下工记录 + */ + @Override + public List selectProWorkrecordList(ProWorkrecord proWorkrecord) + { + return proWorkrecordMapper.selectProWorkrecordList(proWorkrecord); + } + + /** + * 新增上下工记录 + * + * @param proWorkrecord 上下工记录 + * @return 结果 + */ + @Override + public int insertProWorkrecord(ProWorkrecord proWorkrecord) + { + proWorkrecord.setCreateTime(DateUtils.getNowDate()); + return proWorkrecordMapper.insertProWorkrecord(proWorkrecord); + } + + /** + * 修改上下工记录 + * + * @param proWorkrecord 上下工记录 + * @return 结果 + */ + @Override + public int updateProWorkrecord(ProWorkrecord proWorkrecord) + { + proWorkrecord.setUpdateTime(DateUtils.getNowDate()); + return proWorkrecordMapper.updateProWorkrecord(proWorkrecord); + } + + /** + * 批量删除上下工记录 + * + * @param recordIds 需要删除的上下工记录主键 + * @return 结果 + */ + @Override + public int deleteProWorkrecordByRecordIds(Long[] recordIds) + { + return proWorkrecordMapper.deleteProWorkrecordByRecordIds(recordIds); + } + + /** + * 删除上下工记录信息 + * + * @param recordId 上下工记录主键 + * @return 结果 + */ + @Override + public int deleteProWorkrecordByRecordId(Long recordId) + { + return proWorkrecordMapper.deleteProWorkrecordByRecordId(recordId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectController.java new file mode 100644 index 0000000..5eaac0a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectController.java @@ -0,0 +1,110 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcDefect; +import com.ktg.mes.qc.service.IQcDefectService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 常见缺陷Controller + * + * @author yinjinlu + * @date 2022-05-19 + */ +@RestController +@RequestMapping("/mes/qc/qcdefect") +public class QcDefectController extends BaseController +{ + @Autowired + private IQcDefectService qcDefectService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询常见缺陷列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcDefect qcDefect) + { + startPage(); + List list = qcDefectService.selectQcDefectList(qcDefect); + return getDataTable(list); + } + + /** + * 导出常见缺陷列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:export')") + @Log(title = "常见缺陷", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcDefect qcDefect) + { + List list = qcDefectService.selectQcDefectList(qcDefect); + ExcelUtil util = new ExcelUtil(QcDefect.class); + util.exportExcel(response, list, "常见缺陷数据"); + } + + /** + * 获取常见缺陷详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:query')") + @GetMapping(value = "/{defectId}") + public AjaxResult getInfo(@PathVariable("defectId") Long defectId) + { + return AjaxResult.success(qcDefectService.selectQcDefectByDefectId(defectId)); + } + + /** + * 新增常见缺陷 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:add')") + @Log(title = "常见缺陷", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcDefect qcDefect) + { + qcDefect.setDefectCode(autoCodeUtil.genSerialCode(UserConstants.DEFECT_CODE,null)); + return toAjax(qcDefectService.insertQcDefect(qcDefect)); + } + + /** + * 修改常见缺陷 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:edit')") + @Log(title = "常见缺陷", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcDefect qcDefect) + { + return toAjax(qcDefectService.updateQcDefect(qcDefect)); + } + + /** + * 删除常见缺陷 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:remove')") + @Log(title = "常见缺陷", businessType = BusinessType.DELETE) + @DeleteMapping("/{defectIds}") + public AjaxResult remove(@PathVariable Long[] defectIds) + { + return toAjax(qcDefectService.deleteQcDefectByDefectIds(defectIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java new file mode 100644 index 0000000..4655daf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java @@ -0,0 +1,176 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.qc.domain.ValidList; +import com.ktg.mes.qc.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcDefectRecord; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 检验单缺陷记录Controller + * + * @author yinjinlu + * @date 2022-08-30 + */ +@RestController +@RequestMapping("/mes/qc/defectrecord") +public class QcDefectRecordController extends BaseController +{ + @Autowired + private IQcDefectRecordService qcDefectRecordService; + + @Autowired + private IQcIqcLineService qcIqcLineService; + + @Autowired + private IQcIqcService qcIqcService; + + @Autowired + private IQcIpqcLineService qcIpqcLineService; + + @Autowired + private IQcIpqcService qcIpqcService; + + @Autowired + private IQcOqcService qcOqcService; + + @Autowired + private IQcOqcLineService qcOqcLineService; + + + /** + * 查询检验单缺陷记录列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcDefectRecord qcDefectRecord) + { + startPage(); + List list = qcDefectRecordService.selectQcDefectRecordList(qcDefectRecord); + return getDataTable(list); + } + + /** + * 导出检验单缺陷记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:defectrecord:export')") + @Log(title = "检验单缺陷记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcDefectRecord qcDefectRecord) + { + List list = qcDefectRecordService.selectQcDefectRecordList(qcDefectRecord); + ExcelUtil util = new ExcelUtil(QcDefectRecord.class); + util.exportExcel(response, list, "检验单缺陷记录数据"); + } + + /** + * 获取检验单缺陷记录详细信息 + */ + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(qcDefectRecordService.selectQcDefectRecordByRecordId(recordId)); + } + + /** + * 新增检验单缺陷记录 + */ + @Log(title = "检验单缺陷记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcDefectRecord qcDefectRecord) + { + if(!StringUtils.isNotNull(qcDefectRecord.getDefectName())){ + return AjaxResult.error("请填写缺陷内容"); + } + + if(!StringUtils.isNotNull(qcDefectRecord.getDefectLevel())){ + return AjaxResult.error("请选择缺陷级别"); + } + + return toAjax(qcDefectRecordService.insertQcDefectRecord(qcDefectRecord)); + } + + /** + * 修改来料检验单缺陷记录 + */ + @Log(title = "检验单缺陷记录", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping + public AjaxResult updateList(@Validated @RequestBody ValidList defects){ + Long qcId = -1L; + String qcType = ""; + Long lineId = -1L; + if(CollUtil.isNotEmpty(defects)){ + for (QcDefectRecord defect: defects + ) { + if(!StringUtils.isNotNull(defect.getDefectName())){ + return AjaxResult.error("请填写缺陷内容"); + } + + if(!StringUtils.isNotNull(defect.getDefectLevel())){ + return AjaxResult.error("请选择缺陷级别"); + } + + if(StringUtils.isNotNull(defect.getRecordId())){ + qcDefectRecordService.updateQcDefectRecord(defect); + }else { + qcDefectRecordService.insertQcDefectRecord(defect); + } + qcId = defect.getQcId(); + qcType = defect.getQcType(); + lineId = defect.getLineId(); + } + + if(UserConstants.QC_TYPE_IQC.equals(qcType)){ + //更新来料检验单行上的cr,maj,min数量 + qcIqcLineService.updateCrMajMinQuantity(qcId,lineId); + //更新来料检验单头上的cr,maj,min数量和比例 + qcIqcService.updateCrMajMinQuaAndRate(qcId); + + }else if(UserConstants.QC_TYPE_IPQC.equals(qcType)){ + //更新过程检验单行上的cr,maj,min数量 + qcIpqcLineService.updateCrMajMinQuantity(qcId,lineId); + //更新过程检验单头上的cr,maj,min数量和比例 + qcIpqcService.updateCrMajMinQuaAndRate(qcId); + }else { + //更新出货检验单行上的cr,maj,min数量 + qcOqcLineService.updateCrMajMinQuantity(qcId,lineId); + //更新出货检验单头上的cr,maj,min数量和比例 + qcOqcService.updateCrMajMinQuaAndRate(qcId); + } + + } + return AjaxResult.success(); + } + + /** + * 删除检验单缺陷记录 + */ + @Log(title = "检验单缺陷记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(qcDefectRecordService.deleteQcDefectRecordByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIndexController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIndexController.java new file mode 100644 index 0000000..b9d1f8f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIndexController.java @@ -0,0 +1,117 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcIndex; +import com.ktg.mes.qc.service.IQcIndexService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 检测项Controller + * + * @author yinjinlu + * @date 2022-05-17 + */ +@RestController +@RequestMapping("/mes/qc/qcindex") +public class QcIndexController extends BaseController +{ + @Autowired + private IQcIndexService qcIndexService; + + /** + * 查询检测项列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcIndex qcIndex) + { + startPage(); + List list = qcIndexService.selectQcIndexList(qcIndex); + return getDataTable(list); + } + + /** + * 导出检测项列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:export')") + @Log(title = "检测项", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcIndex qcIndex) + { + List list = qcIndexService.selectQcIndexList(qcIndex); + ExcelUtil util = new ExcelUtil(QcIndex.class); + util.exportExcel(response, list, "检测项数据"); + } + + /** + * 获取检测项详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:query')") + @GetMapping(value = "/{indexId}") + public AjaxResult getInfo(@PathVariable("indexId") Long indexId) + { + return AjaxResult.success(qcIndexService.selectQcIndexByIndexId(indexId)); + } + + /** + * 新增检测项 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:add')") + @Log(title = "检测项", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcIndex qcIndex) + { + if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexCodeUnique(qcIndex))){ + return AjaxResult.error("检测项编号已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexNameUnique(qcIndex))){ + return AjaxResult.error("检测项名称已存在!"); + } + return toAjax(qcIndexService.insertQcIndex(qcIndex)); + } + + /** + * 修改检测项 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:edit')") + @Log(title = "检测项", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcIndex qcIndex) + { + if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexCodeUnique(qcIndex))){ + return AjaxResult.error("检测项编号已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(qcIndexService.checkIndexNameUnique(qcIndex))){ + return AjaxResult.error("检测项名称已存在!"); + } + return toAjax(qcIndexService.updateQcIndex(qcIndex)); + } + + /** + * 删除检测项 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:remove')") + @Log(title = "检测项", businessType = BusinessType.DELETE) + @DeleteMapping("/{indexIds}") + public AjaxResult remove(@PathVariable Long[] indexIds) + { + return toAjax(qcIndexService.deleteQcIndexByIndexIds(indexIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIpqcController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIpqcController.java new file mode 100644 index 0000000..da8f733 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIpqcController.java @@ -0,0 +1,275 @@ +package com.ktg.mes.qc.controller; + +import java.math.BigDecimal; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProFeedbackService; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.mes.qc.domain.*; +import com.ktg.mes.qc.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 过程检验单Controller + * + * @author yinjinlu + * @date 2022-08-29 + */ +@RestController +@RequestMapping("/mes/qc/ipqc") +public class QcIpqcController extends BaseController +{ + @Autowired + private IQcIpqcService qcIpqcService; + + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private IQcTemplateIndexService qcTemplateIndexService; + + @Autowired + private IQcTemplateService qcTemplateService; + + @Autowired + private IQcIpqcLineService qcIpqcLineService; + + @Autowired + private IQcDefectRecordService qcDefectRecordService; + + @Autowired + private IProFeedbackService proFeedbackService; + + /** + * 查询过程检验单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:list')") + @GetMapping("/list") + public TableDataInfo list(QcIpqc qcIpqc) + { + startPage(); + List list = qcIpqcService.selectQcIpqcList(qcIpqc); + return getDataTable(list); + } + + /** + * 导出过程检验单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:export')") + @Log(title = "过程检验单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcIpqc qcIpqc) + { + List list = qcIpqcService.selectQcIpqcList(qcIpqc); + ExcelUtil util = new ExcelUtil(QcIpqc.class); + util.exportExcel(response, list, "过程检验单数据"); + } + + /** + * 获取过程检验单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:query')") + @GetMapping(value = "/{ipqcId}") + public AjaxResult getInfo(@PathVariable("ipqcId") Long ipqcId) + { + return AjaxResult.success(qcIpqcService.selectQcIpqcByIpqcId(ipqcId)); + } + + /** + * 新增过程检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:add')") + @Log(title = "过程检验单", businessType = BusinessType.INSERT) + @Transactional + @PostMapping + public AjaxResult add(@RequestBody QcIpqc qcIpqc) + { + if(UserConstants.NOT_UNIQUE.equals(qcIpqcService.checkIpqcCodeUnique(qcIpqc))){ + return AjaxResult.error("检测单编码已存在!"); + } + + //根据工单获取产品信息 + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId()); + qcIpqc.setWorkorderId(workorder.getWorkorderId()); + qcIpqc.setWorkorderCode(workorder.getWorkorderCode()); + qcIpqc.setWorkorderName(workorder.getWorkorderName()); + qcIpqc.setItemId(workorder.getProductId()); + qcIpqc.setItemCode(workorder.getProductCode()); + qcIpqc.setItemName(workorder.getProductName()); + qcIpqc.setSpecification(workorder.getProductSpc()); + qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure()); + + //查询工序相关信息 + List infos = qcIpqcService.getProcessInfo(qcIpqc); + if(!CollectionUtils.isEmpty(infos)&&infos.size() ==1){ + qcIpqc.setProcessId(infos.get(0).getProcessId()); + qcIpqc.setProcessCode(infos.get(0).getProcessCode()); + qcIpqc.setProcessName(infos.get(0).getProcessName()); + } + + //根据产品和检测类型获取检测模板 + QcTemplate param = new QcTemplate(); + param.setQcTypes(qcIpqc.getIpqcType()); + param.setItemId(workorder.getProductId()); + QcTemplate template = qcTemplateService.selectQcTemplateByProductAndQcType(param); + if(StringUtils.isNotNull(template)){ + qcIpqc.setTemplateId(template.getTemplateId()); + }else{ + return AjaxResult.error("当前工单生产的产品未配置此类型的检验模板!"); + } + + //先保存 + qcIpqcService.insertQcIpqc(qcIpqc); + + //生成行信息 + generateLine(qcIpqc); + + //将ID返回 + Long ipqcId = qcIpqc.getIpqcId(); + return AjaxResult.success(ipqcId); + } + + /** + * 修改过程检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:edit')") + @Log(title = "过程检验单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping + public AjaxResult edit(@RequestBody QcIpqc qcIpqc) + { + if(UserConstants.NOT_UNIQUE.equals(qcIpqcService.checkIpqcCodeUnique(qcIpqc))){ + return AjaxResult.error("检测单编码已存在!"); + } + + //对合格品和不合格品数量进行检查 + + + //根据工单获取产品信息 + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId()); + qcIpqc.setWorkorderId(workorder.getWorkorderId()); + qcIpqc.setWorkorderCode(workorder.getWorkorderCode()); + qcIpqc.setWorkorderName(workorder.getWorkorderName()); + qcIpqc.setItemId(workorder.getProductId()); + qcIpqc.setItemCode(workorder.getProductCode()); + qcIpqc.setItemName(workorder.getProductName()); + qcIpqc.setSpecification(workorder.getProductSpc()); + qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure()); + + //查询工序相关信息 + List infos = qcIpqcService.getProcessInfo(qcIpqc); + if(!CollectionUtils.isEmpty(infos)&&infos.size() ==1){ + qcIpqc.setProcessId(infos.get(0).getProcessId()); + qcIpqc.setProcessCode(infos.get(0).getProcessCode()); + qcIpqc.setProcessName(infos.get(0).getProcessName()); + } + + //根据产品和检测类型获取检测模板 + QcTemplate param = new QcTemplate(); + param.setQcTypes(qcIpqc.getIpqcType()); + param.setItemId(workorder.getProductId()); + QcTemplate template = qcTemplateService.selectQcTemplateByProductAndQcType(param); + if(StringUtils.isNotNull(template)){ + qcIpqc.setTemplateId(template.getTemplateId()); + }else{ + return AjaxResult.error("当前工单生产的产品未配置此类型的检验模板!"); + } + + //如果是完成单据则根据单据上的来源单据,更新对应的关联检验单信息 + if(UserConstants.ORDER_STATUS_FINISHED.equals(qcIpqc.getStatus())){ + if(StringUtils.isNotNull(qcIpqc.getSourceDocCode())){ + //这里默认更新生产报工单的数据 + ProFeedback feedback = proFeedbackService.selectProFeedbackByRecordId(qcIpqc.getSourceDocId()); + if(StringUtils.isNotNull(feedback)){ + feedback.setQuantityQualified(qcIpqc.getQuantityQualified()); + feedback.setQuantityUnquanlified(qcIpqc.getQuantityUnqualified()); + feedback.setQuantityUncheck(BigDecimal.ZERO); + proFeedbackService.updateProFeedback(feedback); + } + } + } + + return toAjax(qcIpqcService.updateQcIpqc(qcIpqc)); + } + + /** + * 删除过程检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:remove')") + @Log(title = "过程检验单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{ipqcIds}") + public AjaxResult remove(@PathVariable Long[] ipqcIds) + { + for (Long ipqcId: ipqcIds + ) { + QcIpqc ipqc = qcIpqcService.selectQcIpqcByIpqcId(ipqcId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(ipqc.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + qcIpqcLineService.deleteByIpqcId(ipqcId); //删除对应的行信息 + QcDefectRecord p2 = new QcDefectRecord(); + p2.setQcId(ipqcId); + p2.setQcType(UserConstants.QC_TYPE_IPQC); + qcDefectRecordService.deleteByQcIdAndType(p2);//删除对应的缺陷记录 + } + + return toAjax(qcIpqcService.deleteQcIpqcByIpqcIds(ipqcIds)); + } + + + /** + * 根据头信息生成行信息 + * @param iqc + */ + private void generateLine(QcIpqc iqc){ + QcTemplateIndex param = new QcTemplateIndex(); + param.setTemplateId(iqc.getTemplateId()); + List indexs = qcTemplateIndexService.selectQcTemplateIndexList(param); + if(CollUtil.isNotEmpty(indexs)){ + for (QcTemplateIndex index:indexs + ) { + QcIpqcLine line = new QcIpqcLine(); + line.setIpqcId(iqc.getIpqcId()); + line.setIndexId(index.getIndexId()); + line.setIndexCode(index.getIndexCode()); + line.setIndexName(index.getIndexName()); + line.setIndexType(index.getIndexType()); + line.setQcTool(index.getQcTool()); + line.setCheckMethod(index.getCheckMethod()); + line.setStanderVal(index.getStanderVal()); + line.setUnitOfMeasure(index.getUnitOfMeasure()); + line.setThresholdMax(index.getThresholdMax()); + line.setThresholdMin(index.getThresholdMin()); + line.setCrQuantity(new BigDecimal(0L)); + line.setMajQuantity(new BigDecimal(0L)); + line.setMajQuantity(new BigDecimal(0L)); + qcIpqcLineService.insertQcIpqcLine(line); + } + } + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIpqcLineController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIpqcLineController.java new file mode 100644 index 0000000..e0525a6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIpqcLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcIpqcLine; +import com.ktg.mes.qc.service.IQcIpqcLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 过程检验单行Controller + * + * @author yinjinlu + * @date 2022-08-30 + */ +@RestController +@RequestMapping("/mes/qc/ipqcline") +public class QcIpqcLineController extends BaseController +{ + @Autowired + private IQcIpqcLineService qcIpqcLineService; + + /** + * 查询过程检验单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:list')") + @GetMapping("/list") + public TableDataInfo list(QcIpqcLine qcIpqcLine) + { + startPage(); + List list = qcIpqcLineService.selectQcIpqcLineList(qcIpqcLine); + return getDataTable(list); + } + + /** + * 导出过程检验单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:export')") + @Log(title = "过程检验单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcIpqcLine qcIpqcLine) + { + List list = qcIpqcLineService.selectQcIpqcLineList(qcIpqcLine); + ExcelUtil util = new ExcelUtil(QcIpqcLine.class); + util.exportExcel(response, list, "过程检验单行数据"); + } + + /** + * 获取过程检验单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(qcIpqcLineService.selectQcIpqcLineByLineId(lineId)); + } + + /** + * 新增过程检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:add')") + @Log(title = "过程检验单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcIpqcLine qcIpqcLine) + { + return toAjax(qcIpqcLineService.insertQcIpqcLine(qcIpqcLine)); + } + + /** + * 修改过程检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:edit')") + @Log(title = "过程检验单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcIpqcLine qcIpqcLine) + { + return toAjax(qcIpqcLineService.updateQcIpqcLine(qcIpqcLine)); + } + + /** + * 删除过程检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:ipqc:remove')") + @Log(title = "过程检验单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(qcIpqcLineService.deleteQcIpqcLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIqcController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIqcController.java new file mode 100644 index 0000000..ad56f56 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIqcController.java @@ -0,0 +1,219 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.service.IProFeedbackService; +import com.ktg.mes.qc.domain.*; +import com.ktg.mes.qc.service.*; +import com.ktg.mes.wm.domain.WmItemRecptLine; +import com.ktg.mes.wm.service.IWmItemRecptLineService; +import com.ktg.mes.wm.service.IWmItemRecptService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 来料检验单Controller + * + * @author yinjinlu + * @date 2022-05-19 + */ +@RestController +@RequestMapping("/mes/qc/iqc") +public class QcIqcController extends BaseController +{ + @Autowired + private IQcIqcService qcIqcService; + + @Autowired + private IQcTemplateProductService qcTemplateProductService; + + @Autowired + private IQcTemplateIndexService qcTemplateIndexService; + + @Autowired + private IQcIqcLineService qcIqcLineService; + + @Autowired + private IQcDefectRecordService qcDefectRecordService; + + @Autowired + private IWmItemRecptLineService wmItemRecptLineService; + + + /** + * 查询来料检验单列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcIqc qcIqc) + { + startPage(); + List list = qcIqcService.selectQcIqcList(qcIqc); + return getDataTable(list); + } + + /** + * 导出来料检验单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:export')") + @Log(title = "来料检验单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcIqc qcIqc) + { + List list = qcIqcService.selectQcIqcList(qcIqc); + ExcelUtil util = new ExcelUtil(QcIqc.class); + util.exportExcel(response, list, "来料检验单数据"); + } + + /** + * 获取来料检验单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:query')") + @GetMapping(value = "/{iqcId}") + public AjaxResult getInfo(@PathVariable("iqcId") Long iqcId) + { + return AjaxResult.success(qcIqcService.selectQcIqcByIqcId(iqcId)); + } + + /** + * 新增来料检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:add')") + @Log(title = "来料检验单", businessType = BusinessType.INSERT) + @Transactional + @PostMapping + public AjaxResult add(@RequestBody QcIqc qcIqc) + { + if(UserConstants.NOT_UNIQUE.equals(qcIqcService.checkIqcCodeUnique(qcIqc))){ + return AjaxResult.error("单据编号已存在!"); + } + + QcTemplateProduct param = new QcTemplateProduct(); + param.setItemId(qcIqc.getItemId()); + List templates = qcTemplateProductService.selectQcTemplateProductList(param); + if(CollUtil.isNotEmpty(templates)){ + qcIqc.setTemplateId(templates.get(0).getTemplateId()); + }else{ + return AjaxResult.error("当前产品未配置检测模板!"); + } + qcIqc.setInspector(getUsername()); + qcIqcService.insertQcIqc(qcIqc); + generateLine(qcIqc); + Long iqcId = qcIqc.getIqcId(); + return AjaxResult.success(iqcId); //将生成的ID返回给页面 + } + + /** + * 修改来料检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:edit')") + @Log(title = "来料检验单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping + public AjaxResult edit(@RequestBody QcIqc qcIqc) + { + if(UserConstants.NOT_UNIQUE.equals(qcIqcService.checkIqcCodeUnique(qcIqc))){ + return AjaxResult.error("单据编号已存在!"); + } + + QcTemplateProduct param = new QcTemplateProduct(); + param.setItemId(qcIqc.getItemId()); + List templates = qcTemplateProductService.selectQcTemplateProductList(param); + if(CollUtil.isNotEmpty(templates)){ + qcIqc.setTemplateId(templates.get(0).getTemplateId()); + }else{ + return AjaxResult.error("当前产品未配置检测模板!"); + } + qcIqc.setInspector(getUsername()); + + //如果是完成状态,则根据来源单据更新其对应的检测单 + if(UserConstants.ORDER_STATUS_FINISHED.equals(qcIqc.getStatus())){ + if(StringUtils.isNotNull(qcIqc.getSourceDocCode())){ + //这里默认是采购入库单,后续有其他单据则根据单据类型(sourceDocType)进行区分 + WmItemRecptLine line = wmItemRecptLineService.selectWmItemRecptLineByLineId(qcIqc.getSourceLineId()); + if(StringUtils.isNotNull(line)){ + line.setIqcCode(qcIqc.getIqcCode()); + line.setIqcId(qcIqc.getIqcId()); + wmItemRecptLineService.updateWmItemRecptLine(line); + } + } + } + + return toAjax(qcIqcService.updateQcIqc(qcIqc)); + } + + /** + * 删除来料检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:remove')") + @Log(title = "来料检验单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{iqcIds}") + public AjaxResult remove(@PathVariable Long[] iqcIds) + { + for (Long iqcId:iqcIds + ) { + QcIqc iqc = qcIqcService.selectQcIqcByIqcId(iqcId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(iqc.getStatus())){ + return AjaxResult.error("只能删除草稿状态单据!"); + } + qcIqcLineService.deleteByIqcId(iqcId); + QcDefectRecord p2 = new QcDefectRecord(); + p2.setQcId(iqcId); + p2.setQcType(UserConstants.QC_TYPE_IQC); + qcDefectRecordService.deleteByQcIdAndType(p2);//删除对应的缺陷记录 + } + return toAjax(qcIqcService.deleteQcIqcByIqcIds(iqcIds)); + } + + /** + * 根据头信息生成行信息 + * @param iqc + */ + private void generateLine(QcIqc iqc){ + QcTemplateIndex param = new QcTemplateIndex(); + param.setTemplateId(iqc.getTemplateId()); + List indexs = qcTemplateIndexService.selectQcTemplateIndexList(param); + if(CollUtil.isNotEmpty(indexs)){ + for (QcTemplateIndex index:indexs + ) { + QcIqcLine line = new QcIqcLine(); + line.setIqcId(iqc.getIqcId()); + line.setIndexId(index.getIndexId()); + line.setIndexCode(index.getIndexCode()); + line.setIndexName(index.getIndexName()); + line.setIndexType(index.getIndexType()); + line.setQcTool(index.getQcTool()); + line.setCheckMethod(index.getCheckMethod()); + line.setStanderVal(index.getStanderVal()); + line.setUnitOfMeasure(index.getUnitOfMeasure()); + line.setThresholdMax(index.getThresholdMax()); + line.setThresholdMin(index.getThresholdMin()); + line.setCrQuantity(0L); + line.setMajQuantity(0L); + line.setMajQuantity(0L); + qcIqcLineService.insertQcIqcLine(line); + } + } + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIqcLineController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIqcLineController.java new file mode 100644 index 0000000..deefb02 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcIqcLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcIqcLine; +import com.ktg.mes.qc.service.IQcIqcLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 来料检验单行Controller + * + * @author yinjinlu + * @date 2022-05-19 + */ +@RestController +@RequestMapping("/mes/qc/iqcline") +public class QcIqcLineController extends BaseController +{ + @Autowired + private IQcIqcLineService qcIqcLineService; + + /** + * 查询来料检验单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:list')") + @GetMapping("/list") + public TableDataInfo list(QcIqcLine qcIqcLine) + { + startPage(); + List list = qcIqcLineService.selectQcIqcLineList(qcIqcLine); + return getDataTable(list); + } + + /** + * 导出来料检验单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:export')") + @Log(title = "来料检验单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcIqcLine qcIqcLine) + { + List list = qcIqcLineService.selectQcIqcLineList(qcIqcLine); + ExcelUtil util = new ExcelUtil(QcIqcLine.class); + util.exportExcel(response, list, "来料检验单行数据"); + } + + /** + * 获取来料检验单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(qcIqcLineService.selectQcIqcLineByLineId(lineId)); + } + + /** + * 新增来料检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:add')") + @Log(title = "来料检验单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcIqcLine qcIqcLine) + { + return toAjax(qcIqcLineService.insertQcIqcLine(qcIqcLine)); + } + + /** + * 修改来料检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:edit')") + @Log(title = "来料检验单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcIqcLine qcIqcLine) + { + return toAjax(qcIqcLineService.updateQcIqcLine(qcIqcLine)); + } + + /** + * 删除来料检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:iqc:remove')") + @Log(title = "来料检验单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(qcIqcLineService.deleteQcIqcLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcOqcController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcOqcController.java new file mode 100644 index 0000000..d1e081f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcOqcController.java @@ -0,0 +1,214 @@ +package com.ktg.mes.qc.controller; + +import java.math.BigDecimal; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.qc.domain.*; +import com.ktg.mes.qc.service.IQcOqcLineService; +import com.ktg.mes.qc.service.IQcTemplateIndexService; +import com.ktg.mes.qc.service.IQcTemplateProductService; +import com.ktg.mes.wm.domain.WmProductSalseLine; +import com.ktg.mes.wm.service.IWmProductSalseLineService; +import org.apache.catalina.User; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.service.IQcOqcService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 出货检验单Controller + * + * @author yinjinlu + * @date 2022-08-31 + */ +@RestController +@RequestMapping("/mes/qc/oqc") +public class QcOqcController extends BaseController +{ + @Autowired + private IQcOqcService qcOqcService; + + @Autowired + private IQcOqcLineService qcOqcLineService; + + @Autowired + private IQcTemplateProductService qcTemplateProductService; + + @Autowired + private IQcTemplateIndexService qcTemplateIndexService; + + @Autowired + private IWmProductSalseLineService wmProductSalseLineService; + + /** + * 查询出货检验单列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcOqc qcOqc) + { + startPage(); + List list = qcOqcService.selectQcOqcList(qcOqc); + return getDataTable(list); + } + + /** + * 导出出货检验单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:export')") + @Log(title = "出货检验单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcOqc qcOqc) + { + List list = qcOqcService.selectQcOqcList(qcOqc); + ExcelUtil util = new ExcelUtil(QcOqc.class); + util.exportExcel(response, list, "出货检验单数据"); + } + + /** + * 获取出货检验单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:query')") + @GetMapping(value = "/{oqcId}") + public AjaxResult getInfo(@PathVariable("oqcId") Long oqcId) + { + return AjaxResult.success(qcOqcService.selectQcOqcByOqcId(oqcId)); + } + + /** + * 新增出货检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:add')") + @Log(title = "出货检验单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcOqc qcOqc) + { + if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){ + return AjaxResult.error("出货单编号已存在!"); + } + //自动获取对应的检测模板 + QcTemplateProduct param = new QcTemplateProduct(); + param.setItemId(qcOqc.getItemId()); + List templates = qcTemplateProductService.selectQcTemplateProductList(param); + if(CollUtil.isNotEmpty(templates)){ + qcOqc.setTemplateId(templates.get(0).getTemplateId()); + }else{ + return AjaxResult.error("当前产品未配置检测模板!"); + } + //设置检测人 + qcOqc.setInspector(getUsername()); + //先保存单据 + qcOqcService.insertQcOqc(qcOqc); + //生成行信息 + generateLine(qcOqc); + + Long oqcId = qcOqc.getOqcId(); + return AjaxResult.success(oqcId); + } + + /** + * 修改出货检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:edit')") + @Log(title = "出货检验单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcOqc qcOqc) + { + if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){ + return AjaxResult.error("出货单编号已存在!"); + } + + //自动获取对应的检测模板 + QcTemplateProduct param = new QcTemplateProduct(); + param.setItemId(qcOqc.getItemId()); + List templates = qcTemplateProductService.selectQcTemplateProductList(param); + if(CollUtil.isNotEmpty(templates)){ + qcOqc.setTemplateId(templates.get(0).getTemplateId()); + }else{ + return AjaxResult.error("当前产品未配置检测模板!"); + } + //设置检测人 + qcOqc.setInspector(getUsername()); + + if(UserConstants.ORDER_STATUS_FINISHED.equals(qcOqc.getStatus())){ + if(StringUtils.isNotNull(qcOqc.getSourceDocCode())){ + WmProductSalseLine line = wmProductSalseLineService.selectWmProductSalseLineByLineId(qcOqc.getSourceLineId()); + if(StringUtils.isNotNull(line)){ + line.setOqcId(qcOqc.getOqcId()); + line.setOqcCode(qcOqc.getOqcCode()); + wmProductSalseLineService.updateWmProductSalseLine(line); + } + } + } + return toAjax(qcOqcService.updateQcOqc(qcOqc)); + } + + /** + * 删除出货检验单 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:remove')") + @Log(title = "出货检验单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{oqcIds}") + public AjaxResult remove(@PathVariable Long[] oqcIds) + { + for (Long oqcId: oqcIds + ) { + QcOqc oqc = qcOqcService.selectQcOqcByOqcId(oqcId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(oqc.getStatus())){ + return AjaxResult.error("只能删除状态为草稿的单据!"); + } + qcOqcLineService.deleteByOqcId(oqcId); + } + + return toAjax(qcOqcService.deleteQcOqcByOqcIds(oqcIds)); + } + + /** + * 根据头信息生成行信息 + * @param oqc + */ + private void generateLine(QcOqc oqc){ + QcTemplateIndex param = new QcTemplateIndex(); + param.setTemplateId(oqc.getTemplateId()); + List indexs = qcTemplateIndexService.selectQcTemplateIndexList(param); + if(CollUtil.isNotEmpty(indexs)){ + for (QcTemplateIndex index:indexs + ) { + QcOqcLine line = new QcOqcLine(); + line.setOqcId(oqc.getOqcId()); + line.setIndexId(index.getIndexId()); + line.setIndexCode(index.getIndexCode()); + line.setIndexName(index.getIndexName()); + line.setIndexType(index.getIndexType()); + line.setQcTool(index.getQcTool()); + line.setCheckMethod(index.getCheckMethod()); + line.setStanderVal(index.getStanderVal()); + line.setUnitOfMeasure(index.getUnitOfMeasure()); + line.setThresholdMax(index.getThresholdMax()); + line.setThresholdMin(index.getThresholdMin()); + line.setCrQuantity(new BigDecimal(0L)); + line.setMajQuantity(new BigDecimal(0L)); + line.setMajQuantity(new BigDecimal(0L)); + qcOqcLineService.insertQcOqcLine(line); + } + } + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcOqcLineController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcOqcLineController.java new file mode 100644 index 0000000..9462ceb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcOqcLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcOqcLine; +import com.ktg.mes.qc.service.IQcOqcLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 出货检验单行Controller + * + * @author yinjinlu + * @date 2022-09-01 + */ +@RestController +@RequestMapping("/mes/qc/oqcline") +public class QcOqcLineController extends BaseController +{ + @Autowired + private IQcOqcLineService qcOqcLineService; + + /** + * 查询出货检验单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:list')") + @GetMapping("/list") + public TableDataInfo list(QcOqcLine qcOqcLine) + { + startPage(); + List list = qcOqcLineService.selectQcOqcLineList(qcOqcLine); + return getDataTable(list); + } + + /** + * 导出出货检验单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:export')") + @Log(title = "出货检验单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcOqcLine qcOqcLine) + { + List list = qcOqcLineService.selectQcOqcLineList(qcOqcLine); + ExcelUtil util = new ExcelUtil(QcOqcLine.class); + util.exportExcel(response, list, "出货检验单行数据"); + } + + /** + * 获取出货检验单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(qcOqcLineService.selectQcOqcLineByLineId(lineId)); + } + + /** + * 新增出货检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:add')") + @Log(title = "出货检验单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcOqcLine qcOqcLine) + { + return toAjax(qcOqcLineService.insertQcOqcLine(qcOqcLine)); + } + + /** + * 修改出货检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:edit')") + @Log(title = "出货检验单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcOqcLine qcOqcLine) + { + return toAjax(qcOqcLineService.updateQcOqcLine(qcOqcLine)); + } + + /** + * 删除出货检验单行 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:oqc:remove')") + @Log(title = "出货检验单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(qcOqcLineService.deleteQcOqcLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcPendingInspectController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcPendingInspectController.java new file mode 100644 index 0000000..048c1e6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcPendingInspectController.java @@ -0,0 +1,34 @@ +package com.ktg.mes.qc.controller; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.mes.qc.domain.QcPendingInspect; +import com.ktg.mes.qc.service.IQcPendingInspectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/mes/qc/pending") +public class QcPendingInspectController extends BaseController { + + @Autowired + private IQcPendingInspectService qcPendingInspectService; + + + /** + * 获取待检验任务 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:pending:list')") + @GetMapping("/list") + public TableDataInfo list(QcPendingInspect qcPendingInspect) + { + startPage(); + List list = qcPendingInspectService.selectQcPendingList(qcPendingInspect); + return getDataTable(list); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateController.java new file mode 100644 index 0000000..db9a8cf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateController.java @@ -0,0 +1,171 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ArrayUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.qc.service.IQcTemplateIndexService; +import com.ktg.mes.qc.service.IQcTemplateProductService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcTemplate; +import com.ktg.mes.qc.service.IQcTemplateService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 检测模板Controller + * + * @author yinjinlu + * @date 2022-05-17 + */ +@RestController +@RequestMapping("/mes/qc/qctemplate") +public class QcTemplateController extends BaseController +{ + @Autowired + private IQcTemplateService qcTemplateService; + + @Autowired + private IQcTemplateIndexService qcTemplateIndexService; + + @Autowired + private IQcTemplateProductService qcTemplateProductService; + + /** + * 查询检测模板列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcTemplate qcTemplate) + { + startPage(); + List list = qcTemplateService.selectQcTemplateList(qcTemplate); + if(CollUtil.isNotEmpty(list)){ + for (int i=0;i list = qcTemplateService.selectQcTemplateList(qcTemplate); + ExcelUtil util = new ExcelUtil(QcTemplate.class); + util.exportExcel(response, list, "检测模板数据"); + } + + /** + * 获取检测模板详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')") + @GetMapping(value = "/{templateId}") + public AjaxResult getInfo(@PathVariable("templateId") Long templateId) + { + QcTemplate template = qcTemplateService.selectQcTemplateByTemplateId(templateId); + if(StringUtils.isNotNull(template)){ + template.setQcTypesParam(template.getQcTypes().split(",")); + } + return AjaxResult.success(template); + } + + /** + * 新增检测模板 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')") + @Log(title = "检测模板", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcTemplate qcTemplate) + { + if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){ + return AjaxResult.error("检测模板编号已存在!"); + } + + if(ArrayUtil.isNotEmpty(qcTemplate.getQcTypesParam())){ + qcTemplate.setQcTypes(null); //先置空 + String[] types = qcTemplate.getQcTypesParam(); + //根据输入参数重新生成 + for (String type:types + ) { + if(StringUtils.isNotNull(qcTemplate.getQcTypes())){ + qcTemplate.setQcTypes(qcTemplate.getQcTypes()+','+type); + }else{ + qcTemplate.setQcTypes(type); + } + } + } + + return toAjax(qcTemplateService.insertQcTemplate(qcTemplate)); + } + + /** + * 修改检测模板 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')") + @Log(title = "检测模板", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcTemplate qcTemplate) + { + if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){ + return AjaxResult.error("检测模板编号已存在!"); + } + if(ArrayUtil.isNotEmpty(qcTemplate.getQcTypesParam())){ + qcTemplate.setQcTypes(null); //先置空 + String[] types = qcTemplate.getQcTypesParam(); + for (String type:types + ) { + if(StringUtils.isNotNull(qcTemplate.getQcTypes())){ + qcTemplate.setQcTypes(qcTemplate.getQcTypes()+','+type); + }else{ + qcTemplate.setQcTypes(type); + } + } + } + return toAjax(qcTemplateService.updateQcTemplate(qcTemplate)); + } + + /** + * 删除检测模板 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')") + @Log(title = "检测模板", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{templateIds}") + public AjaxResult remove(@PathVariable Long[] templateIds) + { + + for (Long id:templateIds + ) { + //删除当前模板下所有检测项数据 + qcTemplateIndexService.deleteByTemplateId(id); + //删除当前模板下所有检测产品 + qcTemplateProductService.deleteByTemplateId(id); + } + return toAjax(qcTemplateService.deleteQcTemplateByTemplateIds(templateIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateIndexController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateIndexController.java new file mode 100644 index 0000000..a551530 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateIndexController.java @@ -0,0 +1,119 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.mes.qc.domain.QcIndex; +import com.ktg.mes.qc.service.IQcIndexService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcTemplateIndex; +import com.ktg.mes.qc.service.IQcTemplateIndexService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 检测模板-检测项Controller + * + * @author yinjinlu + * @date 2022-05-18 + */ +@RestController +@RequestMapping("/mes/qc/templateindex") +public class QcTemplateIndexController extends BaseController +{ + @Autowired + private IQcTemplateIndexService qcTemplateIndexService; + + @Autowired + private IQcIndexService qcIndexService; + + /** + * 查询检测模板-检测项列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcTemplateIndex qcTemplateIndex) + { + startPage(); + List list = qcTemplateIndexService.selectQcTemplateIndexList(qcTemplateIndex); + return getDataTable(list); + } + + /** + * 导出检测模板-检测项列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:export')") + @Log(title = "检测模板-检测项", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcTemplateIndex qcTemplateIndex) + { + List list = qcTemplateIndexService.selectQcTemplateIndexList(qcTemplateIndex); + ExcelUtil util = new ExcelUtil(QcTemplateIndex.class); + util.exportExcel(response, list, "检测模板-检测项数据"); + } + + /** + * 获取检测模板-检测项详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(qcTemplateIndexService.selectQcTemplateIndexByRecordId(recordId)); + } + + /** + * 新增检测模板-检测项 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')") + @Log(title = "检测模板-检测项", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcTemplateIndex qcTemplateIndex) + { + QcIndex index =qcIndexService.selectQcIndexByIndexId(qcTemplateIndex.getIndexId()); + qcTemplateIndex.setIndexCode(index.getIndexCode()); + qcTemplateIndex.setIndexName(index.getIndexName()); + qcTemplateIndex.setIndexType(index.getIndexType()); + qcTemplateIndex.setQcTool(index.getQcTool()); + return toAjax(qcTemplateIndexService.insertQcTemplateIndex(qcTemplateIndex)); + } + + /** + * 修改检测模板-检测项 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')") + @Log(title = "检测模板-检测项", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcTemplateIndex qcTemplateIndex) + { + QcIndex index =qcIndexService.selectQcIndexByIndexId(qcTemplateIndex.getIndexId()); + qcTemplateIndex.setIndexCode(index.getIndexCode()); + qcTemplateIndex.setIndexName(index.getIndexName()); + qcTemplateIndex.setIndexType(index.getIndexType()); + qcTemplateIndex.setQcTool(index.getQcTool()); + return toAjax(qcTemplateIndexService.updateQcTemplateIndex(qcTemplateIndex)); + } + + /** + * 删除检测模板-检测项 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')") + @Log(title = "检测模板-检测项", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(qcTemplateIndexService.deleteQcTemplateIndexByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java new file mode 100644 index 0000000..b16617b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java @@ -0,0 +1,111 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcTemplateProduct; +import com.ktg.mes.qc.service.IQcTemplateProductService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 检测模板-产品Controller + * + * @author yinjinlu + * @date 2022-05-18 + */ +@RestController +@RequestMapping("/mes/qc/templateproduct") +public class QcTemplateProductController extends BaseController +{ + @Autowired + private IQcTemplateProductService qcTemplateProductService; + + /** + * 查询检测模板-产品列表 + */ + @GetMapping("/list") + public TableDataInfo list(QcTemplateProduct qcTemplateProduct) + { + startPage(); + List list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct); + return getDataTable(list); + } + + /** + * 导出检测模板-产品列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:export')") + @Log(title = "检测模板-产品", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcTemplateProduct qcTemplateProduct) + { + List list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct); + ExcelUtil util = new ExcelUtil(QcTemplateProduct.class); + util.exportExcel(response, list, "检测模板-产品数据"); + } + + /** + * 获取检测模板-产品详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(qcTemplateProductService.selectQcTemplateProductByRecordId(recordId)); + } + + /** + * 新增检测模板-产品 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')") + @Log(title = "检测模板-产品", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcTemplateProduct qcTemplateProduct) + { + if(UserConstants.NOT_UNIQUE.equals(qcTemplateProductService.checkProductUnique(qcTemplateProduct))){ + return AjaxResult.error("产品已设置检测模板!"); + } + return toAjax(qcTemplateProductService.insertQcTemplateProduct(qcTemplateProduct)); + } + + /** + * 修改检测模板-产品 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')") + @Log(title = "检测模板-产品", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcTemplateProduct qcTemplateProduct) + { + if(UserConstants.NOT_UNIQUE.equals(qcTemplateProductService.checkProductUnique(qcTemplateProduct))){ + return AjaxResult.error("产品已设置检测模板!"); + } + return toAjax(qcTemplateProductService.updateQcTemplateProduct(qcTemplateProduct)); + } + + /** + * 删除检测模板-产品 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')") + @Log(title = "检测模板-产品", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(qcTemplateProductService.deleteQcTemplateProductByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/mobile/QcTemplateIndexMobController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/mobile/QcTemplateIndexMobController.java new file mode 100644 index 0000000..d95462b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/mobile/QcTemplateIndexMobController.java @@ -0,0 +1,46 @@ +package com.ktg.mes.qc.controller.mobile; + +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.qc.domain.QcMobParam; +import com.ktg.mes.qc.domain.QcTemplate; +import com.ktg.mes.qc.domain.QcTemplateIndex; +import com.ktg.mes.qc.service.IQcTemplateIndexService; +import com.ktg.mes.qc.service.IQcTemplateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/mobile/qc/templateindex") +public class QcTemplateIndexMobController { + + @Autowired + private IQcTemplateService qcTemplateService; + + @Autowired + private IQcTemplateIndexService qcTemplateIndexService; + + /** + * 根据物料产品和质检类型查询对应的质检模板行信息 + */ + @GetMapping("/getLines") + public AjaxResult getLines(QcMobParam param){ + + //根据物料和质检类型查询模板 + QcTemplate template = qcTemplateService.findTemplateByProductIdAndQcType(param); + if(StringUtils.isNull(template)){ + return AjaxResult.error("当前生产的产品未配置此类型的检验模板,请联系质量管理人员!"); + } + + //根据模板查询模板行 + QcTemplateIndex p = new QcTemplateIndex(); + p.setTemplateId(template.getTemplateId()); + List indexList = qcTemplateIndexService.selectQcTemplateIndexList(p); + return AjaxResult.success(indexList); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcDefect.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcDefect.java new file mode 100644 index 0000000..6920af1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcDefect.java @@ -0,0 +1,150 @@ +package com.ktg.mes.qc.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 常见缺陷对象 qc_defect + * + * @author yinjinlu + * @date 2022-05-19 + */ +public class QcDefect extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 缺陷ID */ + private Long defectId; + + /** 缺陷编码 */ + @Excel(name = "缺陷编码") + private String defectCode; + + /** 缺陷描述 */ + @Excel(name = "缺陷描述") + private String defectName; + + /** 检测项类型 */ + @Excel(name = "检测项类型") + private String indexType; + + /** 缺陷等级 */ + @Excel(name = "缺陷等级") + private String defectLevel; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setDefectId(Long defectId) + { + this.defectId = defectId; + } + + public Long getDefectId() + { + return defectId; + } + public void setDefectCode(String defectCode) + { + this.defectCode = defectCode; + } + + public String getDefectCode() + { + return defectCode; + } + public void setDefectName(String defectName) + { + this.defectName = defectName; + } + + public String getDefectName() + { + return defectName; + } + public void setIndexType(String indexType) + { + this.indexType = indexType; + } + + public String getIndexType() + { + return indexType; + } + public void setDefectLevel(String defectLevel) + { + this.defectLevel = defectLevel; + } + + public String getDefectLevel() + { + return defectLevel; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("defectId", getDefectId()) + .append("defectCode", getDefectCode()) + .append("defectName", getDefectName()) + .append("indexType", getIndexType()) + .append("defectLevel", getDefectLevel()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcDefectRecord.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcDefectRecord.java new file mode 100644 index 0000000..832f41b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcDefectRecord.java @@ -0,0 +1,178 @@ +package com.ktg.mes.qc.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 检验单缺陷记录对象 qc_defect_record + * + * @author yinjinlu + * @date 2022-08-30 + */ +public class QcDefectRecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 缺陷ID */ + private Long recordId; + + /** 检验单类型 */ + @Excel(name = "检验单类型") + private String qcType; + + /** 检验单ID */ + @Excel(name = "检验单ID") + private Long qcId; + + /** 检验单行ID */ + @Excel(name = "检验单行ID") + private Long lineId; + + /** 缺陷描述 */ + @Excel(name = "缺陷描述") + private String defectName; + + /** 缺陷等级 */ + @Excel(name = "缺陷等级") + private String defectLevel; + + /** 缺陷数量 */ + @Excel(name = "缺陷数量") + private Long defectQuantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setQcType(String qcType) + { + this.qcType = qcType; + } + + public String getQcType() + { + return qcType; + } + public void setQcId(Long qcId) + { + this.qcId = qcId; + } + + public Long getQcId() + { + return qcId; + } + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setDefectName(String defectName) + { + this.defectName = defectName; + } + + public String getDefectName() + { + return defectName; + } + public void setDefectLevel(String defectLevel) + { + this.defectLevel = defectLevel; + } + + public String getDefectLevel() + { + return defectLevel; + } + public void setDefectQuantity(Long defectQuantity) + { + this.defectQuantity = defectQuantity; + } + + public Long getDefectQuantity() + { + return defectQuantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("qcType", getQcType()) + .append("qcId", getQcId()) + .append("lineId", getLineId()) + .append("defectName", getDefectName()) + .append("defectLevel", getDefectLevel()) + .append("defectQuantity", getDefectQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIndex.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIndex.java new file mode 100644 index 0000000..ddd1fcc --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIndex.java @@ -0,0 +1,150 @@ +package com.ktg.mes.qc.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 检测项对象 qc_index + * + * @author yinjinlu + * @date 2022-05-17 + */ +public class QcIndex extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 检测项ID */ + private Long indexId; + + /** 检测项编码 */ + @Excel(name = "检测项编码") + private String indexCode; + + /** 检测项名称 */ + @Excel(name = "检测项名称") + private String indexName; + + /** 检测项类型 */ + @Excel(name = "检测项类型") + private String indexType; + + /** 检测工具 */ + @Excel(name = "检测工具") + private String qcTool; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setIndexId(Long indexId) + { + this.indexId = indexId; + } + + public Long getIndexId() + { + return indexId; + } + public void setIndexCode(String indexCode) + { + this.indexCode = indexCode; + } + + public String getIndexCode() + { + return indexCode; + } + public void setIndexName(String indexName) + { + this.indexName = indexName; + } + + public String getIndexName() + { + return indexName; + } + public void setIndexType(String indexType) + { + this.indexType = indexType; + } + + public String getIndexType() + { + return indexType; + } + public void setQcTool(String qcTool) + { + this.qcTool = qcTool; + } + + public String getQcTool() + { + return qcTool; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("indexId", getIndexId()) + .append("indexCode", getIndexCode()) + .append("indexName", getIndexName()) + .append("indexType", getIndexType()) + .append("qcTool", getQcTool()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIpqc.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIpqc.java new file mode 100644 index 0000000..79108ae --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIpqc.java @@ -0,0 +1,617 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 过程检验单对象 qc_ipqc + * + * @author yinjinlu + * @date 2022-08-29 + */ +public class QcIpqc extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 检验单ID */ + private Long ipqcId; + + /** 检验单编号 */ + @Excel(name = "检验单编号") + private String ipqcCode; + + /** 检验单名称 */ + @Excel(name = "检验单名称") + private String ipqcName; + + /** 检验类型 */ + @Excel(name = "检验类型") + private String ipqcType; + + /** 检验模板ID */ + @Excel(name = "检验模板ID") + private Long templateId; + + private Long sourceDocId; + + @Excel(name = "来源单据类型") + private String sourceDocType; + + @Excel(name = "来源单据编号") + private String sourceDocCode; + + private Long sourceLineId; + + /** 工单ID */ + @Excel(name = "工单ID") + private Long workorderId; + + /** 工单编码 */ + @Excel(name = "工单编码") + private String workorderCode; + + /** 工单名称 */ + @Excel(name = "工单名称") + private String workorderName; + + /** 任务ID */ + @Excel(name = "任务ID") + private Long taskId; + + /** 任务编号 */ + @Excel(name = "任务编号") + private String taskCode; + + /** 任务名称 */ + @Excel(name = "任务名称") + private String taskName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 检测数量 */ + @Excel(name = "检测数量") + private BigDecimal quantityCheck; + + /** 不合格数 */ + @Excel(name = "不合格数") + private BigDecimal quantityUnqualified; + + /** 合格品数量 */ + @Excel(name = "合格品数量") + private BigDecimal quantityQualified; + + /** 致命缺陷率 */ + @Excel(name = "致命缺陷率") + private BigDecimal crRate; + + /** 严重缺陷率 */ + @Excel(name = "严重缺陷率") + private BigDecimal majRate; + + /** 轻微缺陷率 */ + @Excel(name = "轻微缺陷率") + private BigDecimal minRate; + + /** 致命缺陷数量 */ + @Excel(name = "致命缺陷数量") + private BigDecimal crQuantity; + + /** 严重缺陷数量 */ + @Excel(name = "严重缺陷数量") + private BigDecimal majQuantity; + + /** 轻微缺陷数量 */ + @Excel(name = "轻微缺陷数量") + private BigDecimal minQuantity; + + /** 检测结果 */ + @Excel(name = "检测结果") + private String checkResult; + + /** 检测日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date inspectDate; + + /** 检测人员 */ + @Excel(name = "检测人员") + private String inspector; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setIpqcId(Long ipqcId) + { + this.ipqcId = ipqcId; + } + + public Long getIpqcId() + { + return ipqcId; + } + public void setIpqcCode(String ipqcCode) + { + this.ipqcCode = ipqcCode; + } + + public String getIpqcCode() + { + return ipqcCode; + } + public void setIpqcName(String ipqcName) + { + this.ipqcName = ipqcName; + } + + public String getIpqcName() + { + return ipqcName; + } + public void setIpqcType(String ipqcType) + { + this.ipqcType = ipqcType; + } + + public String getIpqcType() + { + return ipqcType; + } + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceLineId() { + return sourceLineId; + } + + public void setSourceLineId(Long sourceLineId) { + this.sourceLineId = sourceLineId; + } + + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setTaskName(String taskName) + { + this.taskName = taskName; + } + + public String getTaskName() + { + return taskName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityCheck(BigDecimal quantityCheck) + { + this.quantityCheck = quantityCheck; + } + + public BigDecimal getQuantityCheck() + { + return quantityCheck; + } + public void setQuantityUnqualified(BigDecimal quantityUnqualified) + { + this.quantityUnqualified = quantityUnqualified; + } + + public BigDecimal getQuantityUnqualified() + { + return quantityUnqualified; + } + public void setQuantityQualified(BigDecimal quantityQualified) + { + this.quantityQualified = quantityQualified; + } + + public BigDecimal getQuantityQualified() + { + return quantityQualified; + } + public void setCrRate(BigDecimal crRate) + { + this.crRate = crRate; + } + + public BigDecimal getCrRate() + { + return crRate; + } + public void setMajRate(BigDecimal majRate) + { + this.majRate = majRate; + } + + public BigDecimal getMajRate() + { + return majRate; + } + public void setMinRate(BigDecimal minRate) + { + this.minRate = minRate; + } + + public BigDecimal getMinRate() + { + return minRate; + } + public void setCrQuantity(BigDecimal crQuantity) + { + this.crQuantity = crQuantity; + } + + public BigDecimal getCrQuantity() + { + return crQuantity; + } + public void setMajQuantity(BigDecimal majQuantity) + { + this.majQuantity = majQuantity; + } + + public BigDecimal getMajQuantity() + { + return majQuantity; + } + public void setMinQuantity(BigDecimal minQuantity) + { + this.minQuantity = minQuantity; + } + + public BigDecimal getMinQuantity() + { + return minQuantity; + } + public void setCheckResult(String checkResult) + { + this.checkResult = checkResult; + } + + public String getCheckResult() + { + return checkResult; + } + public void setInspectDate(Date inspectDate) + { + this.inspectDate = inspectDate; + } + + public Date getInspectDate() + { + return inspectDate; + } + public void setInspector(String inspector) + { + this.inspector = inspector; + } + + public String getInspector() + { + return inspector; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("ipqcId", getIpqcId()) + .append("ipqcCode", getIpqcCode()) + .append("ipqcName", getIpqcName()) + .append("ipqcType", getIpqcType()) + .append("templateId", getTemplateId()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("workorderName", getWorkorderName()) + .append("taskId", getTaskId()) + .append("taskCode", getTaskCode()) + .append("taskName", getTaskName()) + .append("workstationId", getWorkstationId()) + .append("workstationCode", getWorkstationCode()) + .append("workstationName", getWorkstationName()) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityCheck", getQuantityCheck()) + .append("quantityUnqualified", getQuantityUnqualified()) + .append("quantityQualified", getQuantityQualified()) + .append("crRate", getCrRate()) + .append("majRate", getMajRate()) + .append("minRate", getMinRate()) + .append("crQuantity", getCrQuantity()) + .append("majQuantity", getMajQuantity()) + .append("minQuantity", getMinQuantity()) + .append("checkResult", getCheckResult()) + .append("inspectDate", getInspectDate()) + .append("inspector", getInspector()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIpqcLine.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIpqcLine.java new file mode 100644 index 0000000..e746e66 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIpqcLine.java @@ -0,0 +1,291 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 过程检验单行对象 qc_ipqc_line + * + * @author yinjinlu + * @date 2022-08-30 + */ +public class QcIpqcLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long lineId; + + /** 检验单ID */ + @Excel(name = "检验单ID") + private Long ipqcId; + + /** 检测项ID */ + @Excel(name = "检测项ID") + private Long indexId; + + /** 检测项编码 */ + @Excel(name = "检测项编码") + private String indexCode; + + /** 检测项名称 */ + @Excel(name = "检测项名称") + private String indexName; + + /** 检测项类型 */ + @Excel(name = "检测项类型") + private String indexType; + + /** 检测工具 */ + @Excel(name = "检测工具") + private String qcTool; + + /** 检测要求 */ + @Excel(name = "检测要求") + private String checkMethod; + + /** 标准值 */ + @Excel(name = "标准值") + private BigDecimal standerVal; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 误差上限 */ + @Excel(name = "误差上限") + private BigDecimal thresholdMax; + + /** 误差下限 */ + @Excel(name = "误差下限") + private BigDecimal thresholdMin; + + /** 致命缺陷数量 */ + @Excel(name = "致命缺陷数量") + private BigDecimal crQuantity; + + /** 严重缺陷数量 */ + @Excel(name = "严重缺陷数量") + private BigDecimal majQuantity; + + /** 轻微缺陷数量 */ + @Excel(name = "轻微缺陷数量") + private BigDecimal minQuantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setIpqcId(Long ipqcId) + { + this.ipqcId = ipqcId; + } + + public Long getIpqcId() + { + return ipqcId; + } + public void setIndexId(Long indexId) + { + this.indexId = indexId; + } + + public Long getIndexId() + { + return indexId; + } + public void setIndexCode(String indexCode) + { + this.indexCode = indexCode; + } + + public String getIndexCode() + { + return indexCode; + } + public void setIndexName(String indexName) + { + this.indexName = indexName; + } + + public String getIndexName() + { + return indexName; + } + public void setIndexType(String indexType) + { + this.indexType = indexType; + } + + public String getIndexType() + { + return indexType; + } + public void setQcTool(String qcTool) + { + this.qcTool = qcTool; + } + + public String getQcTool() + { + return qcTool; + } + public void setCheckMethod(String checkMethod) + { + this.checkMethod = checkMethod; + } + + public String getCheckMethod() + { + return checkMethod; + } + public void setStanderVal(BigDecimal standerVal) + { + this.standerVal = standerVal; + } + + public BigDecimal getStanderVal() + { + return standerVal; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setThresholdMax(BigDecimal thresholdMax) + { + this.thresholdMax = thresholdMax; + } + + public BigDecimal getThresholdMax() + { + return thresholdMax; + } + public void setThresholdMin(BigDecimal thresholdMin) + { + this.thresholdMin = thresholdMin; + } + + public BigDecimal getThresholdMin() + { + return thresholdMin; + } + public void setCrQuantity(BigDecimal crQuantity) + { + this.crQuantity = crQuantity; + } + + public BigDecimal getCrQuantity() + { + return crQuantity; + } + public void setMajQuantity(BigDecimal majQuantity) + { + this.majQuantity = majQuantity; + } + + public BigDecimal getMajQuantity() + { + return majQuantity; + } + public void setMinQuantity(BigDecimal minQuantity) + { + this.minQuantity = minQuantity; + } + + public BigDecimal getMinQuantity() + { + return minQuantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("ipqcId", getIpqcId()) + .append("indexId", getIndexId()) + .append("indexCode", getIndexCode()) + .append("indexName", getIndexName()) + .append("indexType", getIndexType()) + .append("qcTool", getQcTool()) + .append("checkMethod", getCheckMethod()) + .append("standerVal", getStanderVal()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("thresholdMax", getThresholdMax()) + .append("thresholdMin", getThresholdMin()) + .append("crQuantity", getCrQuantity()) + .append("majQuantity", getMajQuantity()) + .append("minQuantity", getMinQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIqc.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIqc.java new file mode 100644 index 0000000..1098d3d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIqc.java @@ -0,0 +1,555 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 来料检验单对象 qc_iqc + * + * @author yinjinlu + * @date 2022-05-19 + */ +public class QcIqc extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 来料检验单ID */ + private Long iqcId; + + /** 来料检验单编号 */ + @Excel(name = "来料检验单编号") + private String iqcCode; + + /** 来料检验单名称 */ + @Excel(name = "来料检验单名称") + private String iqcName; + + /** 检验模板ID */ + @Excel(name = "检验模板ID") + private Long templateId; + + private Long sourceDocId; + + @Excel(name = "来源单据类型") + private String sourceDocType; + + @Excel(name = "来源单据编号") + private String sourceDocCode; + + private Long sourceLineId; + + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 供应商批次号 */ + @Excel(name = "供应商批次号") + private String vendorBatch; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 最低检测数 */ + @Excel(name = "最低检测数") + private Long quantityMinCheck; + + /** 最大不合格数 */ + @Excel(name = "最大不合格数") + private Long quantityMaxUnqualified; + + /** 本次接收数量 */ + @Excel(name = "本次接收数量") + private BigDecimal quantityRecived; + + /** 本次检测数量 */ + @Excel(name = "本次检测数量") + private Long quantityCheck; + + /** 不合格数 */ + @Excel(name = "不合格数") + private Long quantityUnqualified; + + /** 致命缺陷率 */ + @Excel(name = "致命缺陷率") + private BigDecimal crRate; + + /** 严重缺陷率 */ + @Excel(name = "严重缺陷率") + private BigDecimal majRate; + + /** 轻微缺陷率 */ + @Excel(name = "轻微缺陷率") + private BigDecimal minRate; + + /** 致命缺陷数量 */ + @Excel(name = "致命缺陷数量") + private Long crQuantity; + + /** 严重缺陷数量 */ + @Excel(name = "严重缺陷数量") + private Long majQuantity; + + /** 轻微缺陷数量 */ + @Excel(name = "轻微缺陷数量") + private Long minQuantity; + + /** 检测结果 */ + @Excel(name = "检测结果") + private String checkResult; + + /** 来料日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "来料日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date reciveDate; + + /** 检测日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date inspectDate; + + /** 检测人员 */ + @Excel(name = "检测人员") + private String inspector; + + private String inspectorName; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setIqcId(Long iqcId) + { + this.iqcId = iqcId; + } + + public Long getIqcId() + { + return iqcId; + } + public void setIqcCode(String iqcCode) + { + this.iqcCode = iqcCode; + } + + public String getIqcCode() + { + return iqcCode; + } + public void setIqcName(String iqcName) + { + this.iqcName = iqcName; + } + + public String getIqcName() + { + return iqcName; + } + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceLineId() { + return sourceLineId; + } + + public void setSourceLineId(Long sourceLineId) { + this.sourceLineId = sourceLineId; + } + + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setVendorBatch(String vendorBatch) + { + this.vendorBatch = vendorBatch; + } + + public String getVendorBatch() + { + return vendorBatch; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityMinCheck(Long quantityMinCheck) + { + this.quantityMinCheck = quantityMinCheck; + } + + public Long getQuantityMinCheck() + { + return quantityMinCheck; + } + public void setQuantityMaxUnqualified(Long quantityMaxUnqualified) + { + this.quantityMaxUnqualified = quantityMaxUnqualified; + } + + public Long getQuantityMaxUnqualified() + { + return quantityMaxUnqualified; + } + public void setQuantityRecived(BigDecimal quantityRecived) + { + this.quantityRecived = quantityRecived; + } + + public BigDecimal getQuantityRecived() + { + return quantityRecived; + } + public void setQuantityCheck(Long quantityCheck) + { + this.quantityCheck = quantityCheck; + } + + public Long getQuantityCheck() + { + return quantityCheck; + } + public void setQuantityUnqualified(Long quantityUnqualified) + { + this.quantityUnqualified = quantityUnqualified; + } + + public Long getQuantityUnqualified() + { + return quantityUnqualified; + } + public void setCrRate(BigDecimal crRate) + { + this.crRate = crRate; + } + + public BigDecimal getCrRate() + { + return crRate; + } + public void setMajRate(BigDecimal majRate) + { + this.majRate = majRate; + } + + public BigDecimal getMajRate() + { + return majRate; + } + public void setMinRate(BigDecimal minRate) + { + this.minRate = minRate; + } + + public BigDecimal getMinRate() + { + return minRate; + } + public void setCrQuantity(Long crQuantity) + { + this.crQuantity = crQuantity; + } + + public Long getCrQuantity() + { + return crQuantity; + } + public void setMajQuantity(Long majQuantity) + { + this.majQuantity = majQuantity; + } + + public Long getMajQuantity() + { + return majQuantity; + } + public void setMinQuantity(Long minQuantity) + { + this.minQuantity = minQuantity; + } + + public Long getMinQuantity() + { + return minQuantity; + } + public void setCheckResult(String checkResult) + { + this.checkResult = checkResult; + } + + public String getCheckResult() + { + return checkResult; + } + public void setReciveDate(Date reciveDate) + { + this.reciveDate = reciveDate; + } + + public Date getReciveDate() + { + return reciveDate; + } + public void setInspectDate(Date inspectDate) + { + this.inspectDate = inspectDate; + } + + public Date getInspectDate() + { + return inspectDate; + } + public void setInspector(String inspector) + { + this.inspector = inspector; + } + + public String getInspector() + { + return inspector; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getInspectorName() { + return inspectorName; + } + + public void setInspectorName(String inspectorName) { + this.inspectorName = inspectorName; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "QcIqc{" + + "iqcId=" + iqcId + + ", iqcCode='" + iqcCode + '\'' + + ", iqcName='" + iqcName + '\'' + + ", templateId=" + templateId + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", vendorBatch='" + vendorBatch + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantityMinCheck=" + quantityMinCheck + + ", quantityMaxUnqualified=" + quantityMaxUnqualified + + ", quantityRecived=" + quantityRecived + + ", quantityCheck=" + quantityCheck + + ", quantityUnqualified=" + quantityUnqualified + + ", crRate=" + crRate + + ", majRate=" + majRate + + ", minRate=" + minRate + + ", crQuantity=" + crQuantity + + ", majQuantity=" + majQuantity + + ", minQuantity=" + minQuantity + + ", checkResult='" + checkResult + '\'' + + ", reciveDate=" + reciveDate + + ", inspectDate=" + inspectDate + + ", inspector='" + inspector + '\'' + + ", inspectorName='" + inspectorName + '\'' + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIqcLine.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIqcLine.java new file mode 100644 index 0000000..51862b1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcIqcLine.java @@ -0,0 +1,291 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 来料检验单行对象 qc_iqc_line + * + * @author yinjinlu + * @date 2022-05-19 + */ +public class QcIqcLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long lineId; + + /** 检验单ID */ + @Excel(name = "检验单ID") + private Long iqcId; + + /** 检测项ID */ + @Excel(name = "检测项ID") + private Long indexId; + + /** 检测项编码 */ + @Excel(name = "检测项编码") + private String indexCode; + + /** 检测项名称 */ + @Excel(name = "检测项名称") + private String indexName; + + /** 检测项类型 */ + @Excel(name = "检测项类型") + private String indexType; + + /** 检测工具 */ + @Excel(name = "检测工具") + private String qcTool; + + /** 检测要求 */ + @Excel(name = "检测要求") + private String checkMethod; + + /** 标准值 */ + @Excel(name = "标准值") + private BigDecimal standerVal; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 误差上限 */ + @Excel(name = "误差上限") + private BigDecimal thresholdMax; + + /** 误差下限 */ + @Excel(name = "误差下限") + private BigDecimal thresholdMin; + + /** 致命缺陷数量 */ + @Excel(name = "致命缺陷数量") + private Long crQuantity; + + /** 严重缺陷数量 */ + @Excel(name = "严重缺陷数量") + private Long majQuantity; + + /** 轻微缺陷数量 */ + @Excel(name = "轻微缺陷数量") + private Long minQuantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setIqcId(Long iqcId) + { + this.iqcId = iqcId; + } + + public Long getIqcId() + { + return iqcId; + } + public void setIndexId(Long indexId) + { + this.indexId = indexId; + } + + public Long getIndexId() + { + return indexId; + } + public void setIndexCode(String indexCode) + { + this.indexCode = indexCode; + } + + public String getIndexCode() + { + return indexCode; + } + public void setIndexName(String indexName) + { + this.indexName = indexName; + } + + public String getIndexName() + { + return indexName; + } + public void setIndexType(String indexType) + { + this.indexType = indexType; + } + + public String getIndexType() + { + return indexType; + } + public void setQcTool(String qcTool) + { + this.qcTool = qcTool; + } + + public String getQcTool() + { + return qcTool; + } + public void setCheckMethod(String checkMethod) + { + this.checkMethod = checkMethod; + } + + public String getCheckMethod() + { + return checkMethod; + } + public void setStanderVal(BigDecimal standerVal) + { + this.standerVal = standerVal; + } + + public BigDecimal getStanderVal() + { + return standerVal; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setThresholdMax(BigDecimal thresholdMax) + { + this.thresholdMax = thresholdMax; + } + + public BigDecimal getThresholdMax() + { + return thresholdMax; + } + public void setThresholdMin(BigDecimal thresholdMin) + { + this.thresholdMin = thresholdMin; + } + + public BigDecimal getThresholdMin() + { + return thresholdMin; + } + public void setCrQuantity(Long crQuantity) + { + this.crQuantity = crQuantity; + } + + public Long getCrQuantity() + { + return crQuantity; + } + public void setMajQuantity(Long majQuantity) + { + this.majQuantity = majQuantity; + } + + public Long getMajQuantity() + { + return majQuantity; + } + public void setMinQuantity(Long minQuantity) + { + this.minQuantity = minQuantity; + } + + public Long getMinQuantity() + { + return minQuantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("iqcId", getIqcId()) + .append("indexId", getIndexId()) + .append("indexCode", getIndexCode()) + .append("indexName", getIndexName()) + .append("indexType", getIndexType()) + .append("qcTool", getQcTool()) + .append("checkMethod", getCheckMethod()) + .append("standerVal", getStanderVal()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("thresholdMax", getThresholdMax()) + .append("thresholdMin", getThresholdMin()) + .append("crQuantity", getCrQuantity()) + .append("majQuantity", getMajQuantity()) + .append("minQuantity", getMinQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcMobParam.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcMobParam.java new file mode 100644 index 0000000..dc3c16c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcMobParam.java @@ -0,0 +1,114 @@ +package com.ktg.mes.qc.domain; + +import com.ktg.common.core.domain.BaseEntity; + +/** + * 专门用于移动端质量管理各种数据查询的参数传递 + */ +public class QcMobParam extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 检验单的ID,可以是IQC检验单、PQC过程检验单、OQC出货检验单 + */ + private Long qcId; + + /** + * 对应的物料/产品ID + */ + private Long itemId; + + /** + * 对应的物料/产品编码 + */ + private String itemCode; + + /** + * 对应的物料/产品名称 + */ + private String itemName; + + /** + * 检验类型:IQC、FIRST、FINAL、PATROL、CHECK、SELF、FQC、OQC + */ + private String qcType; + + /** + * 检验模板ID + */ + private String templateId; + + /** + * 检验单行ID + */ + private Long lineId; + + public Long getQcId() { + return qcId; + } + + public void setQcId(Long qcId) { + this.qcId = qcId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getQcType() { + return qcType; + } + + public void setQcType(String qcType) { + this.qcType = qcType; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public Long getLineId() { + return lineId; + } + + public void setLineId(Long lineId) { + this.lineId = lineId; + } + + @Override + public String toString() { + return "QcMobParam{" + + "qcId=" + qcId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", qcType='" + qcType + '\'' + + ", templateId='" + templateId + '\'' + + ", lineId=" + lineId + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcMobResult.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcMobResult.java new file mode 100644 index 0000000..37956e9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcMobResult.java @@ -0,0 +1,7 @@ +package com.ktg.mes.qc.domain; + +import com.ktg.common.core.domain.BaseEntity; + +public class QcMobResult extends BaseEntity { + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcOqc.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcOqc.java new file mode 100644 index 0000000..2f21f77 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcOqc.java @@ -0,0 +1,548 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 出货检验单对象 qc_oqc + * + * @author yinjinlu + * @date 2022-08-31 + */ +public class QcOqc extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 出货检验单ID */ + private Long oqcId; + + /** 出货检验单编号 */ + @Excel(name = "出货检验单编号") + private String oqcCode; + + /** 出货检验单名称 */ + @Excel(name = "出货检验单名称") + private String oqcName; + + /** 检验模板ID */ + @Excel(name = "检验模板ID") + private Long templateId; + + private Long sourceDocId; + + @Excel(name = "来源单据类型") + private String sourceDocType; + + @Excel(name = "来源单据编号") + private String sourceDocCode; + + private Long sourceLineId; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 最低检测数 */ + @Excel(name = "最低检测数") + private BigDecimal quantityMinCheck; + + /** 最大不合格数 */ + @Excel(name = "最大不合格数") + private BigDecimal quantityMaxUnqualified; + + /** 发货数量 */ + @Excel(name = "发货数量") + private BigDecimal quantityOut; + + /** 本次检测数量 */ + @Excel(name = "本次检测数量") + private BigDecimal quantityCheck; + + /** 不合格数 */ + @Excel(name = "不合格数") + private BigDecimal quantityUnqualified; + + /** 合格数量 */ + @Excel(name = "合格数量") + private BigDecimal quantityQuanlified; + + /** 致命缺陷率 */ + @Excel(name = "致命缺陷率") + private BigDecimal crRate; + + /** 严重缺陷率 */ + @Excel(name = "严重缺陷率") + private BigDecimal majRate; + + /** 轻微缺陷率 */ + @Excel(name = "轻微缺陷率") + private BigDecimal minRate; + + /** 致命缺陷数量 */ + @Excel(name = "致命缺陷数量") + private BigDecimal crQuantity; + + /** 严重缺陷数量 */ + @Excel(name = "严重缺陷数量") + private BigDecimal majQuantity; + + /** 轻微缺陷数量 */ + @Excel(name = "轻微缺陷数量") + private BigDecimal minQuantity; + + /** 检测结果 */ + @Excel(name = "检测结果") + private String checkResult; + + /** 出货日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "出货日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date outDate; + + /** 检测日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date inspectDate; + + /** 检测人员 */ + @Excel(name = "检测人员") + private String inspector; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setOqcId(Long oqcId) + { + this.oqcId = oqcId; + } + + public Long getOqcId() + { + return oqcId; + } + public void setOqcCode(String oqcCode) + { + this.oqcCode = oqcCode; + } + + public String getOqcCode() + { + return oqcCode; + } + public void setOqcName(String oqcName) + { + this.oqcName = oqcName; + } + + public String getOqcName() + { + return oqcName; + } + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceLineId() { + return sourceLineId; + } + + public void setSourceLineId(Long sourceLineId) { + this.sourceLineId = sourceLineId; + } + + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityMinCheck(BigDecimal quantityMinCheck) + { + this.quantityMinCheck = quantityMinCheck; + } + + public BigDecimal getQuantityMinCheck() + { + return quantityMinCheck; + } + public void setQuantityMaxUnqualified(BigDecimal quantityMaxUnqualified) + { + this.quantityMaxUnqualified = quantityMaxUnqualified; + } + + public BigDecimal getQuantityMaxUnqualified() + { + return quantityMaxUnqualified; + } + public void setQuantityOut(BigDecimal quantityOut) + { + this.quantityOut = quantityOut; + } + + public BigDecimal getQuantityOut() + { + return quantityOut; + } + public void setQuantityCheck(BigDecimal quantityCheck) + { + this.quantityCheck = quantityCheck; + } + + public BigDecimal getQuantityCheck() + { + return quantityCheck; + } + public void setQuantityUnqualified(BigDecimal quantityUnqualified) + { + this.quantityUnqualified = quantityUnqualified; + } + + public BigDecimal getQuantityUnqualified() + { + return quantityUnqualified; + } + public void setQuantityQuanlified(BigDecimal quantityQuanlified) + { + this.quantityQuanlified = quantityQuanlified; + } + + public BigDecimal getQuantityQuanlified() + { + return quantityQuanlified; + } + public void setCrRate(BigDecimal crRate) + { + this.crRate = crRate; + } + + public BigDecimal getCrRate() + { + return crRate; + } + public void setMajRate(BigDecimal majRate) + { + this.majRate = majRate; + } + + public BigDecimal getMajRate() + { + return majRate; + } + public void setMinRate(BigDecimal minRate) + { + this.minRate = minRate; + } + + public BigDecimal getMinRate() + { + return minRate; + } + public void setCrQuantity(BigDecimal crQuantity) + { + this.crQuantity = crQuantity; + } + + public BigDecimal getCrQuantity() + { + return crQuantity; + } + public void setMajQuantity(BigDecimal majQuantity) + { + this.majQuantity = majQuantity; + } + + public BigDecimal getMajQuantity() + { + return majQuantity; + } + public void setMinQuantity(BigDecimal minQuantity) + { + this.minQuantity = minQuantity; + } + + public BigDecimal getMinQuantity() + { + return minQuantity; + } + public void setCheckResult(String checkResult) + { + this.checkResult = checkResult; + } + + public String getCheckResult() + { + return checkResult; + } + public void setOutDate(Date outDate) + { + this.outDate = outDate; + } + + public Date getOutDate() + { + return outDate; + } + public void setInspectDate(Date inspectDate) + { + this.inspectDate = inspectDate; + } + + public Date getInspectDate() + { + return inspectDate; + } + public void setInspector(String inspector) + { + this.inspector = inspector; + } + + public String getInspector() + { + return inspector; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("oqcId", getOqcId()) + .append("oqcCode", getOqcCode()) + .append("oqcName", getOqcName()) + .append("templateId", getTemplateId()) + .append("clientId", getClientId()) + .append("clientCode", getClientCode()) + .append("clientName", getClientName()) + .append("batchCode", getBatchCode()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityMinCheck", getQuantityMinCheck()) + .append("quantityMaxUnqualified", getQuantityMaxUnqualified()) + .append("quantityOut", getQuantityOut()) + .append("quantityCheck", getQuantityCheck()) + .append("quantityUnqualified", getQuantityUnqualified()) + .append("quantityQuanlified", getQuantityQuanlified()) + .append("crRate", getCrRate()) + .append("majRate", getMajRate()) + .append("minRate", getMinRate()) + .append("crQuantity", getCrQuantity()) + .append("majQuantity", getMajQuantity()) + .append("minQuantity", getMinQuantity()) + .append("checkResult", getCheckResult()) + .append("outDate", getOutDate()) + .append("inspectDate", getInspectDate()) + .append("inspector", getInspector()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcOqcLine.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcOqcLine.java new file mode 100644 index 0000000..7cd5835 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcOqcLine.java @@ -0,0 +1,291 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 出货检验单行对象 qc_oqc_line + * + * @author yinjinlu + * @date 2022-09-01 + */ +public class QcOqcLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long lineId; + + /** 检验单ID */ + @Excel(name = "检验单ID") + private Long oqcId; + + /** 检测项ID */ + @Excel(name = "检测项ID") + private Long indexId; + + /** 检测项编码 */ + @Excel(name = "检测项编码") + private String indexCode; + + /** 检测项名称 */ + @Excel(name = "检测项名称") + private String indexName; + + /** 检测项类型 */ + @Excel(name = "检测项类型") + private String indexType; + + /** 检测工具 */ + @Excel(name = "检测工具") + private String qcTool; + + /** 检测要求 */ + @Excel(name = "检测要求") + private String checkMethod; + + /** 标准值 */ + @Excel(name = "标准值") + private BigDecimal standerVal; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 误差上限 */ + @Excel(name = "误差上限") + private BigDecimal thresholdMax; + + /** 误差下限 */ + @Excel(name = "误差下限") + private BigDecimal thresholdMin; + + /** 致命缺陷数量 */ + @Excel(name = "致命缺陷数量") + private BigDecimal crQuantity; + + /** 严重缺陷数量 */ + @Excel(name = "严重缺陷数量") + private BigDecimal majQuantity; + + /** 轻微缺陷数量 */ + @Excel(name = "轻微缺陷数量") + private BigDecimal minQuantity; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setOqcId(Long oqcId) + { + this.oqcId = oqcId; + } + + public Long getOqcId() + { + return oqcId; + } + public void setIndexId(Long indexId) + { + this.indexId = indexId; + } + + public Long getIndexId() + { + return indexId; + } + public void setIndexCode(String indexCode) + { + this.indexCode = indexCode; + } + + public String getIndexCode() + { + return indexCode; + } + public void setIndexName(String indexName) + { + this.indexName = indexName; + } + + public String getIndexName() + { + return indexName; + } + public void setIndexType(String indexType) + { + this.indexType = indexType; + } + + public String getIndexType() + { + return indexType; + } + public void setQcTool(String qcTool) + { + this.qcTool = qcTool; + } + + public String getQcTool() + { + return qcTool; + } + public void setCheckMethod(String checkMethod) + { + this.checkMethod = checkMethod; + } + + public String getCheckMethod() + { + return checkMethod; + } + public void setStanderVal(BigDecimal standerVal) + { + this.standerVal = standerVal; + } + + public BigDecimal getStanderVal() + { + return standerVal; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setThresholdMax(BigDecimal thresholdMax) + { + this.thresholdMax = thresholdMax; + } + + public BigDecimal getThresholdMax() + { + return thresholdMax; + } + public void setThresholdMin(BigDecimal thresholdMin) + { + this.thresholdMin = thresholdMin; + } + + public BigDecimal getThresholdMin() + { + return thresholdMin; + } + public void setCrQuantity(BigDecimal crQuantity) + { + this.crQuantity = crQuantity; + } + + public BigDecimal getCrQuantity() + { + return crQuantity; + } + public void setMajQuantity(BigDecimal majQuantity) + { + this.majQuantity = majQuantity; + } + + public BigDecimal getMajQuantity() + { + return majQuantity; + } + public void setMinQuantity(BigDecimal minQuantity) + { + this.minQuantity = minQuantity; + } + + public BigDecimal getMinQuantity() + { + return minQuantity; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("oqcId", getOqcId()) + .append("indexId", getIndexId()) + .append("indexCode", getIndexCode()) + .append("indexName", getIndexName()) + .append("indexType", getIndexType()) + .append("qcTool", getQcTool()) + .append("checkMethod", getCheckMethod()) + .append("standerVal", getStanderVal()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("thresholdMax", getThresholdMax()) + .append("thresholdMin", getThresholdMin()) + .append("crQuantity", getCrQuantity()) + .append("majQuantity", getMajQuantity()) + .append("minQuantity", getMinQuantity()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcPendingInspect.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcPendingInspect.java new file mode 100644 index 0000000..0c7be04 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcPendingInspect.java @@ -0,0 +1,399 @@ +package com.ktg.mes.qc.domain; + +import com.ktg.common.core.domain.BaseEntity; + +public class QcPendingInspect extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long sourceDocId; + + private String sourceDocCode; + + private Long sourceLineId; + + private String recordTime; + + private String qcType; + + private Long itemId; + + private String itemCode; + + private String itemName; + + private String specification; + + private String unitOfMeasure; + + private String quantityUncheck; + + private Long workOrderId; + + private String workOrderCode; + + private String workOrderName; + + private Long workstationId; + + private String workstationCode; + + private String workstationName; + + private Long vendorClientId; + + private String vendorClientCode; + + private String vendorClientName; + + private String vendorClientNick; + + private String batchCode; + + private Long taskId; + + private String taskCode; + + private String taskName; + + private Long warehouseId; + + private String warehouseCode; + + private String warehouseName; + + private Long locationId; + + private String locationCode; + + private String locationName; + + private Long areaId; + + private String areaCode; + + private String areaName; + + private String address; + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceLineId() { + return sourceLineId; + } + + public void setSourceLineId(Long sourceLineId) { + this.sourceLineId = sourceLineId; + } + + public String getRecordTime() { + return recordTime; + } + + public void setRecordTime(String recordTime) { + this.recordTime = recordTime; + } + + public String getQcType() { + return qcType; + } + + public void setQcType(String qcType) { + this.qcType = qcType; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getQuantityUncheck() { + return quantityUncheck; + } + + public void setQuantityUncheck(String quantityUncheck) { + this.quantityUncheck = quantityUncheck; + } + + public Long getWorkOrderId() { + return workOrderId; + } + + public void setWorkOrderId(Long workOrderId) { + this.workOrderId = workOrderId; + } + + public String getWorkOrderCode() { + return workOrderCode; + } + + public void setWorkOrderCode(String workOrderCode) { + this.workOrderCode = workOrderCode; + } + + public String getWorkOrderName() { + return workOrderName; + } + + public void setWorkOrderName(String workOrderName) { + this.workOrderName = workOrderName; + } + + public Long getWorkstationId() { + return workstationId; + } + + public void setWorkstationId(Long workstationId) { + this.workstationId = workstationId; + } + + public String getWorkstationCode() { + return workstationCode; + } + + public void setWorkstationCode(String workstationCode) { + this.workstationCode = workstationCode; + } + + public String getWorkstationName() { + return workstationName; + } + + public void setWorkstationName(String workstationName) { + this.workstationName = workstationName; + } + + public Long getVendorClientId() { + return vendorClientId; + } + + public void setVendorClientId(Long vendorClientId) { + this.vendorClientId = vendorClientId; + } + + public String getVendorClientCode() { + return vendorClientCode; + } + + public void setVendorClientCode(String vendorClientCode) { + this.vendorClientCode = vendorClientCode; + } + + public String getVendorClientName() { + return vendorClientName; + } + + public void setVendorClientName(String vendorClientName) { + this.vendorClientName = vendorClientName; + } + + public String getVendorClientNick() { + return vendorClientNick; + } + + public void setVendorClientNick(String vendorClientNick) { + this.vendorClientNick = vendorClientNick; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "QcPendingInspect{" + + "sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceLineId=" + sourceLineId + + ", recordTime='" + recordTime + '\'' + + ", qcType='" + qcType + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantityUncheck='" + quantityUncheck + '\'' + + ", workOrderId=" + workOrderId + + ", workOrderCode='" + workOrderCode + '\'' + + ", workOrderName='" + workOrderName + '\'' + + ", workstationId=" + workstationId + + ", workstationCode='" + workstationCode + '\'' + + ", workstationName='" + workstationName + '\'' + + ", vendorClientId=" + vendorClientId + + ", vendorClientCode='" + vendorClientCode + '\'' + + ", vendorClientName='" + vendorClientName + '\'' + + ", vendorClientNick='" + vendorClientNick + '\'' + + ", batchCode='" + batchCode + '\'' + + ", taskId=" + taskId + + ", taskCode='" + taskCode + '\'' + + ", taskName='" + taskName + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", address='" + address + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplate.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplate.java new file mode 100644 index 0000000..6b6c2eb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplate.java @@ -0,0 +1,177 @@ +package com.ktg.mes.qc.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import java.util.Arrays; + +/** + * 检测模板对象 qc_template + * + * @author yinjinlu + * @date 2022-05-17 + */ +public class QcTemplate extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 检测模板ID */ + private Long templateId; + + /** 检测模板编号 */ + @Excel(name = "检测模板编号") + private String templateCode; + + /** 检测模板名称 */ + @Excel(name = "检测模板名称") + private String templateName; + + /** 检测种类 */ + @Excel(name = "检测种类") + private String qcTypes; + + /** + * 用来传递检测种类参数 + */ + private String[] qcTypesParam; + + /** + * 物料ID + */ + private Long itemId; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + public void setTemplateCode(String templateCode) + { + this.templateCode = templateCode; + } + + public String getTemplateCode() + { + return templateCode; + } + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + public String getTemplateName() + { + return templateName; + } + public void setQcTypes(String qcTypes) + { + this.qcTypes = qcTypes; + } + + public String getQcTypes() + { + return qcTypes; + } + + public String[] getQcTypesParam() { + return qcTypesParam; + } + + public void setQcTypesParam(String[] qcTypesParam) { + this.qcTypesParam = qcTypesParam; + } + + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "QcTemplate{" + + "templateId=" + templateId + + ", templateCode='" + templateCode + '\'' + + ", templateName='" + templateName + '\'' + + ", qcTypes='" + qcTypes + '\'' + + ", qcTypesParam=" + Arrays.toString(qcTypesParam) + + ", itemId=" + itemId + + ", enableFlag='" + enableFlag + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateIndex.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateIndex.java new file mode 100644 index 0000000..1b2d523 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateIndex.java @@ -0,0 +1,263 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 检测模板-检测项对象 qc_template_index + * + * @author yinjinlu + * @date 2022-05-18 + */ +public class QcTemplateIndex extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 检测模板ID */ + @Excel(name = "检测模板ID") + private Long templateId; + + /** 检测项ID */ + @Excel(name = "检测项ID") + private Long indexId; + + /** 检测项编码 */ + @Excel(name = "检测项编码") + private String indexCode; + + /** 检测项名称 */ + @Excel(name = "检测项名称") + private String indexName; + + /** 检测项类型 */ + @Excel(name = "检测项类型") + private String indexType; + + /** 检测工具 */ + @Excel(name = "检测工具") + private String qcTool; + + /** 检测方法 */ + @Excel(name = "检测方法") + private String checkMethod; + + /** 标准值 */ + @Excel(name = "标准值") + private BigDecimal standerVal; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 误差上限 */ + @Excel(name = "误差上限") + private BigDecimal thresholdMax; + + /** 误差下限 */ + @Excel(name = "误差下限") + private BigDecimal thresholdMin; + + /** 说明图 */ + @Excel(name = "说明图") + private String docUrl; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + public void setIndexId(Long indexId) + { + this.indexId = indexId; + } + + public Long getIndexId() + { + return indexId; + } + public void setIndexCode(String indexCode) + { + this.indexCode = indexCode; + } + + public String getIndexCode() + { + return indexCode; + } + public void setIndexName(String indexName) + { + this.indexName = indexName; + } + + public String getIndexName() + { + return indexName; + } + public void setIndexType(String indexType) + { + this.indexType = indexType; + } + + public String getIndexType() + { + return indexType; + } + public void setQcTool(String qcTool) + { + this.qcTool = qcTool; + } + + public String getQcTool() + { + return qcTool; + } + public void setCheckMethod(String checkMethod) + { + this.checkMethod = checkMethod; + } + + public String getCheckMethod() + { + return checkMethod; + } + public void setStanderVal(BigDecimal standerVal) + { + this.standerVal = standerVal; + } + + public BigDecimal getStanderVal() + { + return standerVal; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setThresholdMax(BigDecimal thresholdMax) + { + this.thresholdMax = thresholdMax; + } + + public BigDecimal getThresholdMax() + { + return thresholdMax; + } + public void setThresholdMin(BigDecimal thresholdMin) + { + this.thresholdMin = thresholdMin; + } + + public BigDecimal getThresholdMin() + { + return thresholdMin; + } + public void setDocUrl(String docUrl) + { + this.docUrl = docUrl; + } + + public String getDocUrl() + { + return docUrl; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("templateId", getTemplateId()) + .append("indexId", getIndexId()) + .append("indexCode", getIndexCode()) + .append("indexName", getIndexName()) + .append("indexType", getIndexType()) + .append("qcTool", getQcTool()) + .append("checkMethod", getCheckMethod()) + .append("standerVal", getStanderVal()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("thresholdMax", getThresholdMax()) + .append("thresholdMin", getThresholdMin()) + .append("docUrl", getDocUrl()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java new file mode 100644 index 0000000..50eda72 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java @@ -0,0 +1,249 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 检测模板-产品对象 qc_template_product + * + * @author yinjinlu + * @date 2022-05-18 + */ +public class QcTemplateProduct extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 检测模板ID */ + @Excel(name = "检测模板ID") + private Long templateId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 最低检测数 */ + @Excel(name = "最低检测数") + private Long quantityCheck; + + /** 最大不合格数 */ + @Excel(name = "最大不合格数") + private Long quantityUnqualified; + + /** 最大致命缺陷率 */ + @Excel(name = "最大致命缺陷率") + private BigDecimal crRate; + + /** 最大严重缺陷率 */ + @Excel(name = "最大严重缺陷率") + private BigDecimal majRate; + + /** 最大轻微缺陷率 */ + @Excel(name = "最大轻微缺陷率") + private BigDecimal minRate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityCheck(Long quantityCheck) + { + this.quantityCheck = quantityCheck; + } + + public Long getQuantityCheck() + { + return quantityCheck; + } + public void setQuantityUnqualified(Long quantityUnqualified) + { + this.quantityUnqualified = quantityUnqualified; + } + + public Long getQuantityUnqualified() + { + return quantityUnqualified; + } + public void setCrRate(BigDecimal crRate) + { + this.crRate = crRate; + } + + public BigDecimal getCrRate() + { + return crRate; + } + public void setMajRate(BigDecimal majRate) + { + this.majRate = majRate; + } + + public BigDecimal getMajRate() + { + return majRate; + } + public void setMinRate(BigDecimal minRate) + { + this.minRate = minRate; + } + + public BigDecimal getMinRate() + { + return minRate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("templateId", getTemplateId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityCheck", getQuantityCheck()) + .append("quantityUnqualified", getQuantityUnqualified()) + .append("crRate", getCrRate()) + .append("majRate", getMajRate()) + .append("minRate", getMinRate()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/ValidList.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/ValidList.java new file mode 100644 index 0000000..ad50a5f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/ValidList.java @@ -0,0 +1,133 @@ +package com.ktg.mes.qc.domain; + +import javax.validation.Valid; +import java.util.*; +public class ValidList implements List { + + @Valid + private List list = new LinkedList<>(); + + @Override + public int size() { + return list.size(); + } + + @Override + public boolean isEmpty() { + return list.isEmpty(); + } + + @Override + public boolean contains(Object o) { + return list.contains(o); + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public Object[] toArray() { + return list.toArray(); + } + + @Override + public T[] toArray(T[] a) { + return list.toArray(a); + } + + @Override + public boolean add(E e) { + return list.add(e); + } + + @Override + public boolean remove(Object o) { + return list.remove(o); + } + + @Override + public boolean containsAll(Collection c) { + return list.containsAll(c); + } + + @Override + public boolean addAll(Collection c) { + return list.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + return list.addAll(index, c); + } + + @Override + public boolean removeAll(Collection c) { + return list.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return list.retainAll(c); + } + + @Override + public void clear() { + list.clear(); + } + + @Override + public E get(int index) { + return list.get(index); + } + + @Override + public E set(int index, E element) { + return list.set(index, element); + } + + @Override + public void add(int index, E element) { + list.add(index, element); + } + + @Override + public E remove(int index) { + return list.remove(index); + } + + @Override + public int indexOf(Object o) { + return list.indexOf(o); + } + + @Override + public int lastIndexOf(Object o) { + return list.lastIndexOf(o); + } + + @Override + public ListIterator listIterator() { + return list.listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return list.listIterator(index); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return list.subList(fromIndex, toIndex); + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcDefectMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcDefectMapper.java new file mode 100644 index 0000000..fb3c62a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcDefectMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcDefect; + +/** + * 常见缺陷Mapper接口 + * + * @author yinjinlu + * @date 2022-05-19 + */ +public interface QcDefectMapper +{ + /** + * 查询常见缺陷 + * + * @param defectId 常见缺陷主键 + * @return 常见缺陷 + */ + public QcDefect selectQcDefectByDefectId(Long defectId); + + /** + * 查询常见缺陷列表 + * + * @param qcDefect 常见缺陷 + * @return 常见缺陷集合 + */ + public List selectQcDefectList(QcDefect qcDefect); + + /** + * 新增常见缺陷 + * + * @param qcDefect 常见缺陷 + * @return 结果 + */ + public int insertQcDefect(QcDefect qcDefect); + + /** + * 修改常见缺陷 + * + * @param qcDefect 常见缺陷 + * @return 结果 + */ + public int updateQcDefect(QcDefect qcDefect); + + /** + * 删除常见缺陷 + * + * @param defectId 常见缺陷主键 + * @return 结果 + */ + public int deleteQcDefectByDefectId(Long defectId); + + /** + * 批量删除常见缺陷 + * + * @param defectIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcDefectByDefectIds(Long[] defectIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcDefectRecordMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcDefectRecordMapper.java new file mode 100644 index 0000000..066506e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcDefectRecordMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcDefectRecord; + +/** + * 检验单缺陷记录Mapper接口 + * + * @author yinjinlu + * @date 2022-08-30 + */ +public interface QcDefectRecordMapper +{ + /** + * 查询检验单缺陷记录 + * + * @param recordId 检验单缺陷记录主键 + * @return 检验单缺陷记录 + */ + public QcDefectRecord selectQcDefectRecordByRecordId(Long recordId); + + /** + * 查询检验单缺陷记录列表 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 检验单缺陷记录集合 + */ + public List selectQcDefectRecordList(QcDefectRecord qcDefectRecord); + + /** + * 新增检验单缺陷记录 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 结果 + */ + public int insertQcDefectRecord(QcDefectRecord qcDefectRecord); + + /** + * 修改检验单缺陷记录 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 结果 + */ + public int updateQcDefectRecord(QcDefectRecord qcDefectRecord); + + /** + * 删除检验单缺陷记录 + * + * @param recordId 检验单缺陷记录主键 + * @return 结果 + */ + public int deleteQcDefectRecordByRecordId(Long recordId); + + /** + * 批量删除检验单缺陷记录 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcDefectRecordByRecordIds(Long[] recordIds); + + /** + * 根据检测单ID和对应的类型删除 + * @param qcDefectRecord + * @return + */ + public int deleteByQcIdAndType(QcDefectRecord qcDefectRecord); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIndexMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIndexMapper.java new file mode 100644 index 0000000..e27e1f1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIndexMapper.java @@ -0,0 +1,66 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIndex; + +/** + * 检测项Mapper接口 + * + * @author yinjinlu + * @date 2022-05-17 + */ +public interface QcIndexMapper +{ + /** + * 查询检测项 + * + * @param indexId 检测项主键 + * @return 检测项 + */ + public QcIndex selectQcIndexByIndexId(Long indexId); + + /** + * 查询检测项列表 + * + * @param qcIndex 检测项 + * @return 检测项集合 + */ + public List selectQcIndexList(QcIndex qcIndex); + + + public QcIndex checkIndexCodeUnique(QcIndex qcIndex); + public QcIndex checkIndexNameUnique(QcIndex qcIndex); + + + /** + * 新增检测项 + * + * @param qcIndex 检测项 + * @return 结果 + */ + public int insertQcIndex(QcIndex qcIndex); + + /** + * 修改检测项 + * + * @param qcIndex 检测项 + * @return 结果 + */ + public int updateQcIndex(QcIndex qcIndex); + + /** + * 删除检测项 + * + * @param indexId 检测项主键 + * @return 结果 + */ + public int deleteQcIndexByIndexId(Long indexId); + + /** + * 批量删除检测项 + * + * @param indexIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcIndexByIndexIds(Long[] indexIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIpqcLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIpqcLineMapper.java new file mode 100644 index 0000000..7d3c49e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIpqcLineMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIpqcLine; + +/** + * 过程检验单行Mapper接口 + * + * @author yinjinlu + * @date 2022-08-30 + */ +public interface QcIpqcLineMapper +{ + /** + * 查询过程检验单行 + * + * @param lineId 过程检验单行主键 + * @return 过程检验单行 + */ + public QcIpqcLine selectQcIpqcLineByLineId(Long lineId); + + /** + * 查询过程检验单行列表 + * + * @param qcIpqcLine 过程检验单行 + * @return 过程检验单行集合 + */ + public List selectQcIpqcLineList(QcIpqcLine qcIpqcLine); + + /** + * 新增过程检验单行 + * + * @param qcIpqcLine 过程检验单行 + * @return 结果 + */ + public int insertQcIpqcLine(QcIpqcLine qcIpqcLine); + + /** + * 修改过程检验单行 + * + * @param qcIpqcLine 过程检验单行 + * @return 结果 + */ + public int updateQcIpqcLine(QcIpqcLine qcIpqcLine); + + /** + * 根据缺陷记录更新过程检验单行上的缺陷数量 + * @param qcIpqcLine + * @return + */ + public int updateCrMajMinQuantity(QcIpqcLine qcIpqcLine); + + /** + * 删除过程检验单行 + * + * @param lineId 过程检验单行主键 + * @return 结果 + */ + public int deleteQcIpqcLineByLineId(Long lineId); + + /** + * 批量删除过程检验单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcIpqcLineByLineIds(Long[] lineIds); + + /*** + * 根据检验单头ID删除所有行信息 + * @param ipqcId + * @return + */ + public int deleteByIpqcId(Long ipqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIpqcMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIpqcMapper.java new file mode 100644 index 0000000..4517153 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIpqcMapper.java @@ -0,0 +1,83 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIpqc; + +/** + * 过程检验单Mapper接口 + * + * @author yinjinlu + * @date 2022-08-29 + */ +public interface QcIpqcMapper +{ + /** + * 查询过程检验单 + * + * @param ipqcId 过程检验单主键 + * @return 过程检验单 + */ + public QcIpqc selectQcIpqcByIpqcId(Long ipqcId); + + /** + * 查询过程检验单列表 + * + * @param qcIpqc 过程检验单 + * @return 过程检验单集合 + */ + public List selectQcIpqcList(QcIpqc qcIpqc); + + /** + * 验证检测编码是否唯一 + * @param qcIpqc + * @return + */ + public QcIpqc checkIpqcCodeUnique(QcIpqc qcIpqc); + + + /** + * 根据当前传递的过程检验单,查询更多工艺相关信息 + * @param qcIpqc + * @return + */ + public List getProcessInfo(QcIpqc qcIpqc); + + /** + * 新增过程检验单 + * + * @param qcIpqc 过程检验单 + * @return 结果 + */ + public int insertQcIpqc(QcIpqc qcIpqc); + + /** + * 修改过程检验单 + * + * @param qcIpqc 过程检验单 + * @return 结果 + */ + public int updateQcIpqc(QcIpqc qcIpqc); + + /** + * 根据缺陷记录更新头上的缺陷数量和缺陷率 + * @param ipqcId + * @return + */ + public int updateCrMajMinQuaAndRate(Long ipqcId); + + /** + * 删除过程检验单 + * + * @param ipqcId 过程检验单主键 + * @return 结果 + */ + public int deleteQcIpqcByIpqcId(Long ipqcId); + + /** + * 批量删除过程检验单 + * + * @param ipqcIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcIpqcByIpqcIds(Long[] ipqcIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIqcLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIqcLineMapper.java new file mode 100644 index 0000000..85db858 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIqcLineMapper.java @@ -0,0 +1,66 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIqcLine; + +/** + * 来料检验单行Mapper接口 + * + * @author yinjinlu + * @date 2022-05-19 + */ +public interface QcIqcLineMapper +{ + /** + * 查询来料检验单行 + * + * @param lineId 来料检验单行主键 + * @return 来料检验单行 + */ + public QcIqcLine selectQcIqcLineByLineId(Long lineId); + + /** + * 查询来料检验单行列表 + * + * @param qcIqcLine 来料检验单行 + * @return 来料检验单行集合 + */ + public List selectQcIqcLineList(QcIqcLine qcIqcLine); + + /** + * 新增来料检验单行 + * + * @param qcIqcLine 来料检验单行 + * @return 结果 + */ + public int insertQcIqcLine(QcIqcLine qcIqcLine); + + /** + * 修改来料检验单行 + * + * @param qcIqcLine 来料检验单行 + * @return 结果 + */ + public int updateQcIqcLine(QcIqcLine qcIqcLine); + + + public int updateCrMajMinQuantity(QcIqcLine qcIqcLine); + + /** + * 删除来料检验单行 + * + * @param lineId 来料检验单行主键 + * @return 结果 + */ + public int deleteQcIqcLineByLineId(Long lineId); + + public int deleteByIqcId(Long iqcId); + + /** + * 批量删除来料检验单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcIqcLineByLineIds(Long[] lineIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIqcMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIqcMapper.java new file mode 100644 index 0000000..58b62e0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcIqcMapper.java @@ -0,0 +1,70 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIqc; + +/** + * 来料检验单Mapper接口 + * + * @author yinjinlu + * @date 2022-05-19 + */ +public interface QcIqcMapper +{ + /** + * 查询来料检验单 + * + * @param iqcId 来料检验单主键 + * @return 来料检验单 + */ + public QcIqc selectQcIqcByIqcId(Long iqcId); + + /** + * 查询来料检验单列表 + * + * @param qcIqc 来料检验单 + * @return 来料检验单集合 + */ + public List selectQcIqcList(QcIqc qcIqc); + + public QcIqc checkIqcCodeUnique(QcIqc qcIqc); + + /** + * 新增来料检验单 + * + * @param qcIqc 来料检验单 + * @return 结果 + */ + public int insertQcIqc(QcIqc qcIqc); + + /** + * 修改来料检验单 + * + * @param qcIqc 来料检验单 + * @return 结果 + */ + public int updateQcIqc(QcIqc qcIqc); + + /** + * 根据缺陷记录更新头上的缺陷数量和比率 + * @param iqcId + * @return + */ + public int updateCrMajMinQuaAndRate(Long iqcId); + + /** + * 删除来料检验单 + * + * @param iqcId 来料检验单主键 + * @return 结果 + */ + public int deleteQcIqcByIqcId(Long iqcId); + + /** + * 批量删除来料检验单 + * + * @param iqcIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcIqcByIqcIds(Long[] iqcIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcOqcLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcOqcLineMapper.java new file mode 100644 index 0000000..40b6411 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcOqcLineMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcOqcLine; + +/** + * 出货检验单行Mapper接口 + * + * @author yinjinlu + * @date 2022-09-01 + */ +public interface QcOqcLineMapper +{ + /** + * 查询出货检验单行 + * + * @param lineId 出货检验单行主键 + * @return 出货检验单行 + */ + public QcOqcLine selectQcOqcLineByLineId(Long lineId); + + /** + * 查询出货检验单行列表 + * + * @param qcOqcLine 出货检验单行 + * @return 出货检验单行集合 + */ + public List selectQcOqcLineList(QcOqcLine qcOqcLine); + + /** + * 新增出货检验单行 + * + * @param qcOqcLine 出货检验单行 + * @return 结果 + */ + public int insertQcOqcLine(QcOqcLine qcOqcLine); + + /** + * 修改出货检验单行 + * + * @param qcOqcLine 出货检验单行 + * @return 结果 + */ + public int updateQcOqcLine(QcOqcLine qcOqcLine); + + /** + * 根据缺陷记录更新行上的缺陷数量 + * @param qcOqcLine + * @return + */ + public int updateCrMajMinQuantity(QcOqcLine qcOqcLine); + + /** + * 删除出货检验单行 + * + * @param lineId 出货检验单行主键 + * @return 结果 + */ + public int deleteQcOqcLineByLineId(Long lineId); + + /** + * 批量删除出货检验单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcOqcLineByLineIds(Long[] lineIds); + + /** + * 根据出货检验单头删除相应的行信息 + * @param oqcId + * @return + */ + public int deleteByOqcId(Long oqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcOqcMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcOqcMapper.java new file mode 100644 index 0000000..5cfff57 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcOqcMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcOqc; + +/** + * 出货检验单Mapper接口 + * + * @author yinjinlu + * @date 2022-08-31 + */ +public interface QcOqcMapper +{ + /** + * 查询出货检验单 + * + * @param oqcId 出货检验单主键 + * @return 出货检验单 + */ + public QcOqc selectQcOqcByOqcId(Long oqcId); + + /** + * 查询出货检验单列表 + * + * @param qcOqc 出货检验单 + * @return 出货检验单集合 + */ + public List selectQcOqcList(QcOqc qcOqc); + + /** + * 检查出货检验单号是否唯一 + * @param qcOqc + * @return + */ + public QcOqc checkOqcCodeUnique(QcOqc qcOqc); + + /** + * 新增出货检验单 + * + * @param qcOqc 出货检验单 + * @return 结果 + */ + public int insertQcOqc(QcOqc qcOqc); + + /** + * 修改出货检验单 + * + * @param qcOqc 出货检验单 + * @return 结果 + */ + public int updateQcOqc(QcOqc qcOqc); + + /** + * 根据缺陷记录更新头上的缺陷数量和缺陷比率 + * @param oqc + * @return + */ + public int updateCrMajMinQuaAndRate(Long oqc); + + /** + * 删除出货检验单 + * + * @param oqcId 出货检验单主键 + * @return 结果 + */ + public int deleteQcOqcByOqcId(Long oqcId); + + /** + * 批量删除出货检验单 + * + * @param oqcIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcOqcByOqcIds(Long[] oqcIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcPendingInspectMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcPendingInspectMapper.java new file mode 100644 index 0000000..d02f735 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcPendingInspectMapper.java @@ -0,0 +1,15 @@ +package com.ktg.mes.qc.mapper; + +import com.ktg.mes.qc.domain.QcPendingInspect; + +import java.util.List; + +public interface QcPendingInspectMapper { + /** + * 查询待检任务列表 + * + * @param qcPendingInspect 待检任务 + * @return 待检任务集合 + */ + public List selectQcPendingList(QcPendingInspect qcPendingInspect); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateIndexMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateIndexMapper.java new file mode 100644 index 0000000..aec8bee --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateIndexMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcTemplateIndex; + +/** + * 检测模板-检测项Mapper接口 + * + * @author yinjinlu + * @date 2022-05-18 + */ +public interface QcTemplateIndexMapper +{ + /** + * 查询检测模板-检测项 + * + * @param recordId 检测模板-检测项主键 + * @return 检测模板-检测项 + */ + public QcTemplateIndex selectQcTemplateIndexByRecordId(Long recordId); + + /** + * 查询检测模板-检测项列表 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 检测模板-检测项集合 + */ + public List selectQcTemplateIndexList(QcTemplateIndex qcTemplateIndex); + + /** + * 新增检测模板-检测项 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 结果 + */ + public int insertQcTemplateIndex(QcTemplateIndex qcTemplateIndex); + + /** + * 修改检测模板-检测项 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 结果 + */ + public int updateQcTemplateIndex(QcTemplateIndex qcTemplateIndex); + + /** + * 删除检测模板-检测项 + * + * @param recordId 检测模板-检测项主键 + * @return 结果 + */ + public int deleteQcTemplateIndexByRecordId(Long recordId); + + /** + * 批量删除检测模板-检测项 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcTemplateIndexByRecordIds(Long[] recordIds); + + /** + * 根据检测模板ID删除所有检测项 + * @param templateId + * @return + */ + public int deleteByTemplateId(Long templateId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java new file mode 100644 index 0000000..e8109b8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java @@ -0,0 +1,81 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; + +import com.ktg.mes.qc.domain.QcMobParam; +import com.ktg.mes.qc.domain.QcTemplate; + +/** + * 检测模板Mapper接口 + * + * @author yinjinlu + * @date 2022-05-17 + */ +public interface QcTemplateMapper +{ + /** + * 查询检测模板 + * + * @param templateId 检测模板主键 + * @return 检测模板 + */ + public QcTemplate selectQcTemplateByTemplateId(Long templateId); + + /** + * 查询检测模板列表 + * + * @param qcTemplate 检测模板 + * @return 检测模板集合 + */ + public List selectQcTemplateList(QcTemplate qcTemplate); + + + /** + * 根据检测类型和产品查找对应的检测模板 + * @param qcTemplate + */ + public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate); + + + /** + * 根据物料/产品和检验类型查询对应的检测模板 + * @param param + * @return + */ + public QcTemplate findTemplateByProductIdAndQcType(QcMobParam param); + + + public QcTemplate checkTemplateCodeUnique(QcTemplate qcTemplate); + + /** + * 新增检测模板 + * + * @param qcTemplate 检测模板 + * @return 结果 + */ + public int insertQcTemplate(QcTemplate qcTemplate); + + /** + * 修改检测模板 + * + * @param qcTemplate 检测模板 + * @return 结果 + */ + public int updateQcTemplate(QcTemplate qcTemplate); + + /** + * 删除检测模板 + * + * @param templateId 检测模板主键 + * @return 结果 + */ + public int deleteQcTemplateByTemplateId(Long templateId); + + /** + * 批量删除检测模板 + * + * @param templateIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcTemplateByTemplateIds(Long[] templateIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java new file mode 100644 index 0000000..f7ed894 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java @@ -0,0 +1,67 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcTemplateProduct; + +/** + * 检测模板-产品Mapper接口 + * + * @author yinjinlu + * @date 2022-05-18 + */ +public interface QcTemplateProductMapper +{ + /** + * 查询检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 检测模板-产品 + */ + public QcTemplateProduct selectQcTemplateProductByRecordId(Long recordId); + + /** + * 查询检测模板-产品列表 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 检测模板-产品集合 + */ + public List selectQcTemplateProductList(QcTemplateProduct qcTemplateProduct); + + public QcTemplateProduct checkProductUnique(QcTemplateProduct qcTemplateProduct); + + + /** + * 新增检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int insertQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 修改检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int updateQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 删除检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordId(Long recordId); + + /** + * 批量删除检测模板-产品 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordIds(Long[] recordIds); + + public int deleteByTemplateId(Long templateId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcDefectRecordService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcDefectRecordService.java new file mode 100644 index 0000000..9f75169 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcDefectRecordService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcDefectRecord; + +/** + * 检验单缺陷记录Service接口 + * + * @author yinjinlu + * @date 2022-08-30 + */ +public interface IQcDefectRecordService +{ + /** + * 查询检验单缺陷记录 + * + * @param recordId 检验单缺陷记录主键 + * @return 检验单缺陷记录 + */ + public QcDefectRecord selectQcDefectRecordByRecordId(Long recordId); + + /** + * 查询检验单缺陷记录列表 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 检验单缺陷记录集合 + */ + public List selectQcDefectRecordList(QcDefectRecord qcDefectRecord); + + /** + * 新增检验单缺陷记录 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 结果 + */ + public int insertQcDefectRecord(QcDefectRecord qcDefectRecord); + + /** + * 修改检验单缺陷记录 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 结果 + */ + public int updateQcDefectRecord(QcDefectRecord qcDefectRecord); + + /** + * 批量删除检验单缺陷记录 + * + * @param recordIds 需要删除的检验单缺陷记录主键集合 + * @return 结果 + */ + public int deleteQcDefectRecordByRecordIds(Long[] recordIds); + + /** + * 删除检验单缺陷记录信息 + * + * @param recordId 检验单缺陷记录主键 + * @return 结果 + */ + public int deleteQcDefectRecordByRecordId(Long recordId); + + /** + * 根据检测单ID和对应的类型删除 + * @param qcDefectRecord + * @return + */ + public int deleteByQcIdAndType(QcDefectRecord qcDefectRecord); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcDefectService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcDefectService.java new file mode 100644 index 0000000..899da08 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcDefectService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcDefect; + +/** + * 常见缺陷Service接口 + * + * @author yinjinlu + * @date 2022-05-19 + */ +public interface IQcDefectService +{ + /** + * 查询常见缺陷 + * + * @param defectId 常见缺陷主键 + * @return 常见缺陷 + */ + public QcDefect selectQcDefectByDefectId(Long defectId); + + /** + * 查询常见缺陷列表 + * + * @param qcDefect 常见缺陷 + * @return 常见缺陷集合 + */ + public List selectQcDefectList(QcDefect qcDefect); + + /** + * 新增常见缺陷 + * + * @param qcDefect 常见缺陷 + * @return 结果 + */ + public int insertQcDefect(QcDefect qcDefect); + + /** + * 修改常见缺陷 + * + * @param qcDefect 常见缺陷 + * @return 结果 + */ + public int updateQcDefect(QcDefect qcDefect); + + /** + * 批量删除常见缺陷 + * + * @param defectIds 需要删除的常见缺陷主键集合 + * @return 结果 + */ + public int deleteQcDefectByDefectIds(Long[] defectIds); + + /** + * 删除常见缺陷信息 + * + * @param defectId 常见缺陷主键 + * @return 结果 + */ + public int deleteQcDefectByDefectId(Long defectId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIndexService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIndexService.java new file mode 100644 index 0000000..b1bc846 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIndexService.java @@ -0,0 +1,77 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIndex; + +/** + * 检测项Service接口 + * + * @author yinjinlu + * @date 2022-05-17 + */ +public interface IQcIndexService +{ + /** + * 查询检测项 + * + * @param indexId 检测项主键 + * @return 检测项 + */ + public QcIndex selectQcIndexByIndexId(Long indexId); + + /** + * 查询检测项列表 + * + * @param qcIndex 检测项 + * @return 检测项集合 + */ + public List selectQcIndexList(QcIndex qcIndex); + + /** + * 检测项编号是否唯一 + * @param qcIndex + * @return + */ + public String checkIndexCodeUnique(QcIndex qcIndex); + + /** + * 检测项名称是否唯一 + * @param qcIndex + * @return + */ + public String checkIndexNameUnique(QcIndex qcIndex); + + + + /** + * 新增检测项 + * + * @param qcIndex 检测项 + * @return 结果 + */ + public int insertQcIndex(QcIndex qcIndex); + + /** + * 修改检测项 + * + * @param qcIndex 检测项 + * @return 结果 + */ + public int updateQcIndex(QcIndex qcIndex); + + /** + * 批量删除检测项 + * + * @param indexIds 需要删除的检测项主键集合 + * @return 结果 + */ + public int deleteQcIndexByIndexIds(Long[] indexIds); + + /** + * 删除检测项信息 + * + * @param indexId 检测项主键 + * @return 结果 + */ + public int deleteQcIndexByIndexId(Long indexId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java new file mode 100644 index 0000000..eb45ccd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIpqcLine; + +/** + * 过程检验单行Service接口 + * + * @author yinjinlu + * @date 2022-08-30 + */ +public interface IQcIpqcLineService +{ + /** + * 查询过程检验单行 + * + * @param lineId 过程检验单行主键 + * @return 过程检验单行 + */ + public QcIpqcLine selectQcIpqcLineByLineId(Long lineId); + + /** + * 查询过程检验单行列表 + * + * @param qcIpqcLine 过程检验单行 + * @return 过程检验单行集合 + */ + public List selectQcIpqcLineList(QcIpqcLine qcIpqcLine); + + /** + * 新增过程检验单行 + * + * @param qcIpqcLine 过程检验单行 + * @return 结果 + */ + public int insertQcIpqcLine(QcIpqcLine qcIpqcLine); + + /** + * 修改过程检验单行 + * + * @param qcIpqcLine 过程检验单行 + * @return 结果 + */ + public int updateQcIpqcLine(QcIpqcLine qcIpqcLine); + + /** + * 计算并更新当前行的Cr,Maj,Min的总数量 + * @param qcId + * @param lineId + * @return + */ + public int updateCrMajMinQuantity(Long qcId,Long lineId); + + /** + * 批量删除过程检验单行 + * + * @param lineIds 需要删除的过程检验单行主键集合 + * @return 结果 + */ + public int deleteQcIpqcLineByLineIds(Long[] lineIds); + + /** + * 删除过程检验单行信息 + * + * @param lineId 过程检验单行主键 + * @return 结果 + */ + public int deleteQcIpqcLineByLineId(Long lineId); + + /*** + * 根据检验单头ID删除所有行信息 + * @param ipqcId + * @return + */ + public int deleteByIpqcId(Long ipqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java new file mode 100644 index 0000000..4a436b8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java @@ -0,0 +1,85 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIpqc; + +/** + * 过程检验单Service接口 + * + * @author yinjinlu + * @date 2022-08-29 + */ +public interface IQcIpqcService +{ + /** + * 查询过程检验单 + * + * @param ipqcId 过程检验单主键 + * @return 过程检验单 + */ + public QcIpqc selectQcIpqcByIpqcId(Long ipqcId); + + /** + * 查询过程检验单列表 + * + * @param qcIpqc 过程检验单 + * @return 过程检验单集合 + */ + public List selectQcIpqcList(QcIpqc qcIpqc); + + + /** + * 检查检测编码是否唯一 + * @param qcIpqc + * @return + */ + public String checkIpqcCodeUnique(QcIpqc qcIpqc); + + /** + * 根据当前传递的过程检验单,查询更多工艺相关信息 + * @param qcIpqc + * @return + */ + public List getProcessInfo(QcIpqc qcIpqc); + + + /** + * 新增过程检验单 + * + * @param qcIpqc 过程检验单 + * @return 结果 + */ + public int insertQcIpqc(QcIpqc qcIpqc); + + /** + * 修改过程检验单 + * + * @param qcIpqc 过程检验单 + * @return 结果 + */ + public int updateQcIpqc(QcIpqc qcIpqc); + + /** + * 更新头上的cr、maj、min数量 + * @param qcId + * @return + */ + public int updateCrMajMinQuaAndRate(Long qcId); + + + /** + * 批量删除过程检验单 + * + * @param ipqcIds 需要删除的过程检验单主键集合 + * @return 结果 + */ + public int deleteQcIpqcByIpqcIds(Long[] ipqcIds); + + /** + * 删除过程检验单信息 + * + * @param ipqcId 过程检验单主键 + * @return 结果 + */ + public int deleteQcIpqcByIpqcId(Long ipqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIqcLineService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIqcLineService.java new file mode 100644 index 0000000..e429156 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIqcLineService.java @@ -0,0 +1,78 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIqcLine; + +/** + * 来料检验单行Service接口 + * + * @author yinjinlu + * @date 2022-05-19 + */ +public interface IQcIqcLineService +{ + /** + * 查询来料检验单行 + * + * @param lineId 来料检验单行主键 + * @return 来料检验单行 + */ + public QcIqcLine selectQcIqcLineByLineId(Long lineId); + + /** + * 查询来料检验单行列表 + * + * @param qcIqcLine 来料检验单行 + * @return 来料检验单行集合 + */ + public List selectQcIqcLineList(QcIqcLine qcIqcLine); + + /** + * 新增来料检验单行 + * + * @param qcIqcLine 来料检验单行 + * @return 结果 + */ + public int insertQcIqcLine(QcIqcLine qcIqcLine); + + /** + * 修改来料检验单行 + * + * @param qcIqcLine 来料检验单行 + * @return 结果 + */ + public int updateQcIqcLine(QcIqcLine qcIqcLine); + + /** + * 计算并更新当前行的Cr,Maj,Min的总数量 + * @param iqcId + * @param lineId + * @return + */ + public int updateCrMajMinQuantity(Long iqcId,Long lineId); + + + /** + * 批量删除来料检验单行 + * + * @param lineIds 需要删除的来料检验单行主键集合 + * @return 结果 + */ + public int deleteQcIqcLineByLineIds(Long[] lineIds); + + /** + * 删除所有行信息 + * @param iqcId + * @return + */ + public int deleteByIqcId(Long iqcId); + + + /** + * 删除来料检验单行信息 + * + * @param lineId 来料检验单行主键 + * @return 结果 + */ + public int deleteQcIqcLineByLineId(Long lineId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIqcService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIqcService.java new file mode 100644 index 0000000..590ab04 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIqcService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcIqc; + +/** + * 来料检验单Service接口 + * + * @author yinjinlu + * @date 2022-05-19 + */ +public interface IQcIqcService +{ + /** + * 查询来料检验单 + * + * @param iqcId 来料检验单主键 + * @return 来料检验单 + */ + public QcIqc selectQcIqcByIqcId(Long iqcId); + + /** + * 查询来料检验单列表 + * + * @param qcIqc 来料检验单 + * @return 来料检验单集合 + */ + public List selectQcIqcList(QcIqc qcIqc); + + /** + * 检查来料检验单号是否重复 + * @param qcIqc + * @return + */ + public String checkIqcCodeUnique(QcIqc qcIqc); + + /** + * 新增来料检验单 + * + * @param qcIqc 来料检验单 + * @return 结果 + */ + public int insertQcIqc(QcIqc qcIqc); + + /** + * 修改来料检验单 + * + * @param qcIqc 来料检验单 + * @return 结果 + */ + public int updateQcIqc(QcIqc qcIqc); + + public int updateCrMajMinQuaAndRate(Long iqcId); + + /** + * 批量删除来料检验单 + * + * @param iqcIds 需要删除的来料检验单主键集合 + * @return 结果 + */ + public int deleteQcIqcByIqcIds(Long[] iqcIds); + + /** + * 删除来料检验单信息 + * + * @param iqcId 来料检验单主键 + * @return 结果 + */ + public int deleteQcIqcByIqcId(Long iqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcOqcLineService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcOqcLineService.java new file mode 100644 index 0000000..bfbd0ac --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcOqcLineService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcOqcLine; + +/** + * 出货检验单行Service接口 + * + * @author yinjinlu + * @date 2022-09-01 + */ +public interface IQcOqcLineService +{ + /** + * 查询出货检验单行 + * + * @param lineId 出货检验单行主键 + * @return 出货检验单行 + */ + public QcOqcLine selectQcOqcLineByLineId(Long lineId); + + /** + * 查询出货检验单行列表 + * + * @param qcOqcLine 出货检验单行 + * @return 出货检验单行集合 + */ + public List selectQcOqcLineList(QcOqcLine qcOqcLine); + + /** + * 新增出货检验单行 + * + * @param qcOqcLine 出货检验单行 + * @return 结果 + */ + public int insertQcOqcLine(QcOqcLine qcOqcLine); + + /** + * 修改出货检验单行 + * + * @param qcOqcLine 出货检验单行 + * @return 结果 + */ + public int updateQcOqcLine(QcOqcLine qcOqcLine); + + /** + * 计算并更新当前行的Cr,Maj,Min的总数量 + * @param qcId + * @param lineId + * @return + */ + public int updateCrMajMinQuantity(Long qcId,Long lineId); + + /** + * 批量删除出货检验单行 + * + * @param lineIds 需要删除的出货检验单行主键集合 + * @return 结果 + */ + public int deleteQcOqcLineByLineIds(Long[] lineIds); + + /** + * 删除出货检验单行信息 + * + * @param lineId 出货检验单行主键 + * @return 结果 + */ + public int deleteQcOqcLineByLineId(Long lineId); + + /** + * 根据出货检验单头删除相应的行信息 + * @param oqcId + * @return + */ + public int deleteByOqcId(Long oqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcOqcService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcOqcService.java new file mode 100644 index 0000000..28c7229 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcOqcService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcOqc; + +/** + * 出货检验单Service接口 + * + * @author yinjinlu + * @date 2022-08-31 + */ +public interface IQcOqcService +{ + /** + * 查询出货检验单 + * + * @param oqcId 出货检验单主键 + * @return 出货检验单 + */ + public QcOqc selectQcOqcByOqcId(Long oqcId); + + /** + * 查询出货检验单列表 + * + * @param qcOqc 出货检验单 + * @return 出货检验单集合 + */ + public List selectQcOqcList(QcOqc qcOqc); + + + /** + * 检查出货检验单号是否唯一 + * @param qcOqc + * @return + */ + public String checkOqcCodeUnique(QcOqc qcOqc); + + /** + * 新增出货检验单 + * + * @param qcOqc 出货检验单 + * @return 结果 + */ + public int insertQcOqc(QcOqc qcOqc); + + /** + * 修改出货检验单 + * + * @param qcOqc 出货检验单 + * @return 结果 + */ + public int updateQcOqc(QcOqc qcOqc); + + /** + * 根据缺陷记录更新头上的缺陷数量和缺陷比率 + * @param oqcId + * @return + */ + public int updateCrMajMinQuaAndRate(Long oqcId); + + /** + * 批量删除出货检验单 + * + * @param oqcIds 需要删除的出货检验单主键集合 + * @return 结果 + */ + public int deleteQcOqcByOqcIds(Long[] oqcIds); + + /** + * 删除出货检验单信息 + * + * @param oqcId 出货检验单主键 + * @return 结果 + */ + public int deleteQcOqcByOqcId(Long oqcId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcPendingInspectService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcPendingInspectService.java new file mode 100644 index 0000000..e714473 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcPendingInspectService.java @@ -0,0 +1,15 @@ +package com.ktg.mes.qc.service; + +import com.ktg.mes.qc.domain.QcPendingInspect; + +import java.util.List; + +public interface IQcPendingInspectService { + /** + * 查询待检任务列表 + * + * @param qcPendingInspect 待检任务 + * @return 待检任务集合 + */ + public List selectQcPendingList(QcPendingInspect qcPendingInspect); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateIndexService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateIndexService.java new file mode 100644 index 0000000..9f4a44c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateIndexService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcTemplateIndex; + +/** + * 检测模板-检测项Service接口 + * + * @author yinjinlu + * @date 2022-05-18 + */ +public interface IQcTemplateIndexService +{ + /** + * 查询检测模板-检测项 + * + * @param recordId 检测模板-检测项主键 + * @return 检测模板-检测项 + */ + public QcTemplateIndex selectQcTemplateIndexByRecordId(Long recordId); + + /** + * 查询检测模板-检测项列表 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 检测模板-检测项集合 + */ + public List selectQcTemplateIndexList(QcTemplateIndex qcTemplateIndex); + + /** + * 新增检测模板-检测项 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 结果 + */ + public int insertQcTemplateIndex(QcTemplateIndex qcTemplateIndex); + + /** + * 修改检测模板-检测项 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 结果 + */ + public int updateQcTemplateIndex(QcTemplateIndex qcTemplateIndex); + + /** + * 批量删除检测模板-检测项 + * + * @param recordIds 需要删除的检测模板-检测项主键集合 + * @return 结果 + */ + public int deleteQcTemplateIndexByRecordIds(Long[] recordIds); + + /** + * 删除检测模板-检测项信息 + * + * @param recordId 检测模板-检测项主键 + * @return 结果 + */ + public int deleteQcTemplateIndexByRecordId(Long recordId); + + /** + * 根据检测模板ID删除所有检测项 + * @param templateId + * @return + */ + public int deleteByTemplateId(Long templateId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java new file mode 100644 index 0000000..ddd5a8f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcTemplateProduct; + +/** + * 检测模板-产品Service接口 + * + * @author yinjinlu + * @date 2022-05-18 + */ +public interface IQcTemplateProductService +{ + /** + * 查询检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 检测模板-产品 + */ + public QcTemplateProduct selectQcTemplateProductByRecordId(Long recordId); + + /** + * 查询检测模板-产品列表 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 检测模板-产品集合 + */ + public List selectQcTemplateProductList(QcTemplateProduct qcTemplateProduct); + + public String checkProductUnique(QcTemplateProduct qcTemplateProduct); + + /** + * 新增检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int insertQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 修改检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int updateQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 批量删除检测模板-产品 + * + * @param recordIds 需要删除的检测模板-产品主键集合 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordIds(Long[] recordIds); + + /** + * 删除检测模板-产品信息 + * + * @param recordId 检测模板-产品主键 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordId(Long recordId); + + /** + * 根据检测模板ID删除产品 + * @param templateId + * @return + */ + public int deleteByTemplateId(Long templateId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateService.java new file mode 100644 index 0000000..aa49038 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateService.java @@ -0,0 +1,83 @@ +package com.ktg.mes.qc.service; + +import java.util.List; + +import com.ktg.mes.qc.domain.QcMobParam; +import com.ktg.mes.qc.domain.QcTemplate; + +/** + * 检测模板Service接口 + * + * @author yinjinlu + * @date 2022-05-17 + */ +public interface IQcTemplateService +{ + /** + * 查询检测模板 + * + * @param templateId 检测模板主键 + * @return 检测模板 + */ + public QcTemplate selectQcTemplateByTemplateId(Long templateId); + + /** + * 查询检测模板列表 + * + * @param qcTemplate 检测模板 + * @return 检测模板集合 + */ + public List selectQcTemplateList(QcTemplate qcTemplate); + + /** + * 根据检测类型和产品查找对应的检测模板 + * @param qcTemplate + */ + public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate); + + /** + * 根据物料/产品和检验类型查询对应的检测模板 + * @param param + * @return + */ + public QcTemplate findTemplateByProductIdAndQcType(QcMobParam param); + + /** + * 检测模板编号是否唯一 + * @param qcTemplate + * @return + */ + public String checkTemplateCodeUnique(QcTemplate qcTemplate); + + /** + * 新增检测模板 + * + * @param qcTemplate 检测模板 + * @return 结果 + */ + public int insertQcTemplate(QcTemplate qcTemplate); + + /** + * 修改检测模板 + * + * @param qcTemplate 检测模板 + * @return 结果 + */ + public int updateQcTemplate(QcTemplate qcTemplate); + + /** + * 批量删除检测模板 + * + * @param templateIds 需要删除的检测模板主键集合 + * @return 结果 + */ + public int deleteQcTemplateByTemplateIds(Long[] templateIds); + + /** + * 删除检测模板信息 + * + * @param templateId 检测模板主键 + * @return 结果 + */ + public int deleteQcTemplateByTemplateId(Long templateId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcDefectRecordServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcDefectRecordServiceImpl.java new file mode 100644 index 0000000..e915077 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcDefectRecordServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcDefectRecordMapper; +import com.ktg.mes.qc.domain.QcDefectRecord; +import com.ktg.mes.qc.service.IQcDefectRecordService; + +/** + * 检验单缺陷记录Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-30 + */ +@Service +public class QcDefectRecordServiceImpl implements IQcDefectRecordService +{ + @Autowired + private QcDefectRecordMapper qcDefectRecordMapper; + + /** + * 查询检验单缺陷记录 + * + * @param recordId 检验单缺陷记录主键 + * @return 检验单缺陷记录 + */ + @Override + public QcDefectRecord selectQcDefectRecordByRecordId(Long recordId) + { + return qcDefectRecordMapper.selectQcDefectRecordByRecordId(recordId); + } + + /** + * 查询检验单缺陷记录列表 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 检验单缺陷记录 + */ + @Override + public List selectQcDefectRecordList(QcDefectRecord qcDefectRecord) + { + return qcDefectRecordMapper.selectQcDefectRecordList(qcDefectRecord); + } + + /** + * 新增检验单缺陷记录 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 结果 + */ + @Override + public int insertQcDefectRecord(QcDefectRecord qcDefectRecord) + { + qcDefectRecord.setCreateTime(DateUtils.getNowDate()); + return qcDefectRecordMapper.insertQcDefectRecord(qcDefectRecord); + } + + /** + * 修改检验单缺陷记录 + * + * @param qcDefectRecord 检验单缺陷记录 + * @return 结果 + */ + @Override + public int updateQcDefectRecord(QcDefectRecord qcDefectRecord) + { + qcDefectRecord.setUpdateTime(DateUtils.getNowDate()); + return qcDefectRecordMapper.updateQcDefectRecord(qcDefectRecord); + } + + /** + * 批量删除检验单缺陷记录 + * + * @param recordIds 需要删除的检验单缺陷记录主键 + * @return 结果 + */ + @Override + public int deleteQcDefectRecordByRecordIds(Long[] recordIds) + { + return qcDefectRecordMapper.deleteQcDefectRecordByRecordIds(recordIds); + } + + /** + * 删除检验单缺陷记录信息 + * + * @param recordId 检验单缺陷记录主键 + * @return 结果 + */ + @Override + public int deleteQcDefectRecordByRecordId(Long recordId) + { + return qcDefectRecordMapper.deleteQcDefectRecordByRecordId(recordId); + } + + @Override + public int deleteByQcIdAndType(QcDefectRecord qcDefectRecord) { + return qcDefectRecordMapper.deleteByQcIdAndType(qcDefectRecord); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcDefectServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcDefectServiceImpl.java new file mode 100644 index 0000000..f3ff4d6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcDefectServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcDefectMapper; +import com.ktg.mes.qc.domain.QcDefect; +import com.ktg.mes.qc.service.IQcDefectService; + +/** + * 常见缺陷Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-19 + */ +@Service +public class QcDefectServiceImpl implements IQcDefectService +{ + @Autowired + private QcDefectMapper qcDefectMapper; + + /** + * 查询常见缺陷 + * + * @param defectId 常见缺陷主键 + * @return 常见缺陷 + */ + @Override + public QcDefect selectQcDefectByDefectId(Long defectId) + { + return qcDefectMapper.selectQcDefectByDefectId(defectId); + } + + /** + * 查询常见缺陷列表 + * + * @param qcDefect 常见缺陷 + * @return 常见缺陷 + */ + @Override + public List selectQcDefectList(QcDefect qcDefect) + { + return qcDefectMapper.selectQcDefectList(qcDefect); + } + + /** + * 新增常见缺陷 + * + * @param qcDefect 常见缺陷 + * @return 结果 + */ + @Override + public int insertQcDefect(QcDefect qcDefect) + { + qcDefect.setCreateTime(DateUtils.getNowDate()); + return qcDefectMapper.insertQcDefect(qcDefect); + } + + /** + * 修改常见缺陷 + * + * @param qcDefect 常见缺陷 + * @return 结果 + */ + @Override + public int updateQcDefect(QcDefect qcDefect) + { + qcDefect.setUpdateTime(DateUtils.getNowDate()); + return qcDefectMapper.updateQcDefect(qcDefect); + } + + /** + * 批量删除常见缺陷 + * + * @param defectIds 需要删除的常见缺陷主键 + * @return 结果 + */ + @Override + public int deleteQcDefectByDefectIds(Long[] defectIds) + { + return qcDefectMapper.deleteQcDefectByDefectIds(defectIds); + } + + /** + * 删除常见缺陷信息 + * + * @param defectId 常见缺陷主键 + * @return 结果 + */ + @Override + public int deleteQcDefectByDefectId(Long defectId) + { + return qcDefectMapper.deleteQcDefectByDefectId(defectId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIndexServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIndexServiceImpl.java new file mode 100644 index 0000000..1573fa0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIndexServiceImpl.java @@ -0,0 +1,119 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcIndexMapper; +import com.ktg.mes.qc.domain.QcIndex; +import com.ktg.mes.qc.service.IQcIndexService; + +/** + * 检测项Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-17 + */ +@Service +public class QcIndexServiceImpl implements IQcIndexService +{ + @Autowired + private QcIndexMapper qcIndexMapper; + + /** + * 查询检测项 + * + * @param indexId 检测项主键 + * @return 检测项 + */ + @Override + public QcIndex selectQcIndexByIndexId(Long indexId) + { + return qcIndexMapper.selectQcIndexByIndexId(indexId); + } + + /** + * 查询检测项列表 + * + * @param qcIndex 检测项 + * @return 检测项 + */ + @Override + public List selectQcIndexList(QcIndex qcIndex) + { + return qcIndexMapper.selectQcIndexList(qcIndex); + } + + @Override + public String checkIndexCodeUnique(QcIndex qcIndex) { + QcIndex index = qcIndexMapper.checkIndexCodeUnique(qcIndex); + Long indexId = qcIndex.getIndexId()==null?-1L:qcIndex.getIndexId(); + if(StringUtils.isNotNull(index) &&index.getIndexId().longValue() != indexId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkIndexNameUnique(QcIndex qcIndex) { + QcIndex index = qcIndexMapper.checkIndexNameUnique(qcIndex); + Long indexId = qcIndex.getIndexId()==null?-1L:qcIndex.getIndexId(); + if(StringUtils.isNotNull(index) &&index.getIndexId().longValue() != indexId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增检测项 + * + * @param qcIndex 检测项 + * @return 结果 + */ + @Override + public int insertQcIndex(QcIndex qcIndex) + { + qcIndex.setCreateTime(DateUtils.getNowDate()); + return qcIndexMapper.insertQcIndex(qcIndex); + } + + /** + * 修改检测项 + * + * @param qcIndex 检测项 + * @return 结果 + */ + @Override + public int updateQcIndex(QcIndex qcIndex) + { + qcIndex.setUpdateTime(DateUtils.getNowDate()); + return qcIndexMapper.updateQcIndex(qcIndex); + } + + /** + * 批量删除检测项 + * + * @param indexIds 需要删除的检测项主键 + * @return 结果 + */ + @Override + public int deleteQcIndexByIndexIds(Long[] indexIds) + { + return qcIndexMapper.deleteQcIndexByIndexIds(indexIds); + } + + /** + * 删除检测项信息 + * + * @param indexId 检测项主键 + * @return 结果 + */ + @Override + public int deleteQcIndexByIndexId(Long indexId) + { + return qcIndexMapper.deleteQcIndexByIndexId(indexId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java new file mode 100644 index 0000000..0b18e0b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcIpqcLineMapper; +import com.ktg.mes.qc.domain.QcIpqcLine; +import com.ktg.mes.qc.service.IQcIpqcLineService; + +/** + * 过程检验单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-30 + */ +@Service +public class QcIpqcLineServiceImpl implements IQcIpqcLineService +{ + @Autowired + private QcIpqcLineMapper qcIpqcLineMapper; + + /** + * 查询过程检验单行 + * + * @param lineId 过程检验单行主键 + * @return 过程检验单行 + */ + @Override + public QcIpqcLine selectQcIpqcLineByLineId(Long lineId) + { + return qcIpqcLineMapper.selectQcIpqcLineByLineId(lineId); + } + + /** + * 查询过程检验单行列表 + * + * @param qcIpqcLine 过程检验单行 + * @return 过程检验单行 + */ + @Override + public List selectQcIpqcLineList(QcIpqcLine qcIpqcLine) + { + return qcIpqcLineMapper.selectQcIpqcLineList(qcIpqcLine); + } + + /** + * 新增过程检验单行 + * + * @param qcIpqcLine 过程检验单行 + * @return 结果 + */ + @Override + public int insertQcIpqcLine(QcIpqcLine qcIpqcLine) + { + qcIpqcLine.setCreateTime(DateUtils.getNowDate()); + return qcIpqcLineMapper.insertQcIpqcLine(qcIpqcLine); + } + + /** + * 修改过程检验单行 + * + * @param qcIpqcLine 过程检验单行 + * @return 结果 + */ + @Override + public int updateQcIpqcLine(QcIpqcLine qcIpqcLine) + { + qcIpqcLine.setUpdateTime(DateUtils.getNowDate()); + return qcIpqcLineMapper.updateQcIpqcLine(qcIpqcLine); + } + + @Override + public int updateCrMajMinQuantity(Long qcId, Long lineId) { + QcIpqcLine line = new QcIpqcLine(); + line.setIpqcId(qcId); + line.setLineId(lineId); + return qcIpqcLineMapper.updateCrMajMinQuantity(line); + } + + /** + * 批量删除过程检验单行 + * + * @param lineIds 需要删除的过程检验单行主键 + * @return 结果 + */ + @Override + public int deleteQcIpqcLineByLineIds(Long[] lineIds) + { + return qcIpqcLineMapper.deleteQcIpqcLineByLineIds(lineIds); + } + + /** + * 删除过程检验单行信息 + * + * @param lineId 过程检验单行主键 + * @return 结果 + */ + @Override + public int deleteQcIpqcLineByLineId(Long lineId) + { + return qcIpqcLineMapper.deleteQcIpqcLineByLineId(lineId); + } + + @Override + public int deleteByIpqcId(Long ipqcId) { + return qcIpqcLineMapper.deleteByIpqcId(ipqcId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java new file mode 100644 index 0000000..c5a6218 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcIpqcMapper; +import com.ktg.mes.qc.domain.QcIpqc; +import com.ktg.mes.qc.service.IQcIpqcService; + +/** + * 过程检验单Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-29 + */ +@Service +public class QcIpqcServiceImpl implements IQcIpqcService +{ + @Autowired + private QcIpqcMapper qcIpqcMapper; + + /** + * 查询过程检验单 + * + * @param ipqcId 过程检验单主键 + * @return 过程检验单 + */ + @Override + public QcIpqc selectQcIpqcByIpqcId(Long ipqcId) + { + return qcIpqcMapper.selectQcIpqcByIpqcId(ipqcId); + } + + /** + * 查询过程检验单列表 + * + * @param qcIpqc 过程检验单 + * @return 过程检验单 + */ + @Override + public List selectQcIpqcList(QcIpqc qcIpqc) + { + return qcIpqcMapper.selectQcIpqcList(qcIpqc); + } + + @Override + public String checkIpqcCodeUnique(QcIpqc qcIpqc) { + QcIpqc ipqc = qcIpqcMapper.checkIpqcCodeUnique(qcIpqc); + Long ipqcId = qcIpqc.getIpqcId()==null?-1:qcIpqc.getIpqcId(); + if(StringUtils.isNotNull(ipqc) && ipqc.getIpqcId().longValue() != ipqcId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public List getProcessInfo(QcIpqc qcIpqc) { + return qcIpqcMapper.getProcessInfo(qcIpqc); + } + + /** + * 新增过程检验单 + * + * @param qcIpqc 过程检验单 + * @return 结果 + */ + @Override + public int insertQcIpqc(QcIpqc qcIpqc) + { + qcIpqc.setCreateTime(DateUtils.getNowDate()); + return qcIpqcMapper.insertQcIpqc(qcIpqc); + } + + /** + * 修改过程检验单 + * + * @param qcIpqc 过程检验单 + * @return 结果 + */ + @Override + public int updateQcIpqc(QcIpqc qcIpqc) + { + qcIpqc.setUpdateTime(DateUtils.getNowDate()); + return qcIpqcMapper.updateQcIpqc(qcIpqc); + } + + @Override + public int updateCrMajMinQuaAndRate(Long qcId) { + return qcIpqcMapper.updateCrMajMinQuaAndRate(qcId); + } + + + /** + * 批量删除过程检验单 + * + * @param ipqcIds 需要删除的过程检验单主键 + * @return 结果 + */ + @Override + public int deleteQcIpqcByIpqcIds(Long[] ipqcIds) + { + return qcIpqcMapper.deleteQcIpqcByIpqcIds(ipqcIds); + } + + /** + * 删除过程检验单信息 + * + * @param ipqcId 过程检验单主键 + * @return 结果 + */ + @Override + public int deleteQcIpqcByIpqcId(Long ipqcId) + { + return qcIpqcMapper.deleteQcIpqcByIpqcId(ipqcId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIqcLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIqcLineServiceImpl.java new file mode 100644 index 0000000..746067b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIqcLineServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcIqcLineMapper; +import com.ktg.mes.qc.domain.QcIqcLine; +import com.ktg.mes.qc.service.IQcIqcLineService; + +/** + * 来料检验单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-19 + */ +@Service +public class QcIqcLineServiceImpl implements IQcIqcLineService +{ + @Autowired + private QcIqcLineMapper qcIqcLineMapper; + + /** + * 查询来料检验单行 + * + * @param lineId 来料检验单行主键 + * @return 来料检验单行 + */ + @Override + public QcIqcLine selectQcIqcLineByLineId(Long lineId) + { + return qcIqcLineMapper.selectQcIqcLineByLineId(lineId); + } + + /** + * 查询来料检验单行列表 + * + * @param qcIqcLine 来料检验单行 + * @return 来料检验单行 + */ + @Override + public List selectQcIqcLineList(QcIqcLine qcIqcLine) + { + return qcIqcLineMapper.selectQcIqcLineList(qcIqcLine); + } + + /** + * 新增来料检验单行 + * + * @param qcIqcLine 来料检验单行 + * @return 结果 + */ + @Override + public int insertQcIqcLine(QcIqcLine qcIqcLine) + { + qcIqcLine.setCreateTime(DateUtils.getNowDate()); + return qcIqcLineMapper.insertQcIqcLine(qcIqcLine); + } + + /** + * 修改来料检验单行 + * + * @param qcIqcLine 来料检验单行 + * @return 结果 + */ + @Override + public int updateQcIqcLine(QcIqcLine qcIqcLine) + { + qcIqcLine.setUpdateTime(DateUtils.getNowDate()); + return qcIqcLineMapper.updateQcIqcLine(qcIqcLine); + } + + @Override + public int updateCrMajMinQuantity(Long iqcId,Long lineId) { + QcIqcLine qcIqcLine = new QcIqcLine(); + qcIqcLine.setIqcId(iqcId); + qcIqcLine.setLineId(lineId); + return qcIqcLineMapper.updateCrMajMinQuantity(qcIqcLine); + } + + /** + * 批量删除来料检验单行 + * + * @param lineIds 需要删除的来料检验单行主键 + * @return 结果 + */ + @Override + public int deleteQcIqcLineByLineIds(Long[] lineIds) + { + return qcIqcLineMapper.deleteQcIqcLineByLineIds(lineIds); + } + + @Override + public int deleteByIqcId(Long iqcId) { + return qcIqcLineMapper.deleteByIqcId(iqcId); + } + + /** + * 删除来料检验单行信息 + * + * @param lineId 来料检验单行主键 + * @return 结果 + */ + @Override + public int deleteQcIqcLineByLineId(Long lineId) + { + return qcIqcLineMapper.deleteQcIqcLineByLineId(lineId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIqcServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIqcServiceImpl.java new file mode 100644 index 0000000..49bea95 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIqcServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcIqcMapper; +import com.ktg.mes.qc.domain.QcIqc; +import com.ktg.mes.qc.service.IQcIqcService; + +/** + * 来料检验单Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-19 + */ +@Service +public class QcIqcServiceImpl implements IQcIqcService +{ + @Autowired + private QcIqcMapper qcIqcMapper; + + /** + * 查询来料检验单 + * + * @param iqcId 来料检验单主键 + * @return 来料检验单 + */ + @Override + public QcIqc selectQcIqcByIqcId(Long iqcId) + { + return qcIqcMapper.selectQcIqcByIqcId(iqcId); + } + + /** + * 查询来料检验单列表 + * + * @param qcIqc 来料检验单 + * @return 来料检验单 + */ + @Override + public List selectQcIqcList(QcIqc qcIqc) + { + return qcIqcMapper.selectQcIqcList(qcIqc); + } + + @Override + public String checkIqcCodeUnique(QcIqc qcIqc) { + QcIqc iqc = qcIqcMapper.checkIqcCodeUnique(qcIqc); + Long iqcId = qcIqc.getIqcId()==null?-1L:qcIqc.getIqcId(); + if(StringUtils.isNotNull(iqc) && iqc.getIqcId().longValue() != iqcId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增来料检验单 + * + * @param qcIqc 来料检验单 + * @return 结果 + */ + @Override + public int insertQcIqc(QcIqc qcIqc) + { + qcIqc.setCreateTime(DateUtils.getNowDate()); + return qcIqcMapper.insertQcIqc(qcIqc); + } + + /** + * 修改来料检验单 + * + * @param qcIqc 来料检验单 + * @return 结果 + */ + @Override + public int updateQcIqc(QcIqc qcIqc) + { + qcIqc.setUpdateTime(DateUtils.getNowDate()); + return qcIqcMapper.updateQcIqc(qcIqc); + } + + @Override + public int updateCrMajMinQuaAndRate(Long iqcId) { + return qcIqcMapper.updateCrMajMinQuaAndRate(iqcId); + } + + /** + * 批量删除来料检验单 + * + * @param iqcIds 需要删除的来料检验单主键 + * @return 结果 + */ + @Override + public int deleteQcIqcByIqcIds(Long[] iqcIds) + { + return qcIqcMapper.deleteQcIqcByIqcIds(iqcIds); + } + + /** + * 删除来料检验单信息 + * + * @param iqcId 来料检验单主键 + * @return 结果 + */ + @Override + public int deleteQcIqcByIqcId(Long iqcId) + { + return qcIqcMapper.deleteQcIqcByIqcId(iqcId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcOqcLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcOqcLineServiceImpl.java new file mode 100644 index 0000000..308c119 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcOqcLineServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcOqcLineMapper; +import com.ktg.mes.qc.domain.QcOqcLine; +import com.ktg.mes.qc.service.IQcOqcLineService; + +/** + * 出货检验单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-01 + */ +@Service +public class QcOqcLineServiceImpl implements IQcOqcLineService +{ + @Autowired + private QcOqcLineMapper qcOqcLineMapper; + + /** + * 查询出货检验单行 + * + * @param lineId 出货检验单行主键 + * @return 出货检验单行 + */ + @Override + public QcOqcLine selectQcOqcLineByLineId(Long lineId) + { + return qcOqcLineMapper.selectQcOqcLineByLineId(lineId); + } + + /** + * 查询出货检验单行列表 + * + * @param qcOqcLine 出货检验单行 + * @return 出货检验单行 + */ + @Override + public List selectQcOqcLineList(QcOqcLine qcOqcLine) + { + return qcOqcLineMapper.selectQcOqcLineList(qcOqcLine); + } + + /** + * 新增出货检验单行 + * + * @param qcOqcLine 出货检验单行 + * @return 结果 + */ + @Override + public int insertQcOqcLine(QcOqcLine qcOqcLine) + { + qcOqcLine.setCreateTime(DateUtils.getNowDate()); + return qcOqcLineMapper.insertQcOqcLine(qcOqcLine); + } + + /** + * 修改出货检验单行 + * + * @param qcOqcLine 出货检验单行 + * @return 结果 + */ + @Override + public int updateQcOqcLine(QcOqcLine qcOqcLine) + { + qcOqcLine.setUpdateTime(DateUtils.getNowDate()); + return qcOqcLineMapper.updateQcOqcLine(qcOqcLine); + } + + @Override + public int updateCrMajMinQuantity(Long qcId, Long lineId) { + QcOqcLine line = new QcOqcLine(); + line.setLineId(lineId); + line.setOqcId(qcId); + return qcOqcLineMapper.updateCrMajMinQuantity(line); + } + + /** + * 批量删除出货检验单行 + * + * @param lineIds 需要删除的出货检验单行主键 + * @return 结果 + */ + @Override + public int deleteQcOqcLineByLineIds(Long[] lineIds) + { + return qcOqcLineMapper.deleteQcOqcLineByLineIds(lineIds); + } + + /** + * 删除出货检验单行信息 + * + * @param lineId 出货检验单行主键 + * @return 结果 + */ + @Override + public int deleteQcOqcLineByLineId(Long lineId) + { + return qcOqcLineMapper.deleteQcOqcLineByLineId(lineId); + } + + @Override + public int deleteByOqcId(Long oqcId) { + return qcOqcLineMapper.deleteByOqcId(oqcId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcOqcServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcOqcServiceImpl.java new file mode 100644 index 0000000..db62fbf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcOqcServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcOqcMapper; +import com.ktg.mes.qc.domain.QcOqc; +import com.ktg.mes.qc.service.IQcOqcService; + +/** + * 出货检验单Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-31 + */ +@Service +public class QcOqcServiceImpl implements IQcOqcService +{ + @Autowired + private QcOqcMapper qcOqcMapper; + + /** + * 查询出货检验单 + * + * @param oqcId 出货检验单主键 + * @return 出货检验单 + */ + @Override + public QcOqc selectQcOqcByOqcId(Long oqcId) + { + return qcOqcMapper.selectQcOqcByOqcId(oqcId); + } + + /** + * 查询出货检验单列表 + * + * @param qcOqc 出货检验单 + * @return 出货检验单 + */ + @Override + public List selectQcOqcList(QcOqc qcOqc) + { + return qcOqcMapper.selectQcOqcList(qcOqc); + } + + @Override + public String checkOqcCodeUnique(QcOqc qcOqc) { + QcOqc oqc = qcOqcMapper.checkOqcCodeUnique(qcOqc); + Long oqcId = qcOqc.getOqcId() == null? -1L : qcOqc.getOqcId(); + if(StringUtils.isNotNull(oqc) && oqc.getOqcId().longValue() != oqcId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增出货检验单 + * + * @param qcOqc 出货检验单 + * @return 结果 + */ + @Override + public int insertQcOqc(QcOqc qcOqc) + { + qcOqc.setCreateTime(DateUtils.getNowDate()); + return qcOqcMapper.insertQcOqc(qcOqc); + } + + /** + * 修改出货检验单 + * + * @param qcOqc 出货检验单 + * @return 结果 + */ + @Override + public int updateQcOqc(QcOqc qcOqc) + { + qcOqc.setUpdateTime(DateUtils.getNowDate()); + return qcOqcMapper.updateQcOqc(qcOqc); + } + + @Override + public int updateCrMajMinQuaAndRate(Long oqcId) { + return qcOqcMapper.updateCrMajMinQuaAndRate(oqcId); + } + + /** + * 批量删除出货检验单 + * + * @param oqcIds 需要删除的出货检验单主键 + * @return 结果 + */ + @Override + public int deleteQcOqcByOqcIds(Long[] oqcIds) + { + return qcOqcMapper.deleteQcOqcByOqcIds(oqcIds); + } + + /** + * 删除出货检验单信息 + * + * @param oqcId 出货检验单主键 + * @return 结果 + */ + @Override + public int deleteQcOqcByOqcId(Long oqcId) + { + return qcOqcMapper.deleteQcOqcByOqcId(oqcId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcPendingInspectServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcPendingInspectServiceImpl.java new file mode 100644 index 0000000..cb27507 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcPendingInspectServiceImpl.java @@ -0,0 +1,21 @@ +package com.ktg.mes.qc.service.impl; + +import com.ktg.mes.qc.domain.QcPendingInspect; +import com.ktg.mes.qc.mapper.QcPendingInspectMapper; +import com.ktg.mes.qc.service.IQcPendingInspectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class QcPendingInspectServiceImpl implements IQcPendingInspectService { + + @Autowired + private QcPendingInspectMapper qcPendingInspectMapper; + + @Override + public List selectQcPendingList(QcPendingInspect qcPendingInspect) { + return qcPendingInspectMapper.selectQcPendingList(qcPendingInspect); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateIndexServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateIndexServiceImpl.java new file mode 100644 index 0000000..49468c5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateIndexServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcTemplateIndexMapper; +import com.ktg.mes.qc.domain.QcTemplateIndex; +import com.ktg.mes.qc.service.IQcTemplateIndexService; + +/** + * 检测模板-检测项Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-18 + */ +@Service +public class QcTemplateIndexServiceImpl implements IQcTemplateIndexService +{ + @Autowired + private QcTemplateIndexMapper qcTemplateIndexMapper; + + /** + * 查询检测模板-检测项 + * + * @param recordId 检测模板-检测项主键 + * @return 检测模板-检测项 + */ + @Override + public QcTemplateIndex selectQcTemplateIndexByRecordId(Long recordId) + { + return qcTemplateIndexMapper.selectQcTemplateIndexByRecordId(recordId); + } + + /** + * 查询检测模板-检测项列表 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 检测模板-检测项 + */ + @Override + public List selectQcTemplateIndexList(QcTemplateIndex qcTemplateIndex) + { + return qcTemplateIndexMapper.selectQcTemplateIndexList(qcTemplateIndex); + } + + /** + * 新增检测模板-检测项 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 结果 + */ + @Override + public int insertQcTemplateIndex(QcTemplateIndex qcTemplateIndex) + { + qcTemplateIndex.setCreateTime(DateUtils.getNowDate()); + return qcTemplateIndexMapper.insertQcTemplateIndex(qcTemplateIndex); + } + + /** + * 修改检测模板-检测项 + * + * @param qcTemplateIndex 检测模板-检测项 + * @return 结果 + */ + @Override + public int updateQcTemplateIndex(QcTemplateIndex qcTemplateIndex) + { + qcTemplateIndex.setUpdateTime(DateUtils.getNowDate()); + return qcTemplateIndexMapper.updateQcTemplateIndex(qcTemplateIndex); + } + + /** + * 批量删除检测模板-检测项 + * + * @param recordIds 需要删除的检测模板-检测项主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateIndexByRecordIds(Long[] recordIds) + { + return qcTemplateIndexMapper.deleteQcTemplateIndexByRecordIds(recordIds); + } + + /** + * 删除检测模板-检测项信息 + * + * @param recordId 检测模板-检测项主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateIndexByRecordId(Long recordId) + { + return qcTemplateIndexMapper.deleteQcTemplateIndexByRecordId(recordId); + } + + @Override + public int deleteByTemplateId(Long templateId) { + return qcTemplateIndexMapper.deleteByTemplateId(templateId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java new file mode 100644 index 0000000..feeba3f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcTemplateProductMapper; +import com.ktg.mes.qc.domain.QcTemplateProduct; +import com.ktg.mes.qc.service.IQcTemplateProductService; + +/** + * 检测模板-产品Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-18 + */ +@Service +public class QcTemplateProductServiceImpl implements IQcTemplateProductService +{ + @Autowired + private QcTemplateProductMapper qcTemplateProductMapper; + + /** + * 查询检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 检测模板-产品 + */ + @Override + public QcTemplateProduct selectQcTemplateProductByRecordId(Long recordId) + { + return qcTemplateProductMapper.selectQcTemplateProductByRecordId(recordId); + } + + /** + * 查询检测模板-产品列表 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 检测模板-产品 + */ + @Override + public List selectQcTemplateProductList(QcTemplateProduct qcTemplateProduct) + { + return qcTemplateProductMapper.selectQcTemplateProductList(qcTemplateProduct); + } + + @Override + public String checkProductUnique(QcTemplateProduct qcTemplateProduct) { + QcTemplateProduct product = qcTemplateProductMapper.checkProductUnique(qcTemplateProduct); + Long recordId = qcTemplateProduct.getRecordId() ==null? -1L:qcTemplateProduct.getRecordId(); + if(StringUtils.isNotNull(product) && product.getRecordId().longValue()!=recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + @Override + public int insertQcTemplateProduct(QcTemplateProduct qcTemplateProduct) + { + qcTemplateProduct.setCreateTime(DateUtils.getNowDate()); + return qcTemplateProductMapper.insertQcTemplateProduct(qcTemplateProduct); + } + + /** + * 修改检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + @Override + public int updateQcTemplateProduct(QcTemplateProduct qcTemplateProduct) + { + qcTemplateProduct.setUpdateTime(DateUtils.getNowDate()); + return qcTemplateProductMapper.updateQcTemplateProduct(qcTemplateProduct); + } + + /** + * 批量删除检测模板-产品 + * + * @param recordIds 需要删除的检测模板-产品主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateProductByRecordIds(Long[] recordIds) + { + return qcTemplateProductMapper.deleteQcTemplateProductByRecordIds(recordIds); + } + + /** + * 删除检测模板-产品信息 + * + * @param recordId 检测模板-产品主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateProductByRecordId(Long recordId) + { + return qcTemplateProductMapper.deleteQcTemplateProductByRecordId(recordId); + } + + @Override + public int deleteByTemplateId(Long templateId) { + return qcTemplateProductMapper.deleteByTemplateId(templateId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateServiceImpl.java new file mode 100644 index 0000000..3f8bf0d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.qc.domain.QcMobParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcTemplateMapper; +import com.ktg.mes.qc.domain.QcTemplate; +import com.ktg.mes.qc.service.IQcTemplateService; + +/** + * 检测模板Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-17 + */ +@Service +public class QcTemplateServiceImpl implements IQcTemplateService +{ + @Autowired + private QcTemplateMapper qcTemplateMapper; + + /** + * 查询检测模板 + * + * @param templateId 检测模板主键 + * @return 检测模板 + */ + @Override + public QcTemplate selectQcTemplateByTemplateId(Long templateId) + { + return qcTemplateMapper.selectQcTemplateByTemplateId(templateId); + } + + /** + * 查询检测模板列表 + * + * @param qcTemplate 检测模板 + * @return 检测模板 + */ + @Override + public List selectQcTemplateList(QcTemplate qcTemplate) + { + return qcTemplateMapper.selectQcTemplateList(qcTemplate); + } + + @Override + public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate) { + return qcTemplateMapper.selectQcTemplateByProductAndQcType(qcTemplate); + } + + @Override + public QcTemplate findTemplateByProductIdAndQcType(QcMobParam param) { + return qcTemplateMapper.findTemplateByProductIdAndQcType(param); + } + + @Override + public String checkTemplateCodeUnique(QcTemplate qcTemplate) { + QcTemplate template = qcTemplateMapper.checkTemplateCodeUnique(qcTemplate); + Long templateId = qcTemplate.getTemplateId()==null?-1L:qcTemplate.getTemplateId(); + if(StringUtils.isNotNull(template) && template.getTemplateId().longValue()!=templateId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增检测模板 + * + * @param qcTemplate 检测模板 + * @return 结果 + */ + @Override + public int insertQcTemplate(QcTemplate qcTemplate) + { + qcTemplate.setCreateTime(DateUtils.getNowDate()); + return qcTemplateMapper.insertQcTemplate(qcTemplate); + } + + /** + * 修改检测模板 + * + * @param qcTemplate 检测模板 + * @return 结果 + */ + @Override + public int updateQcTemplate(QcTemplate qcTemplate) + { + qcTemplate.setUpdateTime(DateUtils.getNowDate()); + return qcTemplateMapper.updateQcTemplate(qcTemplate); + } + + /** + * 批量删除检测模板 + * + * @param templateIds 需要删除的检测模板主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateByTemplateIds(Long[] templateIds) + { + return qcTemplateMapper.deleteQcTemplateByTemplateIds(templateIds); + } + + /** + * 删除检测模板信息 + * + * @param templateId 检测模板主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateByTemplateId(Long templateId) + { + return qcTemplateMapper.deleteQcTemplateByTemplateId(templateId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/controller/UreportFileTblController.java b/ktg-mes/src/main/java/com/ktg/mes/report/controller/UreportFileTblController.java new file mode 100644 index 0000000..d54349e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/controller/UreportFileTblController.java @@ -0,0 +1,98 @@ +package com.ktg.mes.report.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.report.domain.UreportFileTbl; +import com.ktg.mes.report.service.IUreportFileTblService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 报表管理Controller + * + * @author yanshikui + * @date 2022-10-07 + */ +@RestController +@RequestMapping("/ureportM") +public class UreportFileTblController extends BaseController +{ + @Autowired + private IUreportFileTblService ureportFileTblService; + + /** + * 查询报表管理列表 + */ + @PreAuthorize("@ss.hasPermi('mes:report:list')") + @GetMapping("/list") + public TableDataInfo list(UreportFileTbl ureportFileTbl) + { + startPage(); + List list = ureportFileTblService.selectUreportFileTblList(ureportFileTbl); + return getDataTable(list); + } + + /** + * 导出报表管理列表 + */ + @PreAuthorize("@ss.hasPermi('mes:report:export')") + @Log(title = "报表管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, UreportFileTbl ureportFileTbl) + { + List list = ureportFileTblService.selectUreportFileTblList(ureportFileTbl); + ExcelUtil util = new ExcelUtil(UreportFileTbl.class); + util.exportExcel(response, list, "报表管理数据"); + } + + /** + * 获取报表管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:report:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(ureportFileTblService.selectUreportFileTblById(id)); + } + + /** + * 新增报表管理 + */ + @PreAuthorize("@ss.hasPermi('mes:report:add')") + @Log(title = "报表管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody UreportFileTbl ureportFileTbl) + { + return toAjax(ureportFileTblService.insertUreportFileTbl(ureportFileTbl)); + } + + /** + * 修改报表管理 + */ + @PreAuthorize("@ss.hasPermi('mes:report:edit')") + @Log(title = "报表管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody UreportFileTbl ureportFileTbl) + { + return toAjax(ureportFileTblService.updateUreportFileTbl(ureportFileTbl)); + } + + /** + * 删除报表管理 + */ + @PreAuthorize("@ss.hasPermi('mes:report:remove')") + @Log(title = "报表管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(ureportFileTblService.deleteUreportFileTblByIds(ids)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/domain/UreportFileEntity.java b/ktg-mes/src/main/java/com/ktg/mes/report/domain/UreportFileEntity.java new file mode 100644 index 0000000..d5874b9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/domain/UreportFileEntity.java @@ -0,0 +1,78 @@ +package com.ktg.mes.report.domain; + +import com.ktg.common.core.domain.BaseEntity; + +import java.util.Arrays; +import java.util.Date; + +/** + * Ureport文件 实体类 + * @author yanshikui + * @version 2022年10月7日 + * + */ + +public class UreportFileEntity extends BaseEntity { + + private static final long serialVersionUID = 1L; + private Long id; + private String name; + private byte[] content; + private Date createTime; + private Date updateTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public byte[] getContent() { + return content; + } + + public void setContent(byte[] content) { + this.content = content; + } + + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public Date getUpdateTime() { + return updateTime; + } + + @Override + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + @Override + public String toString() { + return "UreportFileEntity{" + + "id=" + id + + ", name='" + name + '\'' + + ", content=" + Arrays.toString(content) + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/domain/UreportFileTbl.java b/ktg-mes/src/main/java/com/ktg/mes/report/domain/UreportFileTbl.java new file mode 100644 index 0000000..4cc23e1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/domain/UreportFileTbl.java @@ -0,0 +1,67 @@ +package com.ktg.mes.report.domain; + +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 报表管理对象 ureport_file_tbl + * + * @author yanshikui + * @date 2022-10-07 + */ +public class UreportFileTbl extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String name; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String content; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .append("content", getContent()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/mapper/UreportFileMapper.java b/ktg-mes/src/main/java/com/ktg/mes/report/mapper/UreportFileMapper.java new file mode 100644 index 0000000..5d17cd8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/mapper/UreportFileMapper.java @@ -0,0 +1,56 @@ +package com.ktg.mes.report.mapper; + +import com.ktg.mes.report.domain.UreportFileEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * Ureport文件 Mapper + * @author yanshikui + * @version 2022年10月7日 + * + */ +@Mapper +public interface UreportFileMapper { + + /** + * 根据报表名称检查报表是否存在 + * @param name 报表名称 + * @return + */ + public int checkExistByName(String name); + + /** + * 根据报表名称查询报表 + * @param name 报表名称 + * @return + */ + public UreportFileEntity queryUreportFileEntityByName(String name); + + /** + * 查询全部报表 + * @return + */ + public List queryReportFileList(); + + /** + * 根据报表名称删除报表 + * @param name + * @return + */ + public int deleteReportFileByName(String name); + + + /** + * 保存报表 + */ + public int insertReportFile(UreportFileEntity entity); + + /** + * 更新报表 + * @param entity + * @return + */ + public int updateReportFile(UreportFileEntity entity); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/mapper/UreportFileTblMapper.java b/ktg-mes/src/main/java/com/ktg/mes/report/mapper/UreportFileTblMapper.java new file mode 100644 index 0000000..b25d555 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/mapper/UreportFileTblMapper.java @@ -0,0 +1,62 @@ +package com.ktg.mes.report.mapper; + +import com.ktg.mes.report.domain.UreportFileTbl; + +import java.util.List; + +/** + * 报表管理Mapper接口 + * + * @author yanshikui + * @date 2022-10-07 + */ +public interface UreportFileTblMapper +{ + /** + * 查询报表管理 + * + * @param id 报表管理主键 + * @return 报表管理 + */ + public UreportFileTbl selectUreportFileTblById(Long id); + + /** + * 查询报表管理列表 + * + * @param ureportFileTbl 报表管理 + * @return 报表管理集合 + */ + public List selectUreportFileTblList(UreportFileTbl ureportFileTbl); + + /** + * 新增报表管理 + * + * @param ureportFileTbl 报表管理 + * @return 结果 + */ + public int insertUreportFileTbl(UreportFileTbl ureportFileTbl); + + /** + * 修改报表管理 + * + * @param ureportFileTbl 报表管理 + * @return 结果 + */ + public int updateUreportFileTbl(UreportFileTbl ureportFileTbl); + + /** + * 删除报表管理 + * + * @param id 报表管理主键 + * @return 结果 + */ + public int deleteUreportFileTblById(Long id); + + /** + * 批量删除报表管理 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteUreportFileTblByIds(Long[] ids); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/provider/MySQLProvider.java b/ktg-mes/src/main/java/com/ktg/mes/report/provider/MySQLProvider.java new file mode 100644 index 0000000..2faad79 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/provider/MySQLProvider.java @@ -0,0 +1,123 @@ +package com.ktg.mes.report.provider; + +import com.bstek.ureport.provider.report.ReportFile; +import com.bstek.ureport.provider.report.ReportProvider; +import com.ktg.mes.report.domain.UreportFileEntity; +import com.ktg.mes.report.mapper.UreportFileMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Mysql 报表存储 + * @author yanshikui + * @version 2022年10月7日 + * + */ + +@Component +// 该注解可以利用其 prefix属性值 + 类的属性名 在yml中配置属性值 +@ConfigurationProperties(prefix = "ureport.mysql.provider") +public class MySQLProvider implements ReportProvider{ + private static final String NAME = "数据库服务器"; + + // 特定前缀,ureport底层会调用 getPrefix 方法来获取报表操作的Provier类 + private String prefix = "mysql:"; + + // 是否禁用 + private boolean disabled; + + @Autowired + private UreportFileMapper ureportFileMapper; + + @Override + public InputStream loadReport(String file) { + UreportFileEntity ureportFileEntity = ureportFileMapper.queryUreportFileEntityByName(getCorrectName(file)); + byte[] content = ureportFileEntity.getContent(); + ByteArrayInputStream inputStream = new ByteArrayInputStream(content); + return inputStream; + } + + @Override + public void deleteReport(String file) { + ureportFileMapper.deleteReportFileByName(getCorrectName(file)); + } + + @Override + public List getReportFiles() { + List list = ureportFileMapper.queryReportFileList(); + List reportList = new ArrayList<>(); + for (UreportFileEntity ureportFileEntity : list) { + reportList.add(new ReportFile(ureportFileEntity.getName(), ureportFileEntity.getUpdateTime())); + } + return reportList ; + } + + @Override + public void saveReport(String file, String content) { + file = getCorrectName(file); + UreportFileEntity ureportFileEntity = ureportFileMapper.queryUreportFileEntityByName(file); + Date currentDate = new Date(); + if(ureportFileEntity == null){ + ureportFileEntity = new UreportFileEntity(); + ureportFileEntity.setName(file); + ureportFileEntity.setContent(content.getBytes()); + ureportFileEntity.setCreateTime(currentDate); + ureportFileEntity.setUpdateTime(currentDate); + ureportFileMapper.insertReportFile(ureportFileEntity); + }else{ + ureportFileEntity.setContent(content.getBytes()); + ureportFileEntity.setUpdateTime(currentDate); + ureportFileMapper.updateReportFile(ureportFileEntity); + } + } + + @Override + public String getName() { + return NAME; + } + + @Override + public boolean disabled() { + return disabled; + } + + @Override + public String getPrefix() { + return prefix; + } + + public static String getNAME() { + return NAME; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public boolean isDisabled() { + return disabled; + } + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + /** + * 获取没有前缀的文件名 + * @param name + * @return + */ + private String getCorrectName(String name){ + if(name.startsWith(prefix)){ + name = name.substring(prefix.length(), name.length()); + } + return name; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/service/IUreportFileTblService.java b/ktg-mes/src/main/java/com/ktg/mes/report/service/IUreportFileTblService.java new file mode 100644 index 0000000..ee3697f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/service/IUreportFileTblService.java @@ -0,0 +1,62 @@ +package com.ktg.mes.report.service; + +import com.ktg.mes.report.domain.UreportFileTbl; + +import java.util.List; + +/** + * 报表管理Service接口 + * + * @author yanshikui + * @date 2022-10-07 + */ +public interface IUreportFileTblService +{ + /** + * 查询报表管理 + * + * @param id 报表管理主键 + * @return 报表管理 + */ + public UreportFileTbl selectUreportFileTblById(Long id); + + /** + * 查询报表管理列表 + * + * @param ureportFileTbl 报表管理 + * @return 报表管理集合 + */ + public List selectUreportFileTblList(UreportFileTbl ureportFileTbl); + + /** + * 新增报表管理 + * + * @param ureportFileTbl 报表管理 + * @return 结果 + */ + public int insertUreportFileTbl(UreportFileTbl ureportFileTbl); + + /** + * 修改报表管理 + * + * @param ureportFileTbl 报表管理 + * @return 结果 + */ + public int updateUreportFileTbl(UreportFileTbl ureportFileTbl); + + /** + * 批量删除报表管理 + * + * @param ids 需要删除的报表管理主键集合 + * @return 结果 + */ + public int deleteUreportFileTblByIds(Long[] ids); + + /** + * 删除报表管理信息 + * + * @param id 报表管理主键 + * @return 结果 + */ + public int deleteUreportFileTblById(Long id); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/service/impl/UreportFileTblServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/report/service/impl/UreportFileTblServiceImpl.java new file mode 100644 index 0000000..44c48eb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/service/impl/UreportFileTblServiceImpl.java @@ -0,0 +1,97 @@ +package com.ktg.mes.report.service.impl; + +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.report.domain.UreportFileTbl; +import com.ktg.mes.report.mapper.UreportFileTblMapper; +import com.ktg.mes.report.service.IUreportFileTblService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 报表管理Service业务层处理 + * + * @author yanshikui + * @date 2022-10-07 + */ +@Service +public class UreportFileTblServiceImpl implements IUreportFileTblService +{ + @Autowired + private UreportFileTblMapper ureportFileTblMapper; + + /** + * 查询报表管理 + * + * @param id 报表管理主键 + * @return 报表管理 + */ + @Override + public UreportFileTbl selectUreportFileTblById(Long id) + { + return ureportFileTblMapper.selectUreportFileTblById(id); + } + + /** + * 查询报表管理列表 + * + * @param ureportFileTbl 报表管理 + * @return 报表管理 + */ + @Override + public List selectUreportFileTblList(UreportFileTbl ureportFileTbl) + { + return ureportFileTblMapper.selectUreportFileTblList(ureportFileTbl); + } + + /** + * 新增报表管理 + * + * @param ureportFileTbl 报表管理 + * @return 结果 + */ + @Override + public int insertUreportFileTbl(UreportFileTbl ureportFileTbl) + { + ureportFileTbl.setCreateTime(DateUtils.getNowDate()); + return ureportFileTblMapper.insertUreportFileTbl(ureportFileTbl); + } + + /** + * 修改报表管理 + * + * @param ureportFileTbl 报表管理 + * @return 结果 + */ + @Override + public int updateUreportFileTbl(UreportFileTbl ureportFileTbl) + { + ureportFileTbl.setUpdateTime(DateUtils.getNowDate()); + return ureportFileTblMapper.updateUreportFileTbl(ureportFileTbl); + } + + /** + * 批量删除报表管理 + * + * @param ids 需要删除的报表管理主键 + * @return 结果 + */ + @Override + public int deleteUreportFileTblByIds(Long[] ids) + { + return ureportFileTblMapper.deleteUreportFileTblByIds(ids); + } + + /** + * 删除报表管理信息 + * + * @param id 报表管理主键 + * @return 结果 + */ + @Override + public int deleteUreportFileTblById(Long id) + { + return ureportFileTblMapper.deleteUreportFileTblById(id); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/utils/FormatSuffixEnum.java b/ktg-mes/src/main/java/com/ktg/mes/report/utils/FormatSuffixEnum.java new file mode 100644 index 0000000..f14c50f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/utils/FormatSuffixEnum.java @@ -0,0 +1,24 @@ +package com.ktg.mes.report.utils; + +import java.util.Arrays; + +/** + * @author: create by libin + * @version: v1.0 + * @description: pl.piomin.jasperreport.enums + * @date:2020/4/15 + */ +public enum FormatSuffixEnum { + doc, + xls, + pdf, + html, + png, + csv, + odt, + ods; + + public static FormatSuffixEnum getValue(String value){ + return Arrays.stream(values()).filter(item -> item.name().equals(value)).findFirst().orElse(null); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/utils/OpenTypeEnum.java b/ktg-mes/src/main/java/com/ktg/mes/report/utils/OpenTypeEnum.java new file mode 100644 index 0000000..44239c1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/utils/OpenTypeEnum.java @@ -0,0 +1,24 @@ +package com.ktg.mes.report.utils; + +import java.util.Arrays; + +/** + * @author: create by libin + * @version: v1.0 + * @description: pl.piomin.jasperreport.enums + * @date:2020/4/15 + */ +public enum OpenTypeEnum { + /** + * 预览 + */ + inline, + /** + * 下载 + */ + attachment; + + public static OpenTypeEnum getValue(String value){ + return Arrays.stream(values()).filter(item -> item.name().equals(value)).findFirst().orElse(null); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/report/utils/ThreadLocalUtil.java b/ktg-mes/src/main/java/com/ktg/mes/report/utils/ThreadLocalUtil.java new file mode 100644 index 0000000..469c5e5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/report/utils/ThreadLocalUtil.java @@ -0,0 +1,84 @@ +package com.ktg.mes.report.utils; + +import java.util.*; + +public final class ThreadLocalUtil { + private static final ThreadLocal> threadLocal = new ThreadLocal() { + @Override + protected Map initialValue() { + return new HashMap(4); + } + }; + + public static Map getThreadLocal(){ + return threadLocal.get(); + } + public static T get(String key) { + Map map = (Map)threadLocal.get(); + return (T)map.get(key); + } + + public static T get(String key,T defaultValue) { + Map map = (Map)threadLocal.get(); + return (T)map.get(key) == null ? defaultValue : (T)map.get(key); + } + + public static void set(String key, Object value) { + Map map = (Map)threadLocal.get(); + map.put(key, value); + } + + public static void set(Map keyValueMap) { + Map map = (Map)threadLocal.get(); + map.putAll(keyValueMap); + } + + public static void remove() { + threadLocal.remove(); + } + + public static Map fetchVarsByPrefix(String prefix) { + Map vars = new HashMap<>(); + if( prefix == null ){ + return vars; + } + Map map = (Map)threadLocal.get(); + Set set = map.entrySet(); + + for( Map.Entry entry : set ){ + Object key = entry.getKey(); + if( key instanceof String ){ + if( ((String) key).startsWith(prefix) ){ + vars.put((String)key,(T)entry.getValue()); + } + } + } + return vars; + } + + public static T remove(String key) { + Map map = (Map)threadLocal.get(); + return (T)map.remove(key); + } + + public static void clear(String prefix) { + if( prefix == null ){ + return; + } + Map map = (Map)threadLocal.get(); + Set set = map.entrySet(); + List removeKeys = new ArrayList<>(); + + for( Map.Entry entry : set ){ + Object key = entry.getKey(); + if( key instanceof String ){ + if( ((String) key).startsWith(prefix) ){ + removeKeys.add((String)key); + } + } + } + for( String key : removeKeys ){ + map.remove(key); + } + } +} \ No newline at end of file diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/controller/TmToolController.java b/ktg-mes/src/main/java/com/ktg/mes/tm/controller/TmToolController.java new file mode 100644 index 0000000..c1c02f2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/controller/TmToolController.java @@ -0,0 +1,130 @@ +package com.ktg.mes.tm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.tm.domain.TmToolType; +import com.ktg.mes.tm.service.ITmToolTypeService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.tm.domain.TmTool; +import com.ktg.mes.tm.service.ITmToolService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工装夹具清单Controller + * + * @author yinjinlu + * @date 2022-05-11 + */ +@RestController +@RequestMapping("/mes/tm/tool") +public class TmToolController extends BaseController +{ + @Autowired + private ITmToolService tmToolService; + + @Autowired + private ITmToolTypeService tmToolTypeService; + + /** + * 查询工装夹具清单列表 + */ + @GetMapping("/list") + public TableDataInfo list(TmTool tmTool) + { + startPage(); + List list = tmToolService.selectTmToolList(tmTool); + return getDataTable(list); + } + + /** + * 导出工装夹具清单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tool:export')") + @Log(title = "工装夹具清单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TmTool tmTool) + { + List list = tmToolService.selectTmToolList(tmTool); + ExcelUtil util = new ExcelUtil(TmTool.class); + util.exportExcel(response, list, "工装夹具清单数据"); + } + + /** + * 获取工装夹具清单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tool:query')") + @GetMapping(value = "/{toolId}") + public AjaxResult getInfo(@PathVariable("toolId") Long toolId) + { + return AjaxResult.success(tmToolService.selectTmToolByToolId(toolId)); + } + + /** + * 新增工装夹具清单 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tool:add')") + @Log(title = "工装夹具清单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody TmTool tmTool) + { + if(UserConstants.NOT_UNIQUE.equals(tmToolService.checkToolCodeUnique(tmTool))){ + return AjaxResult.error("此工装夹具编码已存在!"); + } + + TmToolType type = tmToolTypeService.selectTmToolTypeByToolTypeId(tmTool.getToolTypeId()); + tmTool.setToolTypeCode(type.getToolTypeCode()); + tmTool.setToolTypeName(type.getToolTypeName()); + tmTool.setCodeFlag(type.getCodeFlag()); + return toAjax(tmToolService.insertTmTool(tmTool)); + } + + /** + * 修改工装夹具清单 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tool:edit')") + @Log(title = "工装夹具清单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody TmTool tmTool) + { + if(UserConstants.NOT_UNIQUE.equals(tmToolService.checkToolCodeUnique(tmTool))){ + return AjaxResult.error("此工装夹具编码已存在!"); + } + TmToolType type = tmToolTypeService.selectTmToolTypeByToolTypeId(tmTool.getToolTypeId()); + tmTool.setToolTypeCode(type.getToolTypeCode()); + tmTool.setToolTypeName(type.getToolTypeName()); + tmTool.setCodeFlag(type.getCodeFlag()); + if(UserConstants.MAINTEN_TYPE_REGULAR.equals(tmTool.getMaintenType())){ + tmTool.setNextMaintenPeriod(null); + }else{ + tmTool.setNextMaintenDate(null); + } + return toAjax(tmToolService.updateTmTool(tmTool)); + } + + /** + * 删除工装夹具清单 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tool:remove')") + @Log(title = "工装夹具清单", businessType = BusinessType.DELETE) + @DeleteMapping("/{toolIds}") + public AjaxResult remove(@PathVariable Long[] toolIds) + { + return toAjax(tmToolService.deleteTmToolByToolIds(toolIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/controller/TmToolTypeController.java b/ktg-mes/src/main/java/com/ktg/mes/tm/controller/TmToolTypeController.java new file mode 100644 index 0000000..3e9e8d5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/controller/TmToolTypeController.java @@ -0,0 +1,125 @@ +package com.ktg.mes.tm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.tm.domain.TmToolType; +import com.ktg.mes.tm.service.ITmToolTypeService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工装夹具类型Controller + * + * @author yinjinlu + * @date 2022-05-10 + */ +@RestController +@RequestMapping("/mes/tm/tooltype") +public class TmToolTypeController extends BaseController +{ + @Autowired + private ITmToolTypeService tmToolTypeService; + + /** + * 查询工装夹具类型列表 + */ + @GetMapping("/list") + public TableDataInfo list(TmToolType tmToolType) + { + startPage(); + List list = tmToolTypeService.selectTmToolTypeList(tmToolType); + return getDataTable(list); + } + + @GetMapping("/listAll") + public AjaxResult listAll(){ + TmToolType tmToolType = new TmToolType(); + List list = tmToolTypeService.selectTmToolTypeList(tmToolType); + return AjaxResult.success(list); + } + + + /** + * 导出工装夹具类型列表 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:export')") + @Log(title = "工装夹具类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TmToolType tmToolType) + { + List list = tmToolTypeService.selectTmToolTypeList(tmToolType); + ExcelUtil util = new ExcelUtil(TmToolType.class); + util.exportExcel(response, list, "工装夹具类型数据"); + } + + /** + * 获取工装夹具类型详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:query')") + @GetMapping(value = "/{toolTypeId}") + public AjaxResult getInfo(@PathVariable("toolTypeId") Long toolTypeId) + { + return AjaxResult.success(tmToolTypeService.selectTmToolTypeByToolTypeId(toolTypeId)); + } + + /** + * 新增工装夹具类型 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:add')") + @Log(title = "工装夹具类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody TmToolType tmToolType) + { + if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeCodeUnique(tmToolType))){ + return AjaxResult.error("类型编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeNameUnique(tmToolType))){ + return AjaxResult.error("类型名称已存在!"); + } + return toAjax(tmToolTypeService.insertTmToolType(tmToolType)); + } + + /** + * 修改工装夹具类型 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:edit')") + @Log(title = "工装夹具类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody TmToolType tmToolType) + { + if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeCodeUnique(tmToolType))){ + return AjaxResult.error("类型编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeNameUnique(tmToolType))){ + return AjaxResult.error("类型名称已存在!"); + } + return toAjax(tmToolTypeService.updateTmToolType(tmToolType)); + } + + /** + * 删除工装夹具类型 + */ + @PreAuthorize("@ss.hasPermi('mes:tm:tooltype:remove')") + @Log(title = "工装夹具类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{toolTypeIds}") + public AjaxResult remove(@PathVariable Long[] toolTypeIds) + { + return toAjax(tmToolTypeService.deleteTmToolTypeByToolTypeIds(toolTypeIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmTool.java b/ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmTool.java new file mode 100644 index 0000000..62e1fe7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmTool.java @@ -0,0 +1,293 @@ +package com.ktg.mes.tm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 工装夹具清单对象 tm_tool + * + * @author yinjinlu + * @date 2022-05-11 + */ +public class TmTool extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工装夹具ID */ + private Long toolId; + + /** 工装夹具编码 */ + @Excel(name = "工装夹具编码") + private String toolCode; + + /** 工装夹具名称 */ + @Excel(name = "工装夹具名称") + private String toolName; + + /** 品牌 */ + @Excel(name = "品牌") + private String brand; + + /** 型号 */ + @Excel(name = "型号") + private String spec; + + /** 工装夹具类型ID */ + @Excel(name = "工装夹具类型ID") + private Long toolTypeId; + + /** 工装夹具类型编码 */ + @Excel(name = "工装夹具类型编码") + private String toolTypeCode; + + /** 工装夹具类型名称 */ + @Excel(name = "工装夹具类型名称") + private String toolTypeName; + + /** 是否单独编码管理 */ + @Excel(name = "是否单独编码管理") + private String codeFlag; + + /** 数量 */ + @Excel(name = "数量") + private Long quantity; + + /** 可用数量 */ + @Excel(name = "可用数量") + private Long quantityAvail; + + /** 保养维护类型 */ + @Excel(name = "保养维护类型") + private String maintenType; + + /** 下一次保养周期 */ + @Excel(name = "下一次保养周期") + private Long nextMaintenPeriod; + + /** 下一次保养日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "下一次保养日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date nextMaintenDate; + + /** 状态 */ + @Excel(name = "状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setToolId(Long toolId) + { + this.toolId = toolId; + } + + public Long getToolId() + { + return toolId; + } + public void setToolCode(String toolCode) + { + this.toolCode = toolCode; + } + + public String getToolCode() + { + return toolCode; + } + public void setToolName(String toolName) + { + this.toolName = toolName; + } + + public String getToolName() + { + return toolName; + } + public void setBrand(String brand) + { + this.brand = brand; + } + + public String getBrand() + { + return brand; + } + public void setSpec(String spec) + { + this.spec = spec; + } + + public String getSpec() + { + return spec; + } + public void setToolTypeId(Long toolTypeId) + { + this.toolTypeId = toolTypeId; + } + + public Long getToolTypeId() + { + return toolTypeId; + } + public void setToolTypeCode(String toolTypeCode) + { + this.toolTypeCode = toolTypeCode; + } + + public String getToolTypeCode() + { + return toolTypeCode; + } + public void setToolTypeName(String toolTypeName) + { + this.toolTypeName = toolTypeName; + } + + public String getToolTypeName() + { + return toolTypeName; + } + public void setCodeFlag(String codeFlag) + { + this.codeFlag = codeFlag; + } + + public String getCodeFlag() + { + return codeFlag; + } + public void setQuantity(Long quantity) + { + this.quantity = quantity; + } + + public Long getQuantity() + { + return quantity; + } + public void setQuantityAvail(Long quantityAvail) + { + this.quantityAvail = quantityAvail; + } + + public Long getQuantityAvail() + { + return quantityAvail; + } + public void setMaintenType(String maintenType) + { + this.maintenType = maintenType; + } + + public String getMaintenType() + { + return maintenType; + } + public void setNextMaintenPeriod(Long nextMaintenPeriod) + { + this.nextMaintenPeriod = nextMaintenPeriod; + } + + public Long getNextMaintenPeriod() + { + return nextMaintenPeriod; + } + public void setNextMaintenDate(Date nextMaintenDate) + { + this.nextMaintenDate = nextMaintenDate; + } + + public Date getNextMaintenDate() + { + return nextMaintenDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("toolId", getToolId()) + .append("toolCode", getToolCode()) + .append("toolName", getToolName()) + .append("brand", getBrand()) + .append("spec", getSpec()) + .append("toolTypeId", getToolTypeId()) + .append("toolTypeCode", getToolTypeCode()) + .append("toolTypeName", getToolTypeName()) + .append("codeFlag", getCodeFlag()) + .append("quantity", getQuantity()) + .append("quantityAvail", getQuantityAvail()) + .append("maintenType", getMaintenType()) + .append("nextMaintenPeriod", getNextMaintenPeriod()) + .append("nextMaintenDate", getNextMaintenDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmToolType.java b/ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmToolType.java new file mode 100644 index 0000000..69c020e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/domain/TmToolType.java @@ -0,0 +1,164 @@ +package com.ktg.mes.tm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 工装夹具类型对象 tm_tool_type + * + * @author yinjinlu + * @date 2022-05-10 + */ +public class TmToolType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 类型ID */ + private Long toolTypeId; + + /** 类型编码 */ + @Excel(name = "类型编码") + private String toolTypeCode; + + /** 类型名称 */ + @Excel(name = "类型名称") + private String toolTypeName; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String codeFlag; + + /** 保养维护类型 */ + @Excel(name = "保养维护类型") + private String maintenType; + + /** 保养周期 */ + @Excel(name = "保养周期") + private Long maintenPeriod; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setToolTypeId(Long toolTypeId) + { + this.toolTypeId = toolTypeId; + } + + public Long getToolTypeId() + { + return toolTypeId; + } + public void setToolTypeCode(String toolTypeCode) + { + this.toolTypeCode = toolTypeCode; + } + + public String getToolTypeCode() + { + return toolTypeCode; + } + public void setToolTypeName(String toolTypeName) + { + this.toolTypeName = toolTypeName; + } + + public String getToolTypeName() + { + return toolTypeName; + } + public void setCodeFlag(String codeFlag) + { + this.codeFlag = codeFlag; + } + + public String getCodeFlag() + { + return codeFlag; + } + public void setMaintenType(String maintenType) + { + this.maintenType = maintenType; + } + + public String getMaintenType() + { + return maintenType; + } + public void setMaintenPeriod(Long maintenPeriod) + { + this.maintenPeriod = maintenPeriod; + } + + public Long getMaintenPeriod() + { + return maintenPeriod; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("toolTypeId", getToolTypeId()) + .append("toolTypeCode", getToolTypeCode()) + .append("toolTypeName", getToolTypeName()) + .append("codeFlag", getCodeFlag()) + .append("maintenType", getMaintenType()) + .append("maintenPeriod", getMaintenPeriod()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/mapper/TmToolMapper.java b/ktg-mes/src/main/java/com/ktg/mes/tm/mapper/TmToolMapper.java new file mode 100644 index 0000000..5d8c2a6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/mapper/TmToolMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.tm.mapper; + +import java.util.List; +import com.ktg.mes.tm.domain.TmTool; + +/** + * 工装夹具清单Mapper接口 + * + * @author yinjinlu + * @date 2022-05-11 + */ +public interface TmToolMapper +{ + /** + * 查询工装夹具清单 + * + * @param toolId 工装夹具清单主键 + * @return 工装夹具清单 + */ + public TmTool selectTmToolByToolId(Long toolId); + + /** + * 查询工装夹具清单列表 + * + * @param tmTool 工装夹具清单 + * @return 工装夹具清单集合 + */ + public List selectTmToolList(TmTool tmTool); + + public TmTool checkToolCodeUnique(TmTool tmTool); + + /** + * 新增工装夹具清单 + * + * @param tmTool 工装夹具清单 + * @return 结果 + */ + public int insertTmTool(TmTool tmTool); + + /** + * 修改工装夹具清单 + * + * @param tmTool 工装夹具清单 + * @return 结果 + */ + public int updateTmTool(TmTool tmTool); + + /** + * 删除工装夹具清单 + * + * @param toolId 工装夹具清单主键 + * @return 结果 + */ + public int deleteTmToolByToolId(Long toolId); + + /** + * 批量删除工装夹具清单 + * + * @param toolIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTmToolByToolIds(Long[] toolIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/mapper/TmToolTypeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/tm/mapper/TmToolTypeMapper.java new file mode 100644 index 0000000..a5824e6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/mapper/TmToolTypeMapper.java @@ -0,0 +1,65 @@ +package com.ktg.mes.tm.mapper; + +import java.util.List; +import com.ktg.mes.tm.domain.TmToolType; + +/** + * 工装夹具类型Mapper接口 + * + * @author yinjinlu + * @date 2022-05-10 + */ +public interface TmToolTypeMapper +{ + /** + * 查询工装夹具类型 + * + * @param toolTypeId 工装夹具类型主键 + * @return 工装夹具类型 + */ + public TmToolType selectTmToolTypeByToolTypeId(Long toolTypeId); + + /** + * 查询工装夹具类型列表 + * + * @param tmToolType 工装夹具类型 + * @return 工装夹具类型集合 + */ + public List selectTmToolTypeList(TmToolType tmToolType); + + + public TmToolType checkToolTypeCodeUnique(TmToolType tmToolType); + public TmToolType checkToolTypeNameUnique(TmToolType tmToolType); + + /** + * 新增工装夹具类型 + * + * @param tmToolType 工装夹具类型 + * @return 结果 + */ + public int insertTmToolType(TmToolType tmToolType); + + /** + * 修改工装夹具类型 + * + * @param tmToolType 工装夹具类型 + * @return 结果 + */ + public int updateTmToolType(TmToolType tmToolType); + + /** + * 删除工装夹具类型 + * + * @param toolTypeId 工装夹具类型主键 + * @return 结果 + */ + public int deleteTmToolTypeByToolTypeId(Long toolTypeId); + + /** + * 批量删除工装夹具类型 + * + * @param toolTypeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTmToolTypeByToolTypeIds(Long[] toolTypeIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/service/ITmToolService.java b/ktg-mes/src/main/java/com/ktg/mes/tm/service/ITmToolService.java new file mode 100644 index 0000000..8b64c18 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/service/ITmToolService.java @@ -0,0 +1,63 @@ +package com.ktg.mes.tm.service; + +import java.util.List; +import com.ktg.mes.tm.domain.TmTool; + +/** + * 工装夹具清单Service接口 + * + * @author yinjinlu + * @date 2022-05-11 + */ +public interface ITmToolService +{ + /** + * 查询工装夹具清单 + * + * @param toolId 工装夹具清单主键 + * @return 工装夹具清单 + */ + public TmTool selectTmToolByToolId(Long toolId); + + /** + * 查询工装夹具清单列表 + * + * @param tmTool 工装夹具清单 + * @return 工装夹具清单集合 + */ + public List selectTmToolList(TmTool tmTool); + + public String checkToolCodeUnique(TmTool tmTool); + + /** + * 新增工装夹具清单 + * + * @param tmTool 工装夹具清单 + * @return 结果 + */ + public int insertTmTool(TmTool tmTool); + + /** + * 修改工装夹具清单 + * + * @param tmTool 工装夹具清单 + * @return 结果 + */ + public int updateTmTool(TmTool tmTool); + + /** + * 批量删除工装夹具清单 + * + * @param toolIds 需要删除的工装夹具清单主键集合 + * @return 结果 + */ + public int deleteTmToolByToolIds(Long[] toolIds); + + /** + * 删除工装夹具清单信息 + * + * @param toolId 工装夹具清单主键 + * @return 结果 + */ + public int deleteTmToolByToolId(Long toolId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/service/ITmToolTypeService.java b/ktg-mes/src/main/java/com/ktg/mes/tm/service/ITmToolTypeService.java new file mode 100644 index 0000000..2230d0e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/service/ITmToolTypeService.java @@ -0,0 +1,65 @@ +package com.ktg.mes.tm.service; + +import java.util.List; +import com.ktg.mes.tm.domain.TmToolType; + +/** + * 工装夹具类型Service接口 + * + * @author yinjinlu + * @date 2022-05-10 + */ +public interface ITmToolTypeService +{ + /** + * 查询工装夹具类型 + * + * @param toolTypeId 工装夹具类型主键 + * @return 工装夹具类型 + */ + public TmToolType selectTmToolTypeByToolTypeId(Long toolTypeId); + + /** + * 查询工装夹具类型列表 + * + * @param tmToolType 工装夹具类型 + * @return 工装夹具类型集合 + */ + public List selectTmToolTypeList(TmToolType tmToolType); + + + public String checkToolTypeCodeUnique(TmToolType tmToolType); + public String checkToolTypeNameUnique(TmToolType tmToolType); + + /** + * 新增工装夹具类型 + * + * @param tmToolType 工装夹具类型 + * @return 结果 + */ + public int insertTmToolType(TmToolType tmToolType); + + /** + * 修改工装夹具类型 + * + * @param tmToolType 工装夹具类型 + * @return 结果 + */ + public int updateTmToolType(TmToolType tmToolType); + + /** + * 批量删除工装夹具类型 + * + * @param toolTypeIds 需要删除的工装夹具类型主键集合 + * @return 结果 + */ + public int deleteTmToolTypeByToolTypeIds(Long[] toolTypeIds); + + /** + * 删除工装夹具类型信息 + * + * @param toolTypeId 工装夹具类型主键 + * @return 结果 + */ + public int deleteTmToolTypeByToolTypeId(Long toolTypeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/service/impl/TmToolServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/tm/service/impl/TmToolServiceImpl.java new file mode 100644 index 0000000..a9eef29 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/service/impl/TmToolServiceImpl.java @@ -0,0 +1,111 @@ +package com.ktg.mes.tm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.tm.mapper.TmToolMapper; +import com.ktg.mes.tm.domain.TmTool; +import com.ktg.mes.tm.service.ITmToolService; + +/** + * 工装夹具清单Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-11 + */ +@Service +public class TmToolServiceImpl implements ITmToolService +{ + @Autowired + private TmToolMapper tmToolMapper; + + /** + * 查询工装夹具清单 + * + * @param toolId 工装夹具清单主键 + * @return 工装夹具清单 + */ + @Override + public TmTool selectTmToolByToolId(Long toolId) + { + return tmToolMapper.selectTmToolByToolId(toolId); + } + + /** + * 查询工装夹具清单列表 + * + * @param tmTool 工装夹具清单 + * @return 工装夹具清单 + */ + @Override + public List selectTmToolList(TmTool tmTool) + { + return tmToolMapper.selectTmToolList(tmTool); + } + + @Override + public String checkToolCodeUnique(TmTool tmTool) { + if(StringUtils.isNotNull(tmTool.getToolCode())){ + TmTool tool = tmToolMapper.checkToolCodeUnique(tmTool); + Long toolId = tmTool.getToolId()==null?-1L:tmTool.getToolId(); + if(StringUtils.isNotNull(tool) && tool.getToolId().longValue()!=toolId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + } + return UserConstants.UNIQUE; + } + + /** + * 新增工装夹具清单 + * + * @param tmTool 工装夹具清单 + * @return 结果 + */ + @Override + public int insertTmTool(TmTool tmTool) + { + tmTool.setCreateTime(DateUtils.getNowDate()); + return tmToolMapper.insertTmTool(tmTool); + } + + /** + * 修改工装夹具清单 + * + * @param tmTool 工装夹具清单 + * @return 结果 + */ + @Override + public int updateTmTool(TmTool tmTool) + { + tmTool.setUpdateTime(DateUtils.getNowDate()); + return tmToolMapper.updateTmTool(tmTool); + } + + /** + * 批量删除工装夹具清单 + * + * @param toolIds 需要删除的工装夹具清单主键 + * @return 结果 + */ + @Override + public int deleteTmToolByToolIds(Long[] toolIds) + { + return tmToolMapper.deleteTmToolByToolIds(toolIds); + } + + /** + * 删除工装夹具清单信息 + * + * @param toolId 工装夹具清单主键 + * @return 结果 + */ + @Override + public int deleteTmToolByToolId(Long toolId) + { + return tmToolMapper.deleteTmToolByToolId(toolId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/tm/service/impl/TmToolTypeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/tm/service/impl/TmToolTypeServiceImpl.java new file mode 100644 index 0000000..676320e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/tm/service/impl/TmToolTypeServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.tm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.tm.mapper.TmToolTypeMapper; +import com.ktg.mes.tm.domain.TmToolType; +import com.ktg.mes.tm.service.ITmToolTypeService; + +/** + * 工装夹具类型Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-10 + */ +@Service +public class TmToolTypeServiceImpl implements ITmToolTypeService +{ + @Autowired + private TmToolTypeMapper tmToolTypeMapper; + + /** + * 查询工装夹具类型 + * + * @param toolTypeId 工装夹具类型主键 + * @return 工装夹具类型 + */ + @Override + public TmToolType selectTmToolTypeByToolTypeId(Long toolTypeId) + { + return tmToolTypeMapper.selectTmToolTypeByToolTypeId(toolTypeId); + } + + /** + * 查询工装夹具类型列表 + * + * @param tmToolType 工装夹具类型 + * @return 工装夹具类型 + */ + @Override + public List selectTmToolTypeList(TmToolType tmToolType) + { + return tmToolTypeMapper.selectTmToolTypeList(tmToolType); + } + + @Override + public String checkToolTypeCodeUnique(TmToolType tmToolType) { + TmToolType toolType =tmToolTypeMapper.checkToolTypeCodeUnique(tmToolType); + Long toolTypeId = tmToolType.getToolTypeId()==null?-1L:tmToolType.getToolTypeId(); + if(StringUtils.isNotNull(toolType) && toolType.getToolTypeId().longValue() != toolTypeId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkToolTypeNameUnique(TmToolType tmToolType) { + TmToolType toolType =tmToolTypeMapper.checkToolTypeNameUnique(tmToolType); + Long toolTypeId = tmToolType.getToolTypeId()==null?-1L:tmToolType.getToolTypeId(); + if(StringUtils.isNotNull(toolType) && toolType.getToolTypeId().longValue() != toolTypeId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增工装夹具类型 + * + * @param tmToolType 工装夹具类型 + * @return 结果 + */ + @Override + public int insertTmToolType(TmToolType tmToolType) + { + tmToolType.setCreateTime(DateUtils.getNowDate()); + return tmToolTypeMapper.insertTmToolType(tmToolType); + } + + /** + * 修改工装夹具类型 + * + * @param tmToolType 工装夹具类型 + * @return 结果 + */ + @Override + public int updateTmToolType(TmToolType tmToolType) + { + tmToolType.setUpdateTime(DateUtils.getNowDate()); + return tmToolTypeMapper.updateTmToolType(tmToolType); + } + + /** + * 批量删除工装夹具类型 + * + * @param toolTypeIds 需要删除的工装夹具类型主键 + * @return 结果 + */ + @Override + public int deleteTmToolTypeByToolTypeIds(Long[] toolTypeIds) + { + return tmToolTypeMapper.deleteTmToolTypeByToolTypeIds(toolTypeIds); + } + + /** + * 删除工装夹具类型信息 + * + * @param toolTypeId 工装夹具类型主键 + * @return 结果 + */ + @Override + public int deleteTmToolTypeByToolTypeId(Long toolTypeId) + { + return tmToolTypeMapper.deleteTmToolTypeByToolTypeId(toolTypeId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmBarcodeConfigController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmBarcodeConfigController.java new file mode 100644 index 0000000..1ba9314 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmBarcodeConfigController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmBarcodeConfig; +import com.ktg.mes.wm.service.IWmBarcodeConfigService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 条码配置Controller + * + * @author yinjinlu + * @date 2022-10-22 + */ +@RestController +@RequestMapping("/mes/wm/barcodeconfig") +public class WmBarcodeConfigController extends BaseController +{ + @Autowired + private IWmBarcodeConfigService wmBarcodeConfigService; + + /** + * 查询条码配置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:list')") + @GetMapping("/list") + public TableDataInfo list(WmBarcodeConfig wmBarcodeConfig) + { + startPage(); + List list = wmBarcodeConfigService.selectWmBarcodeConfigList(wmBarcodeConfig); + return getDataTable(list); + } + + /** + * 导出条码配置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:export')") + @Log(title = "条码配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmBarcodeConfig wmBarcodeConfig) + { + List list = wmBarcodeConfigService.selectWmBarcodeConfigList(wmBarcodeConfig); + ExcelUtil util = new ExcelUtil(WmBarcodeConfig.class); + util.exportExcel(response, list, "条码配置数据"); + } + + /** + * 获取条码配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable("configId") Long configId) + { + return AjaxResult.success(wmBarcodeConfigService.selectWmBarcodeConfigByConfigId(configId)); + } + + /** + * 新增条码配置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:add')") + @Log(title = "条码配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmBarcodeConfig wmBarcodeConfig) + { + return toAjax(wmBarcodeConfigService.insertWmBarcodeConfig(wmBarcodeConfig)); + } + + /** + * 修改条码配置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:edit')") + @Log(title = "条码配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmBarcodeConfig wmBarcodeConfig) + { + return toAjax(wmBarcodeConfigService.updateWmBarcodeConfig(wmBarcodeConfig)); + } + + /** + * 删除条码配置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcodeconfig:remove')") + @Log(title = "条码配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{configIds}") + public AjaxResult remove(@PathVariable Long[] configIds) + { + return toAjax(wmBarcodeConfigService.deleteWmBarcodeConfigByConfigIds(configIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmBarcodeController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmBarcodeController.java new file mode 100644 index 0000000..67e80b7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmBarcodeController.java @@ -0,0 +1,124 @@ +package com.ktg.mes.wm.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmBarcode; +import com.ktg.mes.wm.service.IWmBarcodeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 条码清单Controller + * + * @author yinjinlu + * @date 2022-08-01 + */ +@RestController +@RequestMapping("/mes/wm/barcode") +public class WmBarcodeController extends BaseController +{ + @Autowired + private IWmBarcodeService wmBarcodeService; + + /** + * 查询条码清单列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmBarcode wmBarcode) + { + startPage(); + List list = wmBarcodeService.selectWmBarcodeList(wmBarcode); + return getDataTable(list); + } + + /** + * 导出条码清单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcode:export')") + @Log(title = "条码清单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmBarcode wmBarcode) + { + List list = wmBarcodeService.selectWmBarcodeList(wmBarcode); + ExcelUtil util = new ExcelUtil(WmBarcode.class); + util.exportExcel(response, list, "条码清单数据"); + } + + /** + * 获取条码清单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcode:query')") + @GetMapping(value = "/{barcodeId}") + public AjaxResult getInfo(@PathVariable("barcodeId") Long barcodeId) + { + return AjaxResult.success(wmBarcodeService.selectWmBarcodeByBarcodeId(barcodeId)); + } + + /** + * 新增条码清单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcode:add')") + @Log(title = "条码清单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmBarcode wmBarcode) + { + if(UserConstants.NOT_UNIQUE.equals(wmBarcodeService.checkBarcodeUnique(wmBarcode))){ + return AjaxResult.error("当前业务内容的条码已存在!"); + } + + String path =wmBarcodeService.generateBarcode(wmBarcode); + wmBarcode.setBarcodeUrl(path); + return toAjax(wmBarcodeService.insertWmBarcode(wmBarcode)); + } + + /** + * 修改条码清单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcode:edit')") + @Log(title = "条码清单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmBarcode wmBarcode) + { + if(UserConstants.NOT_UNIQUE.equals(wmBarcodeService.checkBarcodeUnique(wmBarcode))){ + return AjaxResult.error("当前业务内容的条码已存在!"); + } + String path =wmBarcodeService.generateBarcode(wmBarcode); + wmBarcode.setBarcodeUrl(path); + return toAjax(wmBarcodeService.updateWmBarcode(wmBarcode)); + } + + /** + * 删除条码清单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:barcode:remove')") + @Log(title = "条码清单", businessType = BusinessType.DELETE) + @DeleteMapping("/{barcodeIds}") + public AjaxResult remove(@PathVariable Long[] barcodeIds) + { + return toAjax(wmBarcodeService.deleteWmBarcodeByBarcodeIds(barcodeIds)); + } + + /** + * 获取某个对象的二维码地址 + * @return + */ + @GetMapping("/getBarcodeUrl") + public AjaxResult getBarcodeUrl(WmBarcode wmBarcode){ + List list = wmBarcodeService.selectWmBarcodeList(wmBarcode); + if(!CollectionUtils.isEmpty(list)){ + return AjaxResult.success(list.get(0)); + } + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmIssueHeaderController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmIssueHeaderController.java new file mode 100644 index 0000000..70c22d7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmIssueHeaderController.java @@ -0,0 +1,210 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.IssueTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产领料单头Controller + * + * @author yinjinlu + * @date 2022-07-14 + */ +@RestController +@RequestMapping("/mes/wm/issueheader") +public class WmIssueHeaderController extends BaseController +{ + @Autowired + private IWmIssueHeaderService wmIssueHeaderService; + + @Autowired + private IWmIssueLineService wmIssueLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询生产领料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:list')") + @GetMapping("/list") + public TableDataInfo list(WmIssueHeader wmIssueHeader) + { + startPage(); + List list = wmIssueHeaderService.selectWmIssueHeaderList(wmIssueHeader); + return getDataTable(list); + } + + /** + * 导出生产领料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:export')") + @Log(title = "生产领料单头", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmIssueHeader wmIssueHeader) + { + List list = wmIssueHeaderService.selectWmIssueHeaderList(wmIssueHeader); + ExcelUtil util = new ExcelUtil(WmIssueHeader.class); + util.exportExcel(response, list, "生产领料单头数据"); + } + + /** + * 获取生产领料单头详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:query')") + @GetMapping(value = "/{issueId}") + public AjaxResult getInfo(@PathVariable("issueId") Long issueId) + { + return AjaxResult.success(wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId)); + } + + /** + * 新增生产领料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:add')") + @Log(title = "生产领料单头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmIssueHeader wmIssueHeader) + { + if(UserConstants.NOT_UNIQUE.equals(wmIssueHeaderService.checkIssueCodeUnique(wmIssueHeader))){ + return AjaxResult.error("领料单编号已存在"); + } + //根据领料单头上的仓库、库区、库位ID设置对应的编号和名称 + if(StringUtils.isNotNull(wmIssueHeader.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmIssueHeader.getWarehouseId()); + wmIssueHeader.setWarehouseCode(warehouse.getWarehouseCode()); + wmIssueHeader.setWarehouseName(warehouse.getWarehouseName()); + } + + if(StringUtils.isNotNull(wmIssueHeader.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmIssueHeader.getLocationId()); + wmIssueHeader.setLocationCode(location.getLocationCode()); + wmIssueHeader.setLocationName(location.getLocationName()); + } + + if(StringUtils.isNotNull(wmIssueHeader.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmIssueHeader.getAreaId()); + wmIssueHeader.setAreaCode(area.getAreaCode()); + wmIssueHeader.setAreaName(area.getAreaName()); + } + wmIssueHeader.setCreateBy(getUsername()); + return toAjax(wmIssueHeaderService.insertWmIssueHeader(wmIssueHeader)); + } + + /** + * 修改生产领料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')") + @Log(title = "生产领料单头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmIssueHeader wmIssueHeader) + { + if(UserConstants.NOT_UNIQUE.equals(wmIssueHeaderService.checkIssueCodeUnique(wmIssueHeader))){ + return AjaxResult.error("领料单编号已存在"); + } + + //根据领料单头上的仓库、库区、库位ID设置对应的编号和名称 + if(StringUtils.isNotNull(wmIssueHeader.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmIssueHeader.getWarehouseId()); + wmIssueHeader.setWarehouseCode(warehouse.getWarehouseCode()); + wmIssueHeader.setWarehouseName(warehouse.getWarehouseName()); + } + + if(StringUtils.isNotNull(wmIssueHeader.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmIssueHeader.getLocationId()); + wmIssueHeader.setLocationCode(location.getLocationCode()); + wmIssueHeader.setLocationName(location.getLocationName()); + } + + if(StringUtils.isNotNull(wmIssueHeader.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmIssueHeader.getAreaId()); + wmIssueHeader.setAreaCode(area.getAreaCode()); + wmIssueHeader.setAreaName(area.getAreaName()); + } + return toAjax(wmIssueHeaderService.updateWmIssueHeader(wmIssueHeader)); + } + + /** + * 删除生产领料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:remove')") + @Log(title = "生产领料单头", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{issueIds}") + public AjaxResult remove(@PathVariable Long[] issueIds) + { + for (long issueId:issueIds + ) { + WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(header.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmIssueLineService.deleteByIssueHeaderId(issueId); + } + + return toAjax(wmIssueHeaderService.deleteWmIssueHeaderByIssueIds(issueIds)); + } + + /** + * 执行出库 + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')") + @Log(title = "生产领料单头", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{issueId}") + public AjaxResult execute(@PathVariable Long issueId){ + WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId); + WmIssueLine param = new WmIssueLine(); + param.setIssueId(issueId); + List lines = wmIssueLineService.selectWmIssueLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请指定领出的物资"); + } + + List beans = wmIssueHeaderService.getTxBeans(issueId); + + //调用库存核心 + storageCoreService.processIssue(beans); + + //更新单据状态 + header.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmIssueHeaderService.updateWmIssueHeader(header); + return AjaxResult.success(); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmIssueLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmIssueLineController.java new file mode 100644 index 0000000..990a63b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmIssueLineController.java @@ -0,0 +1,105 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmIssueLine; +import com.ktg.mes.wm.service.IWmIssueLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产领料单行Controller + * + * @author yinjinlu + * @date 2022-07-14 + */ +@RestController +@RequestMapping("/mes/wm/issueline") +public class WmIssueLineController extends BaseController +{ + @Autowired + private IWmIssueLineService wmIssueLineService; + + /** + * 查询生产领料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:list')") + @GetMapping("/list") + public TableDataInfo list(WmIssueLine wmIssueLine) + { + startPage(); + List list = wmIssueLineService.selectWmIssueLineList(wmIssueLine); + return getDataTable(list); + } + + /** + * 导出生产领料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:export')") + @Log(title = "生产领料单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmIssueLine wmIssueLine) + { + List list = wmIssueLineService.selectWmIssueLineList(wmIssueLine); + ExcelUtil util = new ExcelUtil(WmIssueLine.class); + util.exportExcel(response, list, "生产领料单行数据"); + } + + /** + * 获取生产领料单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmIssueLineService.selectWmIssueLineByLineId(lineId)); + } + + /** + * 新增生产领料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:add')") + @Log(title = "生产领料单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmIssueLine wmIssueLine) + { + wmIssueLine.setCreateBy(getUsername()); + return toAjax(wmIssueLineService.insertWmIssueLine(wmIssueLine)); + } + + /** + * 修改生产领料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')") + @Log(title = "生产领料单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmIssueLine wmIssueLine) + { + return toAjax(wmIssueLineService.updateWmIssueLine(wmIssueLine)); + } + + /** + * 删除生产领料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:remove')") + @Log(title = "生产领料单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmIssueLineService.deleteWmIssueLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemConsumeController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemConsumeController.java new file mode 100644 index 0000000..058619b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemConsumeController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmItemConsume; +import com.ktg.mes.wm.service.IWmItemConsumeService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 物料消耗记录Controller + * + * @author yinjinlu + * @date 2022-09-19 + */ +@RestController +@RequestMapping("/mes/wm/itemconsume") +public class WmItemConsumeController extends BaseController +{ + @Autowired + private IWmItemConsumeService wmItemConsumeService; + + /** + * 查询物料消耗记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:list')") + @GetMapping("/list") + public TableDataInfo list(WmItemConsume wmItemConsume) + { + startPage(); + List list = wmItemConsumeService.selectWmItemConsumeList(wmItemConsume); + return getDataTable(list); + } + + /** + * 导出物料消耗记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:export')") + @Log(title = "物料消耗记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmItemConsume wmItemConsume) + { + List list = wmItemConsumeService.selectWmItemConsumeList(wmItemConsume); + ExcelUtil util = new ExcelUtil(WmItemConsume.class); + util.exportExcel(response, list, "物料消耗记录数据"); + } + + /** + * 获取物料消耗记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(wmItemConsumeService.selectWmItemConsumeByRecordId(recordId)); + } + + /** + * 新增物料消耗记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:add')") + @Log(title = "物料消耗记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmItemConsume wmItemConsume) + { + return toAjax(wmItemConsumeService.insertWmItemConsume(wmItemConsume)); + } + + /** + * 修改物料消耗记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:edit')") + @Log(title = "物料消耗记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmItemConsume wmItemConsume) + { + return toAjax(wmItemConsumeService.updateWmItemConsume(wmItemConsume)); + } + + /** + * 删除物料消耗记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:remove')") + @Log(title = "物料消耗记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(wmItemConsumeService.deleteWmItemConsumeByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemConsumeLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemConsumeLineController.java new file mode 100644 index 0000000..8f1b6a4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemConsumeLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmItemConsumeLine; +import com.ktg.mes.wm.service.IWmItemConsumeLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 物料消耗记录行Controller + * + * @author yinjinlu + * @date 2022-09-19 + */ +@RestController +@RequestMapping("/mes/wm/itemconsumeline") +public class WmItemConsumeLineController extends BaseController +{ + @Autowired + private IWmItemConsumeLineService wmItemConsumeLineService; + + /** + * 查询物料消耗记录行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:list')") + @GetMapping("/list") + public TableDataInfo list(WmItemConsumeLine wmItemConsumeLine) + { + startPage(); + List list = wmItemConsumeLineService.selectWmItemConsumeLineList(wmItemConsumeLine); + return getDataTable(list); + } + + /** + * 导出物料消耗记录行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:export')") + @Log(title = "物料消耗记录行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmItemConsumeLine wmItemConsumeLine) + { + List list = wmItemConsumeLineService.selectWmItemConsumeLineList(wmItemConsumeLine); + ExcelUtil util = new ExcelUtil(WmItemConsumeLine.class); + util.exportExcel(response, list, "物料消耗记录行数据"); + } + + /** + * 获取物料消耗记录行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmItemConsumeLineService.selectWmItemConsumeLineByLineId(lineId)); + } + + /** + * 新增物料消耗记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:add')") + @Log(title = "物料消耗记录行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmItemConsumeLine wmItemConsumeLine) + { + return toAjax(wmItemConsumeLineService.insertWmItemConsumeLine(wmItemConsumeLine)); + } + + /** + * 修改物料消耗记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:edit')") + @Log(title = "物料消耗记录行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmItemConsumeLine wmItemConsumeLine) + { + return toAjax(wmItemConsumeLineService.updateWmItemConsumeLine(wmItemConsumeLine)); + } + + /** + * 删除物料消耗记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemconsume:remove')") + @Log(title = "物料消耗记录行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmItemConsumeLineService.deleteWmItemConsumeLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemRecptController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemRecptController.java new file mode 100644 index 0000000..fd1fbf7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemRecptController.java @@ -0,0 +1,235 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.ItemRecptTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 物料入库单Controller + * + * @author yinjinlu + * @date 2022-05-22 + */ +@RestController +@RequestMapping("/mes/wm/itemrecpt") +public class WmItemRecptController extends BaseController +{ + @Autowired + private IWmItemRecptService wmItemRecptService; + + @Autowired + private IWmItemRecptLineService wmItemRecptLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询物料入库单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmItemRecpt wmItemRecpt) + { + startPage(); + List list = wmItemRecptService.selectWmItemRecptList(wmItemRecpt); + return getDataTable(list); + } + + /** + * 导出物料入库单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:export')") + @Log(title = "物料入库单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmItemRecpt wmItemRecpt) + { + List list = wmItemRecptService.selectWmItemRecptList(wmItemRecpt); + ExcelUtil util = new ExcelUtil(WmItemRecpt.class); + util.exportExcel(response, list, "物料入库单数据"); + } + + /** + * 获取物料入库单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:query')") + @GetMapping(value = "/{recptId}") + public AjaxResult getInfo(@PathVariable("recptId") Long recptId) + { + return AjaxResult.success(wmItemRecptService.selectWmItemRecptByRecptId(recptId)); + } + + /** + * 新增物料入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:add')") + @Log(title = "物料入库单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmItemRecpt wmItemRecpt) + { + if(UserConstants.NOT_UNIQUE.equals(wmItemRecptService.checkRecptCodeUnique(wmItemRecpt))){ + return AjaxResult.error("单据编号已存在!"); + } + + if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId()); + wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId()); + wmItemRecpt.setLocationCode(location.getLocationCode()); + wmItemRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId()); + wmItemRecpt.setAreaCode(area.getAreaCode()); + wmItemRecpt.setAreaName(area.getAreaName()); + } + + wmItemRecpt.setCreateBy(getUsername()); + return toAjax(wmItemRecptService.insertWmItemRecpt(wmItemRecpt)); + } + + /** + * 确认入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单", businessType = BusinessType.UPDATE) + @PutMapping("/confirm") + public AjaxResult confirm(@RequestBody WmItemRecpt wmItemRecpt){ + //检查有没有入库单行 + WmItemRecptLine param = new WmItemRecptLine(); + param.setRecptId(wmItemRecpt.getRecptId()); + List lines = wmItemRecptLineService.selectWmItemRecptLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请添加入库单行"); + } + + wmItemRecpt.setStatus(UserConstants.ORDER_STATUS_CONFIRMED); + + if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId()); + wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId()); + wmItemRecpt.setLocationCode(location.getLocationCode()); + wmItemRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId()); + wmItemRecpt.setAreaCode(area.getAreaCode()); + wmItemRecpt.setAreaName(area.getAreaName()); + } + return toAjax(wmItemRecptService.updateWmItemRecpt(wmItemRecpt)); + } + + + /** + * 修改物料入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmItemRecpt wmItemRecpt) + { + if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId()); + wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId()); + wmItemRecpt.setLocationCode(location.getLocationCode()); + wmItemRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId()); + wmItemRecpt.setAreaCode(area.getAreaCode()); + wmItemRecpt.setAreaName(area.getAreaName()); + } + return toAjax(wmItemRecptService.updateWmItemRecpt(wmItemRecpt)); + } + + /** + * 执行入库 + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{recptId}") + public AjaxResult execute(@PathVariable Long recptId){ + + WmItemRecpt recpt = wmItemRecptService.selectWmItemRecptByRecptId(recptId); + + //构造Transaction事务,并执行库存更新逻辑 + List beans = wmItemRecptService.getTxBeans(recptId); + + //调用库存核心 + storageCoreService.processItemRecpt(beans); + + //更新单据状态 + recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmItemRecptService.updateWmItemRecpt(recpt); + + return AjaxResult.success(); + } + + + /** + * 删除物料入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:remove')") + @Log(title = "物料入库单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recptIds}") + public AjaxResult remove(@PathVariable Long[] recptIds) + { + for (Long id: + recptIds + ) { + WmItemRecpt itemRecpt = wmItemRecptService.selectWmItemRecptByRecptId(id); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(itemRecpt.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmItemRecptLineService.deleteByRecptId(id); + } + + return toAjax(wmItemRecptService.deleteWmItemRecptByRecptIds(recptIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemRecptLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemRecptLineController.java new file mode 100644 index 0000000..e8d082d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmItemRecptLineController.java @@ -0,0 +1,153 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmItemRecptLine; +import com.ktg.mes.wm.service.IWmItemRecptLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 物料入库单行Controller + * + * @author yinjinlu + * @date 2022-05-22 + */ +@RestController +@RequestMapping("/mes/wm/itemrecptline") +public class WmItemRecptLineController extends BaseController +{ + @Autowired + private IWmItemRecptLineService wmItemRecptLineService; + + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询物料入库单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmItemRecptLine wmItemRecptLine) + { + startPage(); + List list = wmItemRecptLineService.selectWmItemRecptLineList(wmItemRecptLine); + return getDataTable(list); + } + + /** + * 导出物料入库单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:export')") + @Log(title = "物料入库单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmItemRecptLine wmItemRecptLine) + { + List list = wmItemRecptLineService.selectWmItemRecptLineList(wmItemRecptLine); + ExcelUtil util = new ExcelUtil(WmItemRecptLine.class); + util.exportExcel(response, list, "物料入库单行数据"); + } + + /** + * 获取物料入库单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmItemRecptLineService.selectWmItemRecptLineByLineId(lineId)); + } + + /** + * 新增物料入库单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:add')") + @Log(title = "物料入库单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmItemRecptLine wmItemRecptLine) + { + if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecptLine.getWarehouseId()); + wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecptLine.getLocationId()); + wmItemRecptLine.setLocationCode(location.getLocationCode()); + wmItemRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecptLine.getAreaId()); + wmItemRecptLine.setAreaCode(area.getAreaCode()); + wmItemRecptLine.setAreaName(area.getAreaName()); + } + wmItemRecptLine.setCreateBy(getUsername()); + return toAjax(wmItemRecptLineService.insertWmItemRecptLine(wmItemRecptLine)); + } + + /** + * 修改物料入库单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmItemRecptLine wmItemRecptLine) + { + if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecptLine.getWarehouseId()); + wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecptLine.getLocationId()); + wmItemRecptLine.setLocationCode(location.getLocationCode()); + wmItemRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecptLine.getAreaId()); + wmItemRecptLine.setAreaCode(area.getAreaCode()); + wmItemRecptLine.setAreaName(area.getAreaName()); + } + return toAjax(wmItemRecptLineService.updateWmItemRecptLine(wmItemRecptLine)); + } + + /** + * 删除物料入库单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:remove')") + @Log(title = "物料入库单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmItemRecptLineService.deleteWmItemRecptLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmMaterialStockController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmMaterialStockController.java new file mode 100644 index 0000000..34039e3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmMaterialStockController.java @@ -0,0 +1,103 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmMaterialStock; +import com.ktg.mes.wm.service.IWmMaterialStockService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库存记录Controller + * + * @author yinjinlu + * @date 2022-05-30 + */ +@RestController +@RequestMapping("/mes/wm/wmstock") +public class WmMaterialStockController extends BaseController +{ + @Autowired + private IWmMaterialStockService wmMaterialStockService; + + /** + * 查询库存记录列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmMaterialStock wmMaterialStock) + { + startPage(); + List list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock); + return getDataTable(list); + } + + /** + * 导出库存记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:export')") + @Log(title = "库存记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmMaterialStock wmMaterialStock) + { + List list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock); + ExcelUtil util = new ExcelUtil(WmMaterialStock.class); + util.exportExcel(response, list, "库存记录数据"); + } + + /** + * 获取库存记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:query')") + @GetMapping(value = "/{materialStockId}") + public AjaxResult getInfo(@PathVariable("materialStockId") Long materialStockId) + { + return AjaxResult.success(wmMaterialStockService.selectWmMaterialStockByMaterialStockId(materialStockId)); + } + + /** + * 新增库存记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:add')") + @Log(title = "库存记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmMaterialStock wmMaterialStock) + { + return toAjax(wmMaterialStockService.insertWmMaterialStock(wmMaterialStock)); + } + + /** + * 修改库存记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:edit')") + @Log(title = "库存记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmMaterialStock wmMaterialStock) + { + return toAjax(wmMaterialStockService.updateWmMaterialStock(wmMaterialStock)); + } + + /** + * 删除库存记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:remove')") + @Log(title = "库存记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{materialStockIds}") + public AjaxResult remove(@PathVariable Long[] materialStockIds) + { + return toAjax(wmMaterialStockService.deleteWmMaterialStockByMaterialStockIds(materialStockIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceIssueController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceIssueController.java new file mode 100644 index 0000000..f7592df --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceIssueController.java @@ -0,0 +1,152 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.domain.WmIssueHeader; +import com.ktg.mes.wm.domain.WmIssueLine; +import com.ktg.mes.wm.domain.WmOutsourceIssueLine; +import com.ktg.mes.wm.domain.tx.IssueTxBean; +import com.ktg.mes.wm.domain.tx.OutsourceIssueTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmOutsourceIssueLineService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmOutsourceIssue; +import com.ktg.mes.wm.service.IWmOutsourceIssueService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 外协领料单头Controller + * + * @author yinjinlu + * @date 2023-10-30 + */ +@RestController +@RequestMapping("/mes/wm/outsourceissue") +public class WmOutsourceIssueController extends BaseController +{ + @Autowired + private IWmOutsourceIssueService wmOutsourceIssueService; + + @Autowired + private IWmOutsourceIssueLineService wmOutsourceIssueLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询外协领料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmOutsourceIssue wmOutsourceIssue) + { + startPage(); + List list = wmOutsourceIssueService.selectWmOutsourceIssueList(wmOutsourceIssue); + return getDataTable(list); + } + + /** + * 导出外协领料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:export')") + @Log(title = "外协领料单头", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmOutsourceIssue wmOutsourceIssue) + { + List list = wmOutsourceIssueService.selectWmOutsourceIssueList(wmOutsourceIssue); + ExcelUtil util = new ExcelUtil(WmOutsourceIssue.class); + util.exportExcel(response, list, "外协领料单头数据"); + } + + /** + * 获取外协领料单头详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:query')") + @GetMapping(value = "/{issueId}") + public AjaxResult getInfo(@PathVariable("issueId") Long issueId) + { + return AjaxResult.success(wmOutsourceIssueService.selectWmOutsourceIssueByIssueId(issueId)); + } + + /** + * 新增外协领料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:add')") + @Log(title = "外协领料单头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmOutsourceIssue wmOutsourceIssue) + { + return toAjax(wmOutsourceIssueService.insertWmOutsourceIssue(wmOutsourceIssue)); + } + + /** + * 修改外协领料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:edit')") + @Log(title = "外协领料单头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmOutsourceIssue wmOutsourceIssue) + { + return toAjax(wmOutsourceIssueService.updateWmOutsourceIssue(wmOutsourceIssue)); + } + + /** + * 删除外协领料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:remove')") + @Log(title = "外协领料单头", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{issueIds}") + public AjaxResult remove(@PathVariable Long[] issueIds) + { + for (Long issueId:issueIds + ) { + wmOutsourceIssueLineService.deleteWmOutsourceIssueLineByIssueId(issueId); + } + return toAjax(wmOutsourceIssueService.deleteWmOutsourceIssueByIssueIds(issueIds)); + } + + /** + * 执行出库 + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:edit')") + @Log(title = "外协领料单头", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{issueId}") + public AjaxResult execute(@PathVariable Long issueId){ + WmOutsourceIssue header = wmOutsourceIssueService.selectWmOutsourceIssueByIssueId(issueId); + WmOutsourceIssueLine param = new WmOutsourceIssueLine(); + param.setIssueId(issueId); + List lines = wmOutsourceIssueLineService.selectWmOutsourceIssueLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请指定领出的物资"); + } + + List beans = wmOutsourceIssueService.getTxBeans(issueId); + + storageCoreService.processOutsourceIssue(beans); + //更新单据状态 + header.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmOutsourceIssueService.updateWmOutsourceIssue(header); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceIssueLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceIssueLineController.java new file mode 100644 index 0000000..885f93b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceIssueLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmOutsourceIssueLine; +import com.ktg.mes.wm.service.IWmOutsourceIssueLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 外协领料单行Controller + * + * @author yinjinlu + * @date 2023-10-30 + */ +@RestController +@RequestMapping("/mes/wm/outsourceissueline") +public class WmOutsourceIssueLineController extends BaseController +{ + @Autowired + private IWmOutsourceIssueLineService wmOutsourceIssueLineService; + + /** + * 查询外协领料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmOutsourceIssueLine wmOutsourceIssueLine) + { + startPage(); + List list = wmOutsourceIssueLineService.selectWmOutsourceIssueLineList(wmOutsourceIssueLine); + return getDataTable(list); + } + + /** + * 导出外协领料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:export')") + @Log(title = "外协领料单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmOutsourceIssueLine wmOutsourceIssueLine) + { + List list = wmOutsourceIssueLineService.selectWmOutsourceIssueLineList(wmOutsourceIssueLine); + ExcelUtil util = new ExcelUtil(WmOutsourceIssueLine.class); + util.exportExcel(response, list, "外协领料单行数据"); + } + + /** + * 获取外协领料单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmOutsourceIssueLineService.selectWmOutsourceIssueLineByLineId(lineId)); + } + + /** + * 新增外协领料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:add')") + @Log(title = "外协领料单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmOutsourceIssueLine wmOutsourceIssueLine) + { + return toAjax(wmOutsourceIssueLineService.insertWmOutsourceIssueLine(wmOutsourceIssueLine)); + } + + /** + * 修改外协领料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:edit')") + @Log(title = "外协领料单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmOutsourceIssueLine wmOutsourceIssueLine) + { + return toAjax(wmOutsourceIssueLineService.updateWmOutsourceIssueLine(wmOutsourceIssueLine)); + } + + /** + * 删除外协领料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourceissue:remove')") + @Log(title = "外协领料单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmOutsourceIssueLineService.deleteWmOutsourceIssueLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceRecptController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceRecptController.java new file mode 100644 index 0000000..d3e310f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceRecptController.java @@ -0,0 +1,182 @@ +package com.ktg.mes.wm.controller; + +import java.math.BigDecimal; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import ch.qos.logback.core.util.StringCollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.mes.wm.domain.WmItemRecpt; +import com.ktg.mes.wm.domain.WmOutsourceRecptLine; +import com.ktg.mes.wm.domain.tx.ItemRecptTxBean; +import com.ktg.mes.wm.domain.tx.OutsourceRecptTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmOutsourceRecptLineService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmOutsourceRecpt; +import com.ktg.mes.wm.service.IWmOutsourceRecptService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 外协入库单Controller + * + * @author yinjinlu + * @date 2023-10-30 + */ +@RestController +@RequestMapping("/mes/wm/outsourcerecpt") +public class WmOutsourceRecptController extends BaseController +{ + @Autowired + private IWmOutsourceRecptService wmOutsourceRecptService; + + @Autowired + private IWmOutsourceRecptLineService wmOutsourceRecptLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IProWorkorderService proWorkorderService; + + + /** + * 查询外协入库单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmOutsourceRecpt wmOutsourceRecpt) + { + startPage(); + List list = wmOutsourceRecptService.selectWmOutsourceRecptList(wmOutsourceRecpt); + return getDataTable(list); + } + + /** + * 导出外协入库单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:export')") + @Log(title = "外协入库单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmOutsourceRecpt wmOutsourceRecpt) + { + List list = wmOutsourceRecptService.selectWmOutsourceRecptList(wmOutsourceRecpt); + ExcelUtil util = new ExcelUtil(WmOutsourceRecpt.class); + util.exportExcel(response, list, "外协入库单数据"); + } + + /** + * 获取外协入库单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:query')") + @GetMapping(value = "/{recptId}") + public AjaxResult getInfo(@PathVariable("recptId") Long recptId) + { + return AjaxResult.success(wmOutsourceRecptService.selectWmOutsourceRecptByRecptId(recptId)); + } + + /** + * 新增外协入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:add')") + @Log(title = "外协入库单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmOutsourceRecpt wmOutsourceRecpt) + { + return toAjax(wmOutsourceRecptService.insertWmOutsourceRecpt(wmOutsourceRecpt)); + } + + /** + * 修改外协入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:edit')") + @Log(title = "外协入库单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmOutsourceRecpt wmOutsourceRecpt) + { + return toAjax(wmOutsourceRecptService.updateWmOutsourceRecpt(wmOutsourceRecpt)); + } + + /** + * 删除外协入库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:remove')") + @Log(title = "外协入库单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recptIds}") + public AjaxResult remove(@PathVariable Long[] recptIds) + { + for (Long recptId:recptIds + ) { + wmOutsourceRecptLineService.selectWmOutsourceRecptLineByRecptId(recptId); + } + return toAjax(wmOutsourceRecptService.deleteWmOutsourceRecptByRecptIds(recptIds)); + } + + /** + * 执行入库 + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:outsourcerecpt:edit')") + @Log(title = "外协入库单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{recptId}") + public AjaxResult execute(@PathVariable Long recptId){ + + WmOutsourceRecpt recpt = wmOutsourceRecptService.selectWmOutsourceRecptByRecptId(recptId); + + List lines = wmOutsourceRecptLineService.selectWmOutsourceRecptLineByRecptId(recptId); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("请指定入库的物资!"); + } + + //构造Transaction事务,并执行库存更新逻辑 + List beans = wmOutsourceRecptService.getTxBeans(recptId); + + //调用库存核心 + storageCoreService.processOutsourceRecpt(beans); + + //根据当前入库的物料更新对应的生产工单/生产任务 已生产数量 + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(recpt.getWorkorderId()); + if(!StringUtils.isNotNull(workorder)){ + return AjaxResult.error("未找到对应的外协工单/外协任务!"); + } + + //正常外协入库的产品必须先经过检验,确认合格数量后才能执行入库,并且更新外协工单的进度。此处暂时先直接根据入库数量更新外协工单的生产数量。 + BigDecimal produced = workorder.getQuantityProduced() == null?new BigDecimal(0):workorder.getQuantityProduced(); + for (int i = 0; i < lines.size(); i++) { + WmOutsourceRecptLine line = lines.get(i); + //判断入库的物资,如果是生产工单中的产品,则更新已生产数量 + if(line.getItemCode().equals(workorder.getProductCode())){ + workorder.setQuantityProduced( produced.add(line.getQuantityRecived())); + } + } + proWorkorderService.updateProWorkorder(workorder); + + //更新单据状态 + recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmOutsourceRecptService.updateWmOutsourceRecpt(recpt); + + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceRecptLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceRecptLineController.java new file mode 100644 index 0000000..de8d3a2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmOutsourceRecptLineController.java @@ -0,0 +1,155 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmOutsourceRecptLine; +import com.ktg.mes.wm.service.IWmOutsourceRecptLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 外协入库单行Controller + * + * @author yinjinlu + * @date 2023-10-30 + */ +@RestController +@RequestMapping("/mes/wm/oursourcerecptline") +public class WmOutsourceRecptLineController extends BaseController +{ + @Autowired + private IWmOutsourceRecptLineService wmOutsourceRecptLineService; + + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询外协入库单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmOutsourceRecptLine wmOutsourceRecptLine) + { + startPage(); + List list = wmOutsourceRecptLineService.selectWmOutsourceRecptLineList(wmOutsourceRecptLine); + return getDataTable(list); + } + + /** + * 导出外协入库单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:export')") + @Log(title = "外协入库单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmOutsourceRecptLine wmOutsourceRecptLine) + { + List list = wmOutsourceRecptLineService.selectWmOutsourceRecptLineList(wmOutsourceRecptLine); + ExcelUtil util = new ExcelUtil(WmOutsourceRecptLine.class); + util.exportExcel(response, list, "外协入库单行数据"); + } + + /** + * 获取外协入库单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmOutsourceRecptLineService.selectWmOutsourceRecptLineByLineId(lineId)); + } + + /** + * 新增外协入库单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:add')") + @Log(title = "外协入库单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmOutsourceRecptLine wmOutsourceRecptLine) + { + if(StringUtils.isNotNull(wmOutsourceRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmOutsourceRecptLine.getWarehouseId()); + wmOutsourceRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmOutsourceRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmOutsourceRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmOutsourceRecptLine.getLocationId()); + wmOutsourceRecptLine.setLocationCode(location.getLocationCode()); + wmOutsourceRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmOutsourceRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmOutsourceRecptLine.getAreaId()); + wmOutsourceRecptLine.setAreaCode(area.getAreaCode()); + wmOutsourceRecptLine.setAreaName(area.getAreaName()); + } + wmOutsourceRecptLine.setCreateBy(getUsername()); + + return toAjax(wmOutsourceRecptLineService.insertWmOutsourceRecptLine(wmOutsourceRecptLine)); + } + + /** + * 修改外协入库单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:edit')") + @Log(title = "外协入库单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmOutsourceRecptLine wmOutsourceRecptLine) + { + if(StringUtils.isNotNull(wmOutsourceRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmOutsourceRecptLine.getWarehouseId()); + wmOutsourceRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmOutsourceRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmOutsourceRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmOutsourceRecptLine.getLocationId()); + wmOutsourceRecptLine.setLocationCode(location.getLocationCode()); + wmOutsourceRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmOutsourceRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmOutsourceRecptLine.getAreaId()); + wmOutsourceRecptLine.setAreaCode(area.getAreaCode()); + wmOutsourceRecptLine.setAreaName(area.getAreaName()); + } + + return toAjax(wmOutsourceRecptLineService.updateWmOutsourceRecptLine(wmOutsourceRecptLine)); + } + + /** + * 删除外协入库单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:oursourcerecpt:remove')") + @Log(title = "外协入库单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmOutsourceRecptLineService.deleteWmOutsourceRecptLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmPackageController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmPackageController.java new file mode 100644 index 0000000..a31255c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmPackageController.java @@ -0,0 +1,172 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmBarcode; +import com.ktg.mes.wm.service.IWmBarcodeService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmPackage; +import com.ktg.mes.wm.service.IWmPackageService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 装箱单Controller + * + * @author yinjinlu + * @date 2022-10-10 + */ +@RestController +@RequestMapping("/mes/wm/package") +public class WmPackageController extends BaseController +{ + @Autowired + private IWmPackageService wmPackageService; + + @Autowired + private IWmBarcodeService wmBarcodeService; + + /** + * 查询装箱单列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmPackage wmPackage) + { + startPage(); + List list = wmPackageService.selectWmPackageList(wmPackage); + return getDataTable(list); + } + + /** + * 导出装箱单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:export')") + @Log(title = "装箱单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmPackage wmPackage) + { + List list = wmPackageService.selectWmPackageList(wmPackage); + ExcelUtil util = new ExcelUtil(WmPackage.class); + util.exportExcel(response, list, "装箱单数据"); + } + + /** + * 获取装箱单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:query')") + @GetMapping(value = "/{packageId}") + public AjaxResult getInfo(@PathVariable("packageId") Long packageId) + { + return AjaxResult.success(wmPackageService.selectWmPackageByPackageId(packageId)); + } + + /** + * 新增装箱单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:add')") + @Log(title = "装箱单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmPackage wmPackage) + { + if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){ + return AjaxResult.error("装箱单编号已存在!"); + } + if(wmPackage.getParentId() !=null){ + WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId()); + if(StringUtils.isNotNull(parentPackage)){ + wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId()); + } + } + + int ret =wmPackageService.insertWmPackage(wmPackage); + + //装箱单保存成功就自动生成对应的箱条码 + WmBarcode wmBarcode = new WmBarcode(); + wmBarcode.setBussinessId(wmPackage.getPackageId()); + wmBarcode.setBussinessCode(wmPackage.getPackageCode()); + wmBarcode.setBussinessName(wmPackage.getClientName()); + wmBarcode.setBarcodeType(UserConstants.BARCODE_TYPE_PACKAGE);//类型设置为箱条码 + wmBarcode.setBarcodeFormart(UserConstants.QR_CODE);//设置为二维码 + wmBarcode.setBarcodeContent(""+UserConstants.BARCODE_TYPE_PACKAGE+"-"+wmPackage.getPackageCode()); + String path =wmBarcodeService.generateBarcode(wmBarcode); + wmBarcode.setBarcodeUrl(path); + wmBarcode.setCreateBy(getUsername()); + wmBarcodeService.insertWmBarcode(wmBarcode); + + //将条码的URL更新上去 + wmPackage.setBarcodeId(wmBarcode.getBarcodeId()); + wmPackage.setBarcodeContent(wmBarcode.getBarcodeContent()); + wmPackage.setBarcodeUrl(path); + wmPackageService.updateWmPackage(wmPackage); + return toAjax(ret); + } + + /** + * 修改装箱单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')") + @Log(title = "装箱单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmPackage wmPackage) + { + if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){ + return AjaxResult.error("装箱单编号已存在!"); + } + return toAjax(wmPackageService.updateWmPackage(wmPackage)); + } + + /** + * 添加子箱 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')") + @Log(title = "装箱单", businessType = BusinessType.UPDATE) + @PutMapping("/addsub") + public AjaxResult addSubPackage(@RequestBody WmPackage wmPackage){ + //不能添加自己 + if(wmPackage.getPackageId().longValue() == wmPackage.getParentId().longValue()){ + return AjaxResult.error("不能添加自己为子箱!"); + } + + //已经有父箱的不能再次添加 + WmPackage subPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getPackageId()); + if(!"0".equals(subPackage.getAncestors())){ + return AjaxResult.error("当前子箱已经有外箱包装!"); + } + + //更新当前子箱的父箱列表 + WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId()); + if(StringUtils.isNotNull(parentPackage)){ + wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId()); + } + + return toAjax(wmPackageService.updateWmPackage(wmPackage)); + } + + + /** + * 删除装箱单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:remove')") + @Log(title = "装箱单", businessType = BusinessType.DELETE) + @DeleteMapping("/{packageIds}") + public AjaxResult remove(@PathVariable Long[] packageIds) + { + return toAjax(wmPackageService.deleteWmPackageByPackageIds(packageIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmPackageLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmPackageLineController.java new file mode 100644 index 0000000..1224453 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmPackageLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmPackageLine; +import com.ktg.mes.wm.service.IWmPackageLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 装箱明细Controller + * + * @author yinjinlu + * @date 2022-10-11 + */ +@RestController +@RequestMapping("/mes/wm/packageline") +public class WmPackageLineController extends BaseController +{ + @Autowired + private IWmPackageLineService wmPackageLineService; + + /** + * 查询装箱明细列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:list')") + @GetMapping("/list") + public TableDataInfo list(WmPackageLine wmPackageLine) + { + startPage(); + List list = wmPackageLineService.selectWmPackageLineList(wmPackageLine); + return getDataTable(list); + } + + /** + * 导出装箱明细列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:export')") + @Log(title = "装箱明细", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmPackageLine wmPackageLine) + { + List list = wmPackageLineService.selectWmPackageLineList(wmPackageLine); + ExcelUtil util = new ExcelUtil(WmPackageLine.class); + util.exportExcel(response, list, "装箱明细数据"); + } + + /** + * 获取装箱明细详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmPackageLineService.selectWmPackageLineByLineId(lineId)); + } + + /** + * 新增装箱明细 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:add')") + @Log(title = "装箱明细", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmPackageLine wmPackageLine) + { + return toAjax(wmPackageLineService.insertWmPackageLine(wmPackageLine)); + } + + /** + * 修改装箱明细 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')") + @Log(title = "装箱明细", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmPackageLine wmPackageLine) + { + return toAjax(wmPackageLineService.updateWmPackageLine(wmPackageLine)); + } + + /** + * 删除装箱明细 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:package:remove')") + @Log(title = "装箱明细", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmPackageLineService.deleteWmPackageLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductProduceController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductProduceController.java new file mode 100644 index 0000000..2db13f0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductProduceController.java @@ -0,0 +1,114 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.mes.wm.service.IWmProductProduceLineService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmProductProduce; +import com.ktg.mes.wm.service.IWmProductProduceService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品产出记录Controller + * + * @author yinjinlu + * @date 2022-09-21 + */ +@RestController +@RequestMapping("/mes/wm/productproduce") +public class WmProductProduceController extends BaseController +{ + @Autowired + private IWmProductProduceService wmProductProduceService; + + @Autowired + private IWmProductProduceLineService wmProductProduceLineService; + /** + * 查询产品产出记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductProduce wmProductProduce) + { + startPage(); + List list = wmProductProduceService.selectWmProductProduceList(wmProductProduce); + return getDataTable(list); + } + + /** + * 导出产品产出记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:export')") + @Log(title = "产品产出记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmProductProduce wmProductProduce) + { + List list = wmProductProduceService.selectWmProductProduceList(wmProductProduce); + ExcelUtil util = new ExcelUtil(WmProductProduce.class); + util.exportExcel(response, list, "产品产出记录数据"); + } + + /** + * 获取产品产出记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(wmProductProduceService.selectWmProductProduceByRecordId(recordId)); + } + + /** + * 新增产品产出记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:add')") + @Log(title = "产品产出记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductProduce wmProductProduce) + { + return toAjax(wmProductProduceService.insertWmProductProduce(wmProductProduce)); + } + + /** + * 修改产品产出记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:edit')") + @Log(title = "产品产出记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductProduce wmProductProduce) + { + return toAjax(wmProductProduceService.updateWmProductProduce(wmProductProduce)); + } + + /** + * 删除产品产出记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:remove')") + @Log(title = "产品产出记录", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + for (Long recordId: recordIds + ) { + wmProductProduceLineService.deleteByRecordId(recordId); + } + return toAjax(wmProductProduceService.deleteWmProductProduceByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductProduceLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductProduceLineController.java new file mode 100644 index 0000000..0772ec7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductProduceLineController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmProductProduceLine; +import com.ktg.mes.wm.service.IWmProductProduceLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品产出记录行Controller + * + * @author yinjinlu + * @date 2022-09-22 + */ +@RestController +@RequestMapping("/mes/wm/productproduceline") +public class WmProductProduceLineController extends BaseController +{ + @Autowired + private IWmProductProduceLineService wmProductProduceLineService; + + /** + * 查询产品产出记录行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductProduceLine wmProductProduceLine) + { + startPage(); + List list = wmProductProduceLineService.selectWmProductProduceLineList(wmProductProduceLine); + return getDataTable(list); + } + + /** + * 导出产品产出记录行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:export')") + @Log(title = "产品产出记录行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmProductProduceLine wmProductProduceLine) + { + List list = wmProductProduceLineService.selectWmProductProduceLineList(wmProductProduceLine); + ExcelUtil util = new ExcelUtil(WmProductProduceLine.class); + util.exportExcel(response, list, "产品产出记录行数据"); + } + + /** + * 获取产品产出记录行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmProductProduceLineService.selectWmProductProduceLineByLineId(lineId)); + } + + /** + * 新增产品产出记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:add')") + @Log(title = "产品产出记录行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductProduceLine wmProductProduceLine) + { + return toAjax(wmProductProduceLineService.insertWmProductProduceLine(wmProductProduceLine)); + } + + /** + * 修改产品产出记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:edit')") + @Log(title = "产品产出记录行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductProduceLine wmProductProduceLine) + { + return toAjax(wmProductProduceLineService.updateWmProductProduceLine(wmProductProduceLine)); + } + + /** + * 删除产品产出记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productproduce:remove')") + @Log(title = "产品产出记录行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmProductProduceLineService.deleteWmProductProduceLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductRecptController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductRecptController.java new file mode 100644 index 0000000..67eec8c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductRecptController.java @@ -0,0 +1,199 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.ProductRecptTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品入库录Controller + * + * @author yinjinlu + * @date 2022-09-22 + */ +@RestController +@RequestMapping("/mes/wm/productrecpt") +public class WmProductRecptController extends BaseController +{ + @Autowired + private IWmProductRecptService wmProductRecptService; + + @Autowired + private IWmProductRecptLineService wmProductRecptLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询产品入库录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductRecpt wmProductRecpt) + { + startPage(); + List list = wmProductRecptService.selectWmProductRecptList(wmProductRecpt); + return getDataTable(list); + } + + /** + * 导出产品入库录列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:export')") + @Log(title = "产品入库记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmProductRecpt wmProductRecpt) + { + List list = wmProductRecptService.selectWmProductRecptList(wmProductRecpt); + ExcelUtil util = new ExcelUtil(WmProductRecpt.class); + util.exportExcel(response, list, "产品入库录数据"); + } + + /** + * 获取产品入库录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')") + @GetMapping(value = "/{recptId}") + public AjaxResult getInfo(@PathVariable("recptId") Long recptId) + { + return AjaxResult.success(wmProductRecptService.selectWmProductRecptByRecptId(recptId)); + } + + /** + * 新增产品入库录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')") + @Log(title = "产品入库记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductRecpt wmProductRecpt) + { + if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){ + return AjaxResult.error("入库单编号已存在!"); + } + + if(StringUtils.isNotNull(wmProductRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecpt.getWarehouseId()); + wmProductRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecpt.getLocationId()); + wmProductRecpt.setLocationCode(location.getLocationCode()); + wmProductRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecpt.getAreaId()); + wmProductRecpt.setAreaCode(area.getAreaCode()); + wmProductRecpt.setAreaName(area.getAreaName()); + } + wmProductRecpt.setCreateBy(getUsername()); + return toAjax(wmProductRecptService.insertWmProductRecpt(wmProductRecpt)); + } + + /** + * 修改产品入库录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')") + @Log(title = "产品入库记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductRecpt wmProductRecpt) + { + if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){ + return AjaxResult.error("入库单编号已存在!"); + } + + + if(StringUtils.isNotNull(wmProductRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecpt.getWarehouseId()); + wmProductRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecpt.getLocationId()); + wmProductRecpt.setLocationCode(location.getLocationCode()); + wmProductRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecpt.getAreaId()); + wmProductRecpt.setAreaCode(area.getAreaCode()); + wmProductRecpt.setAreaName(area.getAreaName()); + } + + return toAjax(wmProductRecptService.updateWmProductRecpt(wmProductRecpt)); + } + + /** + * 删除产品入库录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')") + @Log(title = "产品入库记录", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recptIds}") + public AjaxResult remove(@PathVariable Long[] recptIds) + { + for (Long recptId: recptIds + ) { + wmProductRecptLineService.deleteByRecptId(recptId); + } + return toAjax(wmProductRecptService.deleteWmProductRecptByRecptIds(recptIds)); + } + + /** + * 执行入库 + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')") + @Log(title = "产品入库记录", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{recptId}") + public AjaxResult execute(@PathVariable Long recptId){ + WmProductRecpt recpt = wmProductRecptService.selectWmProductRecptByRecptId(recptId); + + WmProductRecptLine param = new WmProductRecptLine(); + param.setRecptId(recptId); + List lines = wmProductRecptLineService.selectWmProductRecptLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请添加要入库的产品"); + } + + List beans = wmProductRecptService.getTxBean(recptId); + storageCoreService.processProductRecpt(beans); + + recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmProductRecptService.updateWmProductRecpt(recpt); + + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductRecptLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductRecptLineController.java new file mode 100644 index 0000000..03eb987 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductRecptLineController.java @@ -0,0 +1,152 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmProductRecptLine; +import com.ktg.mes.wm.service.IWmProductRecptLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品入库记录行Controller + * + * @author yinjinlu + * @date 2022-09-22 + */ +@RestController +@RequestMapping("/mes/wm/productrecptline") +public class WmProductRecptLineController extends BaseController +{ + @Autowired + private IWmProductRecptLineService wmProductRecptLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询产品入库记录行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductRecptLine wmProductRecptLine) + { + startPage(); + List list = wmProductRecptLineService.selectWmProductRecptLineList(wmProductRecptLine); + return getDataTable(list); + } + + /** + * 导出产品入库记录行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:export')") + @Log(title = "产品入库记录行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmProductRecptLine wmProductRecptLine) + { + List list = wmProductRecptLineService.selectWmProductRecptLineList(wmProductRecptLine); + ExcelUtil util = new ExcelUtil(WmProductRecptLine.class); + util.exportExcel(response, list, "产品入库记录行数据"); + } + + /** + * 获取产品入库记录行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmProductRecptLineService.selectWmProductRecptLineByLineId(lineId)); + } + + /** + * 新增产品入库记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')") + @Log(title = "产品入库记录行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductRecptLine wmProductRecptLine) + { + if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId()); + wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId()); + wmProductRecptLine.setLocationCode(location.getLocationCode()); + wmProductRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId()); + wmProductRecptLine.setAreaCode(area.getAreaCode()); + wmProductRecptLine.setAreaName(area.getAreaName()); + } + wmProductRecptLine.setCreateBy(getUsername()); + return toAjax(wmProductRecptLineService.insertWmProductRecptLine(wmProductRecptLine)); + } + + /** + * 修改产品入库记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')") + @Log(title = "产品入库记录行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductRecptLine wmProductRecptLine) + { + if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId()); + wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId()); + wmProductRecptLine.setLocationCode(location.getLocationCode()); + wmProductRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId()); + wmProductRecptLine.setAreaCode(area.getAreaCode()); + wmProductRecptLine.setAreaName(area.getAreaName()); + } + return toAjax(wmProductRecptLineService.updateWmProductRecptLine(wmProductRecptLine)); + } + + /** + * 删除产品入库记录行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')") + @Log(title = "产品入库记录行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmProductRecptLineService.deleteWmProductRecptLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductSalseController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductSalseController.java new file mode 100644 index 0000000..ec332ad --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductSalseController.java @@ -0,0 +1,194 @@ +package com.ktg.mes.wm.controller; + +import java.util.Collection; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.ProductSalseTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 销售出库单Controller + * + * @author yinjinlu + * @date 2022-10-04 + */ +@RestController +@RequestMapping("/mes/wm/productsalse") +public class WmProductSalseController extends BaseController +{ + @Autowired + private IWmProductSalseService wmProductSalseService; + + @Autowired + private IWmProductSalseLineService wmProductSalseLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询销售出库单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductSalse wmProductSalse) + { + startPage(); + List list = wmProductSalseService.selectWmProductSalseList(wmProductSalse); + return getDataTable(list); + } + + /** + * 导出销售出库单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:export')") + @Log(title = "销售出库单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmProductSalse wmProductSalse) + { + List list = wmProductSalseService.selectWmProductSalseList(wmProductSalse); + ExcelUtil util = new ExcelUtil(WmProductSalse.class); + util.exportExcel(response, list, "销售出库单数据"); + } + + /** + * 获取销售出库单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')") + @GetMapping(value = "/{salseId}") + public AjaxResult getInfo(@PathVariable("salseId") Long salseId) + { + return AjaxResult.success(wmProductSalseService.selectWmProductSalseBySalseId(salseId)); + } + + /** + * 新增销售出库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')") + @Log(title = "销售出库单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductSalse wmProductSalse) + { + if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){ + return AjaxResult.error("出库单编号已存在!"); + } + if(StringUtils.isNotNull(wmProductSalse.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductSalse.getWarehouseId()); + wmProductSalse.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductSalse.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductSalse.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductSalse.getLocationId()); + wmProductSalse.setLocationCode(location.getLocationCode()); + wmProductSalse.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductSalse.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductSalse.getAreaId()); + wmProductSalse.setAreaCode(area.getAreaCode()); + wmProductSalse.setAreaName(area.getAreaName()); + } + wmProductSalse.setCreateBy(getUsername()); + return toAjax(wmProductSalseService.insertWmProductSalse(wmProductSalse)); + } + + /** + * 修改销售出库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')") + @Log(title = "销售出库单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductSalse wmProductSalse) + { + if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){ + return AjaxResult.error("出库单编号已存在!"); + } + if(StringUtils.isNotNull(wmProductSalse.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductSalse.getWarehouseId()); + wmProductSalse.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductSalse.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductSalse.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductSalse.getLocationId()); + wmProductSalse.setLocationCode(location.getLocationCode()); + wmProductSalse.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductSalse.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductSalse.getAreaId()); + wmProductSalse.setAreaCode(area.getAreaCode()); + wmProductSalse.setAreaName(area.getAreaName()); + } + return toAjax(wmProductSalseService.updateWmProductSalse(wmProductSalse)); + } + + /** + * 删除销售出库单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')") + @Log(title = "销售出库单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{salseIds}") + public AjaxResult remove(@PathVariable Long[] salseIds) + { + for (Long salseId: salseIds + ) { + wmProductSalseLineService.deleteBySalseId(salseId); + } + return toAjax(wmProductSalseService.deleteWmProductSalseBySalseIds(salseIds)); + } + + /** + * 执行出库 + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')") + @Log(title = "销售出库单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{salseId}") + public AjaxResult execute(@PathVariable Long salseId){ + WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId); + + WmProductSalseLine param = new WmProductSalseLine(); + param.setSalseId(salseId); + List lines = wmProductSalseLineService.selectWmProductSalseLineList(param); + if(CollectionUtil.isEmpty(lines)){ + return AjaxResult.error("出库物资不能为空"); + } + + List beans = wmProductSalseService.getTxBeans(salseId); + storageCoreService.processProductSalse(beans); + + salse.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmProductSalseService.updateWmProductSalse(salse); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductSalseLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductSalseLineController.java new file mode 100644 index 0000000..e424d5a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmProductSalseLineController.java @@ -0,0 +1,105 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmProductSalseLine; +import com.ktg.mes.wm.service.IWmProductSalseLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品销售出库行Controller + * + * @author yinjinlu + * @date 2022-10-05 + */ +@RestController +@RequestMapping("/mes/wm/productsalseline") +public class WmProductSalseLineController extends BaseController +{ + @Autowired + private IWmProductSalseLineService wmProductSalseLineService; + + /** + * 查询产品销售出库行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductSalseLine wmProductSalseLine) + { + startPage(); + List list = wmProductSalseLineService.selectWmProductSalseLineList(wmProductSalseLine); + return getDataTable(list); + } + + /** + * 导出产品销售出库行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:export')") + @Log(title = "产品销售出库行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmProductSalseLine wmProductSalseLine) + { + List list = wmProductSalseLineService.selectWmProductSalseLineList(wmProductSalseLine); + ExcelUtil util = new ExcelUtil(WmProductSalseLine.class); + util.exportExcel(response, list, "产品销售出库行数据"); + } + + /** + * 获取产品销售出库行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmProductSalseLineService.selectWmProductSalseLineByLineId(lineId)); + } + + /** + * 新增产品销售出库行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')") + @Log(title = "产品销售出库行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductSalseLine wmProductSalseLine) + { + wmProductSalseLine.setCreateBy(getUsername()); + return toAjax(wmProductSalseLineService.insertWmProductSalseLine(wmProductSalseLine)); + } + + /** + * 修改产品销售出库行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')") + @Log(title = "产品销售出库行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductSalseLine wmProductSalseLine) + { + return toAjax(wmProductSalseLineService.updateWmProductSalseLine(wmProductSalseLine)); + } + + /** + * 删除产品销售出库行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')") + @Log(title = "产品销售出库行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmProductSalseLineService.deleteWmProductSalseLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueController.java new file mode 100644 index 0000000..865537a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueController.java @@ -0,0 +1,200 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.RtIssueTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产退料单头Controller + * + * @author yinjinlu + * @date 2022-09-15 + */ +@RestController +@RequestMapping("/mes/wm/rtissue") +public class WmRtIssueController extends BaseController +{ + @Autowired + private IWmRtIssueService wmRtIssueService; + + @Autowired + private IWmRtIssueLineService wmRtIssueLineService; + + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询生产退料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtIssue wmRtIssue) + { + startPage(); + List list = wmRtIssueService.selectWmRtIssueList(wmRtIssue); + return getDataTable(list); + } + + /** + * 导出生产退料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:export')") + @Log(title = "生产退料单头", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtIssue wmRtIssue) + { + List list = wmRtIssueService.selectWmRtIssueList(wmRtIssue); + ExcelUtil util = new ExcelUtil(WmRtIssue.class); + util.exportExcel(response, list, "生产退料单头数据"); + } + + /** + * 获取生产退料单头详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtIssueService.selectWmRtIssueByRtId(rtId)); + } + + /** + * 新增生产退料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')") + @Log(title = "生产退料单头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtIssue wmRtIssue) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){ + return AjaxResult.error("退料单编号已存在"); + } + + if(StringUtils.isNotNull(wmRtIssue.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssue.getWarehouseId()); + wmRtIssue.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtIssue.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtIssue.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssue.getLocationId()); + wmRtIssue.setLocationCode(location.getLocationCode()); + wmRtIssue.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtIssue.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssue.getAreaId()); + wmRtIssue.setAreaCode(area.getAreaCode()); + wmRtIssue.setAreaName(area.getAreaName()); + } + wmRtIssue.setCreateBy(getUsername()); + return toAjax(wmRtIssueService.insertWmRtIssue(wmRtIssue)); + } + + /** + * 修改生产退料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtIssue wmRtIssue) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){ + return AjaxResult.error("退料单编号已存在"); + } + + if(StringUtils.isNotNull(wmRtIssue.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssue.getWarehouseId()); + wmRtIssue.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtIssue.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtIssue.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssue.getLocationId()); + wmRtIssue.setLocationCode(location.getLocationCode()); + wmRtIssue.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtIssue.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssue.getAreaId()); + wmRtIssue.setAreaCode(area.getAreaCode()); + wmRtIssue.setAreaName(area.getAreaName()); + } + return toAjax(wmRtIssueService.updateWmRtIssue(wmRtIssue)); + } + + /** + * 删除生产退料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')") + @Log(title = "生产退料单头", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + for (Long rtId: rtIds + ) { + wmRtIssueLineService.deleteByRtId(rtId); + } + return toAjax(wmRtIssueService.deleteWmRtIssueByRtIds(rtIds)); + } + + /** + * 执行退料 + * @param rtId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单头", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + WmRtIssue rtIssue = wmRtIssueService.selectWmRtIssueByRtId(rtId); + WmRtIssueLine param = new WmRtIssueLine(); + param.setRtId(rtId); + List lines = wmRtIssueLineService.selectWmRtIssueLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请选择要退料的物资"); + } + + List beans = wmRtIssueService.getTxBeans(rtId); + + //执行生产退料 + storageCoreService.processRtIssue(beans); + + + rtIssue.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtIssueService.updateWmRtIssue(rtIssue); + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueLineController.java new file mode 100644 index 0000000..d869df5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueLineController.java @@ -0,0 +1,156 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmRtIssueLine; +import com.ktg.mes.wm.service.IWmRtIssueLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产退料单行Controller + * + * @author yinjinlu + * @date 2022-09-15 + */ +@RestController +@RequestMapping("/mes/wm/rtissueline") +public class WmRtIssueLineController extends BaseController +{ + @Autowired + private IWmRtIssueLineService wmRtIssueLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询生产退料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtIssueLine wmRtIssueLine) + { + startPage(); + List list = wmRtIssueLineService.selectWmRtIssueLineList(wmRtIssueLine); + return getDataTable(list); + } + + /** + * 导出生产退料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:export')") + @Log(title = "生产退料单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtIssueLine wmRtIssueLine) + { + List list = wmRtIssueLineService.selectWmRtIssueLineList(wmRtIssueLine); + ExcelUtil util = new ExcelUtil(WmRtIssueLine.class); + util.exportExcel(response, list, "生产退料单行数据"); + } + + /** + * 获取生产退料单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtIssueLineService.selectWmRtIssueLineByLineId(lineId)); + } + + /** + * 新增生产退料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')") + @Log(title = "生产退料单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtIssueLine wmRtIssueLine) + { + if(!StringUtils.isNotNull(wmRtIssueLine.getMaterialStockId())){ + return AjaxResult.error("请从库存现有量中选择退料的物资!"); + } + + if(StringUtils.isNotNull(wmRtIssueLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssueLine.getWarehouseId()); + wmRtIssueLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtIssueLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssueLine.getLocationId()); + wmRtIssueLine.setLocationCode(location.getLocationCode()); + wmRtIssueLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssueLine.getAreaId()); + wmRtIssueLine.setAreaCode(area.getAreaCode()); + wmRtIssueLine.setAreaName(area.getAreaName()); + } + wmRtIssueLine.setCreateBy(getUsername()); + return toAjax(wmRtIssueLineService.insertWmRtIssueLine(wmRtIssueLine)); + } + + /** + * 修改生产退料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtIssueLine wmRtIssueLine) + { + if(StringUtils.isNotNull(wmRtIssueLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssueLine.getWarehouseId()); + wmRtIssueLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtIssueLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssueLine.getLocationId()); + wmRtIssueLine.setLocationCode(location.getLocationCode()); + wmRtIssueLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssueLine.getAreaId()); + wmRtIssueLine.setAreaCode(area.getAreaCode()); + wmRtIssueLine.setAreaName(area.getAreaName()); + } + return toAjax(wmRtIssueLineService.updateWmRtIssueLine(wmRtIssueLine)); + } + + /** + * 删除生产退料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')") + @Log(title = "生产退料单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtIssueLineService.deleteWmRtIssueLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java new file mode 100644 index 0000000..8b401b4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java @@ -0,0 +1,198 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品销售退货单Controller + * + * @author yinjinlu + * @date 2022-10-06 + */ +@RestController +@RequestMapping("/mes/wm/rtsalse") +public class WmRtSalseController extends BaseController +{ + @Autowired + private IWmRtSalseService wmRtSalseService; + + @Autowired + private IWmRtSalseLineService wmRtSalseLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询产品销售退货单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtSalse wmRtSalse) + { + startPage(); + List list = wmRtSalseService.selectWmRtSalseList(wmRtSalse); + return getDataTable(list); + } + + /** + * 导出产品销售退货单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:export')") + @Log(title = "产品销售退货单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtSalse wmRtSalse) + { + List list = wmRtSalseService.selectWmRtSalseList(wmRtSalse); + ExcelUtil util = new ExcelUtil(WmRtSalse.class); + util.exportExcel(response, list, "产品销售退货单数据"); + } + + /** + * 获取产品销售退货单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtSalseService.selectWmRtSalseByRtId(rtId)); + } + + /** + * 新增产品销售退货单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')") + @Log(title = "产品销售退货单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtSalse wmRtSalse) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){ + return AjaxResult.error("退货单号已存在!"); + } + + if(StringUtils.isNotNull(wmRtSalse.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalse.getWarehouseId()); + wmRtSalse.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtSalse.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtSalse.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalse.getLocationId()); + wmRtSalse.setLocationCode(location.getLocationCode()); + wmRtSalse.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtSalse.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalse.getAreaId()); + wmRtSalse.setAreaCode(area.getAreaCode()); + wmRtSalse.setAreaName(area.getAreaName()); + } + wmRtSalse.setCreateBy(getUsername()); + return toAjax(wmRtSalseService.insertWmRtSalse(wmRtSalse)); + } + + /** + * 修改产品销售退货单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')") + @Log(title = "产品销售退货单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtSalse wmRtSalse) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){ + return AjaxResult.error("退货单号已存在!"); + } + + if(StringUtils.isNotNull(wmRtSalse.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalse.getWarehouseId()); + wmRtSalse.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtSalse.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtSalse.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalse.getLocationId()); + wmRtSalse.setLocationCode(location.getLocationCode()); + wmRtSalse.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtSalse.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalse.getAreaId()); + wmRtSalse.setAreaCode(area.getAreaCode()); + wmRtSalse.setAreaName(area.getAreaName()); + } + return toAjax(wmRtSalseService.updateWmRtSalse(wmRtSalse)); + } + + /** + * 删除产品销售退货单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')") + @Log(title = "产品销售退货单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + for (Long rtId: rtIds + ) { + wmRtSalseLineService.deleteByRtId(rtId); + } + + return toAjax(wmRtSalseService.deleteWmRtSalseByRtIds(rtIds)); + } + + /** + * 执行退货 + * @param rtId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')") + @Log(title = "产品销售退货单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId); + WmRtSalseLine param = new WmRtSalseLine(); + param.setRtId(rtId); + List lines = wmRtSalseLineService.selectWmRtSalseLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("请添加退货单行信息!"); + } + + List beans = wmRtSalseService.getTxBeans(rtId); + + storageCoreService.processRtSalse(beans); + + rtSalse.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtSalseService.updateWmRtSalse(rtSalse); + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseLineController.java new file mode 100644 index 0000000..d53ceb1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseLineController.java @@ -0,0 +1,152 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmRtSalseLine; +import com.ktg.mes.wm.service.IWmRtSalseLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 产品销售退货行Controller + * + * @author yinjinlu + * @date 2022-10-06 + */ +@RestController +@RequestMapping("/mes/wm/rtsalseline") +public class WmRtSalseLineController extends BaseController +{ + @Autowired + private IWmRtSalseLineService wmRtSalseLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询产品销售退货行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtSalseLine wmRtSalseLine) + { + startPage(); + List list = wmRtSalseLineService.selectWmRtSalseLineList(wmRtSalseLine); + return getDataTable(list); + } + + /** + * 导出产品销售退货行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:export')") + @Log(title = "产品销售退货行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtSalseLine wmRtSalseLine) + { + List list = wmRtSalseLineService.selectWmRtSalseLineList(wmRtSalseLine); + ExcelUtil util = new ExcelUtil(WmRtSalseLine.class); + util.exportExcel(response, list, "产品销售退货行数据"); + } + + /** + * 获取产品销售退货行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtSalseLineService.selectWmRtSalseLineByLineId(lineId)); + } + + /** + * 新增产品销售退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')") + @Log(title = "产品销售退货行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtSalseLine wmRtSalseLine) + { + if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId()); + wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId()); + wmRtSalseLine.setLocationCode(location.getLocationCode()); + wmRtSalseLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId()); + wmRtSalseLine.setAreaCode(area.getAreaCode()); + wmRtSalseLine.setAreaName(area.getAreaName()); + } + wmRtSalseLine.setCreateBy(getUsername()); + return toAjax(wmRtSalseLineService.insertWmRtSalseLine(wmRtSalseLine)); + } + + /** + * 修改产品销售退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')") + @Log(title = "产品销售退货行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtSalseLine wmRtSalseLine) + { + if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId()); + wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId()); + wmRtSalseLine.setLocationCode(location.getLocationCode()); + wmRtSalseLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId()); + wmRtSalseLine.setAreaCode(area.getAreaCode()); + wmRtSalseLine.setAreaName(area.getAreaName()); + } + return toAjax(wmRtSalseLineService.updateWmRtSalseLine(wmRtSalseLine)); + } + + /** + * 删除产品销售退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')") + @Log(title = "产品销售退货行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtSalseLineService.deleteWmRtSalseLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorController.java new file mode 100644 index 0000000..01374a7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorController.java @@ -0,0 +1,160 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.domain.WmRtVendorLine; +import com.ktg.mes.wm.domain.tx.RtVendorTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmRtVendorLineService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.service.IWmRtVendorService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 供应商退货Controller + * + * @author yinjinlu + * @date 2022-06-13 + */ +@RestController +@RequestMapping("/mes/wm/rtvendor") +public class WmRtVendorController extends BaseController +{ + @Autowired + private IWmRtVendorService wmRtVendorService; + + @Autowired + private IWmRtVendorLineService wmRtVendorLineService; + + @Autowired + private IStorageCoreService storageCoreService; + /** + * 查询供应商退货列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendor wmRtVendor) + { + startPage(); + List list = wmRtVendorService.selectWmRtVendorList(wmRtVendor); + return getDataTable(list); + } + + /** + * 导出供应商退货列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:export')") + @Log(title = "供应商退货", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtVendor wmRtVendor) + { + List list = wmRtVendorService.selectWmRtVendorList(wmRtVendor); + ExcelUtil util = new ExcelUtil(WmRtVendor.class); + util.exportExcel(response, list, "供应商退货数据"); + } + + /** + * 获取供应商退货详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtVendorService.selectWmRtVendorByRtId(rtId)); + } + + /** + * 新增供应商退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')") + @Log(title = "供应商退货", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtVendor wmRtVendor) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){ + return AjaxResult.error("退货单编号已经存在!"); + } + wmRtVendor.setCreateBy(getUsername()); + return toAjax(wmRtVendorService.insertWmRtVendor(wmRtVendor)); + } + + /** + * 修改供应商退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtVendor wmRtVendor) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){ + return AjaxResult.error("退货单编号已经存在!"); + } + return toAjax(wmRtVendorService.updateWmRtVendor(wmRtVendor)); + } + + /** + * 删除供应商退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:remove')") + @Log(title = "供应商退货", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + for (Long rtId:rtIds + ) { + WmRtVendor rtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(rtVendor.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmRtVendorLineService.deleteByRtId(rtId); + } + return toAjax(wmRtVendorService.deleteWmRtVendorByRtIds(rtIds)); + } + + /** + * 执行退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + //判断单据状态 + WmRtVendor wmRtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + + //构造事务Bean + List beans = wmRtVendorService.getTxBeans(rtId); + + //调用库存核心 + storageCoreService.processRtVendor(beans); + + //更新单据状态 + WmRtVendor rtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + rtVendor.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtVendorService.updateWmRtVendor(rtVendor); + + return AjaxResult.success(); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorLineController.java new file mode 100644 index 0000000..8914719 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorLineController.java @@ -0,0 +1,105 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmRtVendorLine; +import com.ktg.mes.wm.service.IWmRtVendorLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 供应商退货行Controller + * + * @author yinjinlu + * @date 2022-06-13 + */ +@RestController +@RequestMapping("/mes/wm/rtvendorline") +public class WmRtVendorLineController extends BaseController +{ + @Autowired + private IWmRtVendorLineService wmRtVendorLineService; + + /** + * 查询供应商退货行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendorLine wmRtVendorLine) + { + startPage(); + List list = wmRtVendorLineService.selectWmRtVendorLineList(wmRtVendorLine); + return getDataTable(list); + } + + /** + * 导出供应商退货行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:export')") + @Log(title = "供应商退货行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtVendorLine wmRtVendorLine) + { + List list = wmRtVendorLineService.selectWmRtVendorLineList(wmRtVendorLine); + ExcelUtil util = new ExcelUtil(WmRtVendorLine.class); + util.exportExcel(response, list, "供应商退货行数据"); + } + + /** + * 获取供应商退货行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtVendorLineService.selectWmRtVendorLineByLineId(lineId)); + } + + /** + * 新增供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')") + @Log(title = "供应商退货行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtVendorLine wmRtVendorLine) + { + wmRtVendorLine.setCreateBy(getUsername()); + return toAjax(wmRtVendorLineService.insertWmRtVendorLine(wmRtVendorLine)); + } + + /** + * 修改供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtVendorLine wmRtVendorLine) + { + return toAjax(wmRtVendorLineService.updateWmRtVendorLine(wmRtVendorLine)); + } + + /** + * 删除供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:remove')") + @Log(title = "供应商退货行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtVendorLineService.deleteWmRtVendorLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java new file mode 100644 index 0000000..53e2f80 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java @@ -0,0 +1,134 @@ +package com.ktg.mes.wm.controller; + +import java.util.Date; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.date.DateUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.system.strategy.AutoCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmSn; +import com.ktg.mes.wm.service.IWmSnService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * SN码Controller + * + * @author yinjinlu + * @date 2022-12-08 + */ +@RestController +@RequestMapping("/mes/wm/sn") +public class WmSnController extends BaseController +{ + @Autowired + private IWmSnService wmSnService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询SN码列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmSn wmSn) + { + startPage(); + List list = wmSnService.selectWmSnList(wmSn); + return getDataTable(list); + } + + /** + * 查询SN码列表 + */ + @GetMapping("/listSn") + public TableDataInfo listSn(WmSn wmSn) + { + startPage(); + List list = wmSnService.selectSnList(wmSn); + return getDataTable(list); + } + + /** + * 导出SN码列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:export')") + @Log(title = "SN码", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmSn wmSn) + { + List list = wmSnService.selectWmSnList(wmSn); + ExcelUtil util = new ExcelUtil(WmSn.class); + util.exportExcel(response, list, "SN码数据"); + } + + /** + * 获取SN码详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:query')") + @GetMapping(value = "/{snId}") + public AjaxResult getInfo(@PathVariable("snId") Long snId) + { + return AjaxResult.success(wmSnService.selectWmSnBySnId(snId)); + } + + /** + * 新增SN码 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:add')") + @Log(title = "SN码", businessType = BusinessType.INSERT) + @Transactional + @PostMapping + public AjaxResult add(@RequestBody WmSn wmSn) + { + Date genDate = DateUtil.date(); + wmSn.setGenDate(genDate); + String SNCode= null; + if(wmSn.getSnNum()>0){ + for(int i=0;i list = wmStockTakingService.selectWmStockTakingList(wmStockTaking); + return getDataTable(list); + } + + /** + * 获取库存盘点记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')") + @GetMapping(value = "/{takingId}") + public AjaxResult getInfo(@PathVariable("takingId") Long takingId) + { + return AjaxResult.success(wmStockTakingService.selectWmStockTakingByTakingId(takingId)); + } + + /** + * 新增库存盘点记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')") + @Log(title = "库存盘点记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTaking wmStockTaking) + { + if(StringUtils.isNotNull(wmStockTaking.getTakingCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmStockTakingService.checkUnique(wmStockTaking))){ + return AjaxResult.error("单据编号已存在!"); + } + }else { + wmStockTaking.setTakingCode(autoCodeUtil.genSerialCode(UserConstants.STOCKTAKING_CODE,"")); + } + + if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId()); + wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode()); + wmStockTaking.setWarehouseName(warehouse.getWarehouseName()); + } + + wmStockTakingService.insertWmStockTaking(wmStockTaking); + wmStockTaking.setCreateBy(getUsername()); + return AjaxResult.success(wmStockTaking); + } + + /** + * 修改库存盘点记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "库存盘点记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTaking wmStockTaking) + { + if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId()); + wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode()); + wmStockTaking.setWarehouseName(warehouse.getWarehouseName()); + } + return toAjax(wmStockTakingService.updateWmStockTaking(wmStockTaking)); + } + + /** + * 删除库存盘点记录 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')") + @Log(title = "库存盘点记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{takingIds}") + public AjaxResult remove(@PathVariable Long[] takingIds) + { + for(Long takingId:takingIds){ + WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(taking.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + wmStockTakingLineService.deleteByTakingId(takingId); + wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId); + } + + return toAjax(wmStockTakingService.deleteWmStockTakingByTakingIds(takingIds)); + } + + /** + * 完成盘点,系统对比计算盘点结果 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "盘点单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{takingId}") + public AjaxResult execute(@PathVariable Long takingId){ + WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId); + + WmStockTakingLine param = new WmStockTakingLine(); + param.setTakingId(takingId); + List lines = wmStockTakingLineService.selectWmStockTakingLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("未检测到盘点的物资!"); + } + + //先删除历史记录 + wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId); + + if(UserConstants.WM_STOCK_TAKING_TYPE_OPEN.equals(taking.getTakingType())){ + //如果是明盘,则直接对比明细中的库存数量和盘点数量 + wmStockTakingResultService.calculateOpenWmStockTakingResult(takingId); + }else { + //如果是盲盘,则对比盘点明细中的盘点数量,和当前库存现有量的数量 + wmStockTakingResultService.calculateWmStockTakingResult(takingId); + } + + taking.setStatus(UserConstants.ORDER_STATUS_APPROVED); + wmStockTakingService.updateWmStockTaking(taking); + + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java new file mode 100644 index 0000000..d61a4d9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingLineController.java @@ -0,0 +1,59 @@ +package com.ktg.mes.wm.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmStockTakingLine; +import com.ktg.mes.wm.service.IWmStockTakingLineService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@RestController +@RequestMapping("/mes/wm/stocktakingline") +public class WmStockTakingLineController extends BaseController { + @Autowired + private IWmStockTakingLineService wmStockTakingLineService; + + /** + * 查询库存盘点明细列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTakingLine wmStockTakingLine) + { + startPage(); + List list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine); + return getDataTable(list); + } + + /** + * 导出库存盘点明细列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:export')") + @Log(title = "库存盘点明细", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStockTakingLine wmStockTakingLine) + { + List list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine); + ExcelUtil util = new ExcelUtil(WmStockTakingLine.class); + util.exportExcel(response, list, "库存盘点明细数据"); + } + + /** + * 获取库存盘点明细详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmStockTakingLineService.selectWmStockTakingLineByLineId(lineId)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java new file mode 100644 index 0000000..079adfa --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStockTakingResultController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmStockTakingResult; +import com.ktg.mes.wm.service.IWmStockTakingResultService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库存盘点结果Controller + * + * @author yinjinlu + * @date 2023-08-22 + */ +@RestController +@RequestMapping("/wm/stocktakingresult") +public class WmStockTakingResultController extends BaseController +{ + @Autowired + private IWmStockTakingResultService wmStockTakingResultService; + + /** + * 查询库存盘点结果列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTakingResult wmStockTakingResult) + { + startPage(); + List list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult); + return getDataTable(list); + } + + /** + * 导出库存盘点结果列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:export')") + @Log(title = "库存盘点结果", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStockTakingResult wmStockTakingResult) + { + List list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult); + ExcelUtil util = new ExcelUtil(WmStockTakingResult.class); + util.exportExcel(response, list, "库存盘点结果数据"); + } + + /** + * 获取库存盘点结果详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')") + @GetMapping(value = "/{resultId}") + public AjaxResult getInfo(@PathVariable("resultId") Long resultId) + { + return AjaxResult.success(wmStockTakingResultService.selectWmStockTakingResultByResultId(resultId)); + } + + /** + * 新增库存盘点结果 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')") + @Log(title = "库存盘点结果", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTakingResult wmStockTakingResult) + { + return toAjax(wmStockTakingResultService.insertWmStockTakingResult(wmStockTakingResult)); + } + + /** + * 修改库存盘点结果 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "库存盘点结果", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTakingResult wmStockTakingResult) + { + return toAjax(wmStockTakingResultService.updateWmStockTakingResult(wmStockTakingResult)); + } + + /** + * 删除库存盘点结果 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')") + @Log(title = "库存盘点结果", businessType = BusinessType.DELETE) + @DeleteMapping("/{resultIds}") + public AjaxResult remove(@PathVariable Long[] resultIds) + { + return toAjax(wmStockTakingResultService.deleteWmStockTakingResultByResultIds(resultIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageAreaController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageAreaController.java new file mode 100644 index 0000000..309eb02 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageAreaController.java @@ -0,0 +1,113 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库位设置Controller + * + * @author yinjinlu + * @date 2022-05-08 + */ +@RestController +@RequestMapping("/mes/wm/area") +public class WmStorageAreaController extends BaseController +{ + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private WmBarCodeUtil barCodeUtil; + + /** + * 查询库位设置列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmStorageArea wmStorageArea) + { + startPage(); + List list = wmStorageAreaService.selectWmStorageAreaList(wmStorageArea); + return getDataTable(list); + } + + /** + * 导出库位设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:area:export')") + @Log(title = "库位设置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStorageArea wmStorageArea) + { + List list = wmStorageAreaService.selectWmStorageAreaList(wmStorageArea); + ExcelUtil util = new ExcelUtil(WmStorageArea.class); + util.exportExcel(response, list, "库位设置数据"); + } + + /** + * 获取库位设置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:area:query')") + @GetMapping(value = "/{areaId}") + public AjaxResult getInfo(@PathVariable("areaId") Long areaId) + { + return AjaxResult.success(wmStorageAreaService.selectWmStorageAreaByAreaId(areaId)); + } + + /** + * 新增库位设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:area:add')") + @Log(title = "库位设置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStorageArea wmStorageArea) + { + wmStorageAreaService.insertWmStorageArea(wmStorageArea); + barCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_STORAGEAREA,wmStorageArea.getAreaId(),wmStorageArea.getAreaCode(),wmStorageArea.getAreaName()); + return AjaxResult.success(wmStorageArea.getAreaId()); + } + + /** + * 修改库位设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:area:edit')") + @Log(title = "库位设置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStorageArea wmStorageArea) + { + return toAjax(wmStorageAreaService.updateWmStorageArea(wmStorageArea)); + } + + /** + * 删除库位设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:area:remove')") + @Log(title = "库位设置", businessType = BusinessType.DELETE) + @DeleteMapping("/{areaIds}") + public AjaxResult remove(@PathVariable Long[] areaIds) + { + //TODO:库位删除之前的逻辑校验 + + return toAjax(wmStorageAreaService.deleteWmStorageAreaByAreaIds(areaIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageLocationController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageLocationController.java new file mode 100644 index 0000000..029020a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageLocationController.java @@ -0,0 +1,129 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库区设置Controller + * + * @author yinjinlu + * @date 2022-05-07 + */ +@RestController +@RequestMapping("/mes/wm/location") +public class WmStorageLocationController extends BaseController +{ + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private WmBarCodeUtil wmBarCodeUtil; + + /** + * 查询库区设置列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmStorageLocation wmStorageLocation) + { + startPage(); + List list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation); + return getDataTable(list); + } + + /** + * 导出库区设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:export')") + @Log(title = "库区设置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation) + { + List list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation); + ExcelUtil util = new ExcelUtil(WmStorageLocation.class); + util.exportExcel(response, list, "库区设置数据"); + } + + /** + * 获取库区设置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:query')") + @GetMapping(value = "/{locationId}") + public AjaxResult getInfo(@PathVariable("locationId") Long locationId) + { + return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationByLocationId(locationId)); + } + + /** + * 新增库区设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:add')") + @Log(title = "库区设置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation) + { + if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))){ + return AjaxResult.error("库区编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))){ + return AjaxResult.error("库区名称已存在!"); + } + wmStorageLocationService.insertWmStorageLocation(wmStorageLocation); + wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE,wmStorageLocation.getLocationId(),wmStorageLocation.getLocationCode(),wmStorageLocation.getLocationName()); + return AjaxResult.success(wmStorageLocation.getLocationId()); + } + + /** + * 修改库区设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:edit')") + @Log(title = "库区设置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation) + { + return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation)); + } + + /** + * 删除库区设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:remove')") + @Log(title = "库区设置", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{locationIds}") + public AjaxResult remove(@PathVariable Long[] locationIds) + { + //TODO:库区删除之前的逻辑校验 + + for (Long locationId: locationIds + ) { + wmStorageAreaService.deleteByLocationId(locationId); + } + return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmTransferController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmTransferController.java new file mode 100644 index 0000000..f85583d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmTransferController.java @@ -0,0 +1,183 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.TransferTxBean; +import com.ktg.mes.wm.service.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 转移单Controller + * + * @author yinjinlu + * @date 2022-11-28 + */ +@RestController +@RequestMapping("/mes/wm/transfer") +public class WmTransferController extends BaseController +{ + @Autowired + private IWmTransferService wmTransferService; + + @Autowired + private IWmTransferLineService wmTransferLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IStorageCoreService storageCoreService; + + /** + * 查询转移单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:list')") + @GetMapping("/list") + public TableDataInfo list(WmTransfer wmTransfer) + { + startPage(); + List list = wmTransferService.selectWmTransferList(wmTransfer); + return getDataTable(list); + } + + /** + * 导出转移单列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:export')") + @Log(title = "转移单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmTransfer wmTransfer) + { + List list = wmTransferService.selectWmTransferList(wmTransfer); + ExcelUtil util = new ExcelUtil(WmTransfer.class); + util.exportExcel(response, list, "转移单数据"); + } + + /** + * 获取转移单详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:query')") + @GetMapping(value = "/{transferId}") + public AjaxResult getInfo(@PathVariable("transferId") Long transferId) + { + return AjaxResult.success(wmTransferService.selectWmTransferByTransferId(transferId)); + } + + /** + * 新增转移单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:add')") + @Log(title = "转移单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmTransfer wmTransfer) + { + if(UserConstants.NOT_UNIQUE.equals(wmTransferService.checkUnique(wmTransfer))){ + return AjaxResult.error("转移单编号已存在"); + } + if(StringUtils.isNotNull(wmTransfer.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getFromWarehouseId()); + wmTransfer.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransfer.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getToWarehouseId()); + wmTransfer.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setToWarehouseName(warehouse.getWarehouseName()); + } + + wmTransfer.setCreateBy(getUsername()); + return toAjax(wmTransferService.insertWmTransfer(wmTransfer)); + } + + /** + * 修改转移单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')") + @Log(title = "转移单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmTransfer wmTransfer) + { + if(UserConstants.NOT_UNIQUE.equals(wmTransferService.checkUnique(wmTransfer))){ + return AjaxResult.error("转移单编号已存在"); + } + if(StringUtils.isNotNull(wmTransfer.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getFromWarehouseId()); + wmTransfer.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransfer.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getToWarehouseId()); + wmTransfer.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setToWarehouseName(warehouse.getWarehouseName()); + } + return toAjax(wmTransferService.updateWmTransfer(wmTransfer)); + } + + /** + * 删除转移单 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:remove')") + @Log(title = "转移单", businessType = BusinessType.DELETE) + @DeleteMapping("/{transferIds}") + @Transactional + public AjaxResult remove(@PathVariable Long[] transferIds) + { + for (Long transferId:transferIds + ) { + wmTransferLineService.deleteByTransferId(transferId); + } + return toAjax(wmTransferService.deleteWmTransferByTransferIds(transferIds)); + } + + /** + * 执行退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')") + @Log(title = "转移单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{transferId}") + public AjaxResult execute(@PathVariable Long transferId){ + WmTransfer transfer = wmTransferService.selectWmTransferByTransferId(transferId); + + WmTransferLine param = new WmTransferLine(); + param.setTransferId(transferId); + List lines = wmTransferLineService.selectWmTransferLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("请添加需要转移的物资!"); + } + + List beans = wmTransferService.getTxBeans(transferId); + + if(CollectionUtils.isEmpty(beans)){ + return AjaxResult.error("请添加转移单行信息!"); + } + + storageCoreService.processTransfer(beans); + + + transfer.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmTransferService.updateWmTransfer(transfer); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmTransferLineController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmTransferLineController.java new file mode 100644 index 0000000..4d5d4f9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmTransferLineController.java @@ -0,0 +1,181 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmTransferLine; +import com.ktg.mes.wm.service.IWmTransferLineService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 转移单行Controller + * + * @author yinjinlu + * @date 2022-11-28 + */ +@RestController +@RequestMapping("/mes/wm/transferline") +public class WmTransferLineController extends BaseController +{ + @Autowired + private IWmTransferLineService wmTransferLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + /** + * 查询转移单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:list')") + @GetMapping("/list") + public TableDataInfo list(WmTransferLine wmTransferLine) + { + startPage(); + List list = wmTransferLineService.selectWmTransferLineList(wmTransferLine); + return getDataTable(list); + } + + /** + * 导出转移单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:export')") + @Log(title = "转移单行", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmTransferLine wmTransferLine) + { + List list = wmTransferLineService.selectWmTransferLineList(wmTransferLine); + ExcelUtil util = new ExcelUtil(WmTransferLine.class); + util.exportExcel(response, list, "转移单行数据"); + } + + /** + * 获取转移单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmTransferLineService.selectWmTransferLineByLineId(lineId)); + } + + /** + * 新增转移单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:add')") + @Log(title = "转移单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmTransferLine wmTransferLine) + { + if(StringUtils.isNotNull(wmTransferLine.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getFromWarehouseId()); + wmTransferLine.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getFromLocationId()); + wmTransferLine.setFromLocationCode(location.getLocationCode()); + wmTransferLine.setFromLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getFromAreaId()); + wmTransferLine.setFromAreaCode(area.getAreaCode()); + wmTransferLine.setFromAreaName(area.getAreaName()); + } + if(StringUtils.isNotNull(wmTransferLine.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getToWarehouseId()); + wmTransferLine.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setToWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getToLocationId()); + wmTransferLine.setToLocationCode(location.getLocationCode()); + wmTransferLine.setToLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getToAreaId()); + wmTransferLine.setToAreaCode(area.getAreaCode()); + wmTransferLine.setToAreaName(area.getAreaName()); + } + wmTransferLine.setCreateBy(getUsername()); + return toAjax(wmTransferLineService.insertWmTransferLine(wmTransferLine)); + } + + /** + * 修改转移单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')") + @Log(title = "转移单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmTransferLine wmTransferLine) + { + if(StringUtils.isNotNull(wmTransferLine.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getFromWarehouseId()); + wmTransferLine.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getFromLocationId()); + wmTransferLine.setFromLocationCode(location.getLocationCode()); + wmTransferLine.setFromLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getFromAreaId()); + wmTransferLine.setFromAreaCode(area.getAreaCode()); + wmTransferLine.setFromAreaName(area.getAreaName()); + } + if(StringUtils.isNotNull(wmTransferLine.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getToWarehouseId()); + wmTransferLine.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setToWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getToLocationId()); + wmTransferLine.setToLocationCode(location.getLocationCode()); + wmTransferLine.setToLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getToAreaId()); + wmTransferLine.setToAreaCode(area.getAreaCode()); + wmTransferLine.setToAreaName(area.getAreaName()); + } + return toAjax(wmTransferLineService.updateWmTransferLine(wmTransferLine)); + } + + /** + * 删除转移单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:remove')") + @Log(title = "转移单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmTransferLineService.deleteWmTransferLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java new file mode 100644 index 0000000..ab16366 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java @@ -0,0 +1,147 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.utils.WmBarCodeUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmWarehouseService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 仓库设置Controller + * + * @author yinjinlu + * @date 2022-05-07 + */ +@RestController +@RequestMapping("/mes/wm/warehouse") +public class WmWarehouseController extends BaseController +{ + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private WmBarCodeUtil wmBarCodeUtil; + + /** + * 查询仓库设置列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmWarehouse wmWarehouse) + { + startPage(); + List list = wmWarehouseService.selectWmWarehouseList(wmWarehouse); + return getDataTable(list); + } + + /** + * 查询树型的列表 + * @return + */ + @GetMapping("/getTreeList") + public AjaxResult getTreeList(){ + return AjaxResult.success(wmWarehouseService.getTreeList()); + } + + /** + * 导出仓库设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:export')") + @Log(title = "仓库设置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmWarehouse wmWarehouse) + { + List list = wmWarehouseService.selectWmWarehouseList(wmWarehouse); + ExcelUtil util = new ExcelUtil(WmWarehouse.class); + util.exportExcel(response, list, "仓库设置数据"); + } + + /** + * 获取仓库设置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:query')") + @GetMapping(value = "/{warehouseId}") + public AjaxResult getInfo(@PathVariable("warehouseId") Long warehouseId) + { + return AjaxResult.success(wmWarehouseService.selectWmWarehouseByWarehouseId(warehouseId)); + } + + /** + * 新增仓库设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:add')") + @Log(title = "仓库设置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmWarehouse wmWarehouse) + { + if(UserConstants.NOT_UNIQUE.equals(wmWarehouseService.checkWarehouseCodeUnique(wmWarehouse))){ + return AjaxResult.error("仓库编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(wmWarehouseService.checkWarehouseNameUnique(wmWarehouse))){ + return AjaxResult.error("仓库名称已存在!"); + } + + wmWarehouseService.insertWmWarehouse(wmWarehouse); + wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE,wmWarehouse.getWarehouseId(),wmWarehouse.getWarehouseCode(),wmWarehouse.getWarehouseName()); + + return AjaxResult.success(wmWarehouse.getWarehouseId()); + } + + /** + * 修改仓库设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:edit')") + @Log(title = "仓库设置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmWarehouse wmWarehouse) + { + return toAjax(wmWarehouseService.updateWmWarehouse(wmWarehouse)); + } + + /** + * 删除仓库设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:remove')") + @Log(title = "仓库设置", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{warehouseIds}") + public AjaxResult remove(@PathVariable Long[] warehouseIds) + { + + //TODO:仓库删除之前的逻辑校验 + + for (Long wahouseId: warehouseIds + ) { + wmStorageLocationService.deleteByWarehouseId(wahouseId); + wmStorageAreaService.deleteByWarehouseId(wahouseId); + } + + return toAjax(wmWarehouseService.deleteWmWarehouseByWarehouseIds(warehouseIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmIssueLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmIssueLineMobController.java new file mode 100644 index 0000000..4d032dc --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmIssueLineMobController.java @@ -0,0 +1,132 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmIssueLine; +import com.ktg.mes.wm.domain.WmMaterialStock; +import com.ktg.mes.wm.service.IWmIssueLineService; +import com.ktg.mes.wm.service.IWmMaterialStockService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("生产领料明细") +@RestController +@RequestMapping("/mobile/wm/issueline") +public class WmIssueLineMobController extends BaseController { + + @Autowired + private IWmIssueLineService wmIssueLineService; + + @Autowired + private IWmMaterialStockService wmMaterialStockService; + + /** + * 查询生产领料单行列表 + */ + @ApiOperation("查询生产领导单行信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:list')") + @GetMapping("/list") + public TableDataInfo list(WmIssueLine wmIssueLine) + { + startPage(); + List list = wmIssueLineService.selectWmIssueLineList(wmIssueLine); + return getDataTable(list); + } + + /** + * 获取生产领料单行详细信息 + */ + @ApiOperation("获取生产领料单行明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmIssueLineService.selectWmIssueLineByLineId(lineId)); + } + + /** + * 新增生产领料单行 + */ + @ApiOperation("新增生产领料单行信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:add')") + @Log(title = "生产领料单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmIssueLine wmIssueLine) + { + if(StringUtils.isNotNull(wmIssueLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmIssueLine.getMaterialStockId()); + wmIssueLine.setItemId(stock.getItemId()); + wmIssueLine.setItemCode(stock.getItemCode()); + wmIssueLine.setItemName(stock.getItemName()); + wmIssueLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmIssueLine.setSpecification(stock.getSpecification()); + wmIssueLine.setBatchCode(stock.getBatchCode()); + wmIssueLine.setWarehouseId(stock.getWarehouseId()); + wmIssueLine.setWarehouseCode(stock.getWarehouseCode()); + wmIssueLine.setWarehouseName(stock.getWarehouseName()); + wmIssueLine.setLocationId(stock.getLocationId()); + wmIssueLine.setLocationCode(stock.getLocationCode()); + wmIssueLine.setLocationName(stock.getLocationName()); + wmIssueLine.setAreaId(stock.getAreaId()); + wmIssueLine.setAreaCode(stock.getAreaCode()); + wmIssueLine.setAreaName(stock.getAreaName()); + } + + wmIssueLine.setCreateBy(getUsername()); + wmIssueLineService.insertWmIssueLine(wmIssueLine); + return AjaxResult.success(wmIssueLine); + } + + /** + * 修改生产领料单行 + */ + @ApiOperation("更新生产领料单行信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')") + @Log(title = "生产领料单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmIssueLine wmIssueLine) + { + if(StringUtils.isNotNull(wmIssueLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmIssueLine.getMaterialStockId()); + wmIssueLine.setItemId(stock.getItemId()); + wmIssueLine.setItemCode(stock.getItemCode()); + wmIssueLine.setItemName(stock.getItemName()); + wmIssueLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmIssueLine.setSpecification(stock.getSpecification()); + wmIssueLine.setBatchCode(stock.getBatchCode()); + wmIssueLine.setWarehouseId(stock.getWarehouseId()); + wmIssueLine.setWarehouseCode(stock.getWarehouseCode()); + wmIssueLine.setWarehouseName(stock.getWarehouseName()); + wmIssueLine.setLocationId(stock.getLocationId()); + wmIssueLine.setLocationCode(stock.getLocationCode()); + wmIssueLine.setLocationName(stock.getLocationName()); + wmIssueLine.setAreaId(stock.getAreaId()); + wmIssueLine.setAreaCode(stock.getAreaCode()); + wmIssueLine.setAreaName(stock.getAreaName()); + } + + return toAjax(wmIssueLineService.updateWmIssueLine(wmIssueLine)); + } + + /** + * 删除生产领料单行 + */ + @ApiOperation("删除生产领料单行信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:remove')") + @Log(title = "生产领料单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmIssueLineService.deleteWmIssueLineByLineIds(lineIds)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmIssueMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmIssueMobController.java new file mode 100644 index 0000000..3803222 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmIssueMobController.java @@ -0,0 +1,190 @@ +package com.ktg.mes.wm.controller.mobile; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.IssueTxBean; +import com.ktg.mes.wm.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("生产领料") +@RestController +@RequestMapping("/mobile/wm/issueheader") +public class WmIssueMobController extends BaseController { + @Autowired + private IWmIssueHeaderService wmIssueHeaderService; + + @Autowired + private IWmIssueLineService wmIssueLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询生产领料单头列表 + */ + @ApiOperation("查询生产领料单清单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:list')") + @GetMapping("/list") + public TableDataInfo list(WmIssueHeader wmIssueHeader) + { + startPage(); + List list = wmIssueHeaderService.selectWmIssueHeaderList(wmIssueHeader); + return getDataTable(list); + } + + + + /** + * 获取生产领料单头详细信息 + */ + @ApiOperation("获取生产领料单详情信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:query')") + @GetMapping(value = "/{issueId}") + public AjaxResult getInfo(@PathVariable("issueId") Long issueId) + { + return AjaxResult.success(wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId)); + } + + /** + * 新增生产领料单头 + */ + @ApiOperation("新增生产领料单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:add')") + @Log(title = "生产领料单头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmIssueHeader wmIssueHeader) + { + if(StringUtils.isNotNull(wmIssueHeader.getIssueCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmIssueHeaderService.checkIssueCodeUnique(wmIssueHeader))){ + return AjaxResult.error("单据编号已存在!"); + } + }else { + wmIssueHeader.setIssueCode(autoCodeUtil.genSerialCode(UserConstants.ISSUE_CODE,"")); + } + + //根据领料单上的生产工单初始化客户信息 + if(StringUtils.isNotNull(wmIssueHeader.getWorkorderId())){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmIssueHeader.getWorkorderId()); + wmIssueHeader.setClientId(workorder.getClientId()); + wmIssueHeader.setClientCode(workorder.getClientCode()); + wmIssueHeader.setClientName(workorder.getClientName()); + } + + wmIssueHeader.setCreateBy(getUsername()); + wmIssueHeaderService.insertWmIssueHeader(wmIssueHeader); + return AjaxResult.success(wmIssueHeader); + } + + /** + * 修改生产领料单头 + */ + @ApiOperation("修改生产领料单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')") + @Log(title = "生产领料单头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmIssueHeader wmIssueHeader) + { + if(UserConstants.NOT_UNIQUE.equals(wmIssueHeaderService.checkIssueCodeUnique(wmIssueHeader))){ + return AjaxResult.error("领料单编号已存在"); + } + + //根据领料单上的生产工单初始化客户信息 + if(StringUtils.isNotNull(wmIssueHeader.getWorkorderId())){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmIssueHeader.getWorkorderId()); + wmIssueHeader.setClientId(workorder.getClientId()); + wmIssueHeader.setClientCode(workorder.getClientCode()); + wmIssueHeader.setClientName(workorder.getClientName()); + } + + return toAjax(wmIssueHeaderService.updateWmIssueHeader(wmIssueHeader)); + } + + /** + * 删除生产领料单头 + */ + @ApiOperation("删除生产领料单信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:remove')") + @Log(title = "生产领料单头", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{issueIds}") + public AjaxResult remove(@PathVariable Long[] issueIds) + { + for (long issueId:issueIds + ) { + WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(header.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmIssueLineService.deleteByIssueHeaderId(issueId); + } + + return toAjax(wmIssueHeaderService.deleteWmIssueHeaderByIssueIds(issueIds)); + } + + /** + * 执行出库 + * @return + */ + @ApiOperation("执行生产领出接口") + @PreAuthorize("@ss.hasPermi('mes:wm:issueheader:edit')") + @Log(title = "生产领料单头", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{issueId}") + public AjaxResult execute(@PathVariable Long issueId){ + + WmIssueHeader header = wmIssueHeaderService.selectWmIssueHeaderByIssueId(issueId); + + //单据有效性 + if(!StringUtils.isNotNull(header)){ + return AjaxResult.error("无效单据"); + } + + //先检查单据状态 + if(UserConstants.ORDER_STATUS_FINISHED.equals(header.getStatus())){ + return AjaxResult.error("当前单据已提交!"); + } + + //检查行数量 + WmIssueLine param = new WmIssueLine(); + param.setIssueId(issueId); + List lines = wmIssueLineService.selectWmIssueLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请指定领出的物资"); + } + + List beans = wmIssueHeaderService.getTxBeans(issueId); + + //调用库存核心 + storageCoreService.processIssue(beans); + + //更新单据状态 + header.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmIssueHeaderService.updateWmIssueHeader(header); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmItemRecptLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmItemRecptLineMobController.java new file mode 100644 index 0000000..0531e81 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmItemRecptLineMobController.java @@ -0,0 +1,170 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmItemRecptLine; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmItemRecptLineService; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("采购入库明细") +@RestController +@RequestMapping("/mobile/wm/itemrecptline") +public class WmItemRecptLineMobController extends BaseController { + + @Autowired + private IWmItemRecptLineService wmItemRecptLineService; + + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询物料入库单行列表 + */ + @ApiOperation("查询采购入库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmItemRecptLine wmItemRecptLine) + { + startPage(); + List list = wmItemRecptLineService.selectWmItemRecptLineList(wmItemRecptLine); + return getDataTable(list); + } + + /** + * 获取物料入库单行详细信息 + */ + @ApiOperation("查看采购入库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmItemRecptLineService.selectWmItemRecptLineByLineId(lineId)); + } + + /** + * 新增物料入库单行 + */ + @ApiOperation("新增采购入库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:add')") + @Log(title = "物料入库单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmItemRecptLine wmItemRecptLine) + { + if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecptLine.getWarehouseId()); + wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName()); + }else if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseCode())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(wmItemRecptLine.getWarehouseCode()); + wmItemRecptLine.setWarehouseId(warehouse.getWarehouseId()); + wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + + if(StringUtils.isNotNull(wmItemRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecptLine.getLocationId()); + wmItemRecptLine.setLocationCode(location.getLocationCode()); + wmItemRecptLine.setLocationName(location.getLocationName()); + } else if(StringUtils.isNotNull(wmItemRecptLine.getLocationCode())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationCode(wmItemRecptLine.getLocationCode()); + wmItemRecptLine.setLocationId(location.getLocationId()); + wmItemRecptLine.setLocationCode(location.getLocationCode()); + wmItemRecptLine.setLocationName(location.getLocationName()); + } + + if(StringUtils.isNotNull(wmItemRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecptLine.getAreaId()); + wmItemRecptLine.setAreaCode(area.getAreaCode()); + wmItemRecptLine.setAreaName(area.getAreaName()); + } else if(StringUtils.isNotNull(wmItemRecptLine.getAreaCode())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaCode(wmItemRecptLine.getAreaCode()); + wmItemRecptLine.setAreaId(area.getAreaId()); + wmItemRecptLine.setAreaCode(area.getAreaCode()); + wmItemRecptLine.setAreaName(area.getAreaName()); + } + wmItemRecptLine.setCreateBy(getUsername()); + wmItemRecptLineService.insertWmItemRecptLine(wmItemRecptLine); + return AjaxResult.success(wmItemRecptLine); + } + + /** + * 修改物料入库单行 + */ + @ApiOperation("修改采购入库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmItemRecptLine wmItemRecptLine) + { + if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecptLine.getWarehouseId()); + wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName()); + }else if(StringUtils.isNotNull(wmItemRecptLine.getWarehouseCode())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(wmItemRecptLine.getWarehouseCode()); + wmItemRecptLine.setWarehouseId(warehouse.getWarehouseId()); + wmItemRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + + if(StringUtils.isNotNull(wmItemRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecptLine.getLocationId()); + wmItemRecptLine.setLocationCode(location.getLocationCode()); + wmItemRecptLine.setLocationName(location.getLocationName()); + } else if(StringUtils.isNotNull(wmItemRecptLine.getLocationCode())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationCode(wmItemRecptLine.getLocationCode()); + wmItemRecptLine.setLocationId(location.getLocationId()); + wmItemRecptLine.setLocationCode(location.getLocationCode()); + wmItemRecptLine.setLocationName(location.getLocationName()); + } + + if(StringUtils.isNotNull(wmItemRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecptLine.getAreaId()); + wmItemRecptLine.setAreaCode(area.getAreaCode()); + wmItemRecptLine.setAreaName(area.getAreaName()); + } else if(StringUtils.isNotNull(wmItemRecptLine.getAreaCode())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaCode(wmItemRecptLine.getAreaCode()); + wmItemRecptLine.setAreaId(area.getAreaId()); + wmItemRecptLine.setAreaCode(area.getAreaCode()); + wmItemRecptLine.setAreaName(area.getAreaName()); + } + return toAjax(wmItemRecptLineService.updateWmItemRecptLine(wmItemRecptLine)); + } + + + /** + * 删除物料入库单行 + */ + @ApiOperation("删除采购入库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:remove')") + @Log(title = "物料入库单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmItemRecptLineService.deleteWmItemRecptLineByLineIds(lineIds)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmItemRecptMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmItemRecptMobController.java new file mode 100644 index 0000000..cc31aa5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmItemRecptMobController.java @@ -0,0 +1,195 @@ +package com.ktg.mes.wm.controller.mobile; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.ItemRecptTxBean; +import com.ktg.mes.wm.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("采购入库") +@RestController +@RequestMapping("/mobile/wm/itemrecpt") +public class WmItemRecptMobController extends BaseController { + + @Autowired + private IWmItemRecptService wmItemRecptService; + + @Autowired + private IWmItemRecptLineService wmItemRecptLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 新增物料入库单 + */ + @ApiOperation("新增采购入库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:add')") + @Log(title = "物料入库单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmItemRecpt wmItemRecpt) + { + if(StringUtils.isNotNull(wmItemRecpt.getRecptCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmItemRecptService.checkRecptCodeUnique(wmItemRecpt))){ + return AjaxResult.error("单据编号已存在!"); + } + }else { + wmItemRecpt.setRecptCode(autoCodeUtil.genSerialCode(UserConstants.ITEMRECPT_CODE,"")); + } + + + if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId()); + wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId()); + wmItemRecpt.setLocationCode(location.getLocationCode()); + wmItemRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId()); + wmItemRecpt.setAreaCode(area.getAreaCode()); + wmItemRecpt.setAreaName(area.getAreaName()); + } + wmItemRecpt.setCreateBy(getUsername()); + wmItemRecptService.insertWmItemRecpt(wmItemRecpt); + return AjaxResult.success(wmItemRecpt); + } + + /** + * 修改物料入库单 + */ + @ApiOperation("修改采购入库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmItemRecpt wmItemRecpt) + { + if(StringUtils.isNotNull(wmItemRecpt.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmItemRecpt.getWarehouseId()); + wmItemRecpt.setWarehouseCode(warehouse.getWarehouseCode()); + wmItemRecpt.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmItemRecpt.getLocationId()); + wmItemRecpt.setLocationCode(location.getLocationCode()); + wmItemRecpt.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmItemRecpt.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmItemRecpt.getAreaId()); + wmItemRecpt.setAreaCode(area.getAreaCode()); + wmItemRecpt.setAreaName(area.getAreaName()); + } + return toAjax(wmItemRecptService.updateWmItemRecpt(wmItemRecpt)); + } + + /** + * 获取物料入库单详细信息 + */ + @ApiOperation("获取物料入库单详细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:query')") + @GetMapping(value = "/{recptId}") + public AjaxResult getInfo(@PathVariable("recptId") Long recptId) + { + return AjaxResult.success(wmItemRecptService.selectWmItemRecptByRecptId(recptId)); + } + + + /** + * 删除物料入库单 + */ + @ApiOperation("删除采购入库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:remove')") + @Log(title = "物料入库单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recptIds}") + public AjaxResult remove(@PathVariable Long[] recptIds) + { + for (Long id: + recptIds + ) { + WmItemRecpt itemRecpt = wmItemRecptService.selectWmItemRecptByRecptId(id); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(itemRecpt.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmItemRecptLineService.deleteByRecptId(id); + } + + return toAjax(wmItemRecptService.deleteWmItemRecptByRecptIds(recptIds)); + } + + /** + * 执行入库 + * @return + */ + @ApiOperation("执行入库接口") + @PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')") + @Log(title = "物料入库单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{recptId}") + public AjaxResult execute(@PathVariable Long recptId){ + + WmItemRecpt recpt = wmItemRecptService.selectWmItemRecptByRecptId(recptId); + + //单据有效性 + if(!StringUtils.isNotNull(recpt)){ + return AjaxResult.error("无效单据"); + } + + //先检查单据状态 + if(UserConstants.ORDER_STATUS_FINISHED.equals(recpt.getStatus())){ + return AjaxResult.error("当前单据已提交!"); + } + + //检查行数量 + WmItemRecptLine param = new WmItemRecptLine(); + param.setRecptId(recptId); + List lines = wmItemRecptLineService.selectWmItemRecptLineList(param); + if(CollectionUtil.isEmpty(lines)){ + return AjaxResult.error("请添加明细信息!"); + } + + //构造Transaction事务,并执行库存更新逻辑 + List beans = wmItemRecptService.getTxBeans(recptId); + + //调用库存核心 + storageCoreService.processItemRecpt(beans); + + //更新单据状态 + recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmItemRecptService.updateWmItemRecpt(recpt); + + return AjaxResult.success(); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmMaterialStockMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmMaterialStockMobController.java new file mode 100644 index 0000000..0ceab0a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmMaterialStockMobController.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.mes.wm.domain.WmMaterialStock; +import com.ktg.mes.wm.service.IWmMaterialStockService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("库存现有量查询") +@RestController +@RequestMapping("/mobile/wm/wmstock") +public class WmMaterialStockMobController extends BaseController { + @Autowired + private IWmMaterialStockService wmMaterialStockService; + + /** + * 查询库存记录列表 + */ + @ApiOperation("查询库存现有量") + @GetMapping("/list") + public TableDataInfo list(WmMaterialStock wmMaterialStock) + { + startPage(); + List list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock); + return getDataTable(list); + } + + /** + * 获取库存记录详细信息 + */ + @ApiOperation("查询库存现有量明细") + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:query')") + @GetMapping(value = "/{materialStockId}") + public AjaxResult getInfo(@PathVariable("materialStockId") Long materialStockId) + { + return AjaxResult.success(wmMaterialStockService.selectWmMaterialStockByMaterialStockId(materialStockId)); + } + + /** + * 查询库存记录列表 + */ + @ApiOperation("查询库存现有量") + @PreAuthorize("@ss.hasPermi('mes:wm:wmstock:list')") + @GetMapping("/query") + public TableDataInfo query(WmMaterialStock wmMaterialStock) + { + startPage(); + List list = wmMaterialStockService.queryWmMaterialStockList(wmMaterialStock); + return getDataTable(list); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmPackageLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmPackageLineMobController.java new file mode 100644 index 0000000..d0a3fda --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmPackageLineMobController.java @@ -0,0 +1,87 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmPackageLine; +import com.ktg.mes.wm.service.IWmPackageLineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("装箱单明细") +@RestController +@RequestMapping("/mobile/wm/packageline") +public class WmPackageLineMobController extends BaseController { + @Autowired + private IWmPackageLineService wmPackageLineService; + + /** + * 查询装箱明细列表 + */ + @ApiOperation("查询装箱单明细信息列表接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:list')") + @GetMapping("/list") + public TableDataInfo list(WmPackageLine wmPackageLine) + { + startPage(); + List list = wmPackageLineService.selectWmPackageLineList(wmPackageLine); + return getDataTable(list); + } + + + /** + * 获取装箱明细详细信息 + */ + @ApiOperation("获取装箱单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmPackageLineService.selectWmPackageLineByLineId(lineId)); + } + + /** + * 新增装箱明细 + */ + @ApiOperation("新增装箱单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:add')") + @Log(title = "装箱明细", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmPackageLine wmPackageLine) + { + return toAjax(wmPackageLineService.insertWmPackageLine(wmPackageLine)); + } + + /** + * 修改装箱明细 + */ + @ApiOperation("修改装箱单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')") + @Log(title = "装箱明细", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmPackageLine wmPackageLine) + { + return toAjax(wmPackageLineService.updateWmPackageLine(wmPackageLine)); + } + + /** + * 删除装箱明细 + */ + @ApiOperation("删除装箱单明细") + @PreAuthorize("@ss.hasPermi('mes:wm:package:remove')") + @Log(title = "装箱明细", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmPackageLineService.deleteWmPackageLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmPackageMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmPackageMobController.java new file mode 100644 index 0000000..4fd88e2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmPackageMobController.java @@ -0,0 +1,156 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmBarcode; +import com.ktg.mes.wm.domain.WmPackage; +import com.ktg.mes.wm.service.IWmBarcodeService; +import com.ktg.mes.wm.service.IWmPackageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("装箱单") +@RestController +@RequestMapping("/mobile/wm/package") +public class WmPackageMobController extends BaseController { + @Autowired + private IWmPackageService wmPackageService; + + @Autowired + private IWmBarcodeService wmBarcodeService; + + /** + * 查询装箱单列表 + */ + @ApiOperation("装箱单清单查询接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:list')") + @GetMapping("/list") + public TableDataInfo list(WmPackage wmPackage) + { + startPage(); + List list = wmPackageService.selectWmPackageList(wmPackage); + return getDataTable(list); + } + + + /** + * 获取装箱单详细信息 + */ + @ApiOperation("获取装箱单详细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:query')") + @GetMapping(value = "/{packageId}") + public AjaxResult getInfo(@PathVariable("packageId") Long packageId) + { + return AjaxResult.success(wmPackageService.selectWmPackageByPackageId(packageId)); + } + + /** + * 新增装箱单 + */ + @ApiOperation("新增装箱单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:add')") + @Log(title = "装箱单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmPackage wmPackage) + { + if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){ + return AjaxResult.error("装箱单编号已存在!"); + } + if(wmPackage.getParentId() !=null){ + WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId()); + if(StringUtils.isNotNull(parentPackage)){ + wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId()); + } + } + + int ret =wmPackageService.insertWmPackage(wmPackage); + + //装箱单保存成功就自动生成对应的箱条码 + WmBarcode wmBarcode = new WmBarcode(); + wmBarcode.setBussinessId(wmPackage.getPackageId()); + wmBarcode.setBussinessCode(wmPackage.getPackageCode()); + wmBarcode.setBussinessName(wmPackage.getClientName()); + wmBarcode.setBarcodeType(UserConstants.BARCODE_TYPE_PACKAGE);//类型设置为箱条码 + wmBarcode.setBarcodeFormart(UserConstants.QR_CODE);//设置为二维码 + wmBarcode.setBarcodeContent(""+UserConstants.BARCODE_TYPE_PACKAGE+"-"+wmPackage.getPackageCode()); + String path =wmBarcodeService.generateBarcode(wmBarcode); + wmBarcode.setBarcodeUrl(path); + wmBarcode.setCreateBy(getUsername()); + wmBarcodeService.insertWmBarcode(wmBarcode); + + //将条码的URL更新上去 + wmPackage.setBarcodeId(wmBarcode.getBarcodeId()); + wmPackage.setBarcodeContent(wmBarcode.getBarcodeContent()); + wmPackage.setBarcodeUrl(path); + wmPackageService.updateWmPackage(wmPackage); + return AjaxResult.success(wmPackage); + } + + /** + * 修改装箱单 + */ + @ApiOperation("修改装箱单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')") + @Log(title = "装箱单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmPackage wmPackage) + { + if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){ + return AjaxResult.error("装箱单编号已存在!"); + } + return toAjax(wmPackageService.updateWmPackage(wmPackage)); + } + + /** + * 添加子箱 + */ + @ApiOperation("装箱单添加子箱接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:edit')") + @Log(title = "装箱单", businessType = BusinessType.UPDATE) + @PutMapping("/addsub") + public AjaxResult addSubPackage(@RequestBody WmPackage wmPackage){ + //不能添加自己 + if(wmPackage.getPackageId().longValue() == wmPackage.getParentId().longValue()){ + return AjaxResult.error("不能添加自己为子箱!"); + } + + //已经有父箱的不能再次添加 + WmPackage subPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getPackageId()); + if(!"0".equals(subPackage.getAncestors())){ + return AjaxResult.error("当前子箱已经有外箱包装!"); + } + + //更新当前子箱的父箱列表 + WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId()); + if(StringUtils.isNotNull(parentPackage)){ + wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId()); + } + + return toAjax(wmPackageService.updateWmPackage(wmPackage)); + } + + + /** + * 删除装箱单 + */ + @ApiOperation("删除装箱单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:package:remove')") + @Log(title = "装箱单", businessType = BusinessType.DELETE) + @DeleteMapping("/{packageIds}") + public AjaxResult remove(@PathVariable Long[] packageIds) + { + return toAjax(wmPackageService.deleteWmPackageByPackageIds(packageIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductRecptMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductRecptMobController.java new file mode 100644 index 0000000..a146b7a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductRecptMobController.java @@ -0,0 +1,183 @@ +package com.ktg.mes.wm.controller.mobile; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.ProductRecptTxBean; +import com.ktg.mes.wm.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +@Api("产品入库") +@RestController +@RequestMapping("/mobile/wm/productrecpt") +public class WmProductRecptMobController extends BaseController { + + @Autowired + private IWmProductRecptService wmProductRecptService; + + @Autowired + private IWmProductRecptLineService wmProductRecptLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询产品入库录列表 + */ + @ApiOperation("查询产品入库单清单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductRecpt wmProductRecpt) + { + startPage(); + List list = wmProductRecptService.selectWmProductRecptList(wmProductRecpt); + return getDataTable(list); + } + + + /** + * 获取产品入库录详细信息 + */ + @ApiOperation("获取产品入库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')") + @GetMapping(value = "/{recptId}") + public AjaxResult getInfo(@PathVariable("recptId") Long recptId) + { + return AjaxResult.success(wmProductRecptService.selectWmProductRecptByRecptId(recptId)); + } + + /** + * 新增产品入库记录 + */ + @ApiOperation("新增产品入库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')") + @Log(title = "产品入库记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductRecpt wmProductRecpt) + { + if(StringUtils.isNotNull(wmProductRecpt.getRecptCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){ + return AjaxResult.error("入库单编号已存在!"); + } + }else { + wmProductRecpt.setRecptCode(autoCodeUtil.genSerialCode(UserConstants.PRODUCTRECPT_CODE,"")); + } + + + if(StringUtils.isNotNull(wmProductRecpt.getWorkorderId())){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmProductRecpt.getWorkorderId()); + wmProductRecpt.setWorkorderCode(workorder.getWorkorderCode()); + wmProductRecpt.setWorkorderName(workorder.getWorkorderName()); + } + + wmProductRecpt.setCreateBy(getUsername()); + wmProductRecptService.insertWmProductRecpt(wmProductRecpt); + return AjaxResult.success(wmProductRecpt); + } + + /** + * 修改产品入库录 + */ + @ApiOperation("编辑产品入库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')") + @Log(title = "产品入库记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductRecpt wmProductRecpt) + { + if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){ + return AjaxResult.error("入库单编号已存在!"); + } + + if(StringUtils.isNotNull(wmProductRecpt.getWorkorderId())){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmProductRecpt.getWorkorderId()); + wmProductRecpt.setWorkorderCode(workorder.getWorkorderCode()); + wmProductRecpt.setWorkorderName(workorder.getWorkorderName()); + } + + return toAjax(wmProductRecptService.updateWmProductRecpt(wmProductRecpt)); + } + + /** + * 删除产品入库录 + */ + @ApiOperation("删除产品入库单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')") + @Log(title = "产品入库记录", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{recptIds}") + public AjaxResult remove(@PathVariable Long[] recptIds) + { + for (Long recptId: recptIds + ) { + WmProductRecpt recpt = wmProductRecptService.selectWmProductRecptByRecptId(recptId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(recpt.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + wmProductRecptLineService.deleteByRecptId(recptId); + } + return toAjax(wmProductRecptService.deleteWmProductRecptByRecptIds(recptIds)); + } + + /** + * 执行入库 + * @return + */ + @ApiOperation("产品入库单执行入库接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')") + @Log(title = "产品入库记录", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{recptId}") + public AjaxResult execute(@PathVariable Long recptId){ + WmProductRecpt recpt = wmProductRecptService.selectWmProductRecptByRecptId(recptId); + + //单据有效性 + if(!StringUtils.isNotNull(recpt)){ + return AjaxResult.error("无效单据"); + } + + //先检查单据状态 + if(UserConstants.ORDER_STATUS_FINISHED.equals(recpt.getStatus())){ + return AjaxResult.error("当前单据已提交!"); + } + + + WmProductRecptLine param = new WmProductRecptLine(); + param.setRecptId(recptId); + List lines = wmProductRecptLineService.selectWmProductRecptLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请添加要入库的产品"); + } + + List beans = wmProductRecptService.getTxBean(recptId); + storageCoreService.processProductRecpt(beans); + + recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmProductRecptService.updateWmProductRecpt(recpt); + + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductRectpLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductRectpLineMobController.java new file mode 100644 index 0000000..4c94528 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductRectpLineMobController.java @@ -0,0 +1,134 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmProductRecptLine; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmProductRecptLineService; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("产品入库明细") +@RestController +@RequestMapping("/mobile/wm/productrecptline") +public class WmProductRectpLineMobController extends BaseController { + + @Autowired + private IWmProductRecptLineService wmProductRecptLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 查询产品入库记录行列表 + */ + @ApiOperation("查询产品入库单明细清单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductRecptLine wmProductRecptLine) + { + startPage(); + List list = wmProductRecptLineService.selectWmProductRecptLineList(wmProductRecptLine); + return getDataTable(list); + } + + + /** + * 获取产品入库记录行详细信息 + */ + @ApiOperation("获取产品入库明细详情") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmProductRecptLineService.selectWmProductRecptLineByLineId(lineId)); + } + + /** + * 新增产品入库记录行 + */ + @ApiOperation("新增产品入库明细记录") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')") + @Log(title = "产品入库记录行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductRecptLine wmProductRecptLine) + { + if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId()); + wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId()); + wmProductRecptLine.setLocationCode(location.getLocationCode()); + wmProductRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId()); + wmProductRecptLine.setAreaCode(area.getAreaCode()); + wmProductRecptLine.setAreaName(area.getAreaName()); + } + wmProductRecptLine.setCreateBy(getUsername()); + wmProductRecptLineService.insertWmProductRecptLine(wmProductRecptLine); + return AjaxResult.success(wmProductRecptLine); + } + + /** + * 修改产品入库记录行 + */ + @ApiOperation("编辑产品入库明细记录") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')") + @Log(title = "产品入库记录行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductRecptLine wmProductRecptLine) + { + if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId()); + wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId()); + wmProductRecptLine.setLocationCode(location.getLocationCode()); + wmProductRecptLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId()); + wmProductRecptLine.setAreaCode(area.getAreaCode()); + wmProductRecptLine.setAreaName(area.getAreaName()); + } + return toAjax(wmProductRecptLineService.updateWmProductRecptLine(wmProductRecptLine)); + } + + /** + * 删除产品入库记录行 + */ + @ApiOperation("删除产品入库明细记录") + @PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')") + @Log(title = "产品入库记录行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmProductRecptLineService.deleteWmProductRecptLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductSalseLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductSalseLineMobController.java new file mode 100644 index 0000000..ccb9d80 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductSalseLineMobController.java @@ -0,0 +1,132 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmMaterialStock; +import com.ktg.mes.wm.domain.WmProductSalseLine; +import com.ktg.mes.wm.service.IWmMaterialStockService; +import com.ktg.mes.wm.service.IWmProductSalseLineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("产品销售出库明细") +@RestController +@RequestMapping("/mobile/wm/productsalseline") +public class WmProductSalseLineMobController extends BaseController { + @Autowired + private IWmProductSalseLineService wmProductSalseLineService; + + @Autowired + private IWmMaterialStockService wmMaterialStockService; + + /** + * + * 查询产品销售出库行列表 + */ + @ApiOperation("查询销售出库行列表接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductSalseLine wmProductSalseLine) + { + startPage(); + List list = wmProductSalseLineService.selectWmProductSalseLineList(wmProductSalseLine); + return getDataTable(list); + } + + + /** + * 获取产品销售出库行详细信息 + */ + @ApiOperation("获取销售出库行信息明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmProductSalseLineService.selectWmProductSalseLineByLineId(lineId)); + } + + /** + * 新增产品销售出库行 + */ + @ApiOperation("新增销售出库信息明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')") + @Log(title = "产品销售出库行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductSalseLine wmProductSalseLine) + { + if(StringUtils.isNotNull(wmProductSalseLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmProductSalseLine.getMaterialStockId()); + wmProductSalseLine.setItemId(stock.getItemId()); + wmProductSalseLine.setItemCode(stock.getItemCode()); + wmProductSalseLine.setItemName(stock.getItemName()); + wmProductSalseLine.setSpecification(stock.getSpecification()); + wmProductSalseLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmProductSalseLine.setBatchCode(stock.getBatchCode()); + wmProductSalseLine.setWarehouseId(stock.getWarehouseId()); + wmProductSalseLine.setWarehouseCode(stock.getWarehouseCode()); + wmProductSalseLine.setWarehouseName(stock.getWarehouseName()); + wmProductSalseLine.setLocationId(stock.getLocationId()); + wmProductSalseLine.setLocationCode(stock.getLocationCode()); + wmProductSalseLine.setLocationName(stock.getLocationName()); + wmProductSalseLine.setAreaId(stock.getAreaId()); + wmProductSalseLine.setAreaCode(stock.getAreaCode()); + wmProductSalseLine.setAreaName(stock.getAreaName()); + } + + wmProductSalseLine.setCreateBy(getUsername()); + wmProductSalseLineService.insertWmProductSalseLine(wmProductSalseLine); + return AjaxResult.success(wmProductSalseLine); + } + + /** + * 修改产品销售出库行 + */ + @ApiOperation("编辑销售出库明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')") + @Log(title = "产品销售出库行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductSalseLine wmProductSalseLine) + { + if(StringUtils.isNotNull(wmProductSalseLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmProductSalseLine.getMaterialStockId()); + wmProductSalseLine.setItemId(stock.getItemId()); + wmProductSalseLine.setItemCode(stock.getItemCode()); + wmProductSalseLine.setItemName(stock.getItemName()); + wmProductSalseLine.setSpecification(stock.getSpecification()); + wmProductSalseLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmProductSalseLine.setBatchCode(stock.getBatchCode()); + wmProductSalseLine.setWarehouseId(stock.getWarehouseId()); + wmProductSalseLine.setWarehouseCode(stock.getWarehouseCode()); + wmProductSalseLine.setWarehouseName(stock.getWarehouseName()); + wmProductSalseLine.setLocationId(stock.getLocationId()); + wmProductSalseLine.setLocationCode(stock.getLocationCode()); + wmProductSalseLine.setLocationName(stock.getLocationName()); + wmProductSalseLine.setAreaId(stock.getAreaId()); + wmProductSalseLine.setAreaCode(stock.getAreaCode()); + wmProductSalseLine.setAreaName(stock.getAreaName()); + } + + return toAjax(wmProductSalseLineService.updateWmProductSalseLine(wmProductSalseLine)); + } + + /** + * 删除产品销售出库行 + */ + @ApiOperation("删除销售出库明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')") + @Log(title = "产品销售出库行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmProductSalseLineService.deleteWmProductSalseLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductSalseMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductSalseMobController.java new file mode 100644 index 0000000..544a941 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmProductSalseMobController.java @@ -0,0 +1,181 @@ +package com.ktg.mes.wm.controller.mobile; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.MdClient; +import com.ktg.mes.md.service.IMdClientService; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.ProductSalseTxBean; +import com.ktg.mes.wm.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("产品销售出库") +@RestController +@RequestMapping("/mobile/wm/productsalse") +public class WmProductSalseMobController extends BaseController { + @Autowired + private IWmProductSalseService wmProductSalseService; + + @Autowired + private IWmProductSalseLineService wmProductSalseLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IMdClientService mdClientService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询销售出库单列表 + */ + @ApiOperation("查询销售出库单清单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmProductSalse wmProductSalse) + { + startPage(); + List list = wmProductSalseService.selectWmProductSalseList(wmProductSalse); + return getDataTable(list); + } + + + /** + * 获取销售出库单详细信息 + */ + @ApiOperation("获取销售出库单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')") + @GetMapping(value = "/{salseId}") + public AjaxResult getInfo(@PathVariable("salseId") Long salseId) + { + return AjaxResult.success(wmProductSalseService.selectWmProductSalseBySalseId(salseId)); + } + + /** + * 新增销售出库单 + */ + @ApiOperation("新增销售出库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')") + @Log(title = "销售出库单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmProductSalse wmProductSalse) + { + if(StringUtils.isNotNull(wmProductSalse.getSalseCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){ + return AjaxResult.error("出库单编号已存在!"); + } + }else { + wmProductSalse.setSalseCode(autoCodeUtil.genSerialCode(UserConstants.PRODUCTSALSE_CODE,"")); + } + + if(StringUtils.isNotNull(wmProductSalse.getClientId())){ + MdClient client = mdClientService.selectMdClientByClientId(wmProductSalse.getClientId()); + wmProductSalse.setClientCode(client.getClientCode()); + wmProductSalse.setClientName(client.getClientName()); + wmProductSalse.setClientNick(client.getClientNick()); + } + + wmProductSalse.setCreateBy(getUsername()); + wmProductSalseService.insertWmProductSalse(wmProductSalse); + return AjaxResult.success(wmProductSalse); + } + + /** + * 修改销售出库单 + */ + @ApiOperation("编辑销售出库单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')") + @Log(title = "销售出库单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmProductSalse wmProductSalse) + { + if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){ + return AjaxResult.error("出库单编号已存在!"); + } + + if(StringUtils.isNotNull(wmProductSalse.getClientId())){ + MdClient client = mdClientService.selectMdClientByClientId(wmProductSalse.getClientId()); + wmProductSalse.setClientCode(client.getClientCode()); + wmProductSalse.setClientName(client.getClientName()); + wmProductSalse.setClientNick(client.getClientNick()); + } + + return toAjax(wmProductSalseService.updateWmProductSalse(wmProductSalse)); + } + + /** + * 删除销售出库单 + */ + @ApiOperation("删除销售出库单信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')") + @Log(title = "销售出库单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{salseIds}") + public AjaxResult remove(@PathVariable Long[] salseIds) + { + for (Long salseId: salseIds + ) { + WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(salse.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmProductSalseLineService.deleteBySalseId(salseId); + } + return toAjax(wmProductSalseService.deleteWmProductSalseBySalseIds(salseIds)); + } + + /** + * 执行出库 + * @return + */ + @ApiOperation("执行销售出库接口") + @PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')") + @Log(title = "销售出库单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{salseId}") + public AjaxResult execute(@PathVariable Long salseId){ + WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId); + + WmProductSalseLine param = new WmProductSalseLine(); + param.setSalseId(salseId); + List lines = wmProductSalseLineService.selectWmProductSalseLineList(param); + if(CollectionUtil.isEmpty(lines)){ + return AjaxResult.error("出库物资不能为空"); + } + + List beans = wmProductSalseService.getTxBeans(salseId); + storageCoreService.processProductSalse(beans); + + salse.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmProductSalseService.updateWmProductSalse(salse); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtIssueLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtIssueLineMobController.java new file mode 100644 index 0000000..a9db00a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtIssueLineMobController.java @@ -0,0 +1,147 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.service.*; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("生产退料") +@RestController +@RequestMapping("/mobile/wm/rtissueline") +public class WmRtIssueLineMobController extends BaseController { + + @Autowired + private IWmRtIssueLineService wmRtIssueLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IWmMaterialStockService wmMaterialStockService; + + /** + * 查询生产退料单行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtIssueLine wmRtIssueLine) + { + startPage(); + List list = wmRtIssueLineService.selectWmRtIssueLineList(wmRtIssueLine); + return getDataTable(list); + } + + + /** + * 获取生产退料单行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtIssueLineService.selectWmRtIssueLineByLineId(lineId)); + } + + /** + * 新增生产退料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')") + @Log(title = "生产退料单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtIssueLine wmRtIssueLine) + { + if(StringUtils.isNotNull(wmRtIssueLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmRtIssueLine.getMaterialStockId()); + wmRtIssueLine.setItemId(stock.getItemId()); + wmRtIssueLine.setItemCode(stock.getItemCode()); + wmRtIssueLine.setItemName(stock.getItemName()); + wmRtIssueLine.setSpecification(stock.getSpecification()); + wmRtIssueLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmRtIssueLine.setBatchCode(stock.getBatchCode()); + } + + if(StringUtils.isNotNull(wmRtIssueLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssueLine.getWarehouseId()); + wmRtIssueLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtIssueLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssueLine.getLocationId()); + wmRtIssueLine.setLocationCode(location.getLocationCode()); + wmRtIssueLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssueLine.getAreaId()); + wmRtIssueLine.setAreaCode(area.getAreaCode()); + wmRtIssueLine.setAreaName(area.getAreaName()); + } + wmRtIssueLine.setCreateBy(getUsername()); + wmRtIssueLineService.insertWmRtIssueLine(wmRtIssueLine); + return AjaxResult.success(wmRtIssueLine); + } + + /** + * 修改生产退料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtIssueLine wmRtIssueLine) + { + if(StringUtils.isNotNull(wmRtIssueLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmRtIssueLine.getMaterialStockId()); + wmRtIssueLine.setItemId(stock.getItemId()); + wmRtIssueLine.setItemCode(stock.getItemCode()); + wmRtIssueLine.setItemName(stock.getItemName()); + wmRtIssueLine.setSpecification(stock.getSpecification()); + wmRtIssueLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmRtIssueLine.setBatchCode(stock.getBatchCode()); + } + + if(StringUtils.isNotNull(wmRtIssueLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtIssueLine.getWarehouseId()); + wmRtIssueLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtIssueLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtIssueLine.getLocationId()); + wmRtIssueLine.setLocationCode(location.getLocationCode()); + wmRtIssueLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtIssueLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtIssueLine.getAreaId()); + wmRtIssueLine.setAreaCode(area.getAreaCode()); + wmRtIssueLine.setAreaName(area.getAreaName()); + } + return toAjax(wmRtIssueLineService.updateWmRtIssueLine(wmRtIssueLine)); + } + + /** + * 删除生产退料单行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')") + @Log(title = "生产退料单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtIssueLineService.deleteWmRtIssueLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtIssueMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtIssueMobController.java new file mode 100644 index 0000000..50f388f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtIssueMobController.java @@ -0,0 +1,186 @@ +package com.ktg.mes.wm.controller.mobile; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.service.IProWorkorderService; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.RtIssueTxBean; +import com.ktg.mes.wm.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("生产退料") +@RestController +@RequestMapping("/mobile/wm/rtissue") +public class WmRtIssueMobController extends BaseController { + + @Autowired + private IWmRtIssueService wmRtIssueService; + + @Autowired + private IWmRtIssueLineService wmRtIssueLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IProWorkorderService proWorkorderService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询生产退料单头列表 + */ + @ApiOperation("查询生产退料单清单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtIssue wmRtIssue) + { + startPage(); + List list = wmRtIssueService.selectWmRtIssueList(wmRtIssue); + return getDataTable(list); + } + + + /** + * 获取生产退料单头详细信息 + */ + @ApiOperation("获取生产退料单详情接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtIssueService.selectWmRtIssueByRtId(rtId)); + } + + /** + * 新增生产退料单头 + */ + @ApiOperation("新增生产退料单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')") + @Log(title = "生产退料单头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtIssue wmRtIssue) + { + if(StringUtils.isNotNull(wmRtIssue.getRtCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){ + return AjaxResult.error("退料单编号已存在"); + } + }else { + wmRtIssue.setRtCode(autoCodeUtil.genSerialCode(UserConstants.RTISSUE_CODE,"")); + } + + + if(StringUtils.isNotNull(wmRtIssue.getWorkorderId())){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmRtIssue.getWorkorderId()); + wmRtIssue.setWorkorderCode(workorder.getWorkorderCode()); + } + + wmRtIssue.setCreateBy(getUsername()); + wmRtIssueService.insertWmRtIssue(wmRtIssue); + return AjaxResult.success(wmRtIssue); + } + + /** + * 修改生产退料单头 + */ + @ApiOperation("修改生产退料单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtIssue wmRtIssue) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){ + return AjaxResult.error("退料单编号已存在"); + } + + if(StringUtils.isNotNull(wmRtIssue.getWorkorderId())){ + ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmRtIssue.getWorkorderId()); + wmRtIssue.setWorkorderCode(workorder.getWorkorderCode()); + } + + return toAjax(wmRtIssueService.updateWmRtIssue(wmRtIssue)); + } + + /** + * 删除生产退料单头 + */ + @ApiOperation("删除生产退料单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')") + @Log(title = "生产退料单头", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + for (Long rtId: rtIds + ) { + WmRtIssue header = wmRtIssueService.selectWmRtIssueByRtId(rtId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(header.getStatus())){ + return AjaxResult.error("只能删除草稿状态的单据!"); + } + + wmRtIssueLineService.deleteByRtId(rtId); + } + return toAjax(wmRtIssueService.deleteWmRtIssueByRtIds(rtIds)); + } + + /** + * 执行退料 + * @param rtId + * @return + */ + @ApiOperation("执行生产退料接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单头", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + WmRtIssue rtIssue = wmRtIssueService.selectWmRtIssueByRtId(rtId); + + //单据有效性 + if(!StringUtils.isNotNull(rtIssue)){ + return AjaxResult.error("无效单据"); + } + + //先检查单据状态 + if(UserConstants.ORDER_STATUS_FINISHED.equals(rtIssue.getStatus())){ + return AjaxResult.error("当前单据已提交!"); + } + + //检查行信息 + WmRtIssueLine param = new WmRtIssueLine(); + param.setRtId(rtId); + List lines = wmRtIssueLineService.selectWmRtIssueLineList(param); + if(CollUtil.isEmpty(lines)){ + return AjaxResult.error("请选择要退料的物资"); + } + + List beans = wmRtIssueService.getTxBeans(rtId); + + //执行生产退料 + storageCoreService.processRtIssue(beans); + + + rtIssue.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtIssueService.updateWmRtIssue(rtIssue); + return AjaxResult.success(); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtSalseLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtSalseLineMobController.java new file mode 100644 index 0000000..92a0927 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtSalseLineMobController.java @@ -0,0 +1,157 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.service.IMdItemService; +import com.ktg.mes.wm.domain.WmRtSalseLine; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmRtSalseLineService; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.poi.hssf.record.pivottable.PageItemRecord; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("销售退货明细") +@RestController +@RequestMapping("/mobile/wm/rtsalseline") +public class WmRtSalseLineMobController extends BaseController { + + @Autowired + private IWmRtSalseLineService wmRtSalseLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IMdItemService mdItemService; + + /** + * 查询产品销售退货行列表 + */ + @ApiOperation("查询销售退货单明细列表接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtSalseLine wmRtSalseLine) + { + startPage(); + List list = wmRtSalseLineService.selectWmRtSalseLineList(wmRtSalseLine); + return getDataTable(list); + } + + + /** + * 获取产品销售退货行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtSalseLineService.selectWmRtSalseLineByLineId(lineId)); + } + + /** + * 新增产品销售退货行 + */ + @ApiOperation("新增销售退货单明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')") + @Log(title = "产品销售退货行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtSalseLine wmRtSalseLine) + { + if(StringUtils.isNotNull(wmRtSalseLine.getItemId())){ + MdItem item = mdItemService.selectMdItemById(wmRtSalseLine.getItemId()); + wmRtSalseLine.setItemCode(item.getItemCode()); + wmRtSalseLine.setItemName(item.getItemName()); + wmRtSalseLine.setSpecification(item.getSpecification()); + wmRtSalseLine.setUnitOfMeasure(item.getUnitOfMeasure()); + } + + if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId()); + wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId()); + wmRtSalseLine.setLocationCode(location.getLocationCode()); + wmRtSalseLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId()); + wmRtSalseLine.setAreaCode(area.getAreaCode()); + wmRtSalseLine.setAreaName(area.getAreaName()); + } + wmRtSalseLine.setCreateBy(getUsername()); + return toAjax(wmRtSalseLineService.insertWmRtSalseLine(wmRtSalseLine)); + } + + /** + * 修改产品销售退货行 + */ + @ApiOperation("编辑销售退货单明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')") + @Log(title = "产品销售退货行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtSalseLine wmRtSalseLine) + { + if(StringUtils.isNotNull(wmRtSalseLine.getItemId())){ + MdItem item = mdItemService.selectMdItemById(wmRtSalseLine.getItemId()); + wmRtSalseLine.setItemCode(item.getItemCode()); + wmRtSalseLine.setItemName(item.getItemName()); + wmRtSalseLine.setSpecification(item.getSpecification()); + wmRtSalseLine.setUnitOfMeasure(item.getUnitOfMeasure()); + } + + if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId()); + wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode()); + wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId()); + wmRtSalseLine.setLocationCode(location.getLocationCode()); + wmRtSalseLine.setLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId()); + wmRtSalseLine.setAreaCode(area.getAreaCode()); + wmRtSalseLine.setAreaName(area.getAreaName()); + } + return toAjax(wmRtSalseLineService.updateWmRtSalseLine(wmRtSalseLine)); + } + + /** + * 删除产品销售退货行 + */ + @ApiOperation("删除销售退货单明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')") + @Log(title = "产品销售退货行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtSalseLineService.deleteWmRtSalseLineByLineIds(lineIds)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtSalseMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtSalseMobController.java new file mode 100644 index 0000000..60cacc7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtSalseMobController.java @@ -0,0 +1,175 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.MdClient; +import com.ktg.mes.md.service.IMdClientService; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; +import com.ktg.mes.wm.service.*; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("销售退货") +@RestController +@RequestMapping("/mobile/wm/rtsalse") +public class WmRtSalseMobController extends BaseController { + + @Autowired + private IWmRtSalseService wmRtSalseService; + + @Autowired + private IWmRtSalseLineService wmRtSalseLineService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IMdClientService mdClientService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询产品销售退货单列表 + */ + @ApiOperation("查询销售退货单列表接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtSalse wmRtSalse) + { + startPage(); + List list = wmRtSalseService.selectWmRtSalseList(wmRtSalse); + return getDataTable(list); + } + + + /** + * 获取产品销售退货单详细信息 + */ + @ApiOperation("获取销售退货单详细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtSalseService.selectWmRtSalseByRtId(rtId)); + } + + /** + * 新增产品销售退货单 + */ + @ApiOperation("新增销售退货单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')") + @Log(title = "产品销售退货单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtSalse wmRtSalse) + { + if(StringUtils.isNotNull(wmRtSalse.getRtCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){ + return AjaxResult.error("退货单号已存在!"); + } + }else { + wmRtSalse.setRtCode(autoCodeUtil.genSerialCode(UserConstants.RTSALSE_CODE,"")); + } + + if(StringUtils.isNotNull(wmRtSalse.getClientId())){ + MdClient client = mdClientService.selectMdClientByClientId(wmRtSalse.getClientId()); + wmRtSalse.setClientCode(client.getClientCode()); + wmRtSalse.setClientName(client.getClientName()); + wmRtSalse.setClientNick(client.getClientNick()); + } + + wmRtSalse.setCreateBy(getUsername()); + wmRtSalseService.insertWmRtSalse(wmRtSalse); + return AjaxResult.success(wmRtSalse); + } + + /** + * 修改产品销售退货单 + */ + @ApiOperation("编辑销售退货单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')") + @Log(title = "产品销售退货单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtSalse wmRtSalse) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){ + return AjaxResult.error("退货单号已存在!"); + } + + if(StringUtils.isNotNull(wmRtSalse.getClientId())){ + MdClient client = mdClientService.selectMdClientByClientId(wmRtSalse.getClientId()); + wmRtSalse.setClientCode(client.getClientCode()); + wmRtSalse.setClientName(client.getClientName()); + wmRtSalse.setClientNick(client.getClientNick()); + } + + return toAjax(wmRtSalseService.updateWmRtSalse(wmRtSalse)); + } + + /** + * 删除产品销售退货单 + */ + @ApiOperation("删除销售退货单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')") + @Log(title = "产品销售退货单", businessType = BusinessType.DELETE) + @Transactional + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + for (Long rtId: rtIds + ) { + WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(rtSalse.getStatus())){ + return AjaxResult.error("只能删除草稿状态单据"); + } + + wmRtSalseLineService.deleteByRtId(rtId); + } + + return toAjax(wmRtSalseService.deleteWmRtSalseByRtIds(rtIds)); + } + + /** + * 执行退货 + * @param rtId + * @return + */ + @ApiOperation("执行销售退货接口") + @PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')") + @Log(title = "产品销售退货单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId); + WmRtSalseLine param = new WmRtSalseLine(); + param.setRtId(rtId); + List lines = wmRtSalseLineService.selectWmRtSalseLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("请添加退货单行信息!"); + } + + List beans = wmRtSalseService.getTxBeans(rtId); + + storageCoreService.processRtSalse(beans); + + rtSalse.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtSalseService.updateWmRtSalse(rtSalse); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java new file mode 100644 index 0000000..337aa03 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java @@ -0,0 +1,81 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmRtVendorLine; +import com.ktg.mes.wm.service.IWmRtVendorLineService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("退回供应商行信息") +@RestController +@RequestMapping("/mobile/wm/rtvendorline") +public class WmRtVendorLineMobController extends BaseController { + + @Autowired + private IWmRtVendorLineService wmRtVendorLineService; + + /** + * 查询供应商退货行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendorLine wmRtVendorLine) + { + startPage(); + List list = wmRtVendorLineService.selectWmRtVendorLineList(wmRtVendorLine); + return getDataTable(list); + } + + /** + * 获取供应商退货行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtVendorLineService.selectWmRtVendorLineByLineId(lineId)); + } + + /** + * 新增供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')") + @Log(title = "供应商退货行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtVendorLine wmRtVendorLine) + { + wmRtVendorLine.setCreateBy(getUsername()); + return toAjax(wmRtVendorLineService.insertWmRtVendorLine(wmRtVendorLine)); + } + + /** + * 修改供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtVendorLine wmRtVendorLine) + { + return toAjax(wmRtVendorLineService.updateWmRtVendorLine(wmRtVendorLine)); + } + + /** + * 删除供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:remove')") + @Log(title = "供应商退货行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtVendorLineService.deleteWmRtVendorLineByLineIds(lineIds)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java new file mode 100644 index 0000000..b5ea772 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java @@ -0,0 +1,145 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.service.IMdVendorService; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.domain.tx.RtVendorTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmRtVendorService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("退回供应商") +@RestController +@RequestMapping("/mobile/wm/rtvendor") +public class WmRtVendorMobController extends BaseController { + + @Autowired + private IWmRtVendorService wmRtVendorService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IMdVendorService mdVendorService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询供应商退货列表 + */ + @ApiOperation("查询采购退货单据清单") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendor wmRtVendor) + { + startPage(); + List list = wmRtVendorService.selectWmRtVendorList(wmRtVendor); + return getDataTable(list); + } + + /** + * 获取供应商退货详细信息 + */ + @ApiOperation("查询采购退货单据明细") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtVendorService.selectWmRtVendorByRtId(rtId)); + } + + /** + * 新增供应商退货 + */ + @ApiOperation("新增采购退货单") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')") + @Log(title = "供应商退货", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtVendor wmRtVendor) + { + if(StringUtils.isNotNull(wmRtVendor.getRtCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){ + return AjaxResult.error("退货单编号已经存在!"); + } + }else { + wmRtVendor.setRtCode(autoCodeUtil.genSerialCode(UserConstants.WM_RTVENDOR_CODE,"")); + } + + if(StringUtils.isNotNull(wmRtVendor.getVendorId())){ + MdVendor vendor = mdVendorService.selectMdVendorByVendorId(wmRtVendor.getVendorId()); + wmRtVendor.setVendorCode(vendor.getVendorCode()); + wmRtVendor.setVendorName(vendor.getVendorName()); + wmRtVendor.setVendorNick(vendor.getVendorNick()); + } + + wmRtVendor.setCreateBy(getUsername()); + wmRtVendorService.insertWmRtVendor(wmRtVendor); + return AjaxResult.success(wmRtVendor); + } + + /** + * 修改供应商退货 + */ + @ApiOperation("编辑采购退货单") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtVendor wmRtVendor) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){ + return AjaxResult.error("退货单编号已经存在!"); + } + + if(StringUtils.isNotNull(wmRtVendor.getVendorId())){ + MdVendor vendor = mdVendorService.selectMdVendorByVendorId(wmRtVendor.getVendorId()); + wmRtVendor.setVendorCode(vendor.getVendorCode()); + wmRtVendor.setVendorName(vendor.getVendorName()); + wmRtVendor.setVendorNick(vendor.getVendorNick()); + } + + return toAjax(wmRtVendorService.updateWmRtVendor(wmRtVendor)); + } + + + /** + * 执行退货 + */ + @ApiOperation("执行退货") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + //判断单据状态 + WmRtVendor wmRtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + + //构造事务Bean + List beans = wmRtVendorService.getTxBeans(rtId); + + //调用库存核心 + storageCoreService.processRtVendor(beans); + + //更新单据状态 + WmRtVendor rtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + rtVendor.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtVendorService.updateWmRtVendor(rtVendor); + + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmSnMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmSnMobController.java new file mode 100644 index 0000000..816180b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmSnMobController.java @@ -0,0 +1,122 @@ +package com.ktg.mes.wm.controller.mobile; + +import cn.hutool.core.date.DateUtil; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmSn; +import com.ktg.mes.wm.service.IWmSnService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; + +@Api("SN码") +@RestController +@RequestMapping("/mobile/wm/sn") +public class WmSnMobController extends BaseController { + @Autowired + private IWmSnService wmSnService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询SN码列表 + */ + @GetMapping("/list") + public TableDataInfo list(WmSn wmSn) + { + startPage(); + List list = wmSnService.selectWmSnList(wmSn); + return getDataTable(list); + } + + /** + * 查询SN码列表 + */ + @GetMapping("/listSn") + public TableDataInfo listSn(WmSn wmSn) + { + startPage(); + List list = wmSnService.selectSnList(wmSn); + return getDataTable(list); + } + + /** + * 导出SN码列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:export')") + @Log(title = "SN码", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmSn wmSn) + { + List list = wmSnService.selectWmSnList(wmSn); + ExcelUtil util = new ExcelUtil(WmSn.class); + util.exportExcel(response, list, "SN码数据"); + } + + /** + * 获取SN码详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:query')") + @GetMapping(value = "/{snId}") + public AjaxResult getInfo(@PathVariable("snId") Long snId) + { + return AjaxResult.success(wmSnService.selectWmSnBySnId(snId)); + } + + /** + * 新增SN码 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:add')") + @Log(title = "SN码", businessType = BusinessType.INSERT) + @Transactional + @PostMapping + public AjaxResult add(@RequestBody WmSn wmSn) + { + Date genDate = DateUtil.date(); + wmSn.setGenDate(genDate); + String SNCode= null; + if(wmSn.getSnNum()>0){ + for(int i=0;i list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine); + return getDataTable(list); + } + + + /** + * 获取库存盘点明细详细信息 + */ + @ApiOperation("查询库存盘点明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmStockTakingLineService.selectWmStockTakingLineByLineId(lineId)); + } + + /** + * 新增库存盘点明细 + */ + @ApiOperation("新增库存盘点明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')") + @Log(title = "库存盘点明细", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTakingLine wmStockTakingLine) + { + return toAjax(wmStockTakingLineService.insertWmStockTakingLine(wmStockTakingLine)); + } + + /** + * 修改库存盘点明细 + */ + @ApiOperation("编辑库存盘点明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktakingline:edit')") + @Log(title = "库存盘点明细", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTakingLine wmStockTakingLine) + { + return toAjax(wmStockTakingLineService.updateWmStockTakingLine(wmStockTakingLine)); + } + + /** + * 删除库存盘点明细 + */ + @ApiOperation("删除库存盘点明细接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktakingline:remove')") + @Log(title = "库存盘点明细", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmStockTakingLineService.deleteWmStockTakingLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmStockTakingMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmStockTakingMobController.java new file mode 100644 index 0000000..b906c67 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmStockTakingMobController.java @@ -0,0 +1,173 @@ +package com.ktg.mes.wm.controller.mobile; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.service.IWmStockTakingLineService; +import com.ktg.mes.wm.service.IWmStockTakingResultService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.service.IWmStockTakingService; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库存盘点记录Controller + * + * @author yinjinlu + * @date 2023-08-17 + */ +@Api("物资盘点") +@RestController +@RequestMapping("/mobile/wm/stocktaking") +public class WmStockTakingMobController extends BaseController +{ + @Autowired + private IWmStockTakingService wmStockTakingService; + + @Autowired + private IWmStockTakingLineService wmStockTakingLineService; + + @Autowired + private IWmStockTakingResultService wmStockTakingResultService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + /** + * 查询库存盘点记录列表 + */ + @ApiOperation("查询库存盘点单列表接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTaking wmStockTaking) + { + startPage(); + List list = wmStockTakingService.selectWmStockTakingList(wmStockTaking); + return getDataTable(list); + } + + /** + * 获取库存盘点记录详细信息 + */ + @ApiOperation("获取库存盘点单详情接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')") + @GetMapping(value = "/{takingId}") + public AjaxResult getInfo(@PathVariable("takingId") Long takingId) + { + return AjaxResult.success(wmStockTakingService.selectWmStockTakingByTakingId(takingId)); + } + + /** + * 新增库存盘点记录 + */ + @ApiOperation("新增库存盘点单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')") + @Log(title = "库存盘点记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTaking wmStockTaking) + { + if(StringUtils.isNotNull(wmStockTaking.getTakingCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmStockTakingService.checkUnique(wmStockTaking))){ + return AjaxResult.error("单据编号已存在!"); + } + }else { + wmStockTaking.setTakingCode(autoCodeUtil.genSerialCode(UserConstants.STOCKTAKING_CODE,"")); + } + + if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId()); + wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode()); + wmStockTaking.setWarehouseName(warehouse.getWarehouseName()); + } + + wmStockTakingService.insertWmStockTaking(wmStockTaking); + wmStockTaking.setCreateBy(getUsername()); + return AjaxResult.success(wmStockTaking); + } + + /** + * 修改库存盘点记录 + */ + @ApiOperation("编辑库存盘点单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "库存盘点记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTaking wmStockTaking) + { + if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId()); + wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode()); + wmStockTaking.setWarehouseName(warehouse.getWarehouseName()); + } + return toAjax(wmStockTakingService.updateWmStockTaking(wmStockTaking)); + } + + /** + * 删除库存盘点记录 + */ + @ApiOperation("删除库存盘点单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')") + @Log(title = "库存盘点记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{takingIds}") + public AjaxResult remove(@PathVariable Long[] takingIds) + { + return toAjax(wmStockTakingService.deleteWmStockTakingByTakingIds(takingIds)); + } + + /** + * 完成盘点,系统对比计算盘点结果 + */ + @ApiOperation("执行盘点接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "盘点单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{takingId}") + public AjaxResult execute(@PathVariable Long takingId){ + WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId); + + WmStockTakingLine param = new WmStockTakingLine(); + param.setTakingId(takingId); + List lines = wmStockTakingLineService.selectWmStockTakingLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("未检测到盘点的物资!"); + } + + //先删除历史记录 + wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId); + + if(UserConstants.WM_STOCK_TAKING_TYPE_OPEN.equals(taking.getTakingType())){ + //如果是明盘,则直接对比明细中的库存数量和盘点数量 + wmStockTakingResultService.calculateOpenWmStockTakingResult(takingId); + }else { + //如果是盲盘,则对比盘点明细中的盘点数量,和当前库存现有量的数量 + wmStockTakingResultService.calculateWmStockTakingResult(takingId); + } + + taking.setStatus(UserConstants.ORDER_STATUS_APPROVED); + wmStockTakingService.updateWmStockTaking(taking); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmStockTakingResultMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmStockTakingResultMobController.java new file mode 100644 index 0000000..6af3795 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmStockTakingResultMobController.java @@ -0,0 +1,89 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmStockTakingResult; +import com.ktg.mes.wm.service.IWmStockTakingResultService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("物资盘点结果") +@RestController +@RequestMapping("/mobile/wm/stocktakingresult") +public class WmStockTakingResultMobController extends BaseController { + + @Autowired + private IWmStockTakingResultService wmStockTakingResultService; + + /** + * 查询库存盘点结果列表 + */ + @ApiOperation("查询库存盘点结果列表接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')") + @GetMapping("/list") + public TableDataInfo list(WmStockTakingResult wmStockTakingResult) + { + startPage(); + List list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult); + return getDataTable(list); + } + + + /** + * 获取库存盘点结果详细信息 + */ + @ApiOperation("查询库存盘点结果详情接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')") + @GetMapping(value = "/{resultId}") + public AjaxResult getInfo(@PathVariable("resultId") Long resultId) + { + return AjaxResult.success(wmStockTakingResultService.selectWmStockTakingResultByResultId(resultId)); + } + + /** + * 新增库存盘点结果 + */ + @ApiOperation("新增库存盘点结果接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')") + @Log(title = "库存盘点结果", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStockTakingResult wmStockTakingResult) + { + return toAjax(wmStockTakingResultService.insertWmStockTakingResult(wmStockTakingResult)); + } + + /** + * 修改库存盘点结果 + */ + @ApiOperation("修改库存盘点结果接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')") + @Log(title = "库存盘点结果", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStockTakingResult wmStockTakingResult) + { + return toAjax(wmStockTakingResultService.updateWmStockTakingResult(wmStockTakingResult)); + } + + /** + * 删除库存盘点结果 + */ + @ApiOperation("删除库存盘点结果接口") + @PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')") + @Log(title = "库存盘点结果", businessType = BusinessType.DELETE) + @DeleteMapping("/{resultIds}") + public AjaxResult remove(@PathVariable Long[] resultIds) + { + return toAjax(wmStockTakingResultService.deleteWmStockTakingResultByResultIds(resultIds)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmTransferLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmTransferLineMobController.java new file mode 100644 index 0000000..7e759ca --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmTransferLineMobController.java @@ -0,0 +1,194 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("转移调拨明细") +@RestController +@RequestMapping("/mobile/wm/transferline") +public class WmTransferLineMobController extends BaseController { + @Autowired + private IWmTransferLineService wmTransferLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IWmMaterialStockService wmMaterialStockService; + + /** + * 查询转移单行列表 + */ + @ApiOperation("查询转移调拨单明细清单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:list')") + @GetMapping("/list") + public TableDataInfo list(WmTransferLine wmTransferLine) + { + startPage(); + List list = wmTransferLineService.selectWmTransferLineList(wmTransferLine); + return getDataTable(list); + } + + + /** + * 获取转移单行详细信息 + */ + @ApiOperation("获取转移调拨单明细详情接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmTransferLineService.selectWmTransferLineByLineId(lineId)); + } + + /** + * 新增转移单行 + */ + @ApiOperation("新增转移调拨单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:add')") + @Log(title = "转移单行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmTransferLine wmTransferLine) + { + if(StringUtils.isNotNull(wmTransferLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmTransferLine.getMaterialStockId()); + wmTransferLine.setItemId(stock.getItemId()); + wmTransferLine.setItemCode(stock.getItemCode()); + wmTransferLine.setItemName(stock.getItemName()); + wmTransferLine.setSpecification(stock.getSpecification()); + wmTransferLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmTransferLine.setBatchCode(stock.getBatchCode()); + wmTransferLine.setVendorId(stock.getVendorId()); + wmTransferLine.setVendorCode(stock.getVendorCode()); + wmTransferLine.setVendorName(stock.getVendorName()); + wmTransferLine.setVendorNick(stock.getVendorNick()); + wmTransferLine.setWorkorderId(stock.getWorkorderId()); + wmTransferLine.setWorkorderCode(stock.getWorkorderCode()); + } + + if(StringUtils.isNotNull(wmTransferLine.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getFromWarehouseId()); + wmTransferLine.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getFromLocationId()); + wmTransferLine.setFromLocationCode(location.getLocationCode()); + wmTransferLine.setFromLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getFromAreaId()); + wmTransferLine.setFromAreaCode(area.getAreaCode()); + wmTransferLine.setFromAreaName(area.getAreaName()); + } + if(StringUtils.isNotNull(wmTransferLine.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getToWarehouseId()); + wmTransferLine.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setToWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getToLocationId()); + wmTransferLine.setToLocationCode(location.getLocationCode()); + wmTransferLine.setToLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getToAreaId()); + wmTransferLine.setToAreaCode(area.getAreaCode()); + wmTransferLine.setToAreaName(area.getAreaName()); + } + wmTransferLine.setCreateBy(getUsername()); + wmTransferLineService.insertWmTransferLine(wmTransferLine); + return AjaxResult.success(wmTransferLine); + } + + /** + * 修改转移单行 + */ + @ApiOperation("编辑转移调拨单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')") + @Log(title = "转移单行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmTransferLine wmTransferLine) + { + if(StringUtils.isNotNull(wmTransferLine.getMaterialStockId())){ + WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmTransferLine.getMaterialStockId()); + wmTransferLine.setItemId(stock.getItemId()); + wmTransferLine.setItemCode(stock.getItemCode()); + wmTransferLine.setItemName(stock.getItemName()); + wmTransferLine.setSpecification(stock.getSpecification()); + wmTransferLine.setUnitOfMeasure(stock.getUnitOfMeasure()); + wmTransferLine.setBatchCode(stock.getBatchCode()); + wmTransferLine.setVendorId(stock.getVendorId()); + wmTransferLine.setVendorCode(stock.getVendorCode()); + wmTransferLine.setVendorName(stock.getVendorName()); + wmTransferLine.setVendorNick(stock.getVendorNick()); + wmTransferLine.setWorkorderId(stock.getWorkorderId()); + wmTransferLine.setWorkorderCode(stock.getWorkorderCode()); + } + + if(StringUtils.isNotNull(wmTransferLine.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getFromWarehouseId()); + wmTransferLine.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getFromLocationId()); + wmTransferLine.setFromLocationCode(location.getLocationCode()); + wmTransferLine.setFromLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getFromAreaId()); + wmTransferLine.setFromAreaCode(area.getAreaCode()); + wmTransferLine.setFromAreaName(area.getAreaName()); + } + if(StringUtils.isNotNull(wmTransferLine.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getToWarehouseId()); + wmTransferLine.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransferLine.setToWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){ + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getToLocationId()); + wmTransferLine.setToLocationCode(location.getLocationCode()); + wmTransferLine.setToLocationName(location.getLocationName()); + } + if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){ + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getToAreaId()); + wmTransferLine.setToAreaCode(area.getAreaCode()); + wmTransferLine.setToAreaName(area.getAreaName()); + } + return toAjax(wmTransferLineService.updateWmTransferLine(wmTransferLine)); + } + + /** + * 删除转移单行 + */ + @ApiOperation("删除转移调拨单明细信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:remove')") + @Log(title = "转移单行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmTransferLineService.deleteWmTransferLineByLineIds(lineIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmTransferMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmTransferMobController.java new file mode 100644 index 0000000..93740e7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmTransferMobController.java @@ -0,0 +1,185 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.wm.domain.WmTransfer; +import com.ktg.mes.wm.domain.WmTransferLine; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.domain.tx.TransferTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmTransferLineService; +import com.ktg.mes.wm.service.IWmTransferService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import com.ktg.system.strategy.AutoCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api("转移调拨") +@RestController +@RequestMapping("/mobile/wm/transfer") +public class WmTransferMobController extends BaseController { + @Autowired + private IWmTransferService wmTransferService; + + @Autowired + private IWmTransferLineService wmTransferLineService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询转移单列表 + */ + @ApiOperation("查询转移调拨单清单列表") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:list')") + @GetMapping("/list") + public TableDataInfo list(WmTransfer wmTransfer) + { + startPage(); + List list = wmTransferService.selectWmTransferList(wmTransfer); + return getDataTable(list); + } + + /** + * 获取转移单详细信息 + */ + @ApiOperation("获取转移调拨单详情接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:query')") + @GetMapping(value = "/{transferId}") + public AjaxResult getInfo(@PathVariable("transferId") Long transferId) + { + return AjaxResult.success(wmTransferService.selectWmTransferByTransferId(transferId)); + } + + /** + * 新增转移单 + */ + @ApiOperation("新增转移调拨单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:add')") + @Log(title = "转移单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmTransfer wmTransfer) + { + if(StringUtils.isNotNull(wmTransfer.getTransferCode())){ + if(UserConstants.NOT_UNIQUE.equals(wmTransferService.checkUnique(wmTransfer))){ + return AjaxResult.error("单据编号已存在"); + } + }else { + wmTransfer.setTransferCode(autoCodeUtil.genSerialCode(UserConstants.TRANSFER_CODE,"")); + } + + if(StringUtils.isNotNull(wmTransfer.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getFromWarehouseId()); + wmTransfer.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransfer.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getToWarehouseId()); + wmTransfer.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setToWarehouseName(warehouse.getWarehouseName()); + } + + wmTransfer.setCreateBy(getUsername()); + wmTransferService.insertWmTransfer(wmTransfer); + return AjaxResult.success(wmTransfer); + } + + /** + * 修改转移单 + */ + @ApiOperation("编辑转移调拨单基本信息接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')") + @Log(title = "转移单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmTransfer wmTransfer) + { + if(UserConstants.NOT_UNIQUE.equals(wmTransferService.checkUnique(wmTransfer))){ + return AjaxResult.error("转移单编号已存在"); + } + if(StringUtils.isNotNull(wmTransfer.getFromWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getFromWarehouseId()); + wmTransfer.setFromWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setFromWarehouseName(warehouse.getWarehouseName()); + } + if(StringUtils.isNotNull(wmTransfer.getToWarehouseId())){ + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getToWarehouseId()); + wmTransfer.setToWarehouseCode(warehouse.getWarehouseCode()); + wmTransfer.setToWarehouseName(warehouse.getWarehouseName()); + } + return toAjax(wmTransferService.updateWmTransfer(wmTransfer)); + } + + /** + * 删除转移单 + */ + @ApiOperation("删除转移调拨单接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:remove')") + @Log(title = "转移单", businessType = BusinessType.DELETE) + @DeleteMapping("/{transferIds}") + @Transactional + public AjaxResult remove(@PathVariable Long[] transferIds) + { + for (Long transferId:transferIds + ) { + WmTransfer transfer = wmTransferService.selectWmTransferByTransferId(transferId); + if(!UserConstants.ORDER_STATUS_PREPARE.equals(transfer.getStatus())){ + return AjaxResult.error("只能删除草稿状态单据!"); + } + + wmTransferLineService.deleteByTransferId(transferId); + } + return toAjax(wmTransferService.deleteWmTransferByTransferIds(transferIds)); + } + + /** + * 执行转移 + */ + @ApiOperation("执行转移调拨接口") + @PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')") + @Log(title = "转移单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{transferId}") + public AjaxResult execute(@PathVariable Long transferId){ + WmTransfer transfer = wmTransferService.selectWmTransferByTransferId(transferId); + + WmTransferLine param = new WmTransferLine(); + param.setTransferId(transferId); + List lines = wmTransferLineService.selectWmTransferLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("请添加需要转移的物资!"); + } + + List beans = wmTransferService.getTxBeans(transferId); + + if(CollectionUtils.isEmpty(beans)){ + return AjaxResult.error("请添加转移单行信息!"); + } + + storageCoreService.processTransfer(beans); + + + transfer.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmTransferService.updateWmTransfer(transfer); + return AjaxResult.success(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmWarehouseMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmWarehouseMobController.java new file mode 100644 index 0000000..810693b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmWarehouseMobController.java @@ -0,0 +1,90 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("仓库存储位置信息") +@RestController +@RequestMapping("/mobile/wm/warehouse") +public class WmWarehouseMobController extends BaseController { + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + /** + * 查询库存盘点记录列表 + */ + @ApiOperation("查询仓库列表接口") + @GetMapping("/list") + public TableDataInfo list(WmWarehouse warehouse) + { + startPage(); + List list = wmWarehouseService.selectWmWarehouseList(warehouse); + return getDataTable(list); + } + + /** + * 查询树型的列表 + * @return + */ + @ApiOperation("查询树形结构的完整仓库信息接口") + @GetMapping("/getTreeList") + public AjaxResult getTreeList(){ + return AjaxResult.success(wmWarehouseService.getTreeList()); + } + + + @ApiOperation("根据库位编码/ID查询完整的储位信息") + @GetMapping("/getAreaFullInfo") + public AjaxResult getAreaFullInfo(WmPosition position){ + WmPosition thePosition = null; + WmStorageArea area = null; + + if(StringUtils.isNotNull(position.getAreaId())){ + area = wmStorageAreaService.selectWmStorageAreaByAreaId(area.getAreaId()); + } + + if(StringUtils.isNotNull(position.getAreaCode())){ + area = wmStorageAreaService.selectWmStorageAreaByAreaCode(area.getAreaCode()); + } + + if(area != null){ + thePosition.setAreaId(area.getAreaId()); + thePosition.setAreaCode(area.getAreaCode()); + thePosition.setAreaName(area.getAreaName()); + + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(area.getLocationId()); + thePosition.setLocationCode(location.getLocationCode()); + thePosition.setLocationName(location.getLocationName()); + + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(location.getWarehouseId()); + thePosition.setWarehouseId(location.getWarehouseId()); + thePosition.setWarehouseCode(warehouse.getWarehouseCode()); + thePosition.setWarehouseName(warehouse.getWarehouseName()); + } + + return AjaxResult.success(thePosition); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmBarcode.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmBarcode.java new file mode 100644 index 0000000..1e5ca95 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmBarcode.java @@ -0,0 +1,200 @@ +package com.ktg.mes.wm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 条码清单对象 wm_barcode + * + * @author yinjinlu + * @date 2022-08-01 + */ +public class WmBarcode extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 条码ID */ + private Long barcodeId; + + /** 条码格式 */ + @Excel(name = "条码格式") + private String barcodeFormart; + + /** 条码类型 */ + @Excel(name = "条码类型") + private String barcodeType; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private String barcodeContent; + + private Long bussinessId; + + /** 业务编码 */ + @Excel(name = "业务编码") + private String bussinessCode; + + /** 业务名称 */ + @Excel(name = "业务编码") + private String bussinessName; + + /** 条码地址 */ + @Excel(name = "条码地址") + private String barcodeUrl; + + /** 是否生效 */ + @Excel(name = "是否生效") + private String enableFlag; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setBarcodeId(Long barcodeId) + { + this.barcodeId = barcodeId; + } + + public Long getBarcodeId() + { + return barcodeId; + } + public void setBarcodeFormart(String barcodeFormart) + { + this.barcodeFormart = barcodeFormart; + } + + public String getBarcodeFormart() + { + return barcodeFormart; + } + public void setBarcodeType(String barcodeType) + { + this.barcodeType = barcodeType; + } + + public String getBarcodeType() + { + return barcodeType; + } + public void setBarcodeContent(String barcodeContent) + { + this.barcodeContent = barcodeContent; + } + + public String getBarcodeContent() + { + return barcodeContent; + } + + public Long getBussinessId() { + return bussinessId; + } + + public void setBussinessId(Long bussinessId) { + this.bussinessId = bussinessId; + } + + public String getBussinessCode() { + return bussinessCode; + } + + public void setBussinessCode(String bussinessCode) { + this.bussinessCode = bussinessCode; + } + + public String getBussinessName() { + return bussinessName; + } + + public void setBussinessName(String bussinessName) { + this.bussinessName = bussinessName; + } + + public String getBarcodeUrl() { + return barcodeUrl; + } + + public void setBarcodeUrl(String barcodeUrl) { + this.barcodeUrl = barcodeUrl; + } + + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmBarcode{" + + "barcodeId=" + barcodeId + + ", barcodeFormart='" + barcodeFormart + '\'' + + ", barcodeType='" + barcodeType + '\'' + + ", barcodeContent='" + barcodeContent + '\'' + + ", bussinessId=" + bussinessId + + ", bussinessCode='" + bussinessCode + '\'' + + ", bussinessName='" + bussinessName + '\'' + + ", barcodeUrl='" + barcodeUrl + '\'' + + ", enableFlag='" + enableFlag + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmBarcodeConfig.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmBarcodeConfig.java new file mode 100644 index 0000000..b1abfd6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmBarcodeConfig.java @@ -0,0 +1,188 @@ +package com.ktg.mes.wm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 条码配置对象 wm_barcode_config + * + * @author yinjinlu + * @date 2022-10-22 + */ +public class WmBarcodeConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 配置ID */ + private Long configId; + + /** 条码格式 */ + @Excel(name = "条码格式") + private String barcodeFormart; + + /** 条码类型 */ + @Excel(name = "条码类型") + private String barcodeType; + + /** 内容格式 */ + @Excel(name = "内容格式") + private String contentFormart; + + /** 内容样例 */ + @Excel(name = "内容样例") + private String contentExample; + + /** 是否自动生成 */ + @Excel(name = "是否自动生成") + private String autoGenFlag; + + /** 默认的打印模板 **/ + private String defaultTemplate; + + /** 是否生效 */ + @Excel(name = "是否生效") + private String enableFlag; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setConfigId(Long configId) + { + this.configId = configId; + } + + public Long getConfigId() + { + return configId; + } + public void setBarcodeFormart(String barcodeFormart) + { + this.barcodeFormart = barcodeFormart; + } + + public String getBarcodeFormart() + { + return barcodeFormart; + } + public void setBarcodeType(String barcodeType) + { + this.barcodeType = barcodeType; + } + + public String getBarcodeType() + { + return barcodeType; + } + public void setContentFormart(String contentFormart) + { + this.contentFormart = contentFormart; + } + + public String getContentFormart() + { + return contentFormart; + } + public void setContentExample(String contentExample) + { + this.contentExample = contentExample; + } + + public String getContentExample() + { + return contentExample; + } + public void setAutoGenFlag(String autoGenFlag) + { + this.autoGenFlag = autoGenFlag; + } + + public String getAutoGenFlag() + { + return autoGenFlag; + } + public String getDefaultTemplate() { + return defaultTemplate; + } + + public void setDefaultTemplate(String defaultTemplate) { + this.defaultTemplate = defaultTemplate; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmBarcodeConfig{" + + "configId=" + configId + + ", barcodeFormart='" + barcodeFormart + '\'' + + ", barcodeType='" + barcodeType + '\'' + + ", contentFormart='" + contentFormart + '\'' + + ", contentExample='" + contentExample + '\'' + + ", autoGenFlag='" + autoGenFlag + '\'' + + ", defaultTemplate='" + defaultTemplate + '\'' + + ", enableFlag='" + enableFlag + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmIssueHeader.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmIssueHeader.java new file mode 100644 index 0000000..181fa47 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmIssueHeader.java @@ -0,0 +1,422 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产领料单头对象 wm_issue_header + * + * @author yinjinlu + * @date 2022-07-14 + */ +public class WmIssueHeader extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 领料单ID */ + private Long issueId; + + /** 领料单编号 */ + @Excel(name = "领料单编号") + private String issueCode; + + /** 领料单名称 */ + @Excel(name = "领料单名称") + private String issueName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + private String workstationName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 生产任务编码 */ + @Excel(name = "生产任务编码") + private String taskCode; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 客户简称 */ + @Excel(name = "客户简称") + private String clientNick; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 领料日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm") + @Excel(name = "领料日期", width = 30, dateFormat = "yyyy-MM-dd hh:mm") + private Date issueDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setIssueId(Long issueId) + { + this.issueId = issueId; + } + + public Long getIssueId() + { + return issueId; + } + public void setIssueCode(String issueCode) + { + this.issueCode = issueCode; + } + + public String getIssueCode() + { + return issueCode; + } + public void setIssueName(String issueName) + { + this.issueName = issueName; + } + + public String getIssueName() + { + return issueName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public String getWorkstationName() { + return workstationName; + } + + public void setWorkstationName(String workstationName) { + this.workstationName = workstationName; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + + public Long getClientId() { + return clientId; + } + + public void setClientId(Long clientId) { + this.clientId = clientId; + } + + public String getClientCode() { + return clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getClientNick() { + return clientNick; + } + + public void setClientNick(String clientNick) { + this.clientNick = clientNick; + } + + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setIssueDate(Date issueDate) + { + this.issueDate = issueDate; + } + + public Date getIssueDate() + { + return issueDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmIssueHeader{" + + "issueId=" + issueId + + ", issueCode='" + issueCode + '\'' + + ", issueName='" + issueName + '\'' + + ", workstationId=" + workstationId + + ", workstationCode='" + workstationCode + '\'' + + ", workstationName='" + workstationName + '\'' + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", taskId=" + taskId + + ", taskCode='" + taskCode + '\'' + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", clientNick='" + clientNick + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", issueDate=" + issueDate + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmIssueLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmIssueLine.java new file mode 100644 index 0000000..51033c2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmIssueLine.java @@ -0,0 +1,343 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产领料单行对象 wm_issue_line + * + * @author yinjinlu + * @date 2022-07-14 + */ +public class WmIssueLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 领料单ID */ + @Excel(name = "领料单ID") + private Long issueId; + + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 领料数量 */ + @Excel(name = "领料数量") + private BigDecimal quantityIssued; + + /** 领料批次号 */ + @Excel(name = "领料批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setIssueId(Long issueId) + { + this.issueId = issueId; + } + + public Long getIssueId() + { + return issueId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityIssued(BigDecimal quantityIssued) + { + this.quantityIssued = quantityIssued; + } + + public BigDecimal getQuantityIssued() + { + return quantityIssued; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("issueId", getIssueId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityIssued", getQuantityIssued()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemConsume.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemConsume.java new file mode 100644 index 0000000..58870b2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemConsume.java @@ -0,0 +1,293 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 物料消耗记录对象 wm_item_consume + * + * @author yinjinlu + * @date 2022-09-19 + */ +public class WmItemConsume extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 生产工单名称 */ + @Excel(name = "生产工单名称") + private String workorderName; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 生产任务编号 */ + @Excel(name = "生产任务编号") + private String taskCode; + + /** 生产任务名称 */ + @Excel(name = "生产任务名称") + private String taskName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编号 */ + @Excel(name = "工序编号") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 消耗日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "消耗日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date consumeDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setTaskName(String taskName) + { + this.taskName = taskName; + } + + public String getTaskName() + { + return taskName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setConsumeDate(Date consumeDate) + { + this.consumeDate = consumeDate; + } + + public Date getConsumeDate() + { + return consumeDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("workorderName", getWorkorderName()) + .append("taskId", getTaskId()) + .append("taskCode", getTaskCode()) + .append("taskName", getTaskName()) + .append("workstationId", getWorkstationId()) + .append("workstationCode", getWorkstationCode()) + .append("workstationName", getWorkstationName()) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("consumeDate", getConsumeDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemConsumeLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemConsumeLine.java new file mode 100644 index 0000000..f5d5a67 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemConsumeLine.java @@ -0,0 +1,347 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 物料消耗记录行对象 wm_item_consume_line + * + * @author yinjinlu + * @date 2022-09-19 + */ +public class WmItemConsumeLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 消耗记录ID */ + @Excel(name = "消耗记录ID") + private Long recordId; + + /** 库存ID */ + @Excel(name = "库存ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 消耗数量 */ + @Excel(name = "消耗数量") + private BigDecimal quantityConsume; + + /** 领料批次号 */ + @Excel(name = "领料批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityConsume(BigDecimal quantityConsume) + { + this.quantityConsume = quantityConsume; + } + + public BigDecimal getQuantityConsume() + { + return quantityConsume; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("recordId", getRecordId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityConsume", getQuantityConsume()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemRecpt.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemRecpt.java new file mode 100644 index 0000000..20ed9be --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemRecpt.java @@ -0,0 +1,377 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 物料入库单对象 wm_item_recpt + * + * @author yinjinlu + * @date 2022-05-22 + */ +public class WmItemRecpt extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 入库单ID */ + private Long recptId; + + /** 入库单编号 */ + @Excel(name = "入库单编号") + private String recptCode; + + /** 入库单名称 */ + @Excel(name = "入库单名称") + private String recptName; + + /** 来料检验单ID */ + @Excel(name = "来料检验单ID") + private Long iqcId; + + /** 来料检验单编号 */ + @Excel(name = "来料检验单编号") + private String iqcCode; + + /** 采购订单编号 */ + @Excel(name = "采购订单编号") + private String poCode; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date recptDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecptId(Long recptId) + { + this.recptId = recptId; + } + + public Long getRecptId() + { + return recptId; + } + public void setRecptCode(String recptCode) + { + this.recptCode = recptCode; + } + + public String getRecptCode() + { + return recptCode; + } + public void setRecptName(String recptName) + { + this.recptName = recptName; + } + + public String getRecptName() + { + return recptName; + } + public void setIqcId(Long iqcId) + { + this.iqcId = iqcId; + } + + public Long getIqcId() + { + return iqcId; + } + public void setIqcCode(String iqcCode) + { + this.iqcCode = iqcCode; + } + + public String getIqcCode() + { + return iqcCode; + } + public void setPoCode(String poCode) + { + this.poCode = poCode; + } + + public String getPoCode() + { + return poCode; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setRecptDate(Date recptDate) + { + this.recptDate = recptDate; + } + + public Date getRecptDate() + { + return recptDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recptId", getRecptId()) + .append("recptCode", getRecptCode()) + .append("recptName", getRecptName()) + .append("iqcId", getIqcId()) + .append("iqcCode", getIqcCode()) + .append("poCode", getPoCode()) + .append("vendorId", getVendorId()) + .append("vendorCode", getVendorCode()) + .append("vendorName", getVendorName()) + .append("vendorNick", getVendorNick()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("recptDate", getRecptDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemRecptLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemRecptLine.java new file mode 100644 index 0000000..4976c15 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmItemRecptLine.java @@ -0,0 +1,388 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 物料入库单行对象 wm_item_recpt_line + * + * @author yinjinlu + * @date 2022-05-22 + */ +public class WmItemRecptLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 入库单ID */ + @Excel(name = "入库单ID") + private Long recptId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 入库数量 */ + @Excel(name = "入库数量") + private BigDecimal quantityRecived; + + /** 入库批次号 */ + @Excel(name = "入库批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** + * 是否来料检验 + */ + private String iqcCheck; + + /** + * 来料检验单ID + */ + private Long iqcId; + + /** + * 来料检验单编码 + */ + private String iqcCode; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRecptId(Long recptId) + { + this.recptId = recptId; + } + + public Long getRecptId() + { + return recptId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityRecived(BigDecimal quantityRecived) + { + this.quantityRecived = quantityRecived; + } + + public BigDecimal getQuantityRecived() + { + return quantityRecived; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + + public String getIqcCheck() { + return iqcCheck; + } + + public void setIqcCheck(String iqcCheck) { + this.iqcCheck = iqcCheck; + } + + public Long getIqcId() { + return iqcId; + } + + public void setIqcId(Long iqcId) { + this.iqcId = iqcId; + } + + public String getIqcCode() { + return iqcCode; + } + + public void setIqcCode(String iqcCode) { + this.iqcCode = iqcCode; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmItemRecptLine{" + + "lineId=" + lineId + + ", recptId=" + recptId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantityRecived=" + quantityRecived + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", expireDate=" + expireDate + + ", iqcCheck='" + iqcCheck + '\'' + + ", iqcId=" + iqcId + + ", iqcCode='" + iqcCode + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmMaterialStock.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmMaterialStock.java new file mode 100644 index 0000000..950e6fd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmMaterialStock.java @@ -0,0 +1,465 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存记录对象 wm_material_stock + * + * @author yinjinlu + * @date 2022-05-24 + */ +public class WmMaterialStock extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 事务ID */ + private Long materialStockId; + + /** 物料类型ID */ + @Excel(name = "物料类型ID") + private Long itemTypeId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 入库批次号 */ + @Excel(name = "入库批次号") + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + @Excel(name = "供应商编号") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 在库数量 */ + @Excel(name = "在库数量") + private BigDecimal quantityOnhand; + + /** + * 生产工单ID + */ + private Long workorderId; + + /** 生产工单编号 */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date productionDate; + + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss") + private Date recptDate; + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "库存有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** + * 是否冻结 + */ + @Excel(name = "是否冻结") + private String frozenFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemTypeId(Long itemTypeId) + { + this.itemTypeId = itemTypeId; + } + + public Long getItemTypeId() + { + return itemTypeId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setQuantityOnhand(BigDecimal quantityOnhand) + { + this.quantityOnhand = quantityOnhand; + } + + public BigDecimal getQuantityOnhand() + { + return quantityOnhand; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + + public Date getProductionDate() { + return productionDate; + } + + public void setProductionDate(Date productionDate) { + this.productionDate = productionDate; + } + + public String getFrozenFlag() { + return frozenFlag; + } + + public void setFrozenFlag(String frozenFlag) { + this.frozenFlag = frozenFlag; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmMaterialStock{" + + "materialStockId=" + materialStockId + + ", itemTypeId=" + itemTypeId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", quantityOnhand=" + quantityOnhand + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", recptDate=" + recptDate + + ", expireDate=" + expireDate + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceIssue.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceIssue.java new file mode 100644 index 0000000..97bca09 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceIssue.java @@ -0,0 +1,363 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 外协领料单头对象 wm_outsource_issue + * + * @author yinjinlu + * @date 2023-10-30 + */ +public class WmOutsourceIssue extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 领料单ID */ + private Long issueId; + + /** 领料单编号 */ + @Excel(name = "领料单编号") + private String issueCode; + + /** 领料单名称 */ + @Excel(name = "领料单名称") + private String issueName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 领料日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "领料日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date issueDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setIssueId(Long issueId) + { + this.issueId = issueId; + } + + public Long getIssueId() + { + return issueId; + } + public void setIssueCode(String issueCode) + { + this.issueCode = issueCode; + } + + public String getIssueCode() + { + return issueCode; + } + public void setIssueName(String issueName) + { + this.issueName = issueName; + } + + public String getIssueName() + { + return issueName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setIssueDate(Date issueDate) + { + this.issueDate = issueDate; + } + + public Date getIssueDate() + { + return issueDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("issueId", getIssueId()) + .append("issueCode", getIssueCode()) + .append("issueName", getIssueName()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("vendorId", getVendorId()) + .append("vendorCode", getVendorCode()) + .append("vendorName", getVendorName()) + .append("vendorNick", getVendorNick()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("issueDate", getIssueDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceIssueLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceIssueLine.java new file mode 100644 index 0000000..e1ca171 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceIssueLine.java @@ -0,0 +1,347 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 外协领料单行对象 wm_outsource_issue_line + * + * @author yinjinlu + * @date 2023-10-30 + */ +public class WmOutsourceIssueLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 领料单ID */ + @Excel(name = "领料单ID") + private Long issueId; + + /** 库存ID */ + @Excel(name = "库存ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 领料数量 */ + @Excel(name = "领料数量") + private BigDecimal quantityIssued; + + /** 领料批次号 */ + @Excel(name = "领料批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setIssueId(Long issueId) + { + this.issueId = issueId; + } + + public Long getIssueId() + { + return issueId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityIssued(BigDecimal quantityIssued) + { + this.quantityIssued = quantityIssued; + } + + public BigDecimal getQuantityIssued() + { + return quantityIssued; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("issueId", getIssueId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityIssued", getQuantityIssued()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceRecpt.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceRecpt.java new file mode 100644 index 0000000..2cd7119 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceRecpt.java @@ -0,0 +1,391 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 外协入库单对象 wm_outsource_recpt + * + * @author yinjinlu + * @date 2023-10-30 + */ +public class WmOutsourceRecpt extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 入库单ID */ + private Long recptId; + + /** 入库单编号 */ + @Excel(name = "入库单编号") + private String recptCode; + + /** 入库单名称 */ + @Excel(name = "入库单名称") + private String recptName; + + /** 来料检验单ID */ + @Excel(name = "来料检验单ID") + private Long iqcId; + + /** 来料检验单编号 */ + @Excel(name = "来料检验单编号") + private String iqcCode; + + /** 外协工单ID */ + @Excel(name = "外协工单ID") + private Long workorderId; + + /** 外协工单编号 */ + @Excel(name = "外协工单编号") + private String workorderCode; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date recptDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecptId(Long recptId) + { + this.recptId = recptId; + } + + public Long getRecptId() + { + return recptId; + } + public void setRecptCode(String recptCode) + { + this.recptCode = recptCode; + } + + public String getRecptCode() + { + return recptCode; + } + public void setRecptName(String recptName) + { + this.recptName = recptName; + } + + public String getRecptName() + { + return recptName; + } + public void setIqcId(Long iqcId) + { + this.iqcId = iqcId; + } + + public Long getIqcId() + { + return iqcId; + } + public void setIqcCode(String iqcCode) + { + this.iqcCode = iqcCode; + } + + public String getIqcCode() + { + return iqcCode; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setRecptDate(Date recptDate) + { + this.recptDate = recptDate; + } + + public Date getRecptDate() + { + return recptDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recptId", getRecptId()) + .append("recptCode", getRecptCode()) + .append("recptName", getRecptName()) + .append("iqcId", getIqcId()) + .append("iqcCode", getIqcCode()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("vendorId", getVendorId()) + .append("vendorCode", getVendorCode()) + .append("vendorName", getVendorName()) + .append("vendorNick", getVendorNick()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("recptDate", getRecptDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceRecptLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceRecptLine.java new file mode 100644 index 0000000..b411d72 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmOutsourceRecptLine.java @@ -0,0 +1,392 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 外协入库单行对象 wm_outsource_recpt_line + * + * @author yinjinlu + * @date 2023-10-30 + */ +public class WmOutsourceRecptLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 入库单ID */ + @Excel(name = "入库单ID") + private Long recptId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 入库数量 */ + @Excel(name = "入库数量") + private BigDecimal quantityRecived; + + /** 入库批次号 */ + @Excel(name = "入库批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** 是否来料检验 */ + @Excel(name = "是否来料检验") + private String iqcCheck; + + /** 来料检验单ID */ + @Excel(name = "来料检验单ID") + private Long iqcId; + + /** 来料检验单编号 */ + @Excel(name = "来料检验单编号") + private String iqcCode; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRecptId(Long recptId) + { + this.recptId = recptId; + } + + public Long getRecptId() + { + return recptId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityRecived(BigDecimal quantityRecived) + { + this.quantityRecived = quantityRecived; + } + + public BigDecimal getQuantityRecived() + { + return quantityRecived; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + public void setIqcCheck(String iqcCheck) + { + this.iqcCheck = iqcCheck; + } + + public String getIqcCheck() + { + return iqcCheck; + } + public void setIqcId(Long iqcId) + { + this.iqcId = iqcId; + } + + public Long getIqcId() + { + return iqcId; + } + public void setIqcCode(String iqcCode) + { + this.iqcCode = iqcCode; + } + + public String getIqcCode() + { + return iqcCode; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("recptId", getRecptId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityRecived", getQuantityRecived()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("expireDate", getExpireDate()) + .append("iqcCheck", getIqcCheck()) + .append("iqcId", getIqcId()) + .append("iqcCode", getIqcCode()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPackage.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPackage.java new file mode 100644 index 0000000..d274053 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPackage.java @@ -0,0 +1,428 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 装箱单对象 wm_package + * + * @author yinjinlu + * @date 2022-10-10 + */ +public class WmPackage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 装箱单ID */ + private Long packageId; + + /** 父箱ID */ + @Excel(name = "父箱ID") + private Long parentId; + + /** 所有父节点ID */ + @Excel(name = "所有父节点ID") + private String ancestors; + + /** 装箱单编号 */ + @Excel(name = "装箱单编号") + private String packageCode; + + /** 条码ID */ + @Excel(name = "条码ID") + private Long barcodeId; + + /** 条码内容 */ + @Excel(name = "条码内容") + private String barcodeContent; + + /** 条码地址 */ + @Excel(name = "条码地址") + private String barcodeUrl; + + /** 装箱日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "装箱日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date packageDate; + + /** 销售订单编号 */ + @Excel(name = "销售订单编号") + private String soCode; + + /** 发票编号 */ + @Excel(name = "发票编号") + private String invoiceCode; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 客户简称 */ + @Excel(name = "客户简称") + private String clientNick; + + /** 箱长度 */ + @Excel(name = "箱长度") + private BigDecimal packageLength; + + /** 箱宽度 */ + @Excel(name = "箱宽度") + private BigDecimal packageWidth; + + /** 箱高度 */ + @Excel(name = "箱高度") + private BigDecimal packageHeight; + + /** 尺寸单位 */ + @Excel(name = "尺寸单位") + private String sizeUnit; + + /** 净重 */ + @Excel(name = "净重") + private BigDecimal netWeight; + + /** 毛重 */ + @Excel(name = "毛重") + private BigDecimal crossWeight; + + /** 重量单位 */ + @Excel(name = "重量单位") + private String weightUnit; + + /** 检查员用户名 */ + @Excel(name = "检查员用户名") + private String inspector; + + /** 检查员名称 */ + @Excel(name = "检查员名称") + private String inspectorName; + + /** 是否生效 */ + @Excel(name = "是否生效") + private String enableFlag; + + /** 状态 */ + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setPackageId(Long packageId) + { + this.packageId = packageId; + } + + public Long getPackageId() + { + return packageId; + } + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Long getParentId() + { + return parentId; + } + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + public String getAncestors() + { + return ancestors; + } + public void setPackageCode(String packageCode) + { + this.packageCode = packageCode; + } + + public String getPackageCode() + { + return packageCode; + } + public void setBarcodeId(Long barcodeId) + { + this.barcodeId = barcodeId; + } + + public Long getBarcodeId() + { + return barcodeId; + } + public void setBarcodeContent(String barcodeContent) + { + this.barcodeContent = barcodeContent; + } + + public String getBarcodeContent() + { + return barcodeContent; + } + public void setBarcodeUrl(String barcodeUrl) + { + this.barcodeUrl = barcodeUrl; + } + + public String getBarcodeUrl() + { + return barcodeUrl; + } + public void setPackageDate(Date packageDate) + { + this.packageDate = packageDate; + } + + public Date getPackageDate() + { + return packageDate; + } + public void setSoCode(String soCode) + { + this.soCode = soCode; + } + + public String getSoCode() + { + return soCode; + } + public void setInvoiceCode(String invoiceCode) + { + this.invoiceCode = invoiceCode; + } + + public String getInvoiceCode() + { + return invoiceCode; + } + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setClientNick(String clientNick) + { + this.clientNick = clientNick; + } + + public String getClientNick() + { + return clientNick; + } + public void setPackageLength(BigDecimal packageLength) + { + this.packageLength = packageLength; + } + + public BigDecimal getPackageLength() + { + return packageLength; + } + public void setPackageWidth(BigDecimal packageWidth) + { + this.packageWidth = packageWidth; + } + + public BigDecimal getPackageWidth() + { + return packageWidth; + } + public void setPackageHeight(BigDecimal packageHeight) + { + this.packageHeight = packageHeight; + } + + public BigDecimal getPackageHeight() + { + return packageHeight; + } + public void setSizeUnit(String sizeUnit) + { + this.sizeUnit = sizeUnit; + } + + public String getSizeUnit() + { + return sizeUnit; + } + public void setNetWeight(BigDecimal netWeight) + { + this.netWeight = netWeight; + } + + public BigDecimal getNetWeight() + { + return netWeight; + } + public void setCrossWeight(BigDecimal crossWeight) + { + this.crossWeight = crossWeight; + } + + public BigDecimal getCrossWeight() + { + return crossWeight; + } + public void setWeightUnit(String weightUnit) + { + this.weightUnit = weightUnit; + } + + public String getWeightUnit() + { + return weightUnit; + } + public void setInspector(String inspector) + { + this.inspector = inspector; + } + + public String getInspector() + { + return inspector; + } + public void setInspectorName(String inspectorName) + { + this.inspectorName = inspectorName; + } + + public String getInspectorName() + { + return inspectorName; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmPackage{" + + "packageId=" + packageId + + ", parentId=" + parentId + + ", ancestors='" + ancestors + '\'' + + ", packageCode='" + packageCode + '\'' + + ", barcodeId=" + barcodeId + + ", barcodeContent='" + barcodeContent + '\'' + + ", barcodeUrl='" + barcodeUrl + '\'' + + ", packageDate=" + packageDate + + ", soCode='" + soCode + '\'' + + ", invoiceCode='" + invoiceCode + '\'' + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", clientNick='" + clientNick + '\'' + + ", packageLength=" + packageLength + + ", packageWidth=" + packageWidth + + ", packageHeight=" + packageHeight + + ", sizeUnit='" + sizeUnit + '\'' + + ", netWeight=" + netWeight + + ", crossWeight=" + crossWeight + + ", weightUnit='" + weightUnit + '\'' + + ", inspector='" + inspector + '\'' + + ", inspectorName='" + inspectorName + '\'' + + ", enableFlag='" + enableFlag + '\'' + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPackageLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPackageLine.java new file mode 100644 index 0000000..2f2de99 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPackageLine.java @@ -0,0 +1,392 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 装箱明细对象 wm_package_line + * + * @author yinjinlu + * @date 2022-10-11 + */ +public class WmPackageLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 明细行ID */ + private Long lineId; + + /** 装箱单ID */ + @Excel(name = "装箱单ID") + private Long packageId; + + /** 库存记录ID */ + @Excel(name = "库存记录ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 装箱数量 */ + @Excel(name = "装箱数量") + private BigDecimal quantityPackage; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编号 */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setPackageId(Long packageId) + { + this.packageId = packageId; + } + + public Long getPackageId() + { + return packageId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityPackage(BigDecimal quantityPackage) + { + this.quantityPackage = quantityPackage; + } + + public BigDecimal getQuantityPackage() + { + return quantityPackage; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("packageId", getPackageId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityPackage", getQuantityPackage()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("expireDate", getExpireDate()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java new file mode 100644 index 0000000..4358b5e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmPosition.java @@ -0,0 +1,118 @@ +package com.ktg.mes.wm.domain; + +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +public class WmPosition extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 库区ID */ + private Long locationId; + + private String locationCode; + + private String locationName; + + private Long warehouseId; + + private String warehouseCode; + + private String warehouseName; + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + @Override + public String toString() { + return "WmPosition{" + + "areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductProduce.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductProduce.java new file mode 100644 index 0000000..992d21e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductProduce.java @@ -0,0 +1,293 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品产出记录对象 wm_product_produce + * + * @author yinjinlu + * @date 2022-09-21 + */ +public class WmProductProduce extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 入库单ID */ + private Long recordId; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 生产工单名称 */ + @Excel(name = "生产工单名称") + private String workorderName; + + /** 生产任务ID */ + @Excel(name = "生产任务ID") + private Long taskId; + + /** 生产任务编号 */ + @Excel(name = "生产任务编号") + private String taskCode; + + /** 生产任务名称 */ + @Excel(name = "生产任务名称") + private String taskName; + + /** 工作站ID */ + @Excel(name = "工作站ID") + private Long workstationId; + + /** 工作站编号 */ + @Excel(name = "工作站编号") + private String workstationCode; + + /** 工作站名称 */ + @Excel(name = "工作站名称") + private String workstationName; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序编号 */ + @Excel(name = "工序编号") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date produceDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + public void setTaskId(Long taskId) + { + this.taskId = taskId; + } + + public Long getTaskId() + { + return taskId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setTaskName(String taskName) + { + this.taskName = taskName; + } + + public String getTaskName() + { + return taskName; + } + public void setWorkstationId(Long workstationId) + { + this.workstationId = workstationId; + } + + public Long getWorkstationId() + { + return workstationId; + } + public void setWorkstationCode(String workstationCode) + { + this.workstationCode = workstationCode; + } + + public String getWorkstationCode() + { + return workstationCode; + } + public void setWorkstationName(String workstationName) + { + this.workstationName = workstationName; + } + + public String getWorkstationName() + { + return workstationName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setProduceDate(Date produceDate) + { + this.produceDate = produceDate; + } + + public Date getProduceDate() + { + return produceDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("workorderName", getWorkorderName()) + .append("taskId", getTaskId()) + .append("taskCode", getTaskCode()) + .append("taskName", getTaskName()) + .append("workstationId", getWorkstationId()) + .append("workstationCode", getWorkstationCode()) + .append("workstationName", getWorkstationName()) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("produceDate", getProduceDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductProduceLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductProduceLine.java new file mode 100644 index 0000000..5dbb198 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductProduceLine.java @@ -0,0 +1,333 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品产出记录行对象 wm_product_produce_line + * + * @author yinjinlu + * @date 2022-09-22 + */ +public class WmProductProduceLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 产出记录ID */ + @Excel(name = "产出记录ID") + private Long recordId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 产出数量 */ + @Excel(name = "产出数量") + private BigDecimal quantityProduce; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityProduce(BigDecimal quantityProduce) + { + this.quantityProduce = quantityProduce; + } + + public BigDecimal getQuantityProduce() + { + return quantityProduce; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("recordId", getRecordId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityProduce", getQuantityProduce()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductRecpt.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductRecpt.java new file mode 100644 index 0000000..6d1bbf6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductRecpt.java @@ -0,0 +1,382 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品入库录对象 wm_product_recpt + * + * @author yinjinlu + * @date 2022-09-22 + */ +public class WmProductRecpt extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 入库单ID */ + private Long recptId; + + /** 入库单编号 */ + @Excel(name = "入库单编号") + private String recptCode; + + /** 入库单名称 */ + @Excel(name = "入库单名称") + private String recptName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 生产工单名称 */ + @Excel(name = "生产工单名称") + private String workorderName; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date recptDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecptId(Long recptId) + { + this.recptId = recptId; + } + + public Long getRecptId() + { + return recptId; + } + public void setRecptCode(String recptCode) + { + this.recptCode = recptCode; + } + + public String getRecptCode() + { + return recptCode; + } + public void setRecptName(String recptName) + { + this.recptName = recptName; + } + + public String getRecptName() + { + return recptName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWorkorderName(String workorderName) + { + this.workorderName = workorderName; + } + + public String getWorkorderName() + { + return workorderName; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setRecptDate(Date recptDate) + { + this.recptDate = recptDate; + } + + public Date getRecptDate() + { + return recptDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmProductRecpt{" + + "recptId=" + recptId + + ", recptCode='" + recptCode + '\'' + + ", recptName='" + recptName + '\'' + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", workorderName='" + workorderName + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", recptDate=" + recptDate + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductRecptLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductRecptLine.java new file mode 100644 index 0000000..5c6907e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductRecptLine.java @@ -0,0 +1,360 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品入库记录行对象 wm_product_recpt_line + * + * @author yinjinlu + * @date 2022-09-22 + */ +public class WmProductRecptLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 入库记录ID */ + @Excel(name = "入库记录ID") + private Long recptId; + + /** 库存记录ID */ + @Excel(name = "库存记录ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 入库数量 */ + @Excel(name = "入库数量") + private BigDecimal quantityRecived; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRecptId(Long recptId) + { + this.recptId = recptId; + } + + public Long getRecptId() + { + return recptId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityRecived(BigDecimal quantityRecived) + { + this.quantityRecived = quantityRecived; + } + + public BigDecimal getQuantityRecived() + { + return quantityRecived; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmProductRecptLine{" + + "lineId=" + lineId + + ", recptId=" + recptId + + ", materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantityRecived=" + quantityRecived + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", expireDate=" + expireDate + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductSalse.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductSalse.java new file mode 100644 index 0000000..53adb61 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductSalse.java @@ -0,0 +1,377 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 销售出库单对象 wm_product_salse + * + * @author yinjinlu + * @date 2022-10-04 + */ +public class WmProductSalse extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 出库单ID */ + private Long salseId; + + /** 出库单编号 */ + @Excel(name = "出库单编号") + private String salseCode; + + /** 出库单名称 */ + @Excel(name = "出库单名称") + private String salseName; + + /** 出货检验单ID */ + @Excel(name = "出货检验单ID") + private Long oqcId; + + /** 出货检验单编号 */ + @Excel(name = "出货检验单编号") + private String oqcCode; + + /** 销售订单编号 */ + @Excel(name = "销售订单编号") + private String soCode; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 客户简称 */ + @Excel(name = "客户简称") + private String clientNick; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 出库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date salseDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setSalseId(Long salseId) + { + this.salseId = salseId; + } + + public Long getSalseId() + { + return salseId; + } + public void setSalseCode(String salseCode) + { + this.salseCode = salseCode; + } + + public String getSalseCode() + { + return salseCode; + } + public void setSalseName(String salseName) + { + this.salseName = salseName; + } + + public String getSalseName() + { + return salseName; + } + public void setOqcId(Long oqcId) + { + this.oqcId = oqcId; + } + + public Long getOqcId() + { + return oqcId; + } + public void setOqcCode(String oqcCode) + { + this.oqcCode = oqcCode; + } + + public String getOqcCode() + { + return oqcCode; + } + public void setSoCode(String soCode) + { + this.soCode = soCode; + } + + public String getSoCode() + { + return soCode; + } + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setClientNick(String clientNick) + { + this.clientNick = clientNick; + } + + public String getClientNick() + { + return clientNick; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setSalseDate(Date salseDate) + { + this.salseDate = salseDate; + } + + public Date getSalseDate() + { + return salseDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("salseId", getSalseId()) + .append("salseCode", getSalseCode()) + .append("salseName", getSalseName()) + .append("oqcId", getOqcId()) + .append("oqcCode", getOqcCode()) + .append("soCode", getSoCode()) + .append("clientId", getClientId()) + .append("clientCode", getClientCode()) + .append("clientName", getClientName()) + .append("clientNick", getClientNick()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("salseDate", getSalseDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductSalseLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductSalseLine.java new file mode 100644 index 0000000..48cc9ef --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmProductSalseLine.java @@ -0,0 +1,385 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品销售出库行对象 wm_product_salse_line + * + * @author yinjinlu + * @date 2022-10-05 + */ +public class WmProductSalseLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 出库记录ID */ + @Excel(name = "出库记录ID") + private Long salseId; + + /** 库存记录ID */ + @Excel(name = "库存记录ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 出库数量 */ + @Excel(name = "出库数量") + private BigDecimal quantitySalse; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** + * 是否出厂检验 + */ + private String oqcCheck; + + /** + * 出厂检验单ID + */ + private Long oqcId; + + /** + * 出厂检验单编码 + */ + private String oqcCode; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setSalseId(Long salseId) + { + this.salseId = salseId; + } + + public Long getSalseId() + { + return salseId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantitySalse(BigDecimal quantitySalse) + { + this.quantitySalse = quantitySalse; + } + + public BigDecimal getQuantitySalse() + { + return quantitySalse; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + + public String getOqcCheck() { + return oqcCheck; + } + + public void setOqcCheck(String oqcCheck) { + this.oqcCheck = oqcCheck; + } + + public Long getOqcId() { + return oqcId; + } + + public void setOqcId(Long oqcId) { + this.oqcId = oqcId; + } + + public String getOqcCode() { + return oqcCode; + } + + public void setOqcCode(String oqcCode) { + this.oqcCode = oqcCode; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmProductSalseLine{" + + "lineId=" + lineId + + ", salseId=" + salseId + + ", materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantitySalse=" + quantitySalse + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", oqcCheck='" + oqcCheck + '\'' + + ", oqcId=" + oqcId + + ", oqcCode='" + oqcCode + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssue.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssue.java new file mode 100644 index 0000000..ea12f53 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssue.java @@ -0,0 +1,307 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产退料单头对象 wm_rt_issue + * + * @author yinjinlu + * @date 2022-09-15 + */ +public class WmRtIssue extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 退料单ID */ + private Long rtId; + + /** 退料单编号 */ + @Excel(name = "退料单编号") + private String rtCode; + + /** 退料单名称 */ + @Excel(name = "退料单名称") + private String rtName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 退料日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "退料日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date rtDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setRtCode(String rtCode) + { + this.rtCode = rtCode; + } + + public String getRtCode() + { + return rtCode; + } + public void setRtName(String rtName) + { + this.rtName = rtName; + } + + public String getRtName() + { + return rtName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setRtDate(Date rtDate) + { + this.rtDate = rtDate; + } + + public Date getRtDate() + { + return rtDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("rtId", getRtId()) + .append("rtCode", getRtCode()) + .append("rtName", getRtName()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("rtDate", getRtDate()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssueLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssueLine.java new file mode 100644 index 0000000..ce59a50 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssueLine.java @@ -0,0 +1,347 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 生产退料单行对象 wm_rt_issue_line + * + * @author yinjinlu + * @date 2022-09-15 + */ +public class WmRtIssueLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 退料单ID */ + @Excel(name = "退料单ID") + private Long rtId; + + /** 库存ID */ + @Excel(name = "库存ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 退料数量 */ + @Excel(name = "退料数量") + private BigDecimal quantityRt; + + /** 领料批次号 */ + @Excel(name = "领料批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityRt(BigDecimal quantityRt) + { + this.quantityRt = quantityRt; + } + + public BigDecimal getQuantityRt() + { + return quantityRt; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("rtId", getRtId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityRt", getQuantityRt()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtSalse.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtSalse.java new file mode 100644 index 0000000..2458208 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtSalse.java @@ -0,0 +1,367 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品销售退货单对象 wm_rt_salse + * + * @author yinjinlu + * @date 2022-10-06 + */ +public class WmRtSalse extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 退货单ID */ + private Long rtId; + + /** 退货单编号 */ + @Excel(name = "退货单编号") + private String rtCode; + + /** 退货单名称 */ + @Excel(name = "退货单名称") + private String rtName; + + /** 销售订单编号 */ + @Excel(name = "销售订单编号") + private String soCode; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long clientId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String clientCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String clientName; + + /** 客户简称 */ + @Excel(name = "客户简称") + private String clientNick; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 退货日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "退货日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date rtDate; + + /** 退货原因 */ + @Excel(name = "退货原因") + private String rtReason; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setRtCode(String rtCode) + { + this.rtCode = rtCode; + } + + public String getRtCode() + { + return rtCode; + } + public void setRtName(String rtName) + { + this.rtName = rtName; + } + + public String getRtName() + { + return rtName; + } + public void setSoCode(String soCode) + { + this.soCode = soCode; + } + + public String getSoCode() + { + return soCode; + } + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setClientCode(String clientCode) + { + this.clientCode = clientCode; + } + + public String getClientCode() + { + return clientCode; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setClientNick(String clientNick) + { + this.clientNick = clientNick; + } + + public String getClientNick() + { + return clientNick; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setRtDate(Date rtDate) + { + this.rtDate = rtDate; + } + + public Date getRtDate() + { + return rtDate; + } + public void setRtReason(String rtReason) + { + this.rtReason = rtReason; + } + + public String getRtReason() + { + return rtReason; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("rtId", getRtId()) + .append("rtCode", getRtCode()) + .append("rtName", getRtName()) + .append("soCode", getSoCode()) + .append("clientId", getClientId()) + .append("clientCode", getClientCode()) + .append("clientName", getClientName()) + .append("clientNick", getClientNick()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("rtDate", getRtDate()) + .append("rtReason", getRtReason()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtSalseLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtSalseLine.java new file mode 100644 index 0000000..7033b6a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtSalseLine.java @@ -0,0 +1,350 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 产品销售退货行对象 wm_rt_salse_line + * + * @author yinjinlu + * @date 2022-10-06 + */ +public class WmRtSalseLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 退货单ID */ + @Excel(name = "退货单ID") + private Long rtId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 退货数量 */ + @Excel(name = "退货数量") + private BigDecimal quantityRted; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityRted(BigDecimal quantityRted) + { + this.quantityRted = quantityRted; + } + + public BigDecimal getQuantityRted() + { + return quantityRted; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("rtId", getRtId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityRted", getQuantityRted()) + .append("batchCode", getBatchCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("expireDate", getExpireDate()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendor.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendor.java new file mode 100644 index 0000000..7099176 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendor.java @@ -0,0 +1,230 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 供应商退货对象 wm_rt_vendor + * + * @author yinjinlu + * @date 2022-06-13 + */ +public class WmRtVendor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 退货单ID */ + private Long rtId; + + /** 退货单编号 */ + @Excel(name = "退货单编号") + private String rtCode; + + /** 退货单名称 */ + @Excel(name = "退货单名称") + private String rtName; + + /** 采购订单编号 */ + @Excel(name = "采购订单编号") + private String poCode; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + @Excel(name = "批次号" ) + private String batchCode; + + /** 退货日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "退货日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date rtDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setRtCode(String rtCode) + { + this.rtCode = rtCode; + } + + public String getRtCode() + { + return rtCode; + } + public void setRtName(String rtName) + { + this.rtName = rtName; + } + + public String getRtName() + { + return rtName; + } + public void setPoCode(String poCode) + { + this.poCode = poCode; + } + + public String getPoCode() + { + return poCode; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setRtDate(Date rtDate) + { + this.rtDate = rtDate; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Date getRtDate() + { + return rtDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmRtVendor{" + + "rtId=" + rtId + + ", rtCode='" + rtCode + '\'' + + ", rtName='" + rtName + '\'' + + ", poCode='" + poCode + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", batchCode='" + batchCode + '\'' + + ", rtDate=" + rtDate + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendorLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendorLine.java new file mode 100644 index 0000000..a6efc76 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendorLine.java @@ -0,0 +1,340 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 供应商退货行对象 wm_rt_vendor_line + * + * @author yinjinlu + * @date 2022-06-13 + */ +public class WmRtVendorLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + private Long materialStockId; + + /** 退货单ID */ + @Excel(name = "退货单ID") + private Long rtId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 退货数量 */ + @Excel(name = "退货数量") + private BigDecimal quantityRted; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityRted(BigDecimal quantityRted) + { + this.quantityRted = quantityRted; + } + + public BigDecimal getQuantityRted() + { + return quantityRted; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmRtVendorLine{" + + "lineId=" + lineId + + ", materialStockId=" + materialStockId + + ", rtId=" + rtId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", quantityRted=" + quantityRted + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmSn.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmSn.java new file mode 100644 index 0000000..1ccf3ea --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmSn.java @@ -0,0 +1,218 @@ +package com.ktg.mes.wm.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import java.util.Date; + +/** + * SN码对象 wm_sn + * + * @author yinjinlu + * @date 2022-12-08 + */ +public class WmSn extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** SN码ID */ + private Long snId; + + /** SN码 */ + @Excel(name = "SN码") + private String snCode; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** + * SN码的数量 + */ + private Integer snNum; + + /** 退货日期 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date genDate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setSnId(Long snId) + { + this.snId = snId; + } + + public Long getSnId() + { + return snId; + } + public void setSnCode(String snCode) + { + this.snCode = snCode; + } + + public String getSnCode() + { + return snCode; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public Integer getSnNum() { + return snNum; + } + + public void setSnNum(Integer snNum) { + this.snNum = snNum; + } + + public Date getGenDate() { + return genDate; + } + + public void setGenDate(Date genDate) { + this.genDate = genDate; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmSn{" + + "snId=" + snId + + ", snCode='" + snCode + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", snNum=" + snNum + + ", genDate=" + genDate + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java new file mode 100644 index 0000000..2b9f652 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTaking.java @@ -0,0 +1,237 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存盘点记录对象 wm_stock_taking + * + * @author yinjinlu + * @date 2023-08-17 + */ +public class WmStockTaking extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 盘点单ID */ + private Long takingId; + + /** 盘点单编号 */ + @Excel(name = "盘点单编号") + private String takingCode; + + /** 盘点单名称 */ + @Excel(name = "盘点单名称") + private String takingName; + + /** 盘点日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "盘点日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date takingDate; + + /** 盘点人用户名 */ + @Excel(name = "盘点人用户名") + private String userName; + + /** 盘点人 */ + @Excel(name = "盘点人") + private String nickName; + + /** 盘点类型 */ + @Excel(name = "盘点类型") + private String takingType; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTakingId(Long takingId) + { + this.takingId = takingId; + } + + public Long getTakingId() + { + return takingId; + } + public void setTakingCode(String takingCode) + { + this.takingCode = takingCode; + } + + public String getTakingCode() + { + return takingCode; + } + public void setTakingName(String takingName) + { + this.takingName = takingName; + } + + public String getTakingName() + { + return takingName; + } + public void setTakingDate(Date takingDate) + { + this.takingDate = takingDate; + } + + public Date getTakingDate() + { + return takingDate; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + public void setTakingType(String takingType) + { + this.takingType = takingType; + } + + public String getTakingType() + { + return takingType; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("takingId", getTakingId()) + .append("takingCode", getTakingCode()) + .append("takingName", getTakingName()) + .append("takingDate", getTakingDate()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("takingType", getTakingType()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java new file mode 100644 index 0000000..c2096af --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingLine.java @@ -0,0 +1,374 @@ +package com.ktg.mes.wm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存盘点明细对象 wm_stock_taking_line + * + * @author yinjinlu + * @date 2023-08-17 + */ +public class WmStockTakingLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 行ID */ + private Long lineId; + + /** 报废单ID */ + @Excel(name = "报废单ID") + private Long takingId; + + /** 库存ID */ + @Excel(name = "库存ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String unitName; + + /** 数量 */ + @Excel(name = "数量") + private Long quantity; + + /** 盘点数量 */ + @Excel(name = "盘点数量") + private Long takingQuantity; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 盘点状态 */ + @Excel(name = "盘点状态") + private String takingStatus; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setTakingId(Long takingId) + { + this.takingId = takingId; + } + + public Long getTakingId() + { + return takingId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setUnitName(String unitName) + { + this.unitName = unitName; + } + + public String getUnitName() + { + return unitName; + } + public void setQuantity(Long quantity) + { + this.quantity = quantity; + } + + public Long getQuantity() + { + return quantity; + } + public void setTakingQuantity(Long takingQuantity) + { + this.takingQuantity = takingQuantity; + } + + public Long getTakingQuantity() + { + return takingQuantity; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setTakingStatus(String takingStatus) + { + this.takingStatus = takingStatus; + } + + public String getTakingStatus() + { + return takingStatus; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("takingId", getTakingId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("unitName", getUnitName()) + .append("quantity", getQuantity()) + .append("takingQuantity", getTakingQuantity()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("takingStatus", getTakingStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java new file mode 100644 index 0000000..7ba140b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStockTakingResult.java @@ -0,0 +1,232 @@ +package com.ktg.mes.wm.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存盘点结果对象 wm_stock_taking_result + * + * @author yinjinlu + * @date 2023-08-22 + */ +public class WmStockTakingResult extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 结果ID */ + private Long resultId; + + /** 盘点单ID */ + @Excel(name = "盘点单ID") + private Long takingId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String unitName; + + /** 数量 */ + @Excel(name = "数量") + private Long quantity; + + /** 盘点数量 */ + @Excel(name = "盘点数量") + private Long takingQuantity; + + /** 盘点状态 */ + @Excel(name = "盘点状态") + private String takingStatus; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setResultId(Long resultId) { + this.resultId = resultId; + } + public Long getResultId() + { + return resultId; + } + public void setTakingId(Long takingId) + { + this.takingId = takingId; + } + + public Long getTakingId() + { + return takingId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setUnitName(String unitName) + { + this.unitName = unitName; + } + + public String getUnitName() + { + return unitName; + } + public void setQuantity(Long quantity) + { + this.quantity = quantity; + } + + public Long getQuantity() + { + return quantity; + } + public void setTakingQuantity(Long takingQuantity) + { + this.takingQuantity = takingQuantity; + } + + public Long getTakingQuantity() + { + return takingQuantity; + } + public void setTakingStatus(String takingStatus) + { + this.takingStatus = takingStatus; + } + + public String getTakingStatus() + { + return takingStatus; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("resultId", getResultId()) + .append("takingId", getTakingId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("unitName", getUnitName()) + .append("quantity", getQuantity()) + .append("takingQuantity", getTakingQuantity()) + .append("takingStatus", getTakingStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageArea.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageArea.java new file mode 100644 index 0000000..182e032 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageArea.java @@ -0,0 +1,232 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库位设置对象 wm_storage_area + * + * @author yinjinlu + * @date 2022-05-08 + */ +public class WmStorageArea extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 面积 */ + @Excel(name = "面积") + private BigDecimal area; + + /** 最大载重量 */ + @Excel(name = "最大载重量") + private BigDecimal maxLoa; + + /** 库位位置X */ + @Excel(name = "库位位置X") + private Long positionX; + + /** 库位位置y */ + @Excel(name = "库位位置y") + private Long positionY; + + /** 库位位置z */ + @Excel(name = "库位位置z") + private Long positionZ; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + private String frozenFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setArea(BigDecimal area) + { + this.area = area; + } + + public BigDecimal getArea() + { + return area; + } + public void setMaxLoa(BigDecimal maxLoa) + { + this.maxLoa = maxLoa; + } + + public BigDecimal getMaxLoa() + { + return maxLoa; + } + public void setPositionX(Long positionX) + { + this.positionX = positionX; + } + + public Long getPositionX() + { + return positionX; + } + public void setPositionY(Long positionY) + { + this.positionY = positionY; + } + + public Long getPositionY() + { + return positionY; + } + public void setPositionZ(Long positionZ) + { + this.positionZ = positionZ; + } + + public Long getPositionZ() + { + return positionZ; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + + public String getFrozenFlag() { + return frozenFlag; + } + + public void setFrozenFlag(String frozenFlag) { + this.frozenFlag = frozenFlag; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("locationId", getLocationId()) + .append("area", getArea()) + .append("maxLoa", getMaxLoa()) + .append("positionX", getPositionX()) + .append("positionY", getPositionY()) + .append("positionZ", getPositionZ()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageLocation.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageLocation.java new file mode 100644 index 0000000..0659aa3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageLocation.java @@ -0,0 +1,184 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.List; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库区设置对象 wm_storage_location + * + * @author yinjinlu + * @date 2022-05-07 + */ +public class WmStorageLocation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 面积 */ + @Excel(name = "面积") + private BigDecimal area; + + /** 是否开启库位管理 */ + @Excel(name = "是否开启库位管理") + private String areaFlag; + + private String frozenFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + private List children; + + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setArea(BigDecimal area) + { + this.area = area; + } + + public BigDecimal getArea() + { + return area; + } + public void setAreaFlag(String areaFlag) + { + this.areaFlag = areaFlag; + } + + public String getAreaFlag() + { + return areaFlag; + } + + public String getFrozenFlag() { + return frozenFlag; + } + + public void setFrozenFlag(String frozenFlag) { + this.frozenFlag = frozenFlag; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return "WmStorageLocation{" + + "locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", warehouseId=" + warehouseId + + ", area=" + area + + ", areaFlag='" + areaFlag + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + ", children=" + children + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransaction.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransaction.java new file mode 100644 index 0000000..6178c5a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransaction.java @@ -0,0 +1,592 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库存事务对象 wm_transaction + * + * @author yinjinlu + * @date 2022-05-24 + */ +public class WmTransaction extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 事务ID */ + private Long transactionId; + + /** 事务类型 */ + @Excel(name = "事务类型") + private String transactionType; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 入库批次号 */ + @Excel(name = "入库批次号") + private String batchCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编号 */ + @Excel(name = "供应商编号") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 单据类型 */ + @Excel(name = "单据类型") + private String sourceDocType; + + /** 单据ID */ + @Excel(name = "单据ID") + private Long sourceDocId; + + /** 单据编号 */ + @Excel(name = "单据编号") + private String sourceDocCode; + + /** 单据行ID */ + @Excel(name = "单据行ID") + private Long sourceDocLineId; + + /** 库存记录ID */ + @Excel(name = "库存记录ID") + private Long materialStockId; + + /** 库存方向 */ + @Excel(name = "库存方向") + private Integer transactionFlag; + + /** 事务数量 */ + @Excel(name = "事务数量") + private BigDecimal transactionQuantity; + + /** 事务日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "事务日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date transactionDate; + + /** 关联的事务ID */ + @Excel(name = "关联的事务ID") + private Long relatedTransactionId; + + /** ERP账期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "ERP账期", width = 30, dateFormat = "yyyy-MM-dd") + private Date erpDate; + + /** + * 生产工单ID + */ + private Long workorderId; + + /** + * 生产工单编号 + */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss") + private Date recptDate; + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "库存有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** + * 是否检查库存量 + * 如果设置为True则库存不允许为负 + */ + private boolean storageCheckFlag; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setTransactionId(Long transactionId) + { + this.transactionId = transactionId; + } + + public Long getTransactionId() + { + return transactionId; + } + public void setTransactionType(String transactionType) + { + this.transactionType = transactionType; + } + + public String getTransactionType() + { + return transactionType; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setSourceDocType(String sourceDocType) + { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocType() + { + return sourceDocType; + } + public void setSourceDocId(Long sourceDocId) + { + this.sourceDocId = sourceDocId; + } + + public Long getSourceDocId() + { + return sourceDocId; + } + public void setSourceDocCode(String sourceDocCode) + { + this.sourceDocCode = sourceDocCode; + } + + public String getSourceDocCode() + { + return sourceDocCode; + } + public void setSourceDocLineId(Long sourceDocLineId) + { + this.sourceDocLineId = sourceDocLineId; + } + + public Long getSourceDocLineId() + { + return sourceDocLineId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setTransactionFlag(Integer transactionFlag) + { + this.transactionFlag = transactionFlag; + } + + public Integer getTransactionFlag() + { + return transactionFlag; + } + public void setTransactionQuantity(BigDecimal transactionQuantity) + { + this.transactionQuantity = transactionQuantity; + } + + public BigDecimal getTransactionQuantity() + { + return transactionQuantity; + } + public void setTransactionDate(Date transactionDate) + { + this.transactionDate = transactionDate; + } + + public Date getTransactionDate() + { + return transactionDate; + } + public void setRelatedTransactionId(Long relatedTransactionId) + { + this.relatedTransactionId = relatedTransactionId; + } + + public Long getRelatedTransactionId() + { + return relatedTransactionId; + } + public void setErpDate(Date erpDate) + { + this.erpDate = erpDate; + } + + public Date getErpDate() + { + return erpDate; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public boolean isStorageCheckFlag() { + return storageCheckFlag; + } + + public void setStorageCheckFlag(boolean storageCheckFlag) { + this.storageCheckFlag = storageCheckFlag; + } + + @Override + public String toString() { + return "WmTransaction{" + + "transactionId=" + transactionId + + ", transactionType='" + transactionType + '\'' + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", materialStockId=" + materialStockId + + ", transactionFlag=" + transactionFlag + + ", transactionQuantity=" + transactionQuantity + + ", transactionDate=" + transactionDate + + ", relatedTransactionId=" + relatedTransactionId + + ", erpDate=" + erpDate + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", recptDate=" + recptDate + + ", expireDate=" + expireDate + + ", storageCheckFlag=" + storageCheckFlag + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransfer.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransfer.java new file mode 100644 index 0000000..5b0bae7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransfer.java @@ -0,0 +1,313 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 转移单对象 wm_transfer + * + * @author yinjinlu + * @date 2022-11-28 + */ +public class WmTransfer extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 转移单ID */ + private Long transferId; + + /** 转移单编号 */ + @Excel(name = "转移单编号") + private String transferCode; + + /** 转移单名称 */ + @Excel(name = "转移单名称") + private String transferName; + + /** 转移单类型 */ + @Excel(name = "转移单类型") + private String transferType; + + /** 目的地 */ + @Excel(name = "目的地") + private String destination; + + /** 承运商 */ + @Excel(name = "承运商") + private String carrier; + + /** 托运单号 */ + @Excel(name = "托运单号") + private String bookingNote; + + @Excel(name = "收货人") + private String receiver; + + @Excel(name = "收货人名称") + private String receiverNick; + + /** 移出仓库ID */ + @Excel(name = "移出仓库ID") + private Long fromWarehouseId; + + /** 移出仓库编码 */ + @Excel(name = "移出仓库编码") + private String fromWarehouseCode; + + /** 移出仓库名称 */ + @Excel(name = "移出仓库名称") + private String fromWarehouseName; + + /** 移入仓库ID */ + @Excel(name = "移入仓库ID") + private Long toWarehouseId; + + /** 移入仓库编码 */ + @Excel(name = "移入仓库编码") + private String toWarehouseCode; + + /** 移入仓库名称 */ + @Excel(name = "移入仓库名称") + private String toWarehouseName; + + /** 转移日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "转移日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date transferDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setTransferId(Long transferId) + { + this.transferId = transferId; + } + + public Long getTransferId() + { + return transferId; + } + public void setTransferCode(String transferCode) + { + this.transferCode = transferCode; + } + + public String getTransferCode() + { + return transferCode; + } + public void setTransferName(String transferName) + { + this.transferName = transferName; + } + + public String getTransferName() + { + return transferName; + } + public void setTransferType(String transferType) + { + this.transferType = transferType; + } + + public String getTransferType() + { + return transferType; + } + public void setDestination(String destination) + { + this.destination = destination; + } + + public String getDestination() + { + return destination; + } + public void setCarrier(String carrier) + { + this.carrier = carrier; + } + + public String getCarrier() + { + return carrier; + } + public void setBookingNote(String bookingNote) + { + this.bookingNote = bookingNote; + } + + public String getBookingNote() + { + return bookingNote; + } + + public String getReceiver() { + return receiver; + } + + public void setReceiver(String receiver) { + this.receiver = receiver; + } + + public String getReceiverNick() { + return receiverNick; + } + + public void setReceiverNick(String receiverNick) { + this.receiverNick = receiverNick; + } + + public void setFromWarehouseId(Long fromWarehouseId) + { + this.fromWarehouseId = fromWarehouseId; + } + + public Long getFromWarehouseId() + { + return fromWarehouseId; + } + public void setFromWarehouseCode(String fromWarehouseCode) + { + this.fromWarehouseCode = fromWarehouseCode; + } + + public String getFromWarehouseCode() + { + return fromWarehouseCode; + } + public void setFromWarehouseName(String fromWarehouseName) + { + this.fromWarehouseName = fromWarehouseName; + } + + public String getFromWarehouseName() + { + return fromWarehouseName; + } + public void setToWarehouseId(Long toWarehouseId) + { + this.toWarehouseId = toWarehouseId; + } + + public Long getToWarehouseId() + { + return toWarehouseId; + } + public void setToWarehouseCode(String toWarehouseCode) + { + this.toWarehouseCode = toWarehouseCode; + } + + public String getToWarehouseCode() + { + return toWarehouseCode; + } + public void setToWarehouseName(String toWarehouseName) + { + this.toWarehouseName = toWarehouseName; + } + + public String getToWarehouseName() + { + return toWarehouseName; + } + public void setTransferDate(Date transferDate) + { + this.transferDate = transferDate; + } + + public Date getTransferDate() + { + return transferDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return "WmTransfer{" + + "transferId=" + transferId + + ", transferCode='" + transferCode + '\'' + + ", transferName='" + transferName + '\'' + + ", transferType='" + transferType + '\'' + + ", destination='" + destination + '\'' + + ", carrier='" + carrier + '\'' + + ", bookingNote='" + bookingNote + '\'' + + ", receiver='" + receiver + '\'' + + ", receiverNick='" + receiverNick + '\'' + + ", fromWarehouseId=" + fromWarehouseId + + ", fromWarehouseCode='" + fromWarehouseCode + '\'' + + ", fromWarehouseName='" + fromWarehouseName + '\'' + + ", toWarehouseId=" + toWarehouseId + + ", toWarehouseCode='" + toWarehouseCode + '\'' + + ", toWarehouseName='" + toWarehouseName + '\'' + + ", transferDate=" + transferDate + + ", status='" + status + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransferLine.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransferLine.java new file mode 100644 index 0000000..2523e9c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmTransferLine.java @@ -0,0 +1,574 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 转移单行对象 wm_transfer_line + * + * @author yinjinlu + * @date 2022-11-28 + */ +public class WmTransferLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 明细行ID */ + private Long lineId; + + /** 装箱单ID */ + @Excel(name = "装箱单ID") + private Long transferId; + + /** 库存记录ID */ + @Excel(name = "库存记录ID") + private Long materialStockId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 装箱数量 */ + @Excel(name = "装箱数量") + private BigDecimal quantityTransfer; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编号 */ + @Excel(name = "生产工单编号") + private String workorderCode; + + /** 批次号 */ + @Excel(name = "批次号") + private String batchCode; + + /** 移出仓库ID */ + @Excel(name = "移出仓库ID") + private Long fromWarehouseId; + + /** 移出仓库编码 */ + @Excel(name = "移出仓库编码") + private String fromWarehouseCode; + + /** 移出仓库名称 */ + @Excel(name = "移出仓库名称") + private String fromWarehouseName; + + /** 移出库区ID */ + @Excel(name = "移出库区ID") + private Long fromLocationId; + + /** 移出库区编码 */ + @Excel(name = "移出库区编码") + private String fromLocationCode; + + /** 移出库区名称 */ + @Excel(name = "移出库区名称") + private String fromLocationName; + + /** 移出库位ID */ + @Excel(name = "移出库位ID") + private Long fromAreaId; + + /** 移出库位编码 */ + @Excel(name = "移出库位编码") + private String fromAreaCode; + + /** 移出库位名称 */ + @Excel(name = "移出库位名称") + private String fromAreaName; + + /** 移入仓库ID */ + @Excel(name = "移入仓库ID") + private Long toWarehouseId; + + /** 移入仓库编码 */ + @Excel(name = "移入仓库编码") + private String toWarehouseCode; + + /** 移入仓库名称 */ + @Excel(name = "移入仓库名称") + private String toWarehouseName; + + /** 移入库区ID */ + @Excel(name = "移入库区ID") + private Long toLocationId; + + /** 移入库区编码 */ + @Excel(name = "移入库区编码") + private String toLocationCode; + + /** 移入库区名称 */ + @Excel(name = "移入库区名称") + private String toLocationName; + + /** 移入库位ID */ + @Excel(name = "移入库位ID") + private Long toAreaId; + + /** 移入库位编码 */ + @Excel(name = "移入库位编码") + private String toAreaCode; + + /** 移入库位名称 */ + @Excel(name = "移入库位名称") + private String toAreaName; + + /** 有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expireDate; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + public void setTransferId(Long transferId) + { + this.transferId = transferId; + } + + public Long getTransferId() + { + return transferId; + } + public void setMaterialStockId(Long materialStockId) + { + this.materialStockId = materialStockId; + } + + public Long getMaterialStockId() + { + return materialStockId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityTransfer(BigDecimal quantityTransfer) + { + this.quantityTransfer = quantityTransfer; + } + + public BigDecimal getQuantityTransfer() + { + return quantityTransfer; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setFromWarehouseId(Long fromWarehouseId) + { + this.fromWarehouseId = fromWarehouseId; + } + + public Long getFromWarehouseId() + { + return fromWarehouseId; + } + public void setFromWarehouseCode(String fromWarehouseCode) + { + this.fromWarehouseCode = fromWarehouseCode; + } + + public String getFromWarehouseCode() + { + return fromWarehouseCode; + } + public void setFromWarehouseName(String fromWarehouseName) + { + this.fromWarehouseName = fromWarehouseName; + } + + public String getFromWarehouseName() + { + return fromWarehouseName; + } + public void setFromLocationId(Long fromLocationId) + { + this.fromLocationId = fromLocationId; + } + + public Long getFromLocationId() + { + return fromLocationId; + } + public void setFromLocationCode(String fromLocationCode) + { + this.fromLocationCode = fromLocationCode; + } + + public String getFromLocationCode() + { + return fromLocationCode; + } + public void setFromLocationName(String fromLocationName) + { + this.fromLocationName = fromLocationName; + } + + public String getFromLocationName() + { + return fromLocationName; + } + public void setFromAreaId(Long fromAreaId) + { + this.fromAreaId = fromAreaId; + } + + public Long getFromAreaId() + { + return fromAreaId; + } + public void setFromAreaCode(String fromAreaCode) + { + this.fromAreaCode = fromAreaCode; + } + + public String getFromAreaCode() + { + return fromAreaCode; + } + public void setFromAreaName(String fromAreaName) + { + this.fromAreaName = fromAreaName; + } + + public String getFromAreaName() + { + return fromAreaName; + } + public void setToWarehouseId(Long toWarehouseId) + { + this.toWarehouseId = toWarehouseId; + } + + public Long getToWarehouseId() + { + return toWarehouseId; + } + public void setToWarehouseCode(String toWarehouseCode) + { + this.toWarehouseCode = toWarehouseCode; + } + + public String getToWarehouseCode() + { + return toWarehouseCode; + } + public void setToWarehouseName(String toWarehouseName) + { + this.toWarehouseName = toWarehouseName; + } + + public String getToWarehouseName() + { + return toWarehouseName; + } + public void setToLocationId(Long toLocationId) + { + this.toLocationId = toLocationId; + } + + public Long getToLocationId() + { + return toLocationId; + } + public void setToLocationCode(String toLocationCode) + { + this.toLocationCode = toLocationCode; + } + + public String getToLocationCode() + { + return toLocationCode; + } + public void setToLocationName(String toLocationName) + { + this.toLocationName = toLocationName; + } + + public String getToLocationName() + { + return toLocationName; + } + public void setToAreaId(Long toAreaId) + { + this.toAreaId = toAreaId; + } + + public Long getToAreaId() + { + return toAreaId; + } + public void setToAreaCode(String toAreaCode) + { + this.toAreaCode = toAreaCode; + } + + public String getToAreaCode() + { + return toAreaCode; + } + public void setToAreaName(String toAreaName) + { + this.toAreaName = toAreaName; + } + + public String getToAreaName() + { + return toAreaName; + } + public void setExpireDate(Date expireDate) + { + this.expireDate = expireDate; + } + + public Date getExpireDate() + { + return expireDate; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("transferId", getTransferId()) + .append("materialStockId", getMaterialStockId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityTransfer", getQuantityTransfer()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("batchCode", getBatchCode()) + .append("fromWarehouseId", getFromWarehouseId()) + .append("fromWarehouseCode", getFromWarehouseCode()) + .append("fromWarehouseName", getFromWarehouseName()) + .append("fromLocationId", getFromLocationId()) + .append("fromLocationCode", getFromLocationCode()) + .append("fromLocationName", getFromLocationName()) + .append("fromAreaId", getFromAreaId()) + .append("fromAreaCode", getFromAreaCode()) + .append("fromAreaName", getFromAreaName()) + .append("toWarehouseId", getToWarehouseId()) + .append("toWarehouseCode", getToWarehouseCode()) + .append("toWarehouseName", getToWarehouseName()) + .append("toLocationId", getToLocationId()) + .append("toLocationCode", getToLocationCode()) + .append("toLocationName", getToLocationName()) + .append("toAreaId", getToAreaId()) + .append("toAreaCode", getToAreaCode()) + .append("toAreaName", getToAreaName()) + .append("expireDate", getExpireDate()) + .append("vendorId", getVendorId()) + .append("vendorCode", getVendorCode()) + .append("vendorName", getVendorName()) + .append("vendorNick", getVendorNick()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java new file mode 100644 index 0000000..ec21790 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java @@ -0,0 +1,184 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import java.util.List; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 仓库设置对象 wm_warehouse + * + * @author yinjinlu + * @date 2022-05-07 + */ +public class WmWarehouse extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 位置 */ + @Excel(name = "位置") + private String location; + + /** 面积 */ + @Excel(name = "面积") + private BigDecimal area; + + /** 负责人 */ + @Excel(name = "负责人") + private String charge; + + private String frozenFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + private List children; + + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocation(String location) + { + this.location = location; + } + + public String getLocation() + { + return location; + } + public void setArea(BigDecimal area) + { + this.area = area; + } + + public BigDecimal getArea() + { + return area; + } + public void setCharge(String charge) + { + this.charge = charge; + } + + public String getCharge() + { + return charge; + } + + public String getFrozenFlag() { + return frozenFlag; + } + + public void setFrozenFlag(String frozenFlag) { + this.frozenFlag = frozenFlag; + } + + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return "WmWarehouse{" + + "warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", location='" + location + '\'' + + ", area=" + area + + ", charge='" + charge + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + ", children=" + children + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/IssueTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/IssueTxBean.java new file mode 100644 index 0000000..f35f788 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/IssueTxBean.java @@ -0,0 +1,345 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class IssueTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 批次号 */ + private String batchCode; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** + * 生产工单ID + */ + private Long workorderId; + + /** + * 生产工单编号 + */ + private String workorderCode; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + @Override + public String toString() { + return "IssueTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ItemConsumeTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ItemConsumeTxBean.java new file mode 100644 index 0000000..ba16080 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ItemConsumeTxBean.java @@ -0,0 +1,296 @@ +package com.ktg.mes.wm.domain.tx; + +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; + +public class ItemConsumeTxBean extends BaseEntity { + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 物料ID */ + private Long itemId; + + /** 物料编码 */ + private String itemCode; + + /** 物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 生产工单ID **/ + private Long workorderId; + + + /** 生产工单编号 **/ + private String workorderCode; + + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + @Override + public String toString() { + return "ItemConsumeTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + '}'; + } + + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ItemRecptTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ItemRecptTxBean.java new file mode 100644 index 0000000..8572eff --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ItemRecptTxBean.java @@ -0,0 +1,334 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class ItemRecptTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date recptDate; + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expireDate; + + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } + + @Override + public String toString() { + return "ItemRecptTxBean{" + + "itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", recptDate=" + recptDate + + ", expireDate=" + expireDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/OutsourceIssueTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/OutsourceIssueTxBean.java new file mode 100644 index 0000000..19ad62f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/OutsourceIssueTxBean.java @@ -0,0 +1,343 @@ +package com.ktg.mes.wm.domain.tx; + +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; + +public class OutsourceIssueTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 批次号 */ + private String batchCode; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** + * 生产工单ID + */ + private Long workorderId; + + /** + * 生产工单编号 + */ + private String workorderCode; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + @Override + public String toString() { + return "OutsourceIssueTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/OutsourceRecptTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/OutsourceRecptTxBean.java new file mode 100644 index 0000000..ca9e8f3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/OutsourceRecptTxBean.java @@ -0,0 +1,333 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class OutsourceRecptTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date recptDate; + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expireDate; + + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } + + @Override + public String toString() { + return "OutsourceRecptTxBean{" + + "itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", recptDate=" + recptDate + + ", expireDate=" + expireDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductProductTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductProductTxBean.java new file mode 100644 index 0000000..84f138e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductProductTxBean.java @@ -0,0 +1,326 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class ProductProductTxBean extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 生产工单名称 */ + @Excel(name = "生产工单名称") + private String workorderName; + + /** 生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date produceDate; + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expireDate; + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public String getWorkorderName() { + return workorderName; + } + + public void setWorkorderName(String workorderName) { + this.workorderName = workorderName; + } + + public Date getProduceDate() { + return produceDate; + } + + public void setProduceDate(Date produceDate) { + this.produceDate = produceDate; + } + + @Override + public String toString() { + return "ProductProductTxBean{" + + "itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", workorderName='" + workorderName + '\'' + + ", produceDate=" + produceDate + + ", expireDate=" + expireDate + + '}'; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductRecptTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductRecptTxBean.java new file mode 100644 index 0000000..33a7049 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductRecptTxBean.java @@ -0,0 +1,324 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class ProductRecptTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 库存记录ID **/ + private Long materialStockId; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** + * 生产工单ID + */ + private Long workorderId; + + /** + * 生产工单编号 + */ + private String workorderCode; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date recptDate; + + /** 库存有效期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expireDate; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } + + @Override + public String toString() { + return "ProductRecptTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", recptDate=" + recptDate + + ", expireDate=" + expireDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductSalseTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductSalseTxBean.java new file mode 100644 index 0000000..ed11a17 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/ProductSalseTxBean.java @@ -0,0 +1,354 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class ProductSalseTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 物料ID */ + private Long itemId; + + /** 物料编码 */ + private String itemCode; + + /** 物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 客户ID */ + private Long clientId; + + /** 供应商编号 */ + private String clientCode; + + /** 供应商名称 */ + private String clientName; + + /** 供应商简称 */ + private String clientNick; + + /** 生产工单ID */ + private Long workorderId; + + /** 生产工单编号 */ + private String workorderCode; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 出库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date salseDate; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getClientId() { + return clientId; + } + + public void setClientId(Long clientId) { + this.clientId = clientId; + } + + public String getClientCode() { + return clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getClientNick() { + return clientNick; + } + + public void setClientNick(String clientNick) { + this.clientNick = clientNick; + } + + public Long getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(Long workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Date getSalseDate() { + return salseDate; + } + + public void setSalseDate(Date salseDate) { + this.salseDate = salseDate; + } + + @Override + public String toString() { + return "ProductSalseTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", clientNick='" + clientNick + '\'' + + ", workorderId=" + workorderId + + ", workorderCode='" + workorderCode + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", salseDate=" + salseDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtIssueTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtIssueTxBean.java new file mode 100644 index 0000000..dd83e32 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtIssueTxBean.java @@ -0,0 +1,330 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class RtIssueTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 物料ID */ + private Long itemId; + + /** 物料编码 */ + private String itemCode; + + /** 物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 入库日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date recptDate; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + @Override + public String toString() { + return "RtIssueTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", recptDate=" + recptDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java new file mode 100644 index 0000000..2e4dd01 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java @@ -0,0 +1,318 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class RtSalseTxBean extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 供应商ID */ + private Long clientId; + + /** 客户编号 */ + private String clientCode; + + /** 客户名称 */ + private String clientName; + + /** 客户简称 */ + private String clientNick; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 退货日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date rtDate; + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getClientId() { + return clientId; + } + + public void setClientId(Long clientId) { + this.clientId = clientId; + } + + public String getClientCode() { + return clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getClientNick() { + return clientNick; + } + + public void setClientNick(String clientNick) { + this.clientNick = clientNick; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Date getRtDate() { + return rtDate; + } + + public void setRtDate(Date rtDate) { + this.rtDate = rtDate; + } + + @Override + public String toString() { + return "RtSalseTxBean{" + + "itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", clientNick='" + clientNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", rtDate=" + rtDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtVendorTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtVendorTxBean.java new file mode 100644 index 0000000..ef1b668 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtVendorTxBean.java @@ -0,0 +1,315 @@ +package com.ktg.mes.wm.domain.tx; + +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; + +public class RtVendorTxBean extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + @Override + public String toString() { + return "RtVendorTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/TransferTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/TransferTxBean.java new file mode 100644 index 0000000..7c0571f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/TransferTxBean.java @@ -0,0 +1,470 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class TransferTxBean extends BaseEntity { + private static final long serialVersionUID = 1L; + + private Long materialStockId; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + private String workorderId; + + private String workorderCode; + + /** 供应商ID */ + private Long vendorId; + + /** 供应商编号 */ + private String vendorCode; + + /** 供应商名称 */ + private String vendorName; + + /** 供应商简称 */ + private String vendorNick; + + /** 移出仓库ID */ + private Long fromWarehouseId; + + /** 移出仓库编码 */ + private String fromWarehouseCode; + + /** 移出仓库名称 */ + private String fromWarehouseName; + + /** 移出库区ID */ + private Long fromLocationId; + + /** 移出库区编码 */ + private String fromLocationCode; + + /** 移出库区名称 */ + private String fromLocationName; + + /** 移出库位ID */ + private Long fromAreaId; + + /** 移出库位编码 */ + private String fromAreaCode; + + /** 移出库位名称 */ + private String fromAreaName; + + /** 移入仓库ID */ + private Long toWarehouseId; + + /** 移入仓库编码 */ + private String toWarehouseCode; + + /** 移入仓库名称 */ + private String toWarehouseName; + + /** 移入库区ID */ + private Long toLocationId; + + /** 移入库区编码 */ + private String toLocationCode; + + /** 移入库区名称 */ + private String toLocationName; + + /** 移入库位ID */ + private Long toAreaId; + + /** 移入库位编码 */ + private String toAreaCode; + + /** 移入库位名称 */ + private String toAreaName; + + private Date recptDate; + + /** 有效期 */ + private Date expireDate; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + public Long getMaterialStockId() { + return materialStockId; + } + + public void setMaterialStockId(Long materialStockId) { + this.materialStockId = materialStockId; + } + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public String getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(String workorderId) { + this.workorderId = workorderId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public Long getVendorId() { + return vendorId; + } + + public void setVendorId(Long vendorId) { + this.vendorId = vendorId; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorNick() { + return vendorNick; + } + + public void setVendorNick(String vendorNick) { + this.vendorNick = vendorNick; + } + + public Long getFromWarehouseId() { + return fromWarehouseId; + } + + public void setFromWarehouseId(Long fromWarehouseId) { + this.fromWarehouseId = fromWarehouseId; + } + + public String getFromWarehouseCode() { + return fromWarehouseCode; + } + + public void setFromWarehouseCode(String fromWarehouseCode) { + this.fromWarehouseCode = fromWarehouseCode; + } + + public String getFromWarehouseName() { + return fromWarehouseName; + } + + public void setFromWarehouseName(String fromWarehouseName) { + this.fromWarehouseName = fromWarehouseName; + } + + public Long getFromLocationId() { + return fromLocationId; + } + + public void setFromLocationId(Long fromLocationId) { + this.fromLocationId = fromLocationId; + } + + public String getFromLocationCode() { + return fromLocationCode; + } + + public void setFromLocationCode(String fromLocationCode) { + this.fromLocationCode = fromLocationCode; + } + + public String getFromLocationName() { + return fromLocationName; + } + + public void setFromLocationName(String fromLocationName) { + this.fromLocationName = fromLocationName; + } + + public Long getFromAreaId() { + return fromAreaId; + } + + public void setFromAreaId(Long fromAreaId) { + this.fromAreaId = fromAreaId; + } + + public String getFromAreaCode() { + return fromAreaCode; + } + + public void setFromAreaCode(String fromAreaCode) { + this.fromAreaCode = fromAreaCode; + } + + public String getFromAreaName() { + return fromAreaName; + } + + public void setFromAreaName(String fromAreaName) { + this.fromAreaName = fromAreaName; + } + + public Long getToWarehouseId() { + return toWarehouseId; + } + + public void setToWarehouseId(Long toWarehouseId) { + this.toWarehouseId = toWarehouseId; + } + + public String getToWarehouseCode() { + return toWarehouseCode; + } + + public void setToWarehouseCode(String toWarehouseCode) { + this.toWarehouseCode = toWarehouseCode; + } + + public String getToWarehouseName() { + return toWarehouseName; + } + + public void setToWarehouseName(String toWarehouseName) { + this.toWarehouseName = toWarehouseName; + } + + public Long getToLocationId() { + return toLocationId; + } + + public void setToLocationId(Long toLocationId) { + this.toLocationId = toLocationId; + } + + public String getToLocationCode() { + return toLocationCode; + } + + public void setToLocationCode(String toLocationCode) { + this.toLocationCode = toLocationCode; + } + + public String getToLocationName() { + return toLocationName; + } + + public void setToLocationName(String toLocationName) { + this.toLocationName = toLocationName; + } + + public Long getToAreaId() { + return toAreaId; + } + + public void setToAreaId(Long toAreaId) { + this.toAreaId = toAreaId; + } + + public String getToAreaCode() { + return toAreaCode; + } + + public void setToAreaCode(String toAreaCode) { + this.toAreaCode = toAreaCode; + } + + public String getToAreaName() { + return toAreaName; + } + + public void setToAreaName(String toAreaName) { + this.toAreaName = toAreaName; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } + + public Date getRecptDate() { + return recptDate; + } + + public void setRecptDate(Date recptDate) { + this.recptDate = recptDate; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + @Override + public String toString() { + return "TransferTxBean{" + + "materialStockId=" + materialStockId + + ", itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", workorderId='" + workorderId + '\'' + + ", workorderCode='" + workorderCode + '\'' + + ", vendorId=" + vendorId + + ", vendorCode='" + vendorCode + '\'' + + ", vendorName='" + vendorName + '\'' + + ", vendorNick='" + vendorNick + '\'' + + ", fromWarehouseId=" + fromWarehouseId + + ", fromWarehouseCode='" + fromWarehouseCode + '\'' + + ", fromWarehouseName='" + fromWarehouseName + '\'' + + ", fromLocationId=" + fromLocationId + + ", fromLocationCode='" + fromLocationCode + '\'' + + ", fromLocationName='" + fromLocationName + '\'' + + ", fromAreaId=" + fromAreaId + + ", fromAreaCode='" + fromAreaCode + '\'' + + ", fromAreaName='" + fromAreaName + '\'' + + ", toWarehouseId=" + toWarehouseId + + ", toWarehouseCode='" + toWarehouseCode + '\'' + + ", toWarehouseName='" + toWarehouseName + '\'' + + ", toLocationId=" + toLocationId + + ", toLocationCode='" + toLocationCode + '\'' + + ", toLocationName='" + toLocationName + '\'' + + ", toAreaId=" + toAreaId + + ", toAreaCode='" + toAreaCode + '\'' + + ", toAreaName='" + toAreaName + '\'' + + ", recptDate=" + recptDate + + ", expireDate=" + expireDate + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmBarcodeConfigMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmBarcodeConfigMapper.java new file mode 100644 index 0000000..ce5ef7c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmBarcodeConfigMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmBarcodeConfig; + +/** + * 条码配置Mapper接口 + * + * @author yinjinlu + * @date 2022-10-22 + */ +public interface WmBarcodeConfigMapper +{ + /** + * 查询条码配置 + * + * @param configId 条码配置主键 + * @return 条码配置 + */ + public WmBarcodeConfig selectWmBarcodeConfigByConfigId(Long configId); + + /** + * 查询条码配置列表 + * + * @param wmBarcodeConfig 条码配置 + * @return 条码配置集合 + */ + public List selectWmBarcodeConfigList(WmBarcodeConfig wmBarcodeConfig); + + /** + * 新增条码配置 + * + * @param wmBarcodeConfig 条码配置 + * @return 结果 + */ + public int insertWmBarcodeConfig(WmBarcodeConfig wmBarcodeConfig); + + /** + * 修改条码配置 + * + * @param wmBarcodeConfig 条码配置 + * @return 结果 + */ + public int updateWmBarcodeConfig(WmBarcodeConfig wmBarcodeConfig); + + /** + * 删除条码配置 + * + * @param configId 条码配置主键 + * @return 结果 + */ + public int deleteWmBarcodeConfigByConfigId(Long configId); + + /** + * 批量删除条码配置 + * + * @param configIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmBarcodeConfigByConfigIds(Long[] configIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmBarcodeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmBarcodeMapper.java new file mode 100644 index 0000000..306382e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmBarcodeMapper.java @@ -0,0 +1,69 @@ +package com.ktg.mes.wm.mapper; + +import com.ktg.mes.wm.domain.WmBarcode; + +import java.util.List; + +/** + * 条码清单Mapper接口 + * + * @author yinjinlu + * @date 2022-08-01 + */ +public interface WmBarcodeMapper +{ + /** + * 查询条码清单 + * + * @param barcodeId 条码清单主键 + * @return 条码清单 + */ + public WmBarcode selectWmBarcodeByBarcodeId(Long barcodeId); + + /** + * 查询条码清单列表 + * + * @param wmBarcode 条码清单 + * @return 条码清单集合 + */ + public List selectWmBarcodeList(WmBarcode wmBarcode); + + /** + * 检查当前条码类型下,对应的业务是否已经生成了条码 + * @param wmBarcode + * @return + */ + public WmBarcode checkBarcodeUnique(WmBarcode wmBarcode); + + /** + * 新增条码清单 + * + * @param wmBarcode 条码清单 + * @return 结果 + */ + public int insertWmBarcode(WmBarcode wmBarcode); + + /** + * 修改条码清单 + * + * @param wmBarcode 条码清单 + * @return 结果 + */ + public int updateWmBarcode(WmBarcode wmBarcode); + + /** + * 删除条码清单 + * + * @param barcodeId 条码清单主键 + * @return 结果 + */ + public int deleteWmBarcodeByBarcodeId(Long barcodeId); + + /** + * 批量删除条码清单 + * + * @param barcodeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmBarcodeByBarcodeIds(Long[] barcodeIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmIssueHeaderMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmIssueHeaderMapper.java new file mode 100644 index 0000000..070b0ae --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmIssueHeaderMapper.java @@ -0,0 +1,73 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmIssueHeader; +import com.ktg.mes.wm.domain.tx.IssueTxBean; + +/** + * 生产领料单头Mapper接口 + * + * @author yinjinlu + * @date 2022-07-14 + */ +public interface WmIssueHeaderMapper +{ + /** + * 查询生产领料单头 + * + * @param issueId 生产领料单头主键 + * @return 生产领料单头 + */ + public WmIssueHeader selectWmIssueHeaderByIssueId(Long issueId); + + /** + * 查询生产领料单头列表 + * + * @param wmIssueHeader 生产领料单头 + * @return 生产领料单头集合 + */ + public List selectWmIssueHeaderList(WmIssueHeader wmIssueHeader); + + /** + * 检查生产领料单编号是否唯一 + * @param wmIssueHeader + * @return + */ + public WmIssueHeader checkIssueCodeUnique(WmIssueHeader wmIssueHeader); + + /** + * 新增生产领料单头 + * + * @param wmIssueHeader 生产领料单头 + * @return 结果 + */ + public int insertWmIssueHeader(WmIssueHeader wmIssueHeader); + + /** + * 修改生产领料单头 + * + * @param wmIssueHeader 生产领料单头 + * @return 结果 + */ + public int updateWmIssueHeader(WmIssueHeader wmIssueHeader); + + /** + * 删除生产领料单头 + * + * @param issueId 生产领料单头主键 + * @return 结果 + */ + public int deleteWmIssueHeaderByIssueId(Long issueId); + + /** + * 批量删除生产领料单头 + * + * @param issueIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmIssueHeaderByIssueIds(Long[] issueIds); + + + public List getTxBeans(Long issueId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmIssueLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmIssueLineMapper.java new file mode 100644 index 0000000..a525c25 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmIssueLineMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmIssueLine; + +/** + * 生产领料单行Mapper接口 + * + * @author yinjinlu + * @date 2022-07-14 + */ +public interface WmIssueLineMapper +{ + /** + * 查询生产领料单行 + * + * @param lineId 生产领料单行主键 + * @return 生产领料单行 + */ + public WmIssueLine selectWmIssueLineByLineId(Long lineId); + + /** + * 查询生产领料单行列表 + * + * @param wmIssueLine 生产领料单行 + * @return 生产领料单行集合 + */ + public List selectWmIssueLineList(WmIssueLine wmIssueLine); + + /** + * 新增生产领料单行 + * + * @param wmIssueLine 生产领料单行 + * @return 结果 + */ + public int insertWmIssueLine(WmIssueLine wmIssueLine); + + /** + * 修改生产领料单行 + * + * @param wmIssueLine 生产领料单行 + * @return 结果 + */ + public int updateWmIssueLine(WmIssueLine wmIssueLine); + + /** + * 删除生产领料单行 + * + * @param lineId 生产领料单行主键 + * @return 结果 + */ + public int deleteWmIssueLineByLineId(Long lineId); + + /** + * 批量删除生产领料单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmIssueLineByLineIds(Long[] lineIds); + + public int deleteByIssueHeaderId(Long issueId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemConsumeLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemConsumeLineMapper.java new file mode 100644 index 0000000..05493c8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemConsumeLineMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemConsumeLine; + +/** + * 物料消耗记录行Mapper接口 + * + * @author yinjinlu + * @date 2022-09-19 + */ +public interface WmItemConsumeLineMapper +{ + /** + * 查询物料消耗记录行 + * + * @param lineId 物料消耗记录行主键 + * @return 物料消耗记录行 + */ + public WmItemConsumeLine selectWmItemConsumeLineByLineId(Long lineId); + + /** + * 查询物料消耗记录行列表 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 物料消耗记录行集合 + */ + public List selectWmItemConsumeLineList(WmItemConsumeLine wmItemConsumeLine); + + /** + * 新增物料消耗记录行 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 结果 + */ + public int insertWmItemConsumeLine(WmItemConsumeLine wmItemConsumeLine); + + /** + * 修改物料消耗记录行 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 结果 + */ + public int updateWmItemConsumeLine(WmItemConsumeLine wmItemConsumeLine); + + /** + * 删除物料消耗记录行 + * + * @param lineId 物料消耗记录行主键 + * @return 结果 + */ + public int deleteWmItemConsumeLineByLineId(Long lineId); + + /** + * 批量删除物料消耗记录行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmItemConsumeLineByLineIds(Long[] lineIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemConsumeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemConsumeMapper.java new file mode 100644 index 0000000..c8c8f40 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemConsumeMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemConsume; +import com.ktg.mes.wm.domain.tx.ItemConsumeTxBean; + +/** + * 物料消耗记录Mapper接口 + * + * @author yinjinlu + * @date 2022-09-19 + */ +public interface WmItemConsumeMapper +{ + /** + * 查询物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 物料消耗记录 + */ + public WmItemConsume selectWmItemConsumeByRecordId(Long recordId); + + /** + * 查询物料消耗记录列表 + * + * @param wmItemConsume 物料消耗记录 + * @return 物料消耗记录集合 + */ + public List selectWmItemConsumeList(WmItemConsume wmItemConsume); + + /** + * 新增物料消耗记录 + * + * @param wmItemConsume 物料消耗记录 + * @return 结果 + */ + public int insertWmItemConsume(WmItemConsume wmItemConsume); + + /** + * 修改物料消耗记录 + * + * @param wmItemConsume 物料消耗记录 + * @return 结果 + */ + public int updateWmItemConsume(WmItemConsume wmItemConsume); + + /** + * 删除物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 结果 + */ + public int deleteWmItemConsumeByRecordId(Long recordId); + + /** + * 批量删除物料消耗记录 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmItemConsumeByRecordIds(Long[] recordIds); + + public List getTxBeans(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemRecptLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemRecptLineMapper.java new file mode 100644 index 0000000..c1546b2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemRecptLineMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemRecptLine; + +/** + * 物料入库单行Mapper接口 + * + * @author yinjinlu + * @date 2022-05-22 + */ +public interface WmItemRecptLineMapper +{ + /** + * 查询物料入库单行 + * + * @param lineId 物料入库单行主键 + * @return 物料入库单行 + */ + public WmItemRecptLine selectWmItemRecptLineByLineId(Long lineId); + + /** + * 查询物料入库单行列表 + * + * @param wmItemRecptLine 物料入库单行 + * @return 物料入库单行集合 + */ + public List selectWmItemRecptLineList(WmItemRecptLine wmItemRecptLine); + + /** + * 新增物料入库单行 + * + * @param wmItemRecptLine 物料入库单行 + * @return 结果 + */ + public int insertWmItemRecptLine(WmItemRecptLine wmItemRecptLine); + + /** + * 修改物料入库单行 + * + * @param wmItemRecptLine 物料入库单行 + * @return 结果 + */ + public int updateWmItemRecptLine(WmItemRecptLine wmItemRecptLine); + + /** + * 删除物料入库单行 + * + * @param lineId 物料入库单行主键 + * @return 结果 + */ + public int deleteWmItemRecptLineByLineId(Long lineId); + + /** + * 批量删除物料入库单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmItemRecptLineByLineIds(Long[] lineIds); + + public int deleteByRecptId(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemRecptMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemRecptMapper.java new file mode 100644 index 0000000..bfb8a98 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmItemRecptMapper.java @@ -0,0 +1,67 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemRecpt; +import com.ktg.mes.wm.domain.tx.ItemRecptTxBean; + +/** + * 物料入库单Mapper接口 + * + * @author yinjinlu + * @date 2022-05-22 + */ +public interface WmItemRecptMapper +{ + /** + * 查询物料入库单 + * + * @param recptId 物料入库单主键 + * @return 物料入库单 + */ + public WmItemRecpt selectWmItemRecptByRecptId(Long recptId); + + /** + * 查询物料入库单列表 + * + * @param wmItemRecpt 物料入库单 + * @return 物料入库单集合 + */ + public List selectWmItemRecptList(WmItemRecpt wmItemRecpt); + + public WmItemRecpt checkRecptCodeUnique(WmItemRecpt wmItemRecpt); + + + public List getTxBeans(Long recptId); + + /** + * 新增物料入库单 + * + * @param wmItemRecpt 物料入库单 + * @return 结果 + */ + public int insertWmItemRecpt(WmItemRecpt wmItemRecpt); + + /** + * 修改物料入库单 + * + * @param wmItemRecpt 物料入库单 + * @return 结果 + */ + public int updateWmItemRecpt(WmItemRecpt wmItemRecpt); + + /** + * 删除物料入库单 + * + * @param recptId 物料入库单主键 + * @return 结果 + */ + public int deleteWmItemRecptByRecptId(Long recptId); + + /** + * 批量删除物料入库单 + * + * @param recptIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmItemRecptByRecptIds(Long[] recptIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmMaterialStockMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmMaterialStockMapper.java new file mode 100644 index 0000000..02c27e2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmMaterialStockMapper.java @@ -0,0 +1,73 @@ +package com.ktg.mes.wm.mapper; + +import com.ktg.mes.wm.domain.WmMaterialStock; + +import java.util.List; + +/** + * 库存记录Mapper接口 + * + * @author yinjinlu + * @date 2022-05-24 + */ +public interface WmMaterialStockMapper +{ + /** + * 查询库存记录 + * + * @param materialStockId 库存记录主键 + * @return 库存记录 + */ + public WmMaterialStock selectWmMaterialStockByMaterialStockId(Long materialStockId); + + + public WmMaterialStock loadMaterialStock(WmMaterialStock stock); + + /** + * 查询库存记录列表 + * + * @param wmMaterialStock 库存记录 + * @return 库存记录集合 + */ + public List selectWmMaterialStockList(WmMaterialStock wmMaterialStock); + + /** + * 模糊查询库存记录列表 + * + * @param wmMaterialStock 库存记录 + * @return 库存记录集合 + */ + public List queryWmMaterialStockList(WmMaterialStock wmMaterialStock); + + /** + * 新增库存记录 + * + * @param wmMaterialStock 库存记录 + * @return 结果 + */ + public int insertWmMaterialStock(WmMaterialStock wmMaterialStock); + + /** + * 修改库存记录 + * + * @param wmMaterialStock 库存记录 + * @return 结果 + */ + public int updateWmMaterialStock(WmMaterialStock wmMaterialStock); + + /** + * 删除库存记录 + * + * @param materialStockId 库存记录主键 + * @return 结果 + */ + public int deleteWmMaterialStockByMaterialStockId(Long materialStockId); + + /** + * 批量删除库存记录 + * + * @param materialStockIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmMaterialStockByMaterialStockIds(Long[] materialStockIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceIssueLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceIssueLineMapper.java new file mode 100644 index 0000000..cc75a42 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceIssueLineMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceIssueLine; + +/** + * 外协领料单行Mapper接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface WmOutsourceIssueLineMapper +{ + /** + * 查询外协领料单行 + * + * @param lineId 外协领料单行主键 + * @return 外协领料单行 + */ + public WmOutsourceIssueLine selectWmOutsourceIssueLineByLineId(Long lineId); + + /** + * 查询外协领料单行列表 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 外协领料单行集合 + */ + public List selectWmOutsourceIssueLineList(WmOutsourceIssueLine wmOutsourceIssueLine); + + /** + * 根据发货单ID查询所有行信息 + * @param issueId + * @return + */ + public List selectWmOutsourceIssueLineByIssueId(Long issueId); + + /** + * 新增外协领料单行 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 结果 + */ + public int insertWmOutsourceIssueLine(WmOutsourceIssueLine wmOutsourceIssueLine); + + /** + * 修改外协领料单行 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 结果 + */ + public int updateWmOutsourceIssueLine(WmOutsourceIssueLine wmOutsourceIssueLine); + + /** + * 删除外协领料单行 + * + * @param lineId 外协领料单行主键 + * @return 结果 + */ + public int deleteWmOutsourceIssueLineByLineId(Long lineId); + + /** + * 批量删除外协领料单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmOutsourceIssueLineByLineIds(Long[] lineIds); + + /** + * 根据发料单ID删除所有行 + * @param issueId + * @return + */ + public int deleteWmOutsourceIssueLineByIssueId(Long issueId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceIssueMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceIssueMapper.java new file mode 100644 index 0000000..37db478 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceIssueMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceIssue; +import com.ktg.mes.wm.domain.tx.OutsourceIssueTxBean; + +/** + * 外协领料单头Mapper接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface WmOutsourceIssueMapper +{ + /** + * 查询外协领料单头 + * + * @param issueId 外协领料单头主键 + * @return 外协领料单头 + */ + public WmOutsourceIssue selectWmOutsourceIssueByIssueId(Long issueId); + + /** + * 查询外协领料单头列表 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 外协领料单头集合 + */ + public List selectWmOutsourceIssueList(WmOutsourceIssue wmOutsourceIssue); + + /** + * 新增外协领料单头 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 结果 + */ + public int insertWmOutsourceIssue(WmOutsourceIssue wmOutsourceIssue); + + /** + * 修改外协领料单头 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 结果 + */ + public int updateWmOutsourceIssue(WmOutsourceIssue wmOutsourceIssue); + + /** + * 删除外协领料单头 + * + * @param issueId 外协领料单头主键 + * @return 结果 + */ + public int deleteWmOutsourceIssueByIssueId(Long issueId); + + /** + * 批量删除外协领料单头 + * + * @param issueIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmOutsourceIssueByIssueIds(Long[] issueIds); + + public List getTxBeans(Long issueId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceRecptLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceRecptLineMapper.java new file mode 100644 index 0000000..65d9aa2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceRecptLineMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceRecptLine; + +/** + * 外协入库单行Mapper接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface WmOutsourceRecptLineMapper +{ + /** + * 查询外协入库单行 + * + * @param lineId 外协入库单行主键 + * @return 外协入库单行 + */ + public WmOutsourceRecptLine selectWmOutsourceRecptLineByLineId(Long lineId); + + /** + * 查询外协入库单行列表 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 外协入库单行集合 + */ + public List selectWmOutsourceRecptLineList(WmOutsourceRecptLine wmOutsourceRecptLine); + + /** + * 根据外协入库单ID查询所有入库单行 + * @param recptId + * @return + */ + public List selectWmOutsourceRecptLineByRecptId(Long recptId); + + /** + * 新增外协入库单行 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 结果 + */ + public int insertWmOutsourceRecptLine(WmOutsourceRecptLine wmOutsourceRecptLine); + + /** + * 修改外协入库单行 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 结果 + */ + public int updateWmOutsourceRecptLine(WmOutsourceRecptLine wmOutsourceRecptLine); + + /** + * 删除外协入库单行 + * + * @param lineId 外协入库单行主键 + * @return 结果 + */ + public int deleteWmOutsourceRecptLineByLineId(Long lineId); + + /** + * 批量删除外协入库单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmOutsourceRecptLineByLineIds(Long[] lineIds); + + /** + * 根据外协入库单头ID删除所有行 + * @param recptId + * @return + */ + public int deleteWmOutsourceRecptLineByRecptId(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceRecptMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceRecptMapper.java new file mode 100644 index 0000000..f6d1dc2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmOutsourceRecptMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceRecpt; +import com.ktg.mes.wm.domain.tx.OutsourceRecptTxBean; + +/** + * 外协入库单Mapper接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface WmOutsourceRecptMapper +{ + /** + * 查询外协入库单 + * + * @param recptId 外协入库单主键 + * @return 外协入库单 + */ + public WmOutsourceRecpt selectWmOutsourceRecptByRecptId(Long recptId); + + /** + * 查询外协入库单列表 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 外协入库单集合 + */ + public List selectWmOutsourceRecptList(WmOutsourceRecpt wmOutsourceRecpt); + + /** + * 新增外协入库单 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 结果 + */ + public int insertWmOutsourceRecpt(WmOutsourceRecpt wmOutsourceRecpt); + + /** + * 修改外协入库单 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 结果 + */ + public int updateWmOutsourceRecpt(WmOutsourceRecpt wmOutsourceRecpt); + + /** + * 删除外协入库单 + * + * @param recptId 外协入库单主键 + * @return 结果 + */ + public int deleteWmOutsourceRecptByRecptId(Long recptId); + + /** + * 批量删除外协入库单 + * + * @param recptIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmOutsourceRecptByRecptIds(Long[] recptIds); + + public List getTxBeans(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmPackageLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmPackageLineMapper.java new file mode 100644 index 0000000..65e10b7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmPackageLineMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmPackageLine; + +/** + * 装箱明细Mapper接口 + * + * @author yinjinlu + * @date 2022-10-11 + */ +public interface WmPackageLineMapper +{ + /** + * 查询装箱明细 + * + * @param lineId 装箱明细主键 + * @return 装箱明细 + */ + public WmPackageLine selectWmPackageLineByLineId(Long lineId); + + /** + * 查询装箱明细列表 + * + * @param wmPackageLine 装箱明细 + * @return 装箱明细集合 + */ + public List selectWmPackageLineList(WmPackageLine wmPackageLine); + + /** + * 新增装箱明细 + * + * @param wmPackageLine 装箱明细 + * @return 结果 + */ + public int insertWmPackageLine(WmPackageLine wmPackageLine); + + /** + * 修改装箱明细 + * + * @param wmPackageLine 装箱明细 + * @return 结果 + */ + public int updateWmPackageLine(WmPackageLine wmPackageLine); + + /** + * 删除装箱明细 + * + * @param lineId 装箱明细主键 + * @return 结果 + */ + public int deleteWmPackageLineByLineId(Long lineId); + + /** + * 批量删除装箱明细 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmPackageLineByLineIds(Long[] lineIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmPackageMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmPackageMapper.java new file mode 100644 index 0000000..21b940b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmPackageMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmPackage; + +/** + * 装箱单Mapper接口 + * + * @author yinjinlu + * @date 2022-10-10 + */ +public interface WmPackageMapper +{ + /** + * 查询装箱单 + * + * @param packageId 装箱单主键 + * @return 装箱单 + */ + public WmPackage selectWmPackageByPackageId(Long packageId); + + /** + * 查询装箱单列表 + * + * @param wmPackage 装箱单 + * @return 装箱单集合 + */ + public List selectWmPackageList(WmPackage wmPackage); + + /** + * 检查装箱单编号是否唯一 + * @param wmPackage + * @return + */ + public WmPackage checkPackgeCodeUnique(WmPackage wmPackage); + + /** + * 新增装箱单 + * + * @param wmPackage 装箱单 + * @return 结果 + */ + public int insertWmPackage(WmPackage wmPackage); + + /** + * 修改装箱单 + * + * @param wmPackage 装箱单 + * @return 结果 + */ + public int updateWmPackage(WmPackage wmPackage); + + /** + * 删除装箱单 + * + * @param packageId 装箱单主键 + * @return 结果 + */ + public int deleteWmPackageByPackageId(Long packageId); + + /** + * 批量删除装箱单 + * + * @param packageIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmPackageByPackageIds(Long[] packageIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductProduceLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductProduceLineMapper.java new file mode 100644 index 0000000..48c52e9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductProduceLineMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductProduceLine; + +/** + * 产品产出记录行Mapper接口 + * + * @author yinjinlu + * @date 2022-09-22 + */ +public interface WmProductProduceLineMapper +{ + /** + * 查询产品产出记录行 + * + * @param lineId 产品产出记录行主键 + * @return 产品产出记录行 + */ + public WmProductProduceLine selectWmProductProduceLineByLineId(Long lineId); + + /** + * 查询产品产出记录行列表 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 产品产出记录行集合 + */ + public List selectWmProductProduceLineList(WmProductProduceLine wmProductProduceLine); + + /** + * 新增产品产出记录行 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 结果 + */ + public int insertWmProductProduceLine(WmProductProduceLine wmProductProduceLine); + + /** + * 修改产品产出记录行 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 结果 + */ + public int updateWmProductProduceLine(WmProductProduceLine wmProductProduceLine); + + /** + * 删除产品产出记录行 + * + * @param lineId 产品产出记录行主键 + * @return 结果 + */ + public int deleteWmProductProduceLineByLineId(Long lineId); + + /** + * 批量删除产品产出记录行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmProductProduceLineByLineIds(Long[] lineIds); + + /** + * + * @param recordId + * @return + */ + public int deleteByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductProduceMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductProduceMapper.java new file mode 100644 index 0000000..695a121 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductProduceMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductProduce; +import com.ktg.mes.wm.domain.tx.ProductProductTxBean; + +/** + * 产品产出记录Mapper接口 + * + * @author yinjinlu + * @date 2022-09-21 + */ +public interface WmProductProduceMapper +{ + /** + * 查询产品产出记录 + * + * @param recordId 产品产出记录主键 + * @return 产品产出记录 + */ + public WmProductProduce selectWmProductProduceByRecordId(Long recordId); + + /** + * 查询产品产出记录列表 + * + * @param wmProductProduce 产品产出记录 + * @return 产品产出记录集合 + */ + public List selectWmProductProduceList(WmProductProduce wmProductProduce); + + /** + * 新增产品产出记录 + * + * @param wmProductProduce 产品产出记录 + * @return 结果 + */ + public int insertWmProductProduce(WmProductProduce wmProductProduce); + + /** + * 修改产品产出记录 + * + * @param wmProductProduce 产品产出记录 + * @return 结果 + */ + public int updateWmProductProduce(WmProductProduce wmProductProduce); + + /** + * 删除产品产出记录 + * + * @param recordId 产品产出记录主键 + * @return 结果 + */ + public int deleteWmProductProduceByRecordId(Long recordId); + + /** + * 批量删除产品产出记录 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmProductProduceByRecordIds(Long[] recordIds); + + public List getTxBeans(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductRecptLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductRecptLineMapper.java new file mode 100644 index 0000000..8286cf1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductRecptLineMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductRecptLine; + +/** + * 产品入库记录行Mapper接口 + * + * @author yinjinlu + * @date 2022-09-22 + */ +public interface WmProductRecptLineMapper +{ + /** + * 查询产品入库记录行 + * + * @param lineId 产品入库记录行主键 + * @return 产品入库记录行 + */ + public WmProductRecptLine selectWmProductRecptLineByLineId(Long lineId); + + /** + * 查询产品入库记录行列表 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 产品入库记录行集合 + */ + public List selectWmProductRecptLineList(WmProductRecptLine wmProductRecptLine); + + /** + * 新增产品入库记录行 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 结果 + */ + public int insertWmProductRecptLine(WmProductRecptLine wmProductRecptLine); + + /** + * 修改产品入库记录行 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 结果 + */ + public int updateWmProductRecptLine(WmProductRecptLine wmProductRecptLine); + + /** + * 删除产品入库记录行 + * + * @param lineId 产品入库记录行主键 + * @return 结果 + */ + public int deleteWmProductRecptLineByLineId(Long lineId); + + /** + * 批量删除产品入库记录行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmProductRecptLineByLineIds(Long[] lineIds); + + /** + * 根据入库单ID删除所有行 + * @param recptId + * @return + */ + public int deleteByRecptId(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductRecptMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductRecptMapper.java new file mode 100644 index 0000000..a5eaf85 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductRecptMapper.java @@ -0,0 +1,72 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductRecpt; +import com.ktg.mes.wm.domain.tx.ProductRecptTxBean; + +/** + * 产品入库录Mapper接口 + * + * @author yinjinlu + * @date 2022-09-22 + */ +public interface WmProductRecptMapper +{ + /** + * 查询产品入库录 + * + * @param recptId 产品入库录主键 + * @return 产品入库录 + */ + public WmProductRecpt selectWmProductRecptByRecptId(Long recptId); + + /** + * 查询产品入库录列表 + * + * @param wmProductRecpt 产品入库录 + * @return 产品入库录集合 + */ + public List selectWmProductRecptList(WmProductRecpt wmProductRecpt); + + /** + * 检查编码唯一性 + * @param wmProductRecpt + * @return + */ + public WmProductRecpt checkUnique(WmProductRecpt wmProductRecpt); + + /** + * 新增产品入库录 + * + * @param wmProductRecpt 产品入库录 + * @return 结果 + */ + public int insertWmProductRecpt(WmProductRecpt wmProductRecpt); + + /** + * 修改产品入库录 + * + * @param wmProductRecpt 产品入库录 + * @return 结果 + */ + public int updateWmProductRecpt(WmProductRecpt wmProductRecpt); + + /** + * 删除产品入库录 + * + * @param recptId 产品入库录主键 + * @return 结果 + */ + public int deleteWmProductRecptByRecptId(Long recptId); + + /** + * 批量删除产品入库录 + * + * @param recptIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmProductRecptByRecptIds(Long[] recptIds); + + + public List getTxBean(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductSalseLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductSalseLineMapper.java new file mode 100644 index 0000000..b0221e9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductSalseLineMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductSalseLine; + +/** + * 产品销售出库行Mapper接口 + * + * @author yinjinlu + * @date 2022-10-05 + */ +public interface WmProductSalseLineMapper +{ + /** + * 查询产品销售出库行 + * + * @param lineId 产品销售出库行主键 + * @return 产品销售出库行 + */ + public WmProductSalseLine selectWmProductSalseLineByLineId(Long lineId); + + /** + * 查询产品销售出库行列表 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 产品销售出库行集合 + */ + public List selectWmProductSalseLineList(WmProductSalseLine wmProductSalseLine); + + /** + * 新增产品销售出库行 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 结果 + */ + public int insertWmProductSalseLine(WmProductSalseLine wmProductSalseLine); + + /** + * 修改产品销售出库行 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 结果 + */ + public int updateWmProductSalseLine(WmProductSalseLine wmProductSalseLine); + + /** + * 删除产品销售出库行 + * + * @param lineId 产品销售出库行主键 + * @return 结果 + */ + public int deleteWmProductSalseLineByLineId(Long lineId); + + /** + * 批量删除产品销售出库行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmProductSalseLineByLineIds(Long[] lineIds); + + /** + * 根据出库单头删除所有行 + * @param salseId + * @return + */ + public int deleteBySalseId(Long salseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductSalseMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductSalseMapper.java new file mode 100644 index 0000000..af945da --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmProductSalseMapper.java @@ -0,0 +1,76 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductSalse; +import com.ktg.mes.wm.domain.tx.ProductSalseTxBean; + +/** + * 销售出库单Mapper接口 + * + * @author yinjinlu + * @date 2022-10-04 + */ +public interface WmProductSalseMapper +{ + /** + * 查询销售出库单 + * + * @param salseId 销售出库单主键 + * @return 销售出库单 + */ + public WmProductSalse selectWmProductSalseBySalseId(Long salseId); + + /** + * 查询销售出库单列表 + * + * @param wmProductSalse 销售出库单 + * @return 销售出库单集合 + */ + public List selectWmProductSalseList(WmProductSalse wmProductSalse); + + /** + * 检查编号唯一性 + * @param wmProductSalse + * @return + */ + public WmProductSalse checkUnique(WmProductSalse wmProductSalse); + + /** + * 新增销售出库单 + * + * @param wmProductSalse 销售出库单 + * @return 结果 + */ + public int insertWmProductSalse(WmProductSalse wmProductSalse); + + /** + * 修改销售出库单 + * + * @param wmProductSalse 销售出库单 + * @return 结果 + */ + public int updateWmProductSalse(WmProductSalse wmProductSalse); + + /** + * 删除销售出库单 + * + * @param salseId 销售出库单主键 + * @return 结果 + */ + public int deleteWmProductSalseBySalseId(Long salseId); + + /** + * 批量删除销售出库单 + * + * @param salseIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmProductSalseBySalseIds(Long[] salseIds); + + /** + * 获取产品销售出库事务Bean + * @param salseId + * @return + */ + public List getTxBeans(Long salseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueLineMapper.java new file mode 100644 index 0000000..a427494 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueLineMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtIssueLine; + +/** + * 生产退料单行Mapper接口 + * + * @author yinjinlu + * @date 2022-09-15 + */ +public interface WmRtIssueLineMapper +{ + /** + * 查询生产退料单行 + * + * @param lineId 生产退料单行主键 + * @return 生产退料单行 + */ + public WmRtIssueLine selectWmRtIssueLineByLineId(Long lineId); + + /** + * 查询生产退料单行列表 + * + * @param wmRtIssueLine 生产退料单行 + * @return 生产退料单行集合 + */ + public List selectWmRtIssueLineList(WmRtIssueLine wmRtIssueLine); + + /** + * 新增生产退料单行 + * + * @param wmRtIssueLine 生产退料单行 + * @return 结果 + */ + public int insertWmRtIssueLine(WmRtIssueLine wmRtIssueLine); + + /** + * 修改生产退料单行 + * + * @param wmRtIssueLine 生产退料单行 + * @return 结果 + */ + public int updateWmRtIssueLine(WmRtIssueLine wmRtIssueLine); + + /** + * 删除生产退料单行 + * + * @param lineId 生产退料单行主键 + * @return 结果 + */ + public int deleteWmRtIssueLineByLineId(Long lineId); + + /** + * 批量删除生产退料单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtIssueLineByLineIds(Long[] lineIds); + + /** + * 根据退料单ID删除所有行 + * @param rtId + * @return + */ + public int deleteByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueMapper.java new file mode 100644 index 0000000..bb6b8f7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueMapper.java @@ -0,0 +1,76 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtIssue; +import com.ktg.mes.wm.domain.tx.RtIssueTxBean; + +/** + * 生产退料单头Mapper接口 + * + * @author yinjinlu + * @date 2022-09-15 + */ +public interface WmRtIssueMapper +{ + /** + * 查询生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 生产退料单头 + */ + public WmRtIssue selectWmRtIssueByRtId(Long rtId); + + /** + * 查询生产退料单头列表 + * + * @param wmRtIssue 生产退料单头 + * @return 生产退料单头集合 + */ + public List selectWmRtIssueList(WmRtIssue wmRtIssue); + + /** + * + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + + /** + * 检查编号是否重复 + * @param wmRtIssue + * @return + */ + public WmRtIssue checkUnique(WmRtIssue wmRtIssue); + + /** + * 新增生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int insertWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 修改生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int updateWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 删除生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 结果 + */ + public int deleteWmRtIssueByRtId(Long rtId); + + /** + * 批量删除生产退料单头 + * + * @param rtIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtIssueByRtIds(Long[] rtIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseLineMapper.java new file mode 100644 index 0000000..e435ff8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseLineMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtSalseLine; + +/** + * 产品销售退货行Mapper接口 + * + * @author yinjinlu + * @date 2022-10-06 + */ +public interface WmRtSalseLineMapper +{ + /** + * 查询产品销售退货行 + * + * @param lineId 产品销售退货行主键 + * @return 产品销售退货行 + */ + public WmRtSalseLine selectWmRtSalseLineByLineId(Long lineId); + + /** + * 查询产品销售退货行列表 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 产品销售退货行集合 + */ + public List selectWmRtSalseLineList(WmRtSalseLine wmRtSalseLine); + + /** + * 新增产品销售退货行 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 结果 + */ + public int insertWmRtSalseLine(WmRtSalseLine wmRtSalseLine); + + /** + * 修改产品销售退货行 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 结果 + */ + public int updateWmRtSalseLine(WmRtSalseLine wmRtSalseLine); + + /** + * 删除产品销售退货行 + * + * @param lineId 产品销售退货行主键 + * @return 结果 + */ + public int deleteWmRtSalseLineByLineId(Long lineId); + + /** + * 批量删除产品销售退货行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtSalseLineByLineIds(Long[] lineIds); + + /** + * 根据退货单ID删除所有行 + * @param rtId + * @return + */ + public int deleteByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java new file mode 100644 index 0000000..d257bb7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java @@ -0,0 +1,76 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtSalse; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; + +/** + * 产品销售退货单Mapper接口 + * + * @author yinjinlu + * @date 2022-10-06 + */ +public interface WmRtSalseMapper +{ + /** + * 查询产品销售退货单 + * + * @param rtId 产品销售退货单主键 + * @return 产品销售退货单 + */ + public WmRtSalse selectWmRtSalseByRtId(Long rtId); + + /** + * 查询产品销售退货单列表 + * + * @param wmRtSalse 产品销售退货单 + * @return 产品销售退货单集合 + */ + public List selectWmRtSalseList(WmRtSalse wmRtSalse); + + + /** + * + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + + /** + * 检查编号唯一性 + * @return + */ + public WmRtSalse checkUnique(WmRtSalse wmRtSalse); + + /** + * 新增产品销售退货单 + * + * @param wmRtSalse 产品销售退货单 + * @return 结果 + */ + public int insertWmRtSalse(WmRtSalse wmRtSalse); + + /** + * 修改产品销售退货单 + * + * @param wmRtSalse 产品销售退货单 + * @return 结果 + */ + public int updateWmRtSalse(WmRtSalse wmRtSalse); + + /** + * 删除产品销售退货单 + * + * @param rtId 产品销售退货单主键 + * @return 结果 + */ + public int deleteWmRtSalseByRtId(Long rtId); + + /** + * 批量删除产品销售退货单 + * + * @param rtIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtSalseByRtIds(Long[] rtIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorLineMapper.java new file mode 100644 index 0000000..dae6a8b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorLineMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtVendorLine; + +/** + * 供应商退货行Mapper接口 + * + * @author yinjinlu + * @date 2022-06-13 + */ +public interface WmRtVendorLineMapper +{ + /** + * 查询供应商退货行 + * + * @param lineId 供应商退货行主键 + * @return 供应商退货行 + */ + public WmRtVendorLine selectWmRtVendorLineByLineId(Long lineId); + + /** + * 查询供应商退货行列表 + * + * @param wmRtVendorLine 供应商退货行 + * @return 供应商退货行集合 + */ + public List selectWmRtVendorLineList(WmRtVendorLine wmRtVendorLine); + + /** + * 新增供应商退货行 + * + * @param wmRtVendorLine 供应商退货行 + * @return 结果 + */ + public int insertWmRtVendorLine(WmRtVendorLine wmRtVendorLine); + + /** + * 修改供应商退货行 + * + * @param wmRtVendorLine 供应商退货行 + * @return 结果 + */ + public int updateWmRtVendorLine(WmRtVendorLine wmRtVendorLine); + + /** + * 删除供应商退货行 + * + * @param lineId 供应商退货行主键 + * @return 结果 + */ + public int deleteWmRtVendorLineByLineId(Long lineId); + + /** + * 批量删除供应商退货行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtVendorLineByLineIds(Long[] lineIds); + + + public int deleteByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorMapper.java new file mode 100644 index 0000000..6c2525f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorMapper.java @@ -0,0 +1,72 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.domain.tx.RtVendorTxBean; + +/** + * 供应商退货Mapper接口 + * + * @author yinjinlu + * @date 2022-06-13 + */ +public interface WmRtVendorMapper +{ + /** + * 查询供应商退货 + * + * @param rtId 供应商退货主键 + * @return 供应商退货 + */ + public WmRtVendor selectWmRtVendorByRtId(Long rtId); + + /** + * 查询供应商退货列表 + * + * @param wmRtVendor 供应商退货 + * @return 供应商退货集合 + */ + public List selectWmRtVendorList(WmRtVendor wmRtVendor); + + /** + * 检查供应商退货单编码是否唯一 + * @param wmRtVendor + * @return + */ + public WmRtVendor checkCodeUnique(WmRtVendor wmRtVendor); + + /** + * 新增供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int insertWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 修改供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int updateWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 删除供应商退货 + * + * @param rtId 供应商退货主键 + * @return 结果 + */ + public int deleteWmRtVendorByRtId(Long rtId); + + /** + * 批量删除供应商退货 + * + * @param rtIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtVendorByRtIds(Long[] rtIds); + + + public List getTxBeans(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmSnMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmSnMapper.java new file mode 100644 index 0000000..3300482 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmSnMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmSn; + +/** + * SN码Mapper接口 + * + * @author yinjinlu + * @date 2022-12-08 + */ +public interface WmSnMapper +{ + /** + * 查询SN码 + * + * @param snId SN码主键 + * @return SN码 + */ + public WmSn selectWmSnBySnId(Long snId); + + /** + * 查询SN码列表 + * + * @param wmSn SN码 + * @return SN码集合 + */ + public List selectWmSnList(WmSn wmSn); + + /** + * 查询SN展示列表 + * @param wmSn + * @return + */ + public List selectSnList(WmSn wmSn); + + /** + * 新增SN码 + * + * @param wmSn SN码 + * @return 结果 + */ + public int insertWmSn(WmSn wmSn); + + /** + * 修改SN码 + * + * @param wmSn SN码 + * @return 结果 + */ + public int updateWmSn(WmSn wmSn); + + /** + * 删除SN码 + * + * @param snId SN码主键 + * @return 结果 + */ + public int deleteWmSnBySnId(Long snId); + + /** + * 批量删除SN码 + * + * @param snIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmSnBySnIds(Long[] snIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java new file mode 100644 index 0000000..536f9bf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingLineMapper.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingLine; + +/** + * 库存盘点明细Mapper接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface WmStockTakingLineMapper +{ + /** + * 查询库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 库存盘点明细 + */ + public WmStockTakingLine selectWmStockTakingLineByLineId(Long lineId); + + /** + * 查询库存盘点明细列表 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 库存盘点明细集合 + */ + public List selectWmStockTakingLineList(WmStockTakingLine wmStockTakingLine); + + /** + * 新增库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int insertWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 修改库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int updateWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 删除库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineId(Long lineId); + + /** + * 批量删除库存盘点明细 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineIds(Long[] lineIds); + + public int deleteByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java new file mode 100644 index 0000000..00950a4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTaking; + +/** + * 库存盘点记录Mapper接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface WmStockTakingMapper +{ + /** + * 查询库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 库存盘点记录 + */ + public WmStockTaking selectWmStockTakingByTakingId(Long takingId); + + /** + * 查询库存盘点记录列表 + * + * @param wmStockTaking 库存盘点记录 + * @return 库存盘点记录集合 + */ + public List selectWmStockTakingList(WmStockTaking wmStockTaking); + + /** + * 检查编码是否唯一 + * @param stockTaking + * @return + */ + public WmStockTaking checkUnique(WmStockTaking stockTaking); + + /** + * 新增库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int insertWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 修改库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int updateWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 删除库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 结果 + */ + public int deleteWmStockTakingByTakingId(Long takingId); + + /** + * 批量删除库存盘点记录 + * + * @param takingIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStockTakingByTakingIds(Long[] takingIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java new file mode 100644 index 0000000..2b66985 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStockTakingResultMapper.java @@ -0,0 +1,83 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingResult; + +/** + * 库存盘点结果Mapper接口 + * + * @author yinjinlu + * @date 2023-08-22 + */ +public interface WmStockTakingResultMapper +{ + /** + * 查询库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 库存盘点结果 + */ + public WmStockTakingResult selectWmStockTakingResultByResultId(Long resultId); + + /** + * 查询库存盘点结果列表 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 库存盘点结果集合 + */ + public List selectWmStockTakingResultList(WmStockTakingResult wmStockTakingResult); + + + /** + * 针对明盘的盘点结果计算 + * @param takingId + * @return + */ + public void calculateOpenWmStockTakingResult(Long takingId); + + /** + * 根据当前盘点记录计算盘点结果 + * @param takingId + * @return + */ + public void calculateWmStockTakingResult(Long takingId); + + /** + * 新增库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int insertWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 修改库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int updateWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 删除库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultId(Long resultId); + + /** + * 批量删除库存盘点结果 + * + * @param resultIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultIds(Long[] resultIds); + + /** + * 根据盘点单ID删除所有盘点结果 + * @param takingId + * @return + */ + public int deleteWmStockTakingResultByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageAreaMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageAreaMapper.java new file mode 100644 index 0000000..2f000e3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageAreaMapper.java @@ -0,0 +1,83 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStorageArea; + +/** + * 库位设置Mapper接口 + * + * @author yinjinlu + * @date 2022-05-08 + */ +public interface WmStorageAreaMapper +{ + /** + * 查询库位设置 + * + * @param areaId 库位设置主键 + * @return 库位设置 + */ + public WmStorageArea selectWmStorageAreaByAreaId(Long areaId); + + + /** + * 根据库位编码查询库位 + * @param areaCode + * @return + */ + public WmStorageArea selectWmStorageAreaByAreaCode(String areaCode); + + /** + * 查询库位设置列表 + * + * @param wmStorageArea 库位设置 + * @return 库位设置集合 + */ + public List selectWmStorageAreaList(WmStorageArea wmStorageArea); + + /** + * 新增库位设置 + * + * @param wmStorageArea 库位设置 + * @return 结果 + */ + public int insertWmStorageArea(WmStorageArea wmStorageArea); + + /** + * 修改库位设置 + * + * @param wmStorageArea 库位设置 + * @return 结果 + */ + public int updateWmStorageArea(WmStorageArea wmStorageArea); + + /** + * 删除库位设置 + * + * @param areaId 库位设置主键 + * @return 结果 + */ + public int deleteWmStorageAreaByAreaId(Long areaId); + + /** + * 批量删除库位设置 + * + * @param areaIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStorageAreaByAreaIds(Long[] areaIds); + + /** + * 根据仓库删除对应的库位 + * @param warehouseId + * @return + */ + public int deleteByWarehouseId(Long warehouseId); + + /** + * 根据库区删除对应的库位 + * @param locationId + * @return + */ + public int deleteByLocationId(Long locationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageLocationMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageLocationMapper.java new file mode 100644 index 0000000..9f30244 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageLocationMapper.java @@ -0,0 +1,81 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStorageLocation; + +/** + * 库区设置Mapper接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface WmStorageLocationMapper +{ + /** + * 查询库区设置 + * + * @param locationId 库区设置主键 + * @return 库区设置 + */ + public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId); + + /** + * 根据库区编码查询库区 + * @param locationCode + * @return + */ + public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode); + + /** + * 查询库区设置列表 + * + * @param wmStorageLocation 库区设置 + * @return 库区设置集合 + */ + public List selectWmStorageLocationList(WmStorageLocation wmStorageLocation); + + + public WmStorageLocation checkLocationCodeUnique(WmStorageLocation wmStorageLocation); + public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation); + + + + /** + * 新增库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int insertWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 修改库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int updateWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 删除库区设置 + * + * @param locationId 库区设置主键 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationId(Long locationId); + + /** + * 批量删除库区设置 + * + * @param locationIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationIds(Long[] locationIds); + + /** + * 根据仓库删除对应的库区 + * @param warehouseId + * @return + */ + public int deleteByWarehouseId(Long warehouseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransactionMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransactionMapper.java new file mode 100644 index 0000000..b22d533 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransactionMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmTransaction; + +/** + * 库存事务Mapper接口 + * + * @author yinjinlu + * @date 2022-05-24 + */ +public interface WmTransactionMapper +{ + /** + * 查询库存事务 + * + * @param transactionId 库存事务主键 + * @return 库存事务 + */ + public WmTransaction selectWmTransactionByTransactionId(Long transactionId); + + /** + * 查询库存事务列表 + * + * @param wmTransaction 库存事务 + * @return 库存事务集合 + */ + public List selectWmTransactionList(WmTransaction wmTransaction); + + /** + * 新增库存事务 + * + * @param wmTransaction 库存事务 + * @return 结果 + */ + public int insertWmTransaction(WmTransaction wmTransaction); + + /** + * 修改库存事务 + * + * @param wmTransaction 库存事务 + * @return 结果 + */ + public int updateWmTransaction(WmTransaction wmTransaction); + + /** + * 删除库存事务 + * + * @param transactionId 库存事务主键 + * @return 结果 + */ + public int deleteWmTransactionByTransactionId(Long transactionId); + + /** + * 批量删除库存事务 + * + * @param transactionIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmTransactionByTransactionIds(Long[] transactionIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransferLineMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransferLineMapper.java new file mode 100644 index 0000000..545deb4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransferLineMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmTransferLine; + +/** + * 转移单行Mapper接口 + * + * @author yinjinlu + * @date 2022-11-28 + */ +public interface WmTransferLineMapper +{ + /** + * 查询转移单行 + * + * @param lineId 转移单行主键 + * @return 转移单行 + */ + public WmTransferLine selectWmTransferLineByLineId(Long lineId); + + /** + * 查询转移单行列表 + * + * @param wmTransferLine 转移单行 + * @return 转移单行集合 + */ + public List selectWmTransferLineList(WmTransferLine wmTransferLine); + + /** + * 新增转移单行 + * + * @param wmTransferLine 转移单行 + * @return 结果 + */ + public int insertWmTransferLine(WmTransferLine wmTransferLine); + + /** + * 修改转移单行 + * + * @param wmTransferLine 转移单行 + * @return 结果 + */ + public int updateWmTransferLine(WmTransferLine wmTransferLine); + + /** + * 删除转移单行 + * + * @param lineId 转移单行主键 + * @return 结果 + */ + public int deleteWmTransferLineByLineId(Long lineId); + + /** + * 批量删除转移单行 + * + * @param lineIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmTransferLineByLineIds(Long[] lineIds); + + /** + * 根据头ID删除所有行 + * @param transferId + * @return + */ + public int deleteByTransferId(Long transferId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransferMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransferMapper.java new file mode 100644 index 0000000..5be95a2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmTransferMapper.java @@ -0,0 +1,72 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmTransfer; +import com.ktg.mes.wm.domain.tx.TransferTxBean; + +/** + * 转移单Mapper接口 + * + * @author yinjinlu + * @date 2022-11-28 + */ +public interface WmTransferMapper +{ + /** + * 查询转移单 + * + * @param transferId 转移单主键 + * @return 转移单 + */ + public WmTransfer selectWmTransferByTransferId(Long transferId); + + /** + * 查询转移单列表 + * + * @param wmTransfer 转移单 + * @return 转移单集合 + */ + public List selectWmTransferList(WmTransfer wmTransfer); + + + public List getTxBeans(Long transferId); + + /** + * 检查编码是否唯一 + * @param wmTransfer + * @return + */ + public WmTransfer checkUnique(WmTransfer wmTransfer); + + /** + * 新增转移单 + * + * @param wmTransfer 转移单 + * @return 结果 + */ + public int insertWmTransfer(WmTransfer wmTransfer); + + /** + * 修改转移单 + * + * @param wmTransfer 转移单 + * @return 结果 + */ + public int updateWmTransfer(WmTransfer wmTransfer); + + /** + * 删除转移单 + * + * @param transferId 转移单主键 + * @return 结果 + */ + public int deleteWmTransferByTransferId(Long transferId); + + /** + * 批量删除转移单 + * + * @param transferIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmTransferByTransferIds(Long[] transferIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java new file mode 100644 index 0000000..4b631d0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java @@ -0,0 +1,75 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmWarehouse; + +/** + * 仓库设置Mapper接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface WmWarehouseMapper +{ + /** + * 查询仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 仓库设置 + */ + public WmWarehouse selectWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 根据编码查询仓库 + * @param warehouseCdoe + * @return + */ + public WmWarehouse selectWmWarehouseByWarehouseCode(String warehouseCdoe); + + + /** + * 查询仓库设置列表 + * + * @param wmWarehouse 仓库设置 + * @return 仓库设置集合 + */ + public List selectWmWarehouseList(WmWarehouse wmWarehouse); + + public List getTreeList(); + + public WmWarehouse checkWarehouseCodeUnique(WmWarehouse wmWarehouse); + public WmWarehouse checkWarehouseNameUnique(WmWarehouse wmWarehouse); + + /** + * 新增仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int insertWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 修改仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int updateWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 删除仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 批量删除仓库设置 + * + * @param warehouseIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java new file mode 100644 index 0000000..4c817bb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java @@ -0,0 +1,84 @@ +package com.ktg.mes.wm.service; + +import com.ktg.mes.wm.domain.WmItemRecptLine; +import com.ktg.mes.wm.domain.tx.*; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public interface IStorageCoreService { + + /** + * 处理物料入库单 + * @param lines + */ + public void processItemRecpt(List lines); + + /** + * 处理供应商退货单 + * @param lines + */ + public void processRtVendor(List lines); + + /** + * 处理生产领料 + * @param lines + */ + public void processIssue(List lines); + + /** + * 处理外协领料 + * @param lines + */ + public void processOutsourceIssue(List lines); + + /** + * 处理外协入库 + * @param lines + */ + public void processOutsourceRecpt(List lines); + + /** + * 处理生产退料 + * @param lines + */ + public void processRtIssue(List lines); + + /** + * 处理生产消耗 + * @param lines + */ + public void processItemConsume(List lines); + + /** + * 处理产品产出 + * @param lines + */ + public void processProductProduce(List lines); + + /** + * 处理产品入库 + * @param lines + */ + public void processProductRecpt(List lines); + + /** + * 处理产品销售出库 + * @param lines + */ + public void processProductSalse(List lines); + + /** + * 处理销售退货 + * @param lines + */ + public void processRtSalse(List lines); + + /** + * 处理转移单 + * @param lines + */ + public void processTransfer(List lines); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmBarcodeConfigService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmBarcodeConfigService.java new file mode 100644 index 0000000..b9e38af --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmBarcodeConfigService.java @@ -0,0 +1,70 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmBarcodeConfig; + +/** + * 条码配置Service接口 + * + * @author yinjinlu + * @date 2022-10-22 + */ +public interface IWmBarcodeConfigService +{ + /** + * 查询条码配置 + * + * @param configId 条码配置主键 + * @return 条码配置 + */ + public WmBarcodeConfig selectWmBarcodeConfigByConfigId(Long configId); + + /** + * 查询条码配置列表 + * + * @param wmBarcodeConfig 条码配置 + * @return 条码配置集合 + */ + public List selectWmBarcodeConfigList(WmBarcodeConfig wmBarcodeConfig); + + /** + * 新增条码配置 + * + * @param wmBarcodeConfig 条码配置 + * @return 结果 + */ + public int insertWmBarcodeConfig(WmBarcodeConfig wmBarcodeConfig); + + /** + * 修改条码配置 + * + * @param wmBarcodeConfig 条码配置 + * @return 结果 + */ + public int updateWmBarcodeConfig(WmBarcodeConfig wmBarcodeConfig); + + /** + * 批量删除条码配置 + * + * @param configIds 需要删除的条码配置主键集合 + * @return 结果 + */ + public int deleteWmBarcodeConfigByConfigIds(Long[] configIds); + + /** + * 删除条码配置信息 + * + * @param configId 条码配置主键 + * @return 结果 + */ + public int deleteWmBarcodeConfigByConfigId(Long configId); + + + /** + * 判断某种类型的业务是否需要自动生成赋码 + * @param barcodeType + * @return + */ + public boolean isAutoGen(String barcodeType); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmBarcodeService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmBarcodeService.java new file mode 100644 index 0000000..e5a7f70 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmBarcodeService.java @@ -0,0 +1,78 @@ +package com.ktg.mes.wm.service; + +import com.ktg.mes.wm.domain.WmBarcode; + +import java.util.List; + +/** + * 条码清单Service接口 + * + * @author yinjinlu + * @date 2022-08-01 + */ +public interface IWmBarcodeService +{ + /** + * 查询条码清单 + * + * @param barcodeId 条码清单主键 + * @return 条码清单 + */ + public WmBarcode selectWmBarcodeByBarcodeId(Long barcodeId); + + /** + * 查询条码清单列表 + * + * @param wmBarcode 条码清单 + * @return 条码清单集合 + */ + public List selectWmBarcodeList(WmBarcode wmBarcode); + + + /** + * 根据条码类型和业务内容ID判断条码是否已存在 + * @param wmBarcode + * @return + */ + public String checkBarcodeUnique(WmBarcode wmBarcode); + + /** + * 新增条码清单 + * + * @param wmBarcode 条码清单 + * @return 结果 + */ + public int insertWmBarcode(WmBarcode wmBarcode); + + /** + * 修改条码清单 + * + * @param wmBarcode 条码清单 + * @return 结果 + */ + public int updateWmBarcode(WmBarcode wmBarcode); + + /** + * 批量删除条码清单 + * + * @param barcodeIds 需要删除的条码清单主键集合 + * @return 结果 + */ + public int deleteWmBarcodeByBarcodeIds(Long[] barcodeIds); + + /** + * 删除条码清单信息 + * + * @param barcodeId 条码清单主键 + * @return 结果 + */ + public int deleteWmBarcodeByBarcodeId(Long barcodeId); + + /** + * 根据条码记录生成实际的条码,返回对应的url地址 + * @param wmBarcode + * @return + */ + public String generateBarcode(WmBarcode wmBarcode); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmIssueHeaderService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmIssueHeaderService.java new file mode 100644 index 0000000..2193407 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmIssueHeaderService.java @@ -0,0 +1,71 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmIssueHeader; +import com.ktg.mes.wm.domain.tx.IssueTxBean; + +/** + * 生产领料单头Service接口 + * + * @author yinjinlu + * @date 2022-07-14 + */ +public interface IWmIssueHeaderService +{ + /** + * 查询生产领料单头 + * + * @param issueId 生产领料单头主键 + * @return 生产领料单头 + */ + public WmIssueHeader selectWmIssueHeaderByIssueId(Long issueId); + + /** + * 查询生产领料单头列表 + * + * @param wmIssueHeader 生产领料单头 + * @return 生产领料单头集合 + */ + public List selectWmIssueHeaderList(WmIssueHeader wmIssueHeader); + + /** + * 检查生产领料单编号是否唯一 + * @param wmIssueHeader + * @return + */ + public String checkIssueCodeUnique(WmIssueHeader wmIssueHeader); + + /** + * 新增生产领料单头 + * + * @param wmIssueHeader 生产领料单头 + * @return 结果 + */ + public int insertWmIssueHeader(WmIssueHeader wmIssueHeader); + + /** + * 修改生产领料单头 + * + * @param wmIssueHeader 生产领料单头 + * @return 结果 + */ + public int updateWmIssueHeader(WmIssueHeader wmIssueHeader); + + /** + * 批量删除生产领料单头 + * + * @param issueIds 需要删除的生产领料单头主键集合 + * @return 结果 + */ + public int deleteWmIssueHeaderByIssueIds(Long[] issueIds); + + /** + * 删除生产领料单头信息 + * + * @param issueId 生产领料单头主键 + * @return 结果 + */ + public int deleteWmIssueHeaderByIssueId(Long issueId); + + public List getTxBeans(Long issueId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmIssueLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmIssueLineService.java new file mode 100644 index 0000000..e945c62 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmIssueLineService.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmIssueLine; + +/** + * 生产领料单行Service接口 + * + * @author yinjinlu + * @date 2022-07-14 + */ +public interface IWmIssueLineService +{ + /** + * 查询生产领料单行 + * + * @param lineId 生产领料单行主键 + * @return 生产领料单行 + */ + public WmIssueLine selectWmIssueLineByLineId(Long lineId); + + /** + * 查询生产领料单行列表 + * + * @param wmIssueLine 生产领料单行 + * @return 生产领料单行集合 + */ + public List selectWmIssueLineList(WmIssueLine wmIssueLine); + + /** + * 新增生产领料单行 + * + * @param wmIssueLine 生产领料单行 + * @return 结果 + */ + public int insertWmIssueLine(WmIssueLine wmIssueLine); + + /** + * 修改生产领料单行 + * + * @param wmIssueLine 生产领料单行 + * @return 结果 + */ + public int updateWmIssueLine(WmIssueLine wmIssueLine); + + /** + * 批量删除生产领料单行 + * + * @param lineIds 需要删除的生产领料单行主键集合 + * @return 结果 + */ + public int deleteWmIssueLineByLineIds(Long[] lineIds); + + /** + * 删除生产领料单行信息 + * + * @param lineId 生产领料单行主键 + * @return 结果 + */ + public int deleteWmIssueLineByLineId(Long lineId); + + public int deleteByIssueHeaderId(Long issueId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemConsumeLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemConsumeLineService.java new file mode 100644 index 0000000..87b57b1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemConsumeLineService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemConsumeLine; + +/** + * 物料消耗记录行Service接口 + * + * @author yinjinlu + * @date 2022-09-19 + */ +public interface IWmItemConsumeLineService +{ + /** + * 查询物料消耗记录行 + * + * @param lineId 物料消耗记录行主键 + * @return 物料消耗记录行 + */ + public WmItemConsumeLine selectWmItemConsumeLineByLineId(Long lineId); + + /** + * 查询物料消耗记录行列表 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 物料消耗记录行集合 + */ + public List selectWmItemConsumeLineList(WmItemConsumeLine wmItemConsumeLine); + + /** + * 新增物料消耗记录行 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 结果 + */ + public int insertWmItemConsumeLine(WmItemConsumeLine wmItemConsumeLine); + + /** + * 修改物料消耗记录行 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 结果 + */ + public int updateWmItemConsumeLine(WmItemConsumeLine wmItemConsumeLine); + + /** + * 批量删除物料消耗记录行 + * + * @param lineIds 需要删除的物料消耗记录行主键集合 + * @return 结果 + */ + public int deleteWmItemConsumeLineByLineIds(Long[] lineIds); + + /** + * 删除物料消耗记录行信息 + * + * @param lineId 物料消耗记录行主键 + * @return 结果 + */ + public int deleteWmItemConsumeLineByLineId(Long lineId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemConsumeService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemConsumeService.java new file mode 100644 index 0000000..bb7ef96 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemConsumeService.java @@ -0,0 +1,74 @@ +package com.ktg.mes.wm.service; + +import java.util.List; + +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.wm.domain.WmItemConsume; +import com.ktg.mes.wm.domain.tx.ItemConsumeTxBean; + +/** + * 物料消耗记录Service接口 + * + * @author yinjinlu + * @date 2022-09-19 + */ +public interface IWmItemConsumeService +{ + /** + * 查询物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 物料消耗记录 + */ + public WmItemConsume selectWmItemConsumeByRecordId(Long recordId); + + /** + * 查询物料消耗记录列表 + * + * @param wmItemConsume 物料消耗记录 + * @return 物料消耗记录集合 + */ + public List selectWmItemConsumeList(WmItemConsume wmItemConsume); + + /** + * 新增物料消耗记录 + * + * @param wmItemConsume 物料消耗记录 + * @return 结果 + */ + public int insertWmItemConsume(WmItemConsume wmItemConsume); + + /** + * 修改物料消耗记录 + * + * @param wmItemConsume 物料消耗记录 + * @return 结果 + */ + public int updateWmItemConsume(WmItemConsume wmItemConsume); + + /** + * 批量删除物料消耗记录 + * + * @param recordIds 需要删除的物料消耗记录主键集合 + * @return 结果 + */ + public int deleteWmItemConsumeByRecordIds(Long[] recordIds); + + /** + * 删除物料消耗记录信息 + * + * @param recordId 物料消耗记录主键 + * @return 结果 + */ + public int deleteWmItemConsumeByRecordId(Long recordId); + + /** + * 根据生产报工单生成物料消耗记录 + * 这里需要处理同一个工单分多次领料的问题(每次领料可能是不同的批次) + * @param feedback + * @return + */ + public WmItemConsume generateItemConsume(ProFeedback feedback); + + public List getTxBeans(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemRecptLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemRecptLineService.java new file mode 100644 index 0000000..67e9e17 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemRecptLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemRecptLine; + +/** + * 物料入库单行Service接口 + * + * @author yinjinlu + * @date 2022-05-22 + */ +public interface IWmItemRecptLineService +{ + /** + * 查询物料入库单行 + * + * @param lineId 物料入库单行主键 + * @return 物料入库单行 + */ + public WmItemRecptLine selectWmItemRecptLineByLineId(Long lineId); + + /** + * 查询物料入库单行列表 + * + * @param wmItemRecptLine 物料入库单行 + * @return 物料入库单行集合 + */ + public List selectWmItemRecptLineList(WmItemRecptLine wmItemRecptLine); + + /** + * 新增物料入库单行 + * + * @param wmItemRecptLine 物料入库单行 + * @return 结果 + */ + public int insertWmItemRecptLine(WmItemRecptLine wmItemRecptLine); + + /** + * 修改物料入库单行 + * + * @param wmItemRecptLine 物料入库单行 + * @return 结果 + */ + public int updateWmItemRecptLine(WmItemRecptLine wmItemRecptLine); + + /** + * 批量删除物料入库单行 + * + * @param lineIds 需要删除的物料入库单行主键集合 + * @return 结果 + */ + public int deleteWmItemRecptLineByLineIds(Long[] lineIds); + + /** + * 删除物料入库单行信息 + * + * @param lineId 物料入库单行主键 + * @return 结果 + */ + public int deleteWmItemRecptLineByLineId(Long lineId); + + /** + * 删除物料入库单下所有行信息 + * @param recptId + * @return + */ + public int deleteByRecptId(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemRecptService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemRecptService.java new file mode 100644 index 0000000..6f395c5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmItemRecptService.java @@ -0,0 +1,79 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmItemRecpt; +import com.ktg.mes.wm.domain.tx.ItemRecptTxBean; + +/** + * 物料入库单Service接口 + * + * @author yinjinlu + * @date 2022-05-22 + */ +public interface IWmItemRecptService +{ + /** + * 查询物料入库单 + * + * @param recptId 物料入库单主键 + * @return 物料入库单 + */ + public WmItemRecpt selectWmItemRecptByRecptId(Long recptId); + + /** + * 查询物料入库单列表 + * + * @param wmItemRecpt 物料入库单 + * @return 物料入库单集合 + */ + public List selectWmItemRecptList(WmItemRecpt wmItemRecpt); + + /** + * 检查入库单号是否重复 + * @param wmItemRecpt + * @return + */ + public String checkRecptCodeUnique(WmItemRecpt wmItemRecpt); + + /** + * 新增物料入库单 + * + * @param wmItemRecpt 物料入库单 + * @return 结果 + */ + public int insertWmItemRecpt(WmItemRecpt wmItemRecpt); + + /** + * 修改物料入库单 + * + * @param wmItemRecpt 物料入库单 + * @return 结果 + */ + public int updateWmItemRecpt(WmItemRecpt wmItemRecpt); + + /** + * 批量删除物料入库单 + * + * @param recptIds 需要删除的物料入库单主键集合 + * @return 结果 + */ + public int deleteWmItemRecptByRecptIds(Long[] recptIds); + + /** + * 删除物料入库单信息 + * + * @param recptId 物料入库单主键 + * @return 结果 + */ + public int deleteWmItemRecptByRecptId(Long recptId); + + + /** + * 组装当前入库单对应的库存事务传入bean + * @param receptId + * @return + */ + public List getTxBeans(Long receptId); + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmMaterialStockService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmMaterialStockService.java new file mode 100644 index 0000000..c905520 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmMaterialStockService.java @@ -0,0 +1,74 @@ +package com.ktg.mes.wm.service; + +import com.ktg.mes.wm.domain.WmMaterialStock; + +import java.util.List; + +/** + * 库存记录Service接口 + * + * @author yinjinlu + * @date 2022-05-24 + */ +public interface IWmMaterialStockService +{ + /** + * 查询库存记录 + * + * @param materialStockId 库存记录主键 + * @return 库存记录 + */ + public WmMaterialStock selectWmMaterialStockByMaterialStockId(Long materialStockId); + + + + /** + * 查询库存记录列表 + * + * @param wmMaterialStock 库存记录 + * @return 库存记录集合 + */ + public List selectWmMaterialStockList(WmMaterialStock wmMaterialStock); + + + /** + * 模糊查询库存记录列表 + * + * @param wmMaterialStock 库存记录 + * @return 库存记录集合 + */ + public List queryWmMaterialStockList(WmMaterialStock wmMaterialStock); + + + /** + * 新增库存记录 + * + * @param wmMaterialStock 库存记录 + * @return 结果 + */ + public int insertWmMaterialStock(WmMaterialStock wmMaterialStock); + + /** + * 修改库存记录 + * + * @param wmMaterialStock 库存记录 + * @return 结果 + */ + public int updateWmMaterialStock(WmMaterialStock wmMaterialStock); + + /** + * 批量删除库存记录 + * + * @param materialStockIds 需要删除的库存记录主键集合 + * @return 结果 + */ + public int deleteWmMaterialStockByMaterialStockIds(Long[] materialStockIds); + + /** + * 删除库存记录信息 + * + * @param materialStockId 库存记录主键 + * @return 结果 + */ + public int deleteWmMaterialStockByMaterialStockId(Long materialStockId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceIssueLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceIssueLineService.java new file mode 100644 index 0000000..5553c93 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceIssueLineService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceIssueLine; + +/** + * 外协领料单行Service接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface IWmOutsourceIssueLineService +{ + /** + * 查询外协领料单行 + * + * @param lineId 外协领料单行主键 + * @return 外协领料单行 + */ + public WmOutsourceIssueLine selectWmOutsourceIssueLineByLineId(Long lineId); + + /** + * 查询外协领料单行列表 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 外协领料单行集合 + */ + public List selectWmOutsourceIssueLineList(WmOutsourceIssueLine wmOutsourceIssueLine); + + + /** + * 根据外协领料单ID查询所有行 + * @param issueId + * @return + */ + public List selectWmOutsourceIssueLineByIssueId(Long issueId); + + /** + * 新增外协领料单行 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 结果 + */ + public int insertWmOutsourceIssueLine(WmOutsourceIssueLine wmOutsourceIssueLine); + + /** + * 修改外协领料单行 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 结果 + */ + public int updateWmOutsourceIssueLine(WmOutsourceIssueLine wmOutsourceIssueLine); + + /** + * 批量删除外协领料单行 + * + * @param lineIds 需要删除的外协领料单行主键集合 + * @return 结果 + */ + public int deleteWmOutsourceIssueLineByLineIds(Long[] lineIds); + + /** + * 删除外协领料单行信息 + * + * @param lineId 外协领料单行主键 + * @return 结果 + */ + public int deleteWmOutsourceIssueLineByLineId(Long lineId); + + /** + * 根据发料单ID删除所有行 + * @param issueId + * @return + */ + public int deleteWmOutsourceIssueLineByIssueId(Long issueId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceIssueService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceIssueService.java new file mode 100644 index 0000000..f4dc4a9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceIssueService.java @@ -0,0 +1,65 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceIssue; +import com.ktg.mes.wm.domain.tx.IssueTxBean; +import com.ktg.mes.wm.domain.tx.OutsourceIssueTxBean; + +/** + * 外协领料单头Service接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface IWmOutsourceIssueService +{ + /** + * 查询外协领料单头 + * + * @param issueId 外协领料单头主键 + * @return 外协领料单头 + */ + public WmOutsourceIssue selectWmOutsourceIssueByIssueId(Long issueId); + + /** + * 查询外协领料单头列表 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 外协领料单头集合 + */ + public List selectWmOutsourceIssueList(WmOutsourceIssue wmOutsourceIssue); + + /** + * 新增外协领料单头 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 结果 + */ + public int insertWmOutsourceIssue(WmOutsourceIssue wmOutsourceIssue); + + /** + * 修改外协领料单头 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 结果 + */ + public int updateWmOutsourceIssue(WmOutsourceIssue wmOutsourceIssue); + + /** + * 批量删除外协领料单头 + * + * @param issueIds 需要删除的外协领料单头主键集合 + * @return 结果 + */ + public int deleteWmOutsourceIssueByIssueIds(Long[] issueIds); + + /** + * 删除外协领料单头信息 + * + * @param issueId 外协领料单头主键 + * @return 结果 + */ + public int deleteWmOutsourceIssueByIssueId(Long issueId); + + public List getTxBeans(Long issueId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceRecptLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceRecptLineService.java new file mode 100644 index 0000000..1b38891 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceRecptLineService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceRecptLine; + +/** + * 外协入库单行Service接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface IWmOutsourceRecptLineService +{ + /** + * 查询外协入库单行 + * + * @param lineId 外协入库单行主键 + * @return 外协入库单行 + */ + public WmOutsourceRecptLine selectWmOutsourceRecptLineByLineId(Long lineId); + + /** + * 查询外协入库单行列表 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 外协入库单行集合 + */ + public List selectWmOutsourceRecptLineList(WmOutsourceRecptLine wmOutsourceRecptLine); + + /** + * 根据外协入库单ID查询所有入库单行 + * @param recptId + * @return + */ + public List selectWmOutsourceRecptLineByRecptId(Long recptId); + + /** + * 新增外协入库单行 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 结果 + */ + public int insertWmOutsourceRecptLine(WmOutsourceRecptLine wmOutsourceRecptLine); + + /** + * 修改外协入库单行 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 结果 + */ + public int updateWmOutsourceRecptLine(WmOutsourceRecptLine wmOutsourceRecptLine); + + /** + * 批量删除外协入库单行 + * + * @param lineIds 需要删除的外协入库单行主键集合 + * @return 结果 + */ + public int deleteWmOutsourceRecptLineByLineIds(Long[] lineIds); + + /** + * 删除外协入库单行信息 + * + * @param lineId 外协入库单行主键 + * @return 结果 + */ + public int deleteWmOutsourceRecptLineByLineId(Long lineId); + + /** + * 根据外协入库单头ID删除所有行 + * @param recptId + * @return + */ + public int deleteWmOutsourceRecptLineByRecptId(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceRecptService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceRecptService.java new file mode 100644 index 0000000..bb69149 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmOutsourceRecptService.java @@ -0,0 +1,69 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmOutsourceRecpt; +import com.ktg.mes.wm.domain.tx.OutsourceRecptTxBean; + +/** + * 外协入库单Service接口 + * + * @author yinjinlu + * @date 2023-10-30 + */ +public interface IWmOutsourceRecptService +{ + /** + * 查询外协入库单 + * + * @param recptId 外协入库单主键 + * @return 外协入库单 + */ + public WmOutsourceRecpt selectWmOutsourceRecptByRecptId(Long recptId); + + /** + * 查询外协入库单列表 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 外协入库单集合 + */ + public List selectWmOutsourceRecptList(WmOutsourceRecpt wmOutsourceRecpt); + + /** + * 新增外协入库单 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 结果 + */ + public int insertWmOutsourceRecpt(WmOutsourceRecpt wmOutsourceRecpt); + + /** + * 修改外协入库单 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 结果 + */ + public int updateWmOutsourceRecpt(WmOutsourceRecpt wmOutsourceRecpt); + + /** + * 批量删除外协入库单 + * + * @param recptIds 需要删除的外协入库单主键集合 + * @return 结果 + */ + public int deleteWmOutsourceRecptByRecptIds(Long[] recptIds); + + /** + * 删除外协入库单信息 + * + * @param recptId 外协入库单主键 + * @return 结果 + */ + public int deleteWmOutsourceRecptByRecptId(Long recptId); + + /** + * 获取执行入库的TxBeans + * @param recptId + * @return + */ + public List getTxBeans(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmPackageLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmPackageLineService.java new file mode 100644 index 0000000..5ab35d3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmPackageLineService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmPackageLine; + +/** + * 装箱明细Service接口 + * + * @author yinjinlu + * @date 2022-10-11 + */ +public interface IWmPackageLineService +{ + /** + * 查询装箱明细 + * + * @param lineId 装箱明细主键 + * @return 装箱明细 + */ + public WmPackageLine selectWmPackageLineByLineId(Long lineId); + + /** + * 查询装箱明细列表 + * + * @param wmPackageLine 装箱明细 + * @return 装箱明细集合 + */ + public List selectWmPackageLineList(WmPackageLine wmPackageLine); + + /** + * 新增装箱明细 + * + * @param wmPackageLine 装箱明细 + * @return 结果 + */ + public int insertWmPackageLine(WmPackageLine wmPackageLine); + + /** + * 修改装箱明细 + * + * @param wmPackageLine 装箱明细 + * @return 结果 + */ + public int updateWmPackageLine(WmPackageLine wmPackageLine); + + /** + * 批量删除装箱明细 + * + * @param lineIds 需要删除的装箱明细主键集合 + * @return 结果 + */ + public int deleteWmPackageLineByLineIds(Long[] lineIds); + + /** + * 删除装箱明细信息 + * + * @param lineId 装箱明细主键 + * @return 结果 + */ + public int deleteWmPackageLineByLineId(Long lineId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmPackageService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmPackageService.java new file mode 100644 index 0000000..f346ceb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmPackageService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmPackage; + +/** + * 装箱单Service接口 + * + * @author yinjinlu + * @date 2022-10-10 + */ +public interface IWmPackageService +{ + /** + * 查询装箱单 + * + * @param packageId 装箱单主键 + * @return 装箱单 + */ + public WmPackage selectWmPackageByPackageId(Long packageId); + + /** + * 查询装箱单列表 + * + * @param wmPackage 装箱单 + * @return 装箱单集合 + */ + public List selectWmPackageList(WmPackage wmPackage); + + /** + * 检查装箱单编号是否唯一 + * @param wmPackage + * @return + */ + public String checkPackgeCodeUnique(WmPackage wmPackage); + + /** + * 新增装箱单 + * + * @param wmPackage 装箱单 + * @return 结果 + */ + public int insertWmPackage(WmPackage wmPackage); + + /** + * 修改装箱单 + * + * @param wmPackage 装箱单 + * @return 结果 + */ + public int updateWmPackage(WmPackage wmPackage); + + /** + * 批量删除装箱单 + * + * @param packageIds 需要删除的装箱单主键集合 + * @return 结果 + */ + public int deleteWmPackageByPackageIds(Long[] packageIds); + + /** + * 删除装箱单信息 + * + * @param packageId 装箱单主键 + * @return 结果 + */ + public int deleteWmPackageByPackageId(Long packageId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductProduceLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductProduceLineService.java new file mode 100644 index 0000000..fdbe4c8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductProduceLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductProduceLine; + +/** + * 产品产出记录行Service接口 + * + * @author yinjinlu + * @date 2022-09-22 + */ +public interface IWmProductProduceLineService +{ + /** + * 查询产品产出记录行 + * + * @param lineId 产品产出记录行主键 + * @return 产品产出记录行 + */ + public WmProductProduceLine selectWmProductProduceLineByLineId(Long lineId); + + /** + * 查询产品产出记录行列表 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 产品产出记录行集合 + */ + public List selectWmProductProduceLineList(WmProductProduceLine wmProductProduceLine); + + /** + * 新增产品产出记录行 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 结果 + */ + public int insertWmProductProduceLine(WmProductProduceLine wmProductProduceLine); + + /** + * 修改产品产出记录行 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 结果 + */ + public int updateWmProductProduceLine(WmProductProduceLine wmProductProduceLine); + + /** + * 批量删除产品产出记录行 + * + * @param lineIds 需要删除的产品产出记录行主键集合 + * @return 结果 + */ + public int deleteWmProductProduceLineByLineIds(Long[] lineIds); + + /** + * 删除产品产出记录行信息 + * + * @param lineId 产品产出记录行主键 + * @return 结果 + */ + public int deleteWmProductProduceLineByLineId(Long lineId); + + /** + * + * @param recordId + * @return + */ + public int deleteByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductProduceService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductProduceService.java new file mode 100644 index 0000000..154a769 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductProduceService.java @@ -0,0 +1,74 @@ +package com.ktg.mes.wm.service; + +import java.util.List; + +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.wm.domain.WmProductProduce; +import com.ktg.mes.wm.domain.tx.ProductProductTxBean; +import com.ktg.mes.wm.domain.tx.ProductRecptTxBean; + +/** + * 产品产出记录Service接口 + * + * @author yinjinlu + * @date 2022-09-21 + */ +public interface IWmProductProduceService +{ + /** + * 查询产品产出记录 + * + * @param recordId 产品产出记录主键 + * @return 产品产出记录 + */ + public WmProductProduce selectWmProductProduceByRecordId(Long recordId); + + /** + * 查询产品产出记录列表 + * + * @param wmProductProduce 产品产出记录 + * @return 产品产出记录集合 + */ + public List selectWmProductProduceList(WmProductProduce wmProductProduce); + + /** + * 新增产品产出记录 + * + * @param wmProductProduce 产品产出记录 + * @return 结果 + */ + public int insertWmProductProduce(WmProductProduce wmProductProduce); + + /** + * 修改产品产出记录 + * + * @param wmProductProduce 产品产出记录 + * @return 结果 + */ + public int updateWmProductProduce(WmProductProduce wmProductProduce); + + /** + * 批量删除产品产出记录 + * + * @param recordIds 需要删除的产品产出记录主键集合 + * @return 结果 + */ + public int deleteWmProductProduceByRecordIds(Long[] recordIds); + + /** + * 删除产品产出记录信息 + * + * @param recordId 产品产出记录主键 + * @return 结果 + */ + public int deleteWmProductProduceByRecordId(Long recordId); + + /** + * 根据报工记录生成对应的产品产出记录 + * @param feedback + */ + public WmProductProduce generateProductProduce(ProFeedback feedback); + + public List getTxBeans(Long recordId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductRecptLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductRecptLineService.java new file mode 100644 index 0000000..0d226d2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductRecptLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductRecptLine; + +/** + * 产品入库记录行Service接口 + * + * @author yinjinlu + * @date 2022-09-22 + */ +public interface IWmProductRecptLineService +{ + /** + * 查询产品入库记录行 + * + * @param lineId 产品入库记录行主键 + * @return 产品入库记录行 + */ + public WmProductRecptLine selectWmProductRecptLineByLineId(Long lineId); + + /** + * 查询产品入库记录行列表 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 产品入库记录行集合 + */ + public List selectWmProductRecptLineList(WmProductRecptLine wmProductRecptLine); + + /** + * 新增产品入库记录行 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 结果 + */ + public int insertWmProductRecptLine(WmProductRecptLine wmProductRecptLine); + + /** + * 修改产品入库记录行 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 结果 + */ + public int updateWmProductRecptLine(WmProductRecptLine wmProductRecptLine); + + /** + * 批量删除产品入库记录行 + * + * @param lineIds 需要删除的产品入库记录行主键集合 + * @return 结果 + */ + public int deleteWmProductRecptLineByLineIds(Long[] lineIds); + + /** + * 删除产品入库记录行信息 + * + * @param lineId 产品入库记录行主键 + * @return 结果 + */ + public int deleteWmProductRecptLineByLineId(Long lineId); + + /** + * 根据入库单ID删除所有行 + * @param recptId + * @return + */ + public int deleteByRecptId(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductRecptService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductRecptService.java new file mode 100644 index 0000000..0bf2d92 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductRecptService.java @@ -0,0 +1,72 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductRecpt; +import com.ktg.mes.wm.domain.tx.ProductRecptTxBean; + +/** + * 产品入库录Service接口 + * + * @author yinjinlu + * @date 2022-09-22 + */ +public interface IWmProductRecptService +{ + /** + * 查询产品入库录 + * + * @param recptId 产品入库录主键 + * @return 产品入库录 + */ + public WmProductRecpt selectWmProductRecptByRecptId(Long recptId); + + /** + * 查询产品入库录列表 + * + * @param wmProductRecpt 产品入库录 + * @return 产品入库录集合 + */ + public List selectWmProductRecptList(WmProductRecpt wmProductRecpt); + + + /** + * 检查编码唯一性 + * @param wmProductRecpt + * @return + */ + public String checkUnique(WmProductRecpt wmProductRecpt); + + /** + * 新增产品入库录 + * + * @param wmProductRecpt 产品入库录 + * @return 结果 + */ + public int insertWmProductRecpt(WmProductRecpt wmProductRecpt); + + /** + * 修改产品入库录 + * + * @param wmProductRecpt 产品入库录 + * @return 结果 + */ + public int updateWmProductRecpt(WmProductRecpt wmProductRecpt); + + /** + * 批量删除产品入库录 + * + * @param recptIds 需要删除的产品入库录主键集合 + * @return 结果 + */ + public int deleteWmProductRecptByRecptIds(Long[] recptIds); + + /** + * 删除产品入库录信息 + * + * @param recptId 产品入库录主键 + * @return 结果 + */ + public int deleteWmProductRecptByRecptId(Long recptId); + + public List getTxBean(Long recptId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductSalseLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductSalseLineService.java new file mode 100644 index 0000000..6b16ce0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductSalseLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductSalseLine; + +/** + * 产品销售出库行Service接口 + * + * @author yinjinlu + * @date 2022-10-05 + */ +public interface IWmProductSalseLineService +{ + /** + * 查询产品销售出库行 + * + * @param lineId 产品销售出库行主键 + * @return 产品销售出库行 + */ + public WmProductSalseLine selectWmProductSalseLineByLineId(Long lineId); + + /** + * 查询产品销售出库行列表 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 产品销售出库行集合 + */ + public List selectWmProductSalseLineList(WmProductSalseLine wmProductSalseLine); + + /** + * 新增产品销售出库行 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 结果 + */ + public int insertWmProductSalseLine(WmProductSalseLine wmProductSalseLine); + + /** + * 修改产品销售出库行 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 结果 + */ + public int updateWmProductSalseLine(WmProductSalseLine wmProductSalseLine); + + /** + * 批量删除产品销售出库行 + * + * @param lineIds 需要删除的产品销售出库行主键集合 + * @return 结果 + */ + public int deleteWmProductSalseLineByLineIds(Long[] lineIds); + + /** + * 删除产品销售出库行信息 + * + * @param lineId 产品销售出库行主键 + * @return 结果 + */ + public int deleteWmProductSalseLineByLineId(Long lineId); + + /** + * 根据出库单头删除所有行 + * @param salseId + * @return + */ + public int deleteBySalseId(Long salseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductSalseService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductSalseService.java new file mode 100644 index 0000000..76b7b40 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmProductSalseService.java @@ -0,0 +1,77 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmProductSalse; +import com.ktg.mes.wm.domain.tx.ProductSalseTxBean; + +/** + * 销售出库单Service接口 + * + * @author yinjinlu + * @date 2022-10-04 + */ +public interface IWmProductSalseService +{ + /** + * 查询销售出库单 + * + * @param salseId 销售出库单主键 + * @return 销售出库单 + */ + public WmProductSalse selectWmProductSalseBySalseId(Long salseId); + + /** + * 查询销售出库单列表 + * + * @param wmProductSalse 销售出库单 + * @return 销售出库单集合 + */ + public List selectWmProductSalseList(WmProductSalse wmProductSalse); + + + /** + * 获取产品销售出库事务Bean + * @param salseId + * @return + */ + public List getTxBeans(Long salseId); + + /** + * 检查编号唯一性 + * @param wmProductSalse + * @return + */ + public String checkUnique(WmProductSalse wmProductSalse); + + /** + * 新增销售出库单 + * + * @param wmProductSalse 销售出库单 + * @return 结果 + */ + public int insertWmProductSalse(WmProductSalse wmProductSalse); + + /** + * 修改销售出库单 + * + * @param wmProductSalse 销售出库单 + * @return 结果 + */ + public int updateWmProductSalse(WmProductSalse wmProductSalse); + + /** + * 批量删除销售出库单 + * + * @param salseIds 需要删除的销售出库单主键集合 + * @return 结果 + */ + public int deleteWmProductSalseBySalseIds(Long[] salseIds); + + /** + * 删除销售出库单信息 + * + * @param salseId 销售出库单主键 + * @return 结果 + */ + public int deleteWmProductSalseBySalseId(Long salseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueLineService.java new file mode 100644 index 0000000..98dbdc6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtIssueLine; + +/** + * 生产退料单行Service接口 + * + * @author yinjinlu + * @date 2022-09-15 + */ +public interface IWmRtIssueLineService +{ + /** + * 查询生产退料单行 + * + * @param lineId 生产退料单行主键 + * @return 生产退料单行 + */ + public WmRtIssueLine selectWmRtIssueLineByLineId(Long lineId); + + /** + * 查询生产退料单行列表 + * + * @param wmRtIssueLine 生产退料单行 + * @return 生产退料单行集合 + */ + public List selectWmRtIssueLineList(WmRtIssueLine wmRtIssueLine); + + /** + * 新增生产退料单行 + * + * @param wmRtIssueLine 生产退料单行 + * @return 结果 + */ + public int insertWmRtIssueLine(WmRtIssueLine wmRtIssueLine); + + /** + * 修改生产退料单行 + * + * @param wmRtIssueLine 生产退料单行 + * @return 结果 + */ + public int updateWmRtIssueLine(WmRtIssueLine wmRtIssueLine); + + /** + * 批量删除生产退料单行 + * + * @param lineIds 需要删除的生产退料单行主键集合 + * @return 结果 + */ + public int deleteWmRtIssueLineByLineIds(Long[] lineIds); + + /** + * 删除生产退料单行信息 + * + * @param lineId 生产退料单行主键 + * @return 结果 + */ + public int deleteWmRtIssueLineByLineId(Long lineId); + + /** + * 根据退料单ID删除所有行 + * @param rtId + * @return + */ + public int deleteByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueService.java new file mode 100644 index 0000000..ee2c9e6 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueService.java @@ -0,0 +1,77 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtIssue; +import com.ktg.mes.wm.domain.tx.RtIssueTxBean; + +/** + * 生产退料单头Service接口 + * + * @author yinjinlu + * @date 2022-09-15 + */ +public interface IWmRtIssueService +{ + /** + * 查询生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 生产退料单头 + */ + public WmRtIssue selectWmRtIssueByRtId(Long rtId); + + /** + * 查询生产退料单头列表 + * + * @param wmRtIssue 生产退料单头 + * @return 生产退料单头集合 + */ + public List selectWmRtIssueList(WmRtIssue wmRtIssue); + + /** + * 检查编号是否重复 + * @param wmRtIssue + * @return + */ + public String checkUnique(WmRtIssue wmRtIssue); + + /** + * 新增生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int insertWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 修改生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int updateWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 批量删除生产退料单头 + * + * @param rtIds 需要删除的生产退料单头主键集合 + * @return 结果 + */ + public int deleteWmRtIssueByRtIds(Long[] rtIds); + + /** + * 删除生产退料单头信息 + * + * @param rtId 生产退料单头主键 + * @return 结果 + */ + public int deleteWmRtIssueByRtId(Long rtId); + + /** + * + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseLineService.java new file mode 100644 index 0000000..e4ba207 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtSalseLine; + +/** + * 产品销售退货行Service接口 + * + * @author yinjinlu + * @date 2022-10-06 + */ +public interface IWmRtSalseLineService +{ + /** + * 查询产品销售退货行 + * + * @param lineId 产品销售退货行主键 + * @return 产品销售退货行 + */ + public WmRtSalseLine selectWmRtSalseLineByLineId(Long lineId); + + /** + * 查询产品销售退货行列表 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 产品销售退货行集合 + */ + public List selectWmRtSalseLineList(WmRtSalseLine wmRtSalseLine); + + /** + * 新增产品销售退货行 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 结果 + */ + public int insertWmRtSalseLine(WmRtSalseLine wmRtSalseLine); + + /** + * 修改产品销售退货行 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 结果 + */ + public int updateWmRtSalseLine(WmRtSalseLine wmRtSalseLine); + + /** + * 批量删除产品销售退货行 + * + * @param lineIds 需要删除的产品销售退货行主键集合 + * @return 结果 + */ + public int deleteWmRtSalseLineByLineIds(Long[] lineIds); + + /** + * 删除产品销售退货行信息 + * + * @param lineId 产品销售退货行主键 + * @return 结果 + */ + public int deleteWmRtSalseLineByLineId(Long lineId); + + /** + * 根据退货单ID删除所有行 + * @param rtId + * @return + */ + public int deleteByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java new file mode 100644 index 0000000..75910d7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtSalse; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; + +/** + * 产品销售退货单Service接口 + * + * @author yinjinlu + * @date 2022-10-06 + */ +public interface IWmRtSalseService +{ + /** + * 查询产品销售退货单 + * + * @param rtId 产品销售退货单主键 + * @return 产品销售退货单 + */ + public WmRtSalse selectWmRtSalseByRtId(Long rtId); + + /** + * 查询产品销售退货单列表 + * + * @param wmRtSalse 产品销售退货单 + * @return 产品销售退货单集合 + */ + public List selectWmRtSalseList(WmRtSalse wmRtSalse); + + + /** + * + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + + /** + * 检查编号唯一性 + * @return + */ + public String checkUnique(WmRtSalse wmRtSalse); + + /** + * 新增产品销售退货单 + * + * @param wmRtSalse 产品销售退货单 + * @return 结果 + */ + public int insertWmRtSalse(WmRtSalse wmRtSalse); + + /** + * 修改产品销售退货单 + * + * @param wmRtSalse 产品销售退货单 + * @return 结果 + */ + public int updateWmRtSalse(WmRtSalse wmRtSalse); + + /** + * 批量删除产品销售退货单 + * + * @param rtIds 需要删除的产品销售退货单主键集合 + * @return 结果 + */ + public int deleteWmRtSalseByRtIds(Long[] rtIds); + + /** + * 删除产品销售退货单信息 + * + * @param rtId 产品销售退货单主键 + * @return 结果 + */ + public int deleteWmRtSalseByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorLineService.java new file mode 100644 index 0000000..9593d9f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorLineService.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtVendorLine; + +/** + * 供应商退货行Service接口 + * + * @author yinjinlu + * @date 2022-06-13 + */ +public interface IWmRtVendorLineService +{ + /** + * 查询供应商退货行 + * + * @param lineId 供应商退货行主键 + * @return 供应商退货行 + */ + public WmRtVendorLine selectWmRtVendorLineByLineId(Long lineId); + + /** + * 查询供应商退货行列表 + * + * @param wmRtVendorLine 供应商退货行 + * @return 供应商退货行集合 + */ + public List selectWmRtVendorLineList(WmRtVendorLine wmRtVendorLine); + + /** + * 新增供应商退货行 + * + * @param wmRtVendorLine 供应商退货行 + * @return 结果 + */ + public int insertWmRtVendorLine(WmRtVendorLine wmRtVendorLine); + + /** + * 修改供应商退货行 + * + * @param wmRtVendorLine 供应商退货行 + * @return 结果 + */ + public int updateWmRtVendorLine(WmRtVendorLine wmRtVendorLine); + + /** + * 批量删除供应商退货行 + * + * @param lineIds 需要删除的供应商退货行主键集合 + * @return 结果 + */ + public int deleteWmRtVendorLineByLineIds(Long[] lineIds); + + /** + * 删除供应商退货行信息 + * + * @param lineId 供应商退货行主键 + * @return 结果 + */ + public int deleteWmRtVendorLineByLineId(Long lineId); + + public int deleteByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorService.java new file mode 100644 index 0000000..e3e9103 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorService.java @@ -0,0 +1,77 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.domain.tx.RtVendorTxBean; + +/** + * 供应商退货Service接口 + * + * @author yinjinlu + * @date 2022-06-13 + */ +public interface IWmRtVendorService +{ + /** + * 查询供应商退货 + * + * @param rtId 供应商退货主键 + * @return 供应商退货 + */ + public WmRtVendor selectWmRtVendorByRtId(Long rtId); + + /** + * 查询供应商退货列表 + * + * @param wmRtVendor 供应商退货 + * @return 供应商退货集合 + */ + public List selectWmRtVendorList(WmRtVendor wmRtVendor); + + /** + * 检查供应商退货单编码是否唯一 + * @param wmRtVendor + * @return + */ + public String checkCodeUnique(WmRtVendor wmRtVendor); + + /** + * 新增供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int insertWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 修改供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int updateWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 批量删除供应商退货 + * + * @param rtIds 需要删除的供应商退货主键集合 + * @return 结果 + */ + public int deleteWmRtVendorByRtIds(Long[] rtIds); + + /** + * 删除供应商退货信息 + * + * @param rtId 供应商退货主键 + * @return 结果 + */ + public int deleteWmRtVendorByRtId(Long rtId); + + /** + * 获取库存事务bean + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmSnService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmSnService.java new file mode 100644 index 0000000..f83d333 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmSnService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmSn; + +/** + * SN码Service接口 + * + * @author yinjinlu + * @date 2022-12-08 + */ +public interface IWmSnService +{ + /** + * 查询SN码 + * + * @param snId SN码主键 + * @return SN码 + */ + public WmSn selectWmSnBySnId(Long snId); + + /** + * 查询SN码列表 + * + * @param wmSn SN码 + * @return SN码集合 + */ + public List selectWmSnList(WmSn wmSn); + + /** + * 查询SN展示列表 + * @param wmSn + * @return + */ + public List selectSnList(WmSn wmSn); + + /** + * 新增SN码 + * + * @param wmSn SN码 + * @return 结果 + */ + public int insertWmSn(WmSn wmSn); + + /** + * 修改SN码 + * + * @param wmSn SN码 + * @return 结果 + */ + public int updateWmSn(WmSn wmSn); + + /** + * 批量删除SN码 + * + * @param snIds 需要删除的SN码主键集合 + * @return 结果 + */ + public int deleteWmSnBySnIds(Long[] snIds); + + /** + * 删除SN码信息 + * + * @param snId SN码主键 + * @return 结果 + */ + public int deleteWmSnBySnId(Long snId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java new file mode 100644 index 0000000..6c13826 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingLineService.java @@ -0,0 +1,63 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingLine; + +/** + * 库存盘点明细Service接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface IWmStockTakingLineService +{ + /** + * 查询库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 库存盘点明细 + */ + public WmStockTakingLine selectWmStockTakingLineByLineId(Long lineId); + + /** + * 查询库存盘点明细列表 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 库存盘点明细集合 + */ + public List selectWmStockTakingLineList(WmStockTakingLine wmStockTakingLine); + + /** + * 新增库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int insertWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 修改库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + public int updateWmStockTakingLine(WmStockTakingLine wmStockTakingLine); + + /** + * 批量删除库存盘点明细 + * + * @param lineIds 需要删除的库存盘点明细主键集合 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineIds(Long[] lineIds); + + /** + * 删除库存盘点明细信息 + * + * @param lineId 库存盘点明细主键 + * @return 结果 + */ + public int deleteWmStockTakingLineByLineId(Long lineId); + + public int deleteByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java new file mode 100644 index 0000000..2c48e46 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingResultService.java @@ -0,0 +1,79 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTakingResult; + +/** + * 库存盘点结果Service接口 + * + * @author yinjinlu + * @date 2023-08-22 + */ +public interface IWmStockTakingResultService +{ + /** + * 查询库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 库存盘点结果 + */ + public WmStockTakingResult selectWmStockTakingResultByResultId(Long resultId); + + /** + * 查询库存盘点结果列表 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 库存盘点结果集合 + */ + public List selectWmStockTakingResultList(WmStockTakingResult wmStockTakingResult); + + + /** + * 针对明盘的盘点结果计算 + * @param takingId + * @return + */ + public void calculateOpenWmStockTakingResult(Long takingId); + + + /** + * 根据当前盘点记录计算盘点结果 + * @param takingId + * @return + */ + public void calculateWmStockTakingResult(Long takingId); + + /** + * 新增库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int insertWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 修改库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + public int updateWmStockTakingResult(WmStockTakingResult wmStockTakingResult); + + /** + * 批量删除库存盘点结果 + * + * @param resultIds 需要删除的库存盘点结果主键集合 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultIds(Long[] resultIds); + + /** + * 删除库存盘点结果信息 + * + * @param resultId 库存盘点结果主键 + * @return 结果 + */ + public int deleteWmStockTakingResultByResultId(Long resultId); + + public int deleteWmStockTakingResultByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java new file mode 100644 index 0000000..170622c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStockTakingService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStockTaking; + +/** + * 库存盘点记录Service接口 + * + * @author yinjinlu + * @date 2023-08-17 + */ +public interface IWmStockTakingService +{ + /** + * 查询库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 库存盘点记录 + */ + public WmStockTaking selectWmStockTakingByTakingId(Long takingId); + + /** + * 查询库存盘点记录列表 + * + * @param wmStockTaking 库存盘点记录 + * @return 库存盘点记录集合 + */ + public List selectWmStockTakingList(WmStockTaking wmStockTaking); + + /** + * 检查编码是否唯一 + * @param stockTaking + * @return + */ + public String checkUnique(WmStockTaking stockTaking); + + /** + * 新增库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int insertWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 修改库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + public int updateWmStockTaking(WmStockTaking wmStockTaking); + + /** + * 批量删除库存盘点记录 + * + * @param takingIds 需要删除的库存盘点记录主键集合 + * @return 结果 + */ + public int deleteWmStockTakingByTakingIds(Long[] takingIds); + + /** + * 删除库存盘点记录信息 + * + * @param takingId 库存盘点记录主键 + * @return 结果 + */ + public int deleteWmStockTakingByTakingId(Long takingId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageAreaService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageAreaService.java new file mode 100644 index 0000000..1431ddc --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageAreaService.java @@ -0,0 +1,83 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStorageArea; + +/** + * 库位设置Service接口 + * + * @author yinjinlu + * @date 2022-05-08 + */ +public interface IWmStorageAreaService +{ + /** + * 查询库位设置 + * + * @param areaId 库位设置主键 + * @return 库位设置 + */ + public WmStorageArea selectWmStorageAreaByAreaId(Long areaId); + + + /** + * 根据库位编码查询库位 + * @param areaCode + * @return + */ + public WmStorageArea selectWmStorageAreaByAreaCode(String areaCode); + + /** + * 查询库位设置列表 + * + * @param wmStorageArea 库位设置 + * @return 库位设置集合 + */ + public List selectWmStorageAreaList(WmStorageArea wmStorageArea); + + /** + * 新增库位设置 + * + * @param wmStorageArea 库位设置 + * @return 结果 + */ + public int insertWmStorageArea(WmStorageArea wmStorageArea); + + /** + * 修改库位设置 + * + * @param wmStorageArea 库位设置 + * @return 结果 + */ + public int updateWmStorageArea(WmStorageArea wmStorageArea); + + /** + * 批量删除库位设置 + * + * @param areaIds 需要删除的库位设置主键集合 + * @return 结果 + */ + public int deleteWmStorageAreaByAreaIds(Long[] areaIds); + + /** + * 删除库位设置信息 + * + * @param areaId 库位设置主键 + * @return 结果 + */ + public int deleteWmStorageAreaByAreaId(Long areaId); + + /** + * 根据仓库删除对应的库位 + * @param warehouseId + * @return + */ + public int deleteByWarehouseId(Long warehouseId); + + /** + * 根据库区删除对应的库位 + * @param locationId + * @return + */ + public int deleteByLocationId(Long locationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageLocationService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageLocationService.java new file mode 100644 index 0000000..3e3427c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageLocationService.java @@ -0,0 +1,92 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStorageLocation; + +/** + * 库区设置Service接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface IWmStorageLocationService +{ + /** + * 查询库区设置 + * + * @param locationId 库区设置主键 + * @return 库区设置 + */ + public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId); + + + /** + * 根据库区编码查询库区 + * @param locationCode + * @return + */ + public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode); + + + /** + * 查询库区设置列表 + * + * @param wmStorageLocation 库区设置 + * @return 库区设置集合 + */ + public List selectWmStorageLocationList(WmStorageLocation wmStorageLocation); + + + /** + * 检查库区编码是否唯一 + * @param wmStorageLocation + * @return + */ + public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation); + + /** + * 检查库区名称是否唯一 + * @param wmStorageLocation + * @return + */ + public String checkLocationNameUnique(WmStorageLocation wmStorageLocation); + + /** + * 新增库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int insertWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 修改库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int updateWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 批量删除库区设置 + * + * @param locationIds 需要删除的库区设置主键集合 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationIds(Long[] locationIds); + + /** + * 删除库区设置信息 + * + * @param locationId 库区设置主键 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationId(Long locationId); + + /** + * 根据仓库删除对应的库区 + * @param warehouseId + * @return + */ + public int deleteByWarehouseId(Long warehouseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransactionService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransactionService.java new file mode 100644 index 0000000..bd5df4a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransactionService.java @@ -0,0 +1,65 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmTransaction; + +/** + * 库存事务Service接口 + * + * @author yinjinlu + * @date 2022-05-24 + */ +public interface IWmTransactionService +{ + + public WmTransaction processTransaction(WmTransaction wmTransaction); + + + /** + * 查询库存事务 + * + * @param transactionId 库存事务主键 + * @return 库存事务 + */ + public WmTransaction selectWmTransactionByTransactionId(Long transactionId); + + /** + * 查询库存事务列表 + * + * @param wmTransaction 库存事务 + * @return 库存事务集合 + */ + public List selectWmTransactionList(WmTransaction wmTransaction); + + /** + * 新增库存事务 + * + * @param wmTransaction 库存事务 + * @return 结果 + */ + public int insertWmTransaction(WmTransaction wmTransaction); + + /** + * 修改库存事务 + * + * @param wmTransaction 库存事务 + * @return 结果 + */ + public int updateWmTransaction(WmTransaction wmTransaction); + + /** + * 批量删除库存事务 + * + * @param transactionIds 需要删除的库存事务主键集合 + * @return 结果 + */ + public int deleteWmTransactionByTransactionIds(Long[] transactionIds); + + /** + * 删除库存事务信息 + * + * @param transactionId 库存事务主键 + * @return 结果 + */ + public int deleteWmTransactionByTransactionId(Long transactionId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransferLineService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransferLineService.java new file mode 100644 index 0000000..85e3c07 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransferLineService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmTransferLine; + +/** + * 转移单行Service接口 + * + * @author yinjinlu + * @date 2022-11-28 + */ +public interface IWmTransferLineService +{ + /** + * 查询转移单行 + * + * @param lineId 转移单行主键 + * @return 转移单行 + */ + public WmTransferLine selectWmTransferLineByLineId(Long lineId); + + /** + * 查询转移单行列表 + * + * @param wmTransferLine 转移单行 + * @return 转移单行集合 + */ + public List selectWmTransferLineList(WmTransferLine wmTransferLine); + + /** + * 新增转移单行 + * + * @param wmTransferLine 转移单行 + * @return 结果 + */ + public int insertWmTransferLine(WmTransferLine wmTransferLine); + + /** + * 修改转移单行 + * + * @param wmTransferLine 转移单行 + * @return 结果 + */ + public int updateWmTransferLine(WmTransferLine wmTransferLine); + + /** + * 批量删除转移单行 + * + * @param lineIds 需要删除的转移单行主键集合 + * @return 结果 + */ + public int deleteWmTransferLineByLineIds(Long[] lineIds); + + /** + * 删除转移单行信息 + * + * @param lineId 转移单行主键 + * @return 结果 + */ + public int deleteWmTransferLineByLineId(Long lineId); + + /** + * 根据头ID删除所有行 + * @param transferId + * @return + */ + public int deleteByTransferId(Long transferId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransferService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransferService.java new file mode 100644 index 0000000..74c40fb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmTransferService.java @@ -0,0 +1,72 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmTransfer; +import com.ktg.mes.wm.domain.tx.TransferTxBean; + +/** + * 转移单Service接口 + * + * @author yinjinlu + * @date 2022-11-28 + */ +public interface IWmTransferService +{ + /** + * 查询转移单 + * + * @param transferId 转移单主键 + * @return 转移单 + */ + public WmTransfer selectWmTransferByTransferId(Long transferId); + + /** + * 查询转移单列表 + * + * @param wmTransfer 转移单 + * @return 转移单集合 + */ + public List selectWmTransferList(WmTransfer wmTransfer); + + + public List getTxBeans(Long transferid); + + /** + * 检查编码是否唯一 + * @param wmTransfer + * @return + */ + public String checkUnique(WmTransfer wmTransfer); + + /** + * 新增转移单 + * + * @param wmTransfer 转移单 + * @return 结果 + */ + public int insertWmTransfer(WmTransfer wmTransfer); + + /** + * 修改转移单 + * + * @param wmTransfer 转移单 + * @return 结果 + */ + public int updateWmTransfer(WmTransfer wmTransfer); + + /** + * 批量删除转移单 + * + * @param transferIds 需要删除的转移单主键集合 + * @return 结果 + */ + public int deleteWmTransferByTransferIds(Long[] transferIds); + + /** + * 删除转移单信息 + * + * @param transferId 转移单主键 + * @return 结果 + */ + public int deleteWmTransferByTransferId(Long transferId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java new file mode 100644 index 0000000..7395d7d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java @@ -0,0 +1,90 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmWarehouse; + +/** + * 仓库设置Service接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface IWmWarehouseService +{ + /** + * 查询仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 仓库设置 + */ + public WmWarehouse selectWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 根据编码查询仓库 + * @param warehouseCdoe + * @return + */ + public WmWarehouse selectWmWarehouseByWarehouseCode(String warehouseCdoe); + + /** + * 查询仓库设置列表 + * + * @param wmWarehouse 仓库设置 + * @return 仓库设置集合 + */ + public List selectWmWarehouseList(WmWarehouse wmWarehouse); + + public List getTreeList(); + + /** + * 检查仓库编码是否重复 + * @param wmWarehouse + * @return + */ + public String checkWarehouseCodeUnique(WmWarehouse wmWarehouse); + + /** + * 检查仓库名称是否重复 + * @param wmWarehouse + * @return + */ + public String checkWarehouseNameUnique(WmWarehouse wmWarehouse); + + /** + * 新增仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int insertWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 修改仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int updateWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 批量删除仓库设置 + * + * @param warehouseIds 需要删除的仓库设置主键集合 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds); + + /** + * 删除仓库设置信息 + * + * @param warehouseId 仓库设置主键 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 初始化虚拟的线边库 + * @return + */ + public WmWarehouse initVirtualWarehouse(); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java new file mode 100644 index 0000000..32f77df --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java @@ -0,0 +1,444 @@ +package com.ktg.mes.wm.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.exception.BussinessException; +import com.ktg.common.utils.bean.BeanUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.domain.WmTransaction; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.domain.tx.*; +import com.ktg.mes.wm.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + + +@Component +public class StorageCoreServiceImpl implements IStorageCoreService { + + @Autowired + private IWmTransactionService wmTransactionService; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + /** + * 采购入库 + * @param lines + */ + @Override + public void processItemRecpt(List lines) { + String transactionType = UserConstants.TRANSACTION_TYPE_ITEM_RECPT; + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的入库单行"); + } + + for (int i =0;i lines) { + String transactionType = UserConstants.TRANSACTION_TYPE_ITEM_RTV; + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的退货单行"); + } + + for(int i=0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的领料单行"); + } + + String transactionType_out = UserConstants.TRANSACTION_TYPE_ITEM_ISSUE_OUT; + String transactionType_in = UserConstants.TRANSACTION_TYPE_ITEM_ISSUE_IN; + for(int i=0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的外协发货单行"); + } + + String transactionType_out = UserConstants.TRANSACTION_TYPE_ITEM_ISSUE_OUT; + for(int i=0;i lines) { + String transactionType = UserConstants.TRANSACTION_TYPE_OUTSOURCE_RECPT_IN; + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的外协入库单行"); + } + + for (int i =0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的退料单行"); + } + + String transactionType_out = UserConstants.TRANSACTION_TYPE_ITEM_RT_ISSUE_OUT; + String transactionType_in = UserConstants.TRANSACTION_TYPE_ITEM_RT_ISSUE_IN; + for(int i=0;i lines){ + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的原料消耗单行"); + } + String transactionType = UserConstants.TRANSACTION_TYPE_ITEM_CONSUME; + for(int i=0;i lines){ + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的产品产出单行"); + } + String transactionType = UserConstants.TRANSACTION_TYPE_PRODUCT_PRODUCE; + for(int i=0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的产品入库单行"); + } + String transactionType_out = UserConstants.TRANSACTION_TYPE_PRODUCT_RECPT_OUT; + String transactionType_in = UserConstants.TRANSACTION_TYPE_PRODUCT_RECPT_IN; + + for(int i=0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的产品销售出库单行"); + } + + String transactionType = UserConstants.TRANSACTION_TYPE_PRODUCT_ISSUE; + for(int i=0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的原料消耗单行"); + } + String transactionType = UserConstants.TRANSACTION_TYPE_PRODUCT_RS; + for(int i=0;i lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的原料消耗单行"); + } + String transactionType_out = UserConstants.TRANSACTION_TYPE_WAREHOUSE_TRANS_OUT; + String transactionType_in = UserConstants.TRANSACTION_TYPE_WAREHOUSE_TRANS_IN; + + for(int i=0;i selectWmBarcodeConfigList(WmBarcodeConfig wmBarcodeConfig) + { + return wmBarcodeConfigMapper.selectWmBarcodeConfigList(wmBarcodeConfig); + } + + /** + * 新增条码配置 + * + * @param wmBarcodeConfig 条码配置 + * @return 结果 + */ + @Override + public int insertWmBarcodeConfig(WmBarcodeConfig wmBarcodeConfig) + { + wmBarcodeConfig.setCreateTime(DateUtils.getNowDate()); + return wmBarcodeConfigMapper.insertWmBarcodeConfig(wmBarcodeConfig); + } + + /** + * 修改条码配置 + * + * @param wmBarcodeConfig 条码配置 + * @return 结果 + */ + @Override + public int updateWmBarcodeConfig(WmBarcodeConfig wmBarcodeConfig) + { + wmBarcodeConfig.setUpdateTime(DateUtils.getNowDate()); + return wmBarcodeConfigMapper.updateWmBarcodeConfig(wmBarcodeConfig); + } + + /** + * 批量删除条码配置 + * + * @param configIds 需要删除的条码配置主键 + * @return 结果 + */ + @Override + public int deleteWmBarcodeConfigByConfigIds(Long[] configIds) + { + return wmBarcodeConfigMapper.deleteWmBarcodeConfigByConfigIds(configIds); + } + + /** + * 删除条码配置信息 + * + * @param configId 条码配置主键 + * @return 结果 + */ + @Override + public int deleteWmBarcodeConfigByConfigId(Long configId) + { + return wmBarcodeConfigMapper.deleteWmBarcodeConfigByConfigId(configId); + } + + /** + * 判断某种类型的业务是否需要自动生成赋码 + * @param barcodeType + * @return + */ + @Override + public boolean isAutoGen(String barcodeType) { + WmBarcodeConfig param = new WmBarcodeConfig(); + param.setBarcodeType(barcodeType); + List configs = wmBarcodeConfigMapper.selectWmBarcodeConfigList(param); + if(!CollectionUtils.isEmpty(configs)){ + return UserConstants.YES.equals(configs.get(0).getAutoGenFlag())?true:false; + } + return false; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmBarcodeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmBarcodeServiceImpl.java new file mode 100644 index 0000000..ca28483 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmBarcodeServiceImpl.java @@ -0,0 +1,137 @@ +package com.ktg.mes.wm.service.impl; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.barcode.BarcodeUtil; +import com.ktg.common.utils.file.FileUploadUtils; +import com.ktg.common.utils.file.FileUtils; +import com.ktg.mes.wm.domain.WmBarcode; +import com.ktg.mes.wm.mapper.WmBarcodeMapper; +import com.ktg.mes.wm.service.IWmBarcodeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** + * 条码清单Service业务层处理 + * + * @author yinjinlu + * @date 2022-08-01 + */ +@Service +public class WmBarcodeServiceImpl implements IWmBarcodeService +{ + @Autowired + private WmBarcodeMapper wmBarcodeMapper; + + /** + * 查询条码清单 + * + * @param barcodeId 条码清单主键 + * @return 条码清单 + */ + @Override + public WmBarcode selectWmBarcodeByBarcodeId(Long barcodeId) + { + return wmBarcodeMapper.selectWmBarcodeByBarcodeId(barcodeId); + } + + /** + * 查询条码清单列表 + * + * @param wmBarcode 条码清单 + * @return 条码清单 + */ + @Override + public List selectWmBarcodeList(WmBarcode wmBarcode) + { + return wmBarcodeMapper.selectWmBarcodeList(wmBarcode); + } + + @Override + public String checkBarcodeUnique(WmBarcode wmBarcode) { + WmBarcode barcode = wmBarcodeMapper.checkBarcodeUnique(wmBarcode); + Long barcodeId = wmBarcode.getBarcodeId()==null?-1L:wmBarcode.getBarcodeId(); + if(StringUtils.isNotNull(barcode) && barcode.getBarcodeId().longValue() != barcodeId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增条码清单 + * + * @param wmBarcode 条码清单 + * @return 结果 + */ + @Override + public int insertWmBarcode(WmBarcode wmBarcode) + { + wmBarcode.setCreateTime(DateUtils.getNowDate()); + return wmBarcodeMapper.insertWmBarcode(wmBarcode); + } + + /** + * 修改条码清单 + * + * @param wmBarcode 条码清单 + * @return 结果 + */ + @Override + public int updateWmBarcode(WmBarcode wmBarcode) + { + wmBarcode.setUpdateTime(DateUtils.getNowDate()); + return wmBarcodeMapper.updateWmBarcode(wmBarcode); + } + + /** + * 批量删除条码清单 + * + * @param barcodeIds 需要删除的条码清单主键 + * @return 结果 + */ + @Override + public int deleteWmBarcodeByBarcodeIds(Long[] barcodeIds) + { + return wmBarcodeMapper.deleteWmBarcodeByBarcodeIds(barcodeIds); + } + + /** + * 删除条码清单信息 + * + * @param barcodeId 条码清单主键 + * @return 结果 + */ + @Override + public int deleteWmBarcodeByBarcodeId(Long barcodeId) + { + return wmBarcodeMapper.deleteWmBarcodeByBarcodeId(barcodeId); + } + + @Override + public String generateBarcode(WmBarcode wmBarcode) { + File buf = BarcodeUtil.generateBarCode(wmBarcode.getBarcodeContent(), wmBarcode.getBarcodeFormart(), + "./tmp/barcode/" + wmBarcode.getBarcodeContent() + ".png"); + MultipartFile file = FileUtils.getMultipartFile(buf); + String fileName = null; + try { + fileName = FileUploadUtils.uploadMinio(file); + } catch (IOException e) { + e.printStackTrace(); + return null; + }finally{ + //删除掉临时文件 + if(buf!=null && buf.exists()){ + FileUtils.deleteFile(buf.getAbsolutePath()); + } + } + return fileName; + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmIssueHeaderServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmIssueHeaderServiceImpl.java new file mode 100644 index 0000000..3ae34c9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmIssueHeaderServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.IssueTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmIssueHeaderMapper; +import com.ktg.mes.wm.domain.WmIssueHeader; +import com.ktg.mes.wm.service.IWmIssueHeaderService; + +/** + * 生产领料单头Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-14 + */ +@Service +public class WmIssueHeaderServiceImpl implements IWmIssueHeaderService +{ + @Autowired + private WmIssueHeaderMapper wmIssueHeaderMapper; + + /** + * 查询生产领料单头 + * + * @param issueId 生产领料单头主键 + * @return 生产领料单头 + */ + @Override + public WmIssueHeader selectWmIssueHeaderByIssueId(Long issueId) + { + return wmIssueHeaderMapper.selectWmIssueHeaderByIssueId(issueId); + } + + /** + * 查询生产领料单头列表 + * + * @param wmIssueHeader 生产领料单头 + * @return 生产领料单头 + */ + @Override + public List selectWmIssueHeaderList(WmIssueHeader wmIssueHeader) + { + return wmIssueHeaderMapper.selectWmIssueHeaderList(wmIssueHeader); + } + + @Override + public String checkIssueCodeUnique(WmIssueHeader wmIssueHeader) { + WmIssueHeader header = wmIssueHeaderMapper.checkIssueCodeUnique(wmIssueHeader); + Long headerId = wmIssueHeader.getIssueId()==null?-1l:wmIssueHeader.getIssueId(); + if(StringUtils.isNotNull(header) && headerId.longValue() !=header.getIssueId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增生产领料单头 + * + * @param wmIssueHeader 生产领料单头 + * @return 结果 + */ + @Override + public int insertWmIssueHeader(WmIssueHeader wmIssueHeader) + { + wmIssueHeader.setCreateTime(DateUtils.getNowDate()); + return wmIssueHeaderMapper.insertWmIssueHeader(wmIssueHeader); + } + + /** + * 修改生产领料单头 + * + * @param wmIssueHeader 生产领料单头 + * @return 结果 + */ + @Override + public int updateWmIssueHeader(WmIssueHeader wmIssueHeader) + { + wmIssueHeader.setUpdateTime(DateUtils.getNowDate()); + return wmIssueHeaderMapper.updateWmIssueHeader(wmIssueHeader); + } + + /** + * 批量删除生产领料单头 + * + * @param issueIds 需要删除的生产领料单头主键 + * @return 结果 + */ + @Override + public int deleteWmIssueHeaderByIssueIds(Long[] issueIds) + { + return wmIssueHeaderMapper.deleteWmIssueHeaderByIssueIds(issueIds); + } + + /** + * 删除生产领料单头信息 + * + * @param issueId 生产领料单头主键 + * @return 结果 + */ + @Override + public int deleteWmIssueHeaderByIssueId(Long issueId) + { + return wmIssueHeaderMapper.deleteWmIssueHeaderByIssueId(issueId); + } + + @Override + public List getTxBeans(Long issueId) { + return wmIssueHeaderMapper.getTxBeans(issueId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmIssueLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmIssueLineServiceImpl.java new file mode 100644 index 0000000..d56cbd9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmIssueLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmIssueLineMapper; +import com.ktg.mes.wm.domain.WmIssueLine; +import com.ktg.mes.wm.service.IWmIssueLineService; + +/** + * 生产领料单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-14 + */ +@Service +public class WmIssueLineServiceImpl implements IWmIssueLineService +{ + @Autowired + private WmIssueLineMapper wmIssueLineMapper; + + /** + * 查询生产领料单行 + * + * @param lineId 生产领料单行主键 + * @return 生产领料单行 + */ + @Override + public WmIssueLine selectWmIssueLineByLineId(Long lineId) + { + return wmIssueLineMapper.selectWmIssueLineByLineId(lineId); + } + + /** + * 查询生产领料单行列表 + * + * @param wmIssueLine 生产领料单行 + * @return 生产领料单行 + */ + @Override + public List selectWmIssueLineList(WmIssueLine wmIssueLine) + { + return wmIssueLineMapper.selectWmIssueLineList(wmIssueLine); + } + + /** + * 新增生产领料单行 + * + * @param wmIssueLine 生产领料单行 + * @return 结果 + */ + @Override + public int insertWmIssueLine(WmIssueLine wmIssueLine) + { + wmIssueLine.setCreateTime(DateUtils.getNowDate()); + return wmIssueLineMapper.insertWmIssueLine(wmIssueLine); + } + + /** + * 修改生产领料单行 + * + * @param wmIssueLine 生产领料单行 + * @return 结果 + */ + @Override + public int updateWmIssueLine(WmIssueLine wmIssueLine) + { + wmIssueLine.setUpdateTime(DateUtils.getNowDate()); + return wmIssueLineMapper.updateWmIssueLine(wmIssueLine); + } + + /** + * 批量删除生产领料单行 + * + * @param lineIds 需要删除的生产领料单行主键 + * @return 结果 + */ + @Override + public int deleteWmIssueLineByLineIds(Long[] lineIds) + { + return wmIssueLineMapper.deleteWmIssueLineByLineIds(lineIds); + } + + /** + * 删除生产领料单行信息 + * + * @param lineId 生产领料单行主键 + * @return 结果 + */ + @Override + public int deleteWmIssueLineByLineId(Long lineId) + { + return wmIssueLineMapper.deleteWmIssueLineByLineId(lineId); + } + + @Override + public int deleteByIssueHeaderId(Long issueId) { + return wmIssueLineMapper.deleteByIssueHeaderId(issueId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemConsumeLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemConsumeLineServiceImpl.java new file mode 100644 index 0000000..219036f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemConsumeLineServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmItemConsumeLineMapper; +import com.ktg.mes.wm.domain.WmItemConsumeLine; +import com.ktg.mes.wm.service.IWmItemConsumeLineService; + +/** + * 物料消耗记录行Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-19 + */ +@Service +public class WmItemConsumeLineServiceImpl implements IWmItemConsumeLineService +{ + @Autowired + private WmItemConsumeLineMapper wmItemConsumeLineMapper; + + /** + * 查询物料消耗记录行 + * + * @param lineId 物料消耗记录行主键 + * @return 物料消耗记录行 + */ + @Override + public WmItemConsumeLine selectWmItemConsumeLineByLineId(Long lineId) + { + return wmItemConsumeLineMapper.selectWmItemConsumeLineByLineId(lineId); + } + + /** + * 查询物料消耗记录行列表 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 物料消耗记录行 + */ + @Override + public List selectWmItemConsumeLineList(WmItemConsumeLine wmItemConsumeLine) + { + return wmItemConsumeLineMapper.selectWmItemConsumeLineList(wmItemConsumeLine); + } + + /** + * 新增物料消耗记录行 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 结果 + */ + @Override + public int insertWmItemConsumeLine(WmItemConsumeLine wmItemConsumeLine) + { + wmItemConsumeLine.setCreateTime(DateUtils.getNowDate()); + return wmItemConsumeLineMapper.insertWmItemConsumeLine(wmItemConsumeLine); + } + + /** + * 修改物料消耗记录行 + * + * @param wmItemConsumeLine 物料消耗记录行 + * @return 结果 + */ + @Override + public int updateWmItemConsumeLine(WmItemConsumeLine wmItemConsumeLine) + { + wmItemConsumeLine.setUpdateTime(DateUtils.getNowDate()); + return wmItemConsumeLineMapper.updateWmItemConsumeLine(wmItemConsumeLine); + } + + /** + * 批量删除物料消耗记录行 + * + * @param lineIds 需要删除的物料消耗记录行主键 + * @return 结果 + */ + @Override + public int deleteWmItemConsumeLineByLineIds(Long[] lineIds) + { + return wmItemConsumeLineMapper.deleteWmItemConsumeLineByLineIds(lineIds); + } + + /** + * 删除物料消耗记录行信息 + * + * @param lineId 物料消耗记录行主键 + * @return 结果 + */ + @Override + public int deleteWmItemConsumeLineByLineId(Long lineId) + { + return wmItemConsumeLineMapper.deleteWmItemConsumeLineByLineId(lineId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemConsumeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemConsumeServiceImpl.java new file mode 100644 index 0000000..c3abe93 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemConsumeServiceImpl.java @@ -0,0 +1,266 @@ +package com.ktg.mes.wm.service.impl; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.mapper.MdWorkstationMapper; +import com.ktg.mes.pro.domain.*; +import com.ktg.mes.pro.mapper.*; +import com.ktg.mes.wm.domain.WmItemConsumeLine; +import com.ktg.mes.wm.domain.WmMaterialStock; +import com.ktg.mes.wm.domain.tx.ItemConsumeTxBean; +import com.ktg.mes.wm.mapper.WmItemConsumeLineMapper; +import com.ktg.mes.wm.mapper.WmMaterialStockMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmItemConsumeMapper; +import com.ktg.mes.wm.domain.WmItemConsume; +import com.ktg.mes.wm.service.IWmItemConsumeService; + +/** + * 物料消耗记录Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-19 + */ +@Service +public class WmItemConsumeServiceImpl implements IWmItemConsumeService +{ + @Autowired + private WmItemConsumeMapper wmItemConsumeMapper; + + @Autowired + private WmItemConsumeLineMapper wmItemConsumeLineMapper; + + @Autowired + private ProWorkorderMapper proWorkorderMapper; + + @Autowired + private ProTaskMapper proTaskMapper; + + @Autowired + private MdWorkstationMapper mdWorkstationMapper; + + @Autowired + private ProProcessMapper proProcessMapper; + + @Autowired + private ProRouteMapper proRouteMapper; + + @Autowired + private ProRouteProductBomMapper proRouteProductBomMapper; + + @Autowired + private WmMaterialStockMapper wmMaterialStockMapper; + + /** + * 查询物料消耗记录 + * + * @param recordId 物料消耗记录主键 + * @return 物料消耗记录 + */ + @Override + public WmItemConsume selectWmItemConsumeByRecordId(Long recordId) + { + return wmItemConsumeMapper.selectWmItemConsumeByRecordId(recordId); + } + + /** + * 查询物料消耗记录列表 + * + * @param wmItemConsume 物料消耗记录 + * @return 物料消耗记录 + */ + @Override + public List selectWmItemConsumeList(WmItemConsume wmItemConsume) + { + return wmItemConsumeMapper.selectWmItemConsumeList(wmItemConsume); + } + + /** + * 新增物料消耗记录 + * + * @param wmItemConsume 物料消耗记录 + * @return 结果 + */ + @Override + public int insertWmItemConsume(WmItemConsume wmItemConsume) + { + wmItemConsume.setCreateTime(DateUtils.getNowDate()); + return wmItemConsumeMapper.insertWmItemConsume(wmItemConsume); + } + + /** + * 修改物料消耗记录 + * + * @param wmItemConsume 物料消耗记录 + * @return 结果 + */ + @Override + public int updateWmItemConsume(WmItemConsume wmItemConsume) + { + wmItemConsume.setUpdateTime(DateUtils.getNowDate()); + return wmItemConsumeMapper.updateWmItemConsume(wmItemConsume); + } + + /** + * 批量删除物料消耗记录 + * + * @param recordIds 需要删除的物料消耗记录主键 + * @return 结果 + */ + @Override + public int deleteWmItemConsumeByRecordIds(Long[] recordIds) + { + return wmItemConsumeMapper.deleteWmItemConsumeByRecordIds(recordIds); + } + + /** + * 删除物料消耗记录信息 + * + * @param recordId 物料消耗记录主键 + * @return 结果 + */ + @Override + public int deleteWmItemConsumeByRecordId(Long recordId) + { + return wmItemConsumeMapper.deleteWmItemConsumeByRecordId(recordId); + } + + + @Override + public WmItemConsume generateItemConsume(ProFeedback feedback) { + ProWorkorder workorder = proWorkorderMapper.selectProWorkorderByWorkorderId(feedback.getWorkorderId()); + MdWorkstation workstation = mdWorkstationMapper.selectMdWorkstationByWorkstationId(feedback.getWorkstationId()); + ProProcess process = proProcessMapper.selectProProcessByProcessId(workstation.getProcessId()); + ProTask task = proTaskMapper.selectProTaskByTaskId(feedback.getTaskId()); + ProRoute route = proRouteMapper.getRouteByProductId(feedback.getItemId()); + + //生成消耗单头信息 + WmItemConsume itemConsume = new WmItemConsume(); + itemConsume.setWorkorderId(feedback.getWorkorderId()); + itemConsume.setWorkorderCode(workorder.getWorkorderCode()); + itemConsume.setWorkorderName(workorder.getWorkorderName()); + + itemConsume.setWorkstationId(feedback.getWorkstationId()); + itemConsume.setWorkstationCode(workstation.getWorkstationCode()); + itemConsume.setWorkstationName(workstation.getWorkstationName()); + + itemConsume.setTaskId(feedback.getTaskId()); + itemConsume.setTaskCode(task.getTaskCode()); + itemConsume.setTaskName(task.getTaskName()); + + itemConsume.setProcessId(process.getProcessId()); + itemConsume.setProcessCode(process.getProcessCode()); + itemConsume.setProcessName(process.getProcessName()); + + itemConsume.setConsumeDate(new Date()); + itemConsume.setStatus(UserConstants.ORDER_STATUS_PREPARE); + wmItemConsumeMapper.insertWmItemConsume(itemConsume); + + //生成行信息 + //先获取当前生产的产品在此道工序中配置的物料BOM + ProRouteProductBom param = new ProRouteProductBom(); + param.setProductId(feedback.getItemId()); + param.setRouteId(route.getRouteId()); + List boms = proRouteProductBomMapper.selectProRouteProductBomList(param); + if(CollectionUtil.isNotEmpty(boms)){ + for (ProRouteProductBom bom: boms + ) { + //这里根据需要消耗的原材料/半成品信息 匹配出对应的线边库库存记录。 + BigDecimal quantityToConsume = bom.getQuantity().multiply(feedback.getQuantityFeedback()); //总的消耗量 + + //从线边库中,根据生产工单、物料按照先进先出的原则查询库存现有量 + WmMaterialStock p = new WmMaterialStock(); + p.setWorkorderCode(feedback.getWorkorderCode()); //当前工单 + p.setItemId(bom.getItemId()); //指定物料 + p.setWarehouseCode(UserConstants.VIRTUAL_WH); //线边库 + List ms = wmMaterialStockMapper.selectWmMaterialStockList(p); + if(CollectionUtil.isNotEmpty(ms)){ + WmMaterialStock theStock = null; + for(int i=0;i=0){ + //当前库存记录的库存量大于等于本次需要消耗的库存量, 则直接使用当前记录 + WmItemConsumeLine line = new WmItemConsumeLine(); + line.setMaterialStockId(theStock.getMaterialStockId()); + line.setRecordId(itemConsume.getRecordId()); + line.setItemId(bom.getItemId()); + line.setItemCode(bom.getItemCode()); + line.setItemName(bom.getItemName()); + line.setSpecification(bom.getSpecification()); + line.setUnitOfMeasure(bom.getUnitOfMeasure()); + line.setQuantityConsume(quantityToConsume); + line.setBatchCode(workorder.getBatchCode()); + wmItemConsumeLineMapper.insertWmItemConsumeLine(line); + + quantityToConsume= BigDecimal.ZERO; + }else if(theStock.getQuantityOnhand().compareTo(BigDecimal.ZERO)==1){ + //当前记录的库存量大于0 并且小于需要扣减的量,只从当前库存记录上扣减在库量,并更新剩余需要扣减的量 + WmItemConsumeLine line = new WmItemConsumeLine(); + line.setMaterialStockId(theStock.getMaterialStockId()); + line.setRecordId(itemConsume.getRecordId()); + line.setItemId(bom.getItemId()); + line.setItemCode(bom.getItemCode()); + line.setItemName(bom.getItemName()); + line.setSpecification(bom.getSpecification()); + line.setUnitOfMeasure(bom.getUnitOfMeasure()); + line.setQuantityConsume(theStock.getQuantityOnhand()); + line.setBatchCode(workorder.getBatchCode()); + wmItemConsumeLineMapper.insertWmItemConsumeLine(line); + quantityToConsume = quantityToConsume.subtract(theStock.getQuantityOnhand()); + } else { + //查出的库存量为负,不做处理 + } + + if(quantityToConsume.compareTo(BigDecimal.ZERO)==0){ + //量已经扣减完,则退出 + break; + } + } + + //循环完成后还有剩余未扣除的数量,直接在库中新增一条为负的记录(后期手工核销) + if(quantityToConsume.compareTo(BigDecimal.ZERO)==1){ + WmItemConsumeLine line = new WmItemConsumeLine(); + line.setRecordId(itemConsume.getRecordId()); + line.setItemId(bom.getItemId()); + line.setItemCode(bom.getItemCode()); + line.setItemName(bom.getItemName()); + line.setSpecification(bom.getSpecification()); + line.setUnitOfMeasure(bom.getUnitOfMeasure()); + line.setQuantityConsume(quantityToConsume); + line.setBatchCode(workorder.getBatchCode()); + wmItemConsumeLineMapper.insertWmItemConsumeLine(line); + } + + }else { + //没有查到领出到线边库的物料,直接在库中新增一条为负的记录(后期可能需要手工核销) + WmItemConsumeLine line = new WmItemConsumeLine(); + line.setRecordId(itemConsume.getRecordId()); + line.setItemId(bom.getItemId()); + line.setItemCode(bom.getItemCode()); + line.setItemName(bom.getItemName()); + line.setSpecification(bom.getSpecification()); + line.setUnitOfMeasure(bom.getUnitOfMeasure()); + line.setQuantityConsume(bom.getQuantity().multiply(feedback.getQuantityFeedback())); + line.setBatchCode(workorder.getBatchCode()); + wmItemConsumeLineMapper.insertWmItemConsumeLine(line); + } + } + }else { + return null; //如果本道工序没有配置BOM物料,则直接返回空 + } + + return itemConsume; + } + + @Override + public List getTxBeans(Long recordId) { + return wmItemConsumeMapper.getTxBeans(recordId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemRecptLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemRecptLineServiceImpl.java new file mode 100644 index 0000000..9f05760 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemRecptLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmItemRecptLineMapper; +import com.ktg.mes.wm.domain.WmItemRecptLine; +import com.ktg.mes.wm.service.IWmItemRecptLineService; + +/** + * 物料入库单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-22 + */ +@Service +public class WmItemRecptLineServiceImpl implements IWmItemRecptLineService +{ + @Autowired + private WmItemRecptLineMapper wmItemRecptLineMapper; + + /** + * 查询物料入库单行 + * + * @param lineId 物料入库单行主键 + * @return 物料入库单行 + */ + @Override + public WmItemRecptLine selectWmItemRecptLineByLineId(Long lineId) + { + return wmItemRecptLineMapper.selectWmItemRecptLineByLineId(lineId); + } + + /** + * 查询物料入库单行列表 + * + * @param wmItemRecptLine 物料入库单行 + * @return 物料入库单行 + */ + @Override + public List selectWmItemRecptLineList(WmItemRecptLine wmItemRecptLine) + { + return wmItemRecptLineMapper.selectWmItemRecptLineList(wmItemRecptLine); + } + + /** + * 新增物料入库单行 + * + * @param wmItemRecptLine 物料入库单行 + * @return 结果 + */ + @Override + public int insertWmItemRecptLine(WmItemRecptLine wmItemRecptLine) + { + wmItemRecptLine.setCreateTime(DateUtils.getNowDate()); + return wmItemRecptLineMapper.insertWmItemRecptLine(wmItemRecptLine); + } + + /** + * 修改物料入库单行 + * + * @param wmItemRecptLine 物料入库单行 + * @return 结果 + */ + @Override + public int updateWmItemRecptLine(WmItemRecptLine wmItemRecptLine) + { + wmItemRecptLine.setUpdateTime(DateUtils.getNowDate()); + return wmItemRecptLineMapper.updateWmItemRecptLine(wmItemRecptLine); + } + + /** + * 批量删除物料入库单行 + * + * @param lineIds 需要删除的物料入库单行主键 + * @return 结果 + */ + @Override + public int deleteWmItemRecptLineByLineIds(Long[] lineIds) + { + return wmItemRecptLineMapper.deleteWmItemRecptLineByLineIds(lineIds); + } + + /** + * 删除物料入库单行信息 + * + * @param lineId 物料入库单行主键 + * @return 结果 + */ + @Override + public int deleteWmItemRecptLineByLineId(Long lineId) + { + return wmItemRecptLineMapper.deleteWmItemRecptLineByLineId(lineId); + } + + @Override + public int deleteByRecptId(Long recptId) { + return wmItemRecptLineMapper.deleteByRecptId(recptId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemRecptServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemRecptServiceImpl.java new file mode 100644 index 0000000..3599b14 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmItemRecptServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.ItemRecptTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmItemRecptMapper; +import com.ktg.mes.wm.domain.WmItemRecpt; +import com.ktg.mes.wm.service.IWmItemRecptService; + +/** + * 物料入库单Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-22 + */ +@Service +public class WmItemRecptServiceImpl implements IWmItemRecptService +{ + @Autowired + private WmItemRecptMapper wmItemRecptMapper; + + /** + * 查询物料入库单 + * + * @param recptId 物料入库单主键 + * @return 物料入库单 + */ + @Override + public WmItemRecpt selectWmItemRecptByRecptId(Long recptId) + { + return wmItemRecptMapper.selectWmItemRecptByRecptId(recptId); + } + + /** + * 查询物料入库单列表 + * + * @param wmItemRecpt 物料入库单 + * @return 物料入库单 + */ + @Override + public List selectWmItemRecptList(WmItemRecpt wmItemRecpt) + { + return wmItemRecptMapper.selectWmItemRecptList(wmItemRecpt); + } + + @Override + public String checkRecptCodeUnique(WmItemRecpt wmItemRecpt) { + WmItemRecpt itemRecpt = wmItemRecptMapper.checkRecptCodeUnique(wmItemRecpt); + Long recptId = wmItemRecpt.getRecptId()==null?-1L:wmItemRecpt.getRecptId(); + if(StringUtils.isNotNull(itemRecpt) && itemRecpt.getRecptId().longValue() != recptId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增物料入库单 + * + * @param wmItemRecpt 物料入库单 + * @return 结果 + */ + @Override + public int insertWmItemRecpt(WmItemRecpt wmItemRecpt) + { + wmItemRecpt.setCreateTime(DateUtils.getNowDate()); + return wmItemRecptMapper.insertWmItemRecpt(wmItemRecpt); + } + + /** + * 修改物料入库单 + * + * @param wmItemRecpt 物料入库单 + * @return 结果 + */ + @Override + public int updateWmItemRecpt(WmItemRecpt wmItemRecpt) + { + wmItemRecpt.setUpdateTime(DateUtils.getNowDate()); + return wmItemRecptMapper.updateWmItemRecpt(wmItemRecpt); + } + + /** + * 批量删除物料入库单 + * + * @param recptIds 需要删除的物料入库单主键 + * @return 结果 + */ + @Override + public int deleteWmItemRecptByRecptIds(Long[] recptIds) + { + return wmItemRecptMapper.deleteWmItemRecptByRecptIds(recptIds); + } + + /** + * 删除物料入库单信息 + * + * @param recptId 物料入库单主键 + * @return 结果 + */ + @Override + public int deleteWmItemRecptByRecptId(Long recptId) + { + return wmItemRecptMapper.deleteWmItemRecptByRecptId(recptId); + } + + @Override + public List getTxBeans(Long receptId) { + return wmItemRecptMapper.getTxBeans(receptId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmMaterialStockServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmMaterialStockServiceImpl.java new file mode 100644 index 0000000..cc695e0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmMaterialStockServiceImpl.java @@ -0,0 +1,103 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.wm.domain.WmMaterialStock; +import com.ktg.mes.wm.mapper.WmMaterialStockMapper; +import com.ktg.mes.wm.service.IWmMaterialStockService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * 库存记录Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-24 + */ +@Service +public class WmMaterialStockServiceImpl implements IWmMaterialStockService +{ + @Autowired + private WmMaterialStockMapper wmMaterialStockMapper; + + /** + * 查询库存记录 + * + * @param materialStockId 库存记录主键 + * @return 库存记录 + */ + @Override + public WmMaterialStock selectWmMaterialStockByMaterialStockId(Long materialStockId) + { + return wmMaterialStockMapper.selectWmMaterialStockByMaterialStockId(materialStockId); + } + + + /** + * 查询库存记录列表 + * + * @param wmMaterialStock 库存记录 + * @return 库存记录 + */ + @Override + public List selectWmMaterialStockList(WmMaterialStock wmMaterialStock) + { + return wmMaterialStockMapper.selectWmMaterialStockList(wmMaterialStock); + } + + @Override + public List queryWmMaterialStockList(WmMaterialStock wmMaterialStock) { + return wmMaterialStockMapper.queryWmMaterialStockList(wmMaterialStock); + } + + /** + * 新增库存记录 + * + * @param wmMaterialStock 库存记录 + * @return 结果 + */ + @Override + public int insertWmMaterialStock(WmMaterialStock wmMaterialStock) + { + wmMaterialStock.setCreateTime(DateUtils.getNowDate()); + return wmMaterialStockMapper.insertWmMaterialStock(wmMaterialStock); + } + + /** + * 修改库存记录 + * + * @param wmMaterialStock 库存记录 + * @return 结果 + */ + @Override + public int updateWmMaterialStock(WmMaterialStock wmMaterialStock) + { + wmMaterialStock.setUpdateTime(DateUtils.getNowDate()); + return wmMaterialStockMapper.updateWmMaterialStock(wmMaterialStock); + } + + /** + * 批量删除库存记录 + * + * @param materialStockIds 需要删除的库存记录主键 + * @return 结果 + */ + @Override + public int deleteWmMaterialStockByMaterialStockIds(Long[] materialStockIds) + { + return wmMaterialStockMapper.deleteWmMaterialStockByMaterialStockIds(materialStockIds); + } + + /** + * 删除库存记录信息 + * + * @param materialStockId 库存记录主键 + * @return 结果 + */ + @Override + public int deleteWmMaterialStockByMaterialStockId(Long materialStockId) + { + return wmMaterialStockMapper.deleteWmMaterialStockByMaterialStockId(materialStockId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceIssueLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceIssueLineServiceImpl.java new file mode 100644 index 0000000..51fa74f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceIssueLineServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmOutsourceIssueLineMapper; +import com.ktg.mes.wm.domain.WmOutsourceIssueLine; +import com.ktg.mes.wm.service.IWmOutsourceIssueLineService; + +/** + * 外协领料单行Service业务层处理 + * + * @author yinjinlu + * @date 2023-10-30 + */ +@Service +public class WmOutsourceIssueLineServiceImpl implements IWmOutsourceIssueLineService +{ + @Autowired + private WmOutsourceIssueLineMapper wmOutsourceIssueLineMapper; + + /** + * 查询外协领料单行 + * + * @param lineId 外协领料单行主键 + * @return 外协领料单行 + */ + @Override + public WmOutsourceIssueLine selectWmOutsourceIssueLineByLineId(Long lineId) + { + return wmOutsourceIssueLineMapper.selectWmOutsourceIssueLineByLineId(lineId); + } + + /** + * 查询外协领料单行列表 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 外协领料单行 + */ + @Override + public List selectWmOutsourceIssueLineList(WmOutsourceIssueLine wmOutsourceIssueLine) + { + return wmOutsourceIssueLineMapper.selectWmOutsourceIssueLineList(wmOutsourceIssueLine); + } + + /** + * 根据发货单ID查询所有行信息 + * @param issueId + * @return + */ + @Override + public List selectWmOutsourceIssueLineByIssueId(Long issueId){ + return wmOutsourceIssueLineMapper.selectWmOutsourceIssueLineByIssueId(issueId); + } + + /** + * 新增外协领料单行 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 结果 + */ + @Override + public int insertWmOutsourceIssueLine(WmOutsourceIssueLine wmOutsourceIssueLine) + { + wmOutsourceIssueLine.setCreateTime(DateUtils.getNowDate()); + return wmOutsourceIssueLineMapper.insertWmOutsourceIssueLine(wmOutsourceIssueLine); + } + + /** + * 修改外协领料单行 + * + * @param wmOutsourceIssueLine 外协领料单行 + * @return 结果 + */ + @Override + public int updateWmOutsourceIssueLine(WmOutsourceIssueLine wmOutsourceIssueLine) + { + wmOutsourceIssueLine.setUpdateTime(DateUtils.getNowDate()); + return wmOutsourceIssueLineMapper.updateWmOutsourceIssueLine(wmOutsourceIssueLine); + } + + /** + * 批量删除外协领料单行 + * + * @param lineIds 需要删除的外协领料单行主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceIssueLineByLineIds(Long[] lineIds) + { + return wmOutsourceIssueLineMapper.deleteWmOutsourceIssueLineByLineIds(lineIds); + } + + /** + * 删除外协领料单行信息 + * + * @param lineId 外协领料单行主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceIssueLineByLineId(Long lineId) + { + return wmOutsourceIssueLineMapper.deleteWmOutsourceIssueLineByLineId(lineId); + } + + /** + * 根据发料单ID删除所有行 + * @param issueId + * @return + */ + public int deleteWmOutsourceIssueLineByIssueId(Long issueId){ + return wmOutsourceIssueLineMapper.deleteWmOutsourceIssueLineByIssueId(issueId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceIssueServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceIssueServiceImpl.java new file mode 100644 index 0000000..40a7bb8 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceIssueServiceImpl.java @@ -0,0 +1,97 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.wm.domain.tx.IssueTxBean; +import com.ktg.mes.wm.domain.tx.OutsourceIssueTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmOutsourceIssueMapper; +import com.ktg.mes.wm.domain.WmOutsourceIssue; +import com.ktg.mes.wm.service.IWmOutsourceIssueService; + +/** + * 外协领料单头Service业务层处理 + * + * @author yinjinlu + * @date 2023-10-30 + */ +@Service +public class WmOutsourceIssueServiceImpl implements IWmOutsourceIssueService { + + @Autowired + private WmOutsourceIssueMapper wmOutsourceIssueMapper; + + /** + * 查询外协领料单头 + * + * @param issueId 外协领料单头主键 + * @return 外协领料单头 + */ + @Override + public WmOutsourceIssue selectWmOutsourceIssueByIssueId(Long issueId) { + return wmOutsourceIssueMapper.selectWmOutsourceIssueByIssueId(issueId); + } + + /** + * 查询外协领料单头列表 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 外协领料单头 + */ + @Override + public List selectWmOutsourceIssueList(WmOutsourceIssue wmOutsourceIssue) { + return wmOutsourceIssueMapper.selectWmOutsourceIssueList(wmOutsourceIssue); + } + + /** + * 新增外协领料单头 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 结果 + */ + @Override + public int insertWmOutsourceIssue(WmOutsourceIssue wmOutsourceIssue) { + wmOutsourceIssue.setCreateTime(DateUtils.getNowDate()); + return wmOutsourceIssueMapper.insertWmOutsourceIssue(wmOutsourceIssue); + } + + /** + * 修改外协领料单头 + * + * @param wmOutsourceIssue 外协领料单头 + * @return 结果 + */ + @Override + public int updateWmOutsourceIssue(WmOutsourceIssue wmOutsourceIssue) { + wmOutsourceIssue.setUpdateTime(DateUtils.getNowDate()); + return wmOutsourceIssueMapper.updateWmOutsourceIssue(wmOutsourceIssue); + } + + /** + * 批量删除外协领料单头 + * + * @param issueIds 需要删除的外协领料单头主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceIssueByIssueIds(Long[] issueIds) { + return wmOutsourceIssueMapper.deleteWmOutsourceIssueByIssueIds(issueIds); + } + + /** + * 删除外协领料单头信息 + * + * @param issueId 外协领料单头主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceIssueByIssueId(Long issueId) { + return wmOutsourceIssueMapper.deleteWmOutsourceIssueByIssueId(issueId); + } + + @Override + public List getTxBeans(Long issueId) { + return wmOutsourceIssueMapper.getTxBeans(issueId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceRecptLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceRecptLineServiceImpl.java new file mode 100644 index 0000000..26dff37 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceRecptLineServiceImpl.java @@ -0,0 +1,106 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmOutsourceRecptLineMapper; +import com.ktg.mes.wm.domain.WmOutsourceRecptLine; +import com.ktg.mes.wm.service.IWmOutsourceRecptLineService; + +/** + * 外协入库单行Service业务层处理 + * + * @author yinjinlu + * @date 2023-10-30 + */ +@Service +public class WmOutsourceRecptLineServiceImpl implements IWmOutsourceRecptLineService +{ + @Autowired + private WmOutsourceRecptLineMapper wmOutsourceRecptLineMapper; + + /** + * 查询外协入库单行 + * + * @param lineId 外协入库单行主键 + * @return 外协入库单行 + */ + @Override + public WmOutsourceRecptLine selectWmOutsourceRecptLineByLineId(Long lineId) + { + return wmOutsourceRecptLineMapper.selectWmOutsourceRecptLineByLineId(lineId); + } + + /** + * 查询外协入库单行列表 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 外协入库单行 + */ + @Override + public List selectWmOutsourceRecptLineList(WmOutsourceRecptLine wmOutsourceRecptLine) + { + return wmOutsourceRecptLineMapper.selectWmOutsourceRecptLineList(wmOutsourceRecptLine); + } + + @Override + public List selectWmOutsourceRecptLineByRecptId(Long recptId) { + return wmOutsourceRecptLineMapper.selectWmOutsourceRecptLineByRecptId(recptId); + } + + /** + * 新增外协入库单行 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 结果 + */ + @Override + public int insertWmOutsourceRecptLine(WmOutsourceRecptLine wmOutsourceRecptLine) + { + wmOutsourceRecptLine.setCreateTime(DateUtils.getNowDate()); + return wmOutsourceRecptLineMapper.insertWmOutsourceRecptLine(wmOutsourceRecptLine); + } + + /** + * 修改外协入库单行 + * + * @param wmOutsourceRecptLine 外协入库单行 + * @return 结果 + */ + @Override + public int updateWmOutsourceRecptLine(WmOutsourceRecptLine wmOutsourceRecptLine) + { + wmOutsourceRecptLine.setUpdateTime(DateUtils.getNowDate()); + return wmOutsourceRecptLineMapper.updateWmOutsourceRecptLine(wmOutsourceRecptLine); + } + + /** + * 批量删除外协入库单行 + * + * @param lineIds 需要删除的外协入库单行主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceRecptLineByLineIds(Long[] lineIds) + { + return wmOutsourceRecptLineMapper.deleteWmOutsourceRecptLineByLineIds(lineIds); + } + + /** + * 删除外协入库单行信息 + * + * @param lineId 外协入库单行主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceRecptLineByLineId(Long lineId) + { + return wmOutsourceRecptLineMapper.deleteWmOutsourceRecptLineByLineId(lineId); + } + + @Override + public int deleteWmOutsourceRecptLineByRecptId(Long recptId) { + return wmOutsourceRecptLineMapper.deleteWmOutsourceRecptLineByRecptId(recptId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceRecptServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceRecptServiceImpl.java new file mode 100644 index 0000000..751fec1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmOutsourceRecptServiceImpl.java @@ -0,0 +1,102 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.wm.domain.tx.OutsourceRecptTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmOutsourceRecptMapper; +import com.ktg.mes.wm.domain.WmOutsourceRecpt; +import com.ktg.mes.wm.service.IWmOutsourceRecptService; + +/** + * 外协入库单Service业务层处理 + * + * @author yinjinlu + * @date 2023-10-30 + */ +@Service +public class WmOutsourceRecptServiceImpl implements IWmOutsourceRecptService +{ + @Autowired + private WmOutsourceRecptMapper wmOutsourceRecptMapper; + + /** + * 查询外协入库单 + * + * @param recptId 外协入库单主键 + * @return 外协入库单 + */ + @Override + public WmOutsourceRecpt selectWmOutsourceRecptByRecptId(Long recptId) + { + return wmOutsourceRecptMapper.selectWmOutsourceRecptByRecptId(recptId); + } + + /** + * 查询外协入库单列表 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 外协入库单 + */ + @Override + public List selectWmOutsourceRecptList(WmOutsourceRecpt wmOutsourceRecpt) + { + return wmOutsourceRecptMapper.selectWmOutsourceRecptList(wmOutsourceRecpt); + } + + /** + * 新增外协入库单 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 结果 + */ + @Override + public int insertWmOutsourceRecpt(WmOutsourceRecpt wmOutsourceRecpt) + { + wmOutsourceRecpt.setCreateTime(DateUtils.getNowDate()); + return wmOutsourceRecptMapper.insertWmOutsourceRecpt(wmOutsourceRecpt); + } + + /** + * 修改外协入库单 + * + * @param wmOutsourceRecpt 外协入库单 + * @return 结果 + */ + @Override + public int updateWmOutsourceRecpt(WmOutsourceRecpt wmOutsourceRecpt) + { + wmOutsourceRecpt.setUpdateTime(DateUtils.getNowDate()); + return wmOutsourceRecptMapper.updateWmOutsourceRecpt(wmOutsourceRecpt); + } + + /** + * 批量删除外协入库单 + * + * @param recptIds 需要删除的外协入库单主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceRecptByRecptIds(Long[] recptIds) + { + return wmOutsourceRecptMapper.deleteWmOutsourceRecptByRecptIds(recptIds); + } + + /** + * 删除外协入库单信息 + * + * @param recptId 外协入库单主键 + * @return 结果 + */ + @Override + public int deleteWmOutsourceRecptByRecptId(Long recptId) + { + return wmOutsourceRecptMapper.deleteWmOutsourceRecptByRecptId(recptId); + } + + @Override + public List getTxBeans(Long recptId) { + return wmOutsourceRecptMapper.getTxBeans(recptId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmPackageLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmPackageLineServiceImpl.java new file mode 100644 index 0000000..4d8660f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmPackageLineServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmPackageLineMapper; +import com.ktg.mes.wm.domain.WmPackageLine; +import com.ktg.mes.wm.service.IWmPackageLineService; + +/** + * 装箱明细Service业务层处理 + * + * @author yinjinlu + * @date 2022-10-11 + */ +@Service +public class WmPackageLineServiceImpl implements IWmPackageLineService +{ + @Autowired + private WmPackageLineMapper wmPackageLineMapper; + + /** + * 查询装箱明细 + * + * @param lineId 装箱明细主键 + * @return 装箱明细 + */ + @Override + public WmPackageLine selectWmPackageLineByLineId(Long lineId) + { + return wmPackageLineMapper.selectWmPackageLineByLineId(lineId); + } + + /** + * 查询装箱明细列表 + * + * @param wmPackageLine 装箱明细 + * @return 装箱明细 + */ + @Override + public List selectWmPackageLineList(WmPackageLine wmPackageLine) + { + return wmPackageLineMapper.selectWmPackageLineList(wmPackageLine); + } + + /** + * 新增装箱明细 + * + * @param wmPackageLine 装箱明细 + * @return 结果 + */ + @Override + public int insertWmPackageLine(WmPackageLine wmPackageLine) + { + wmPackageLine.setCreateTime(DateUtils.getNowDate()); + return wmPackageLineMapper.insertWmPackageLine(wmPackageLine); + } + + /** + * 修改装箱明细 + * + * @param wmPackageLine 装箱明细 + * @return 结果 + */ + @Override + public int updateWmPackageLine(WmPackageLine wmPackageLine) + { + wmPackageLine.setUpdateTime(DateUtils.getNowDate()); + return wmPackageLineMapper.updateWmPackageLine(wmPackageLine); + } + + /** + * 批量删除装箱明细 + * + * @param lineIds 需要删除的装箱明细主键 + * @return 结果 + */ + @Override + public int deleteWmPackageLineByLineIds(Long[] lineIds) + { + return wmPackageLineMapper.deleteWmPackageLineByLineIds(lineIds); + } + + /** + * 删除装箱明细信息 + * + * @param lineId 装箱明细主键 + * @return 结果 + */ + @Override + public int deleteWmPackageLineByLineId(Long lineId) + { + return wmPackageLineMapper.deleteWmPackageLineByLineId(lineId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmPackageServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmPackageServiceImpl.java new file mode 100644 index 0000000..b795dc2 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmPackageServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmPackageMapper; +import com.ktg.mes.wm.domain.WmPackage; +import com.ktg.mes.wm.service.IWmPackageService; + +/** + * 装箱单Service业务层处理 + * + * @author yinjinlu + * @date 2022-10-10 + */ +@Service +public class WmPackageServiceImpl implements IWmPackageService +{ + @Autowired + private WmPackageMapper wmPackageMapper; + + /** + * 查询装箱单 + * + * @param packageId 装箱单主键 + * @return 装箱单 + */ + @Override + public WmPackage selectWmPackageByPackageId(Long packageId) + { + return wmPackageMapper.selectWmPackageByPackageId(packageId); + } + + /** + * 查询装箱单列表 + * + * @param wmPackage 装箱单 + * @return 装箱单 + */ + @Override + public List selectWmPackageList(WmPackage wmPackage) + { + return wmPackageMapper.selectWmPackageList(wmPackage); + } + + @Override + public String checkPackgeCodeUnique(WmPackage wmPackage) { + WmPackage pack = wmPackageMapper.checkPackgeCodeUnique(wmPackage); + Long packgeId = wmPackage.getPackageId() ==null?-1L:wmPackage.getPackageId(); + if(StringUtils.isNotNull(pack) && packgeId.longValue()!=pack.getPackageId()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增装箱单 + * + * @param wmPackage 装箱单 + * @return 结果 + */ + @Override + public int insertWmPackage(WmPackage wmPackage) + { + wmPackage.setCreateTime(DateUtils.getNowDate()); + return wmPackageMapper.insertWmPackage(wmPackage); + } + + /** + * 修改装箱单 + * + * @param wmPackage 装箱单 + * @return 结果 + */ + @Override + public int updateWmPackage(WmPackage wmPackage) + { + wmPackage.setUpdateTime(DateUtils.getNowDate()); + return wmPackageMapper.updateWmPackage(wmPackage); + } + + /** + * 批量删除装箱单 + * + * @param packageIds 需要删除的装箱单主键 + * @return 结果 + */ + @Override + public int deleteWmPackageByPackageIds(Long[] packageIds) + { + return wmPackageMapper.deleteWmPackageByPackageIds(packageIds); + } + + /** + * 删除装箱单信息 + * + * @param packageId 装箱单主键 + * @return 结果 + */ + @Override + public int deleteWmPackageByPackageId(Long packageId) + { + return wmPackageMapper.deleteWmPackageByPackageId(packageId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductProduceLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductProduceLineServiceImpl.java new file mode 100644 index 0000000..5d26522 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductProduceLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmProductProduceLineMapper; +import com.ktg.mes.wm.domain.WmProductProduceLine; +import com.ktg.mes.wm.service.IWmProductProduceLineService; + +/** + * 产品产出记录行Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-22 + */ +@Service +public class WmProductProduceLineServiceImpl implements IWmProductProduceLineService +{ + @Autowired + private WmProductProduceLineMapper wmProductProduceLineMapper; + + /** + * 查询产品产出记录行 + * + * @param lineId 产品产出记录行主键 + * @return 产品产出记录行 + */ + @Override + public WmProductProduceLine selectWmProductProduceLineByLineId(Long lineId) + { + return wmProductProduceLineMapper.selectWmProductProduceLineByLineId(lineId); + } + + /** + * 查询产品产出记录行列表 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 产品产出记录行 + */ + @Override + public List selectWmProductProduceLineList(WmProductProduceLine wmProductProduceLine) + { + return wmProductProduceLineMapper.selectWmProductProduceLineList(wmProductProduceLine); + } + + /** + * 新增产品产出记录行 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 结果 + */ + @Override + public int insertWmProductProduceLine(WmProductProduceLine wmProductProduceLine) + { + wmProductProduceLine.setCreateTime(DateUtils.getNowDate()); + return wmProductProduceLineMapper.insertWmProductProduceLine(wmProductProduceLine); + } + + /** + * 修改产品产出记录行 + * + * @param wmProductProduceLine 产品产出记录行 + * @return 结果 + */ + @Override + public int updateWmProductProduceLine(WmProductProduceLine wmProductProduceLine) + { + wmProductProduceLine.setUpdateTime(DateUtils.getNowDate()); + return wmProductProduceLineMapper.updateWmProductProduceLine(wmProductProduceLine); + } + + /** + * 批量删除产品产出记录行 + * + * @param lineIds 需要删除的产品产出记录行主键 + * @return 结果 + */ + @Override + public int deleteWmProductProduceLineByLineIds(Long[] lineIds) + { + return wmProductProduceLineMapper.deleteWmProductProduceLineByLineIds(lineIds); + } + + /** + * 删除产品产出记录行信息 + * + * @param lineId 产品产出记录行主键 + * @return 结果 + */ + @Override + public int deleteWmProductProduceLineByLineId(Long lineId) + { + return wmProductProduceLineMapper.deleteWmProductProduceLineByLineId(lineId); + } + + @Override + public int deleteByRecordId(Long recordId) { + return wmProductProduceLineMapper.deleteByRecordId(recordId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductProduceServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductProduceServiceImpl.java new file mode 100644 index 0000000..abb3630 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductProduceServiceImpl.java @@ -0,0 +1,180 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.Date; +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.md.domain.MdWorkstation; +import com.ktg.mes.md.mapper.MdWorkstationMapper; +import com.ktg.mes.pro.domain.ProFeedback; +import com.ktg.mes.pro.domain.ProProcess; +import com.ktg.mes.pro.domain.ProTask; +import com.ktg.mes.pro.domain.ProWorkorder; +import com.ktg.mes.pro.mapper.ProProcessMapper; +import com.ktg.mes.pro.mapper.ProTaskMapper; +import com.ktg.mes.pro.mapper.ProWorkorderMapper; +import com.ktg.mes.wm.domain.WmProductProduceLine; +import com.ktg.mes.wm.domain.tx.ProductProductTxBean; +import com.ktg.mes.wm.mapper.WmProductProduceLineMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmProductProduceMapper; +import com.ktg.mes.wm.domain.WmProductProduce; +import com.ktg.mes.wm.service.IWmProductProduceService; + +/** + * 产品产出记录Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-21 + */ +@Service +public class WmProductProduceServiceImpl implements IWmProductProduceService +{ + @Autowired + private WmProductProduceMapper wmProductProduceMapper; + + @Autowired + private WmProductProduceLineMapper wmProductProduceLineMapper; + + @Autowired + private ProWorkorderMapper proWorkorderMapper; + + @Autowired + private ProTaskMapper proTaskMapper; + + @Autowired + private MdWorkstationMapper mdWorkstationMapper; + + @Autowired + private ProProcessMapper proProcessMapper; + + /** + * 查询产品产出记录 + * + * @param recordId 产品产出记录主键 + * @return 产品产出记录 + */ + @Override + public WmProductProduce selectWmProductProduceByRecordId(Long recordId) + { + return wmProductProduceMapper.selectWmProductProduceByRecordId(recordId); + } + + /** + * 查询产品产出记录列表 + * + * @param wmProductProduce 产品产出记录 + * @return 产品产出记录 + */ + @Override + public List selectWmProductProduceList(WmProductProduce wmProductProduce) + { + return wmProductProduceMapper.selectWmProductProduceList(wmProductProduce); + } + + /** + * 新增产品产出记录 + * + * @param wmProductProduce 产品产出记录 + * @return 结果 + */ + @Override + public int insertWmProductProduce(WmProductProduce wmProductProduce) + { + wmProductProduce.setCreateTime(DateUtils.getNowDate()); + return wmProductProduceMapper.insertWmProductProduce(wmProductProduce); + } + + /** + * 修改产品产出记录 + * + * @param wmProductProduce 产品产出记录 + * @return 结果 + */ + @Override + public int updateWmProductProduce(WmProductProduce wmProductProduce) + { + wmProductProduce.setUpdateTime(DateUtils.getNowDate()); + return wmProductProduceMapper.updateWmProductProduce(wmProductProduce); + } + + /** + * 批量删除产品产出记录 + * + * @param recordIds 需要删除的产品产出记录主键 + * @return 结果 + */ + @Override + public int deleteWmProductProduceByRecordIds(Long[] recordIds) + { + return wmProductProduceMapper.deleteWmProductProduceByRecordIds(recordIds); + } + + /** + * 删除产品产出记录信息 + * + * @param recordId 产品产出记录主键 + * @return 结果 + */ + @Override + public int deleteWmProductProduceByRecordId(Long recordId) + { + return wmProductProduceMapper.deleteWmProductProduceByRecordId(recordId); + } + + /** + * 根据报工单生成 + * @param feedback + * @return + */ + @Override + public WmProductProduce generateProductProduce(ProFeedback feedback) { + ProWorkorder workorder = proWorkorderMapper.selectProWorkorderByWorkorderId(feedback.getWorkorderId()); + MdWorkstation workstation = mdWorkstationMapper.selectMdWorkstationByWorkstationId(feedback.getWorkstationId()); + ProProcess process = proProcessMapper.selectProProcessByProcessId(workstation.getProcessId()); + ProTask task = proTaskMapper.selectProTaskByTaskId(feedback.getTaskId()); + //生成单据头信息 + WmProductProduce productProduce = new WmProductProduce(); + productProduce.setWorkorderId(feedback.getWorkorderId()); + productProduce.setWorkorderCode(feedback.getWorkorderCode()); + productProduce.setWorkorderName(feedback.getWorkorderName()); + + productProduce.setTaskId(feedback.getTaskId()); + productProduce.setTaskCode(task.getTaskCode()); + productProduce.setTaskName(task.getTaskName()); + + productProduce.setWorkstationId(feedback.getWorkstationId()); + productProduce.setWorkstationCode(workstation.getWorkstationCode()); + productProduce.setWorkstationName(workstation.getWorkstationName()); + + productProduce.setProcessId(process.getProcessId()); + productProduce.setProcessCode(process.getProcessCode()); + productProduce.setProcessName(process.getProcessName()); + + productProduce.setProduceDate(new Date()); + productProduce.setStatus(UserConstants.ORDER_STATUS_PREPARE); + wmProductProduceMapper.insertWmProductProduce(productProduce); + + //生成单据行信息; 以后如果是在生产过程中产生多种副产品可以在这里添加更多的行信息进行支持 + WmProductProduceLine line = new WmProductProduceLine(); + line.setRecordId(productProduce.getRecordId()); + line.setItemId(feedback.getItemId()); + line.setItemCode(feedback.getItemCode()); + line.setItemName(feedback.getItemName()); + line.setSpecification(feedback.getSpecification()); + line.setUnitOfMeasure(feedback.getUnitOfMeasure()); + line.setQuantityProduce(feedback.getQuantityFeedback()); + line.setBatchCode(workorder.getBatchCode()); + wmProductProduceLineMapper.insertWmProductProduceLine(line); + return productProduce; + } + + @Override + public List getTxBeans(Long recordId) { + return wmProductProduceMapper.getTxBeans(recordId); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductRecptLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductRecptLineServiceImpl.java new file mode 100644 index 0000000..9959ac0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductRecptLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmProductRecptLineMapper; +import com.ktg.mes.wm.domain.WmProductRecptLine; +import com.ktg.mes.wm.service.IWmProductRecptLineService; + +/** + * 产品入库记录行Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-22 + */ +@Service +public class WmProductRecptLineServiceImpl implements IWmProductRecptLineService +{ + @Autowired + private WmProductRecptLineMapper wmProductRecptLineMapper; + + /** + * 查询产品入库记录行 + * + * @param lineId 产品入库记录行主键 + * @return 产品入库记录行 + */ + @Override + public WmProductRecptLine selectWmProductRecptLineByLineId(Long lineId) + { + return wmProductRecptLineMapper.selectWmProductRecptLineByLineId(lineId); + } + + /** + * 查询产品入库记录行列表 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 产品入库记录行 + */ + @Override + public List selectWmProductRecptLineList(WmProductRecptLine wmProductRecptLine) + { + return wmProductRecptLineMapper.selectWmProductRecptLineList(wmProductRecptLine); + } + + /** + * 新增产品入库记录行 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 结果 + */ + @Override + public int insertWmProductRecptLine(WmProductRecptLine wmProductRecptLine) + { + wmProductRecptLine.setCreateTime(DateUtils.getNowDate()); + return wmProductRecptLineMapper.insertWmProductRecptLine(wmProductRecptLine); + } + + /** + * 修改产品入库记录行 + * + * @param wmProductRecptLine 产品入库记录行 + * @return 结果 + */ + @Override + public int updateWmProductRecptLine(WmProductRecptLine wmProductRecptLine) + { + wmProductRecptLine.setUpdateTime(DateUtils.getNowDate()); + return wmProductRecptLineMapper.updateWmProductRecptLine(wmProductRecptLine); + } + + /** + * 批量删除产品入库记录行 + * + * @param lineIds 需要删除的产品入库记录行主键 + * @return 结果 + */ + @Override + public int deleteWmProductRecptLineByLineIds(Long[] lineIds) + { + return wmProductRecptLineMapper.deleteWmProductRecptLineByLineIds(lineIds); + } + + /** + * 删除产品入库记录行信息 + * + * @param lineId 产品入库记录行主键 + * @return 结果 + */ + @Override + public int deleteWmProductRecptLineByLineId(Long lineId) + { + return wmProductRecptLineMapper.deleteWmProductRecptLineByLineId(lineId); + } + + @Override + public int deleteByRecptId(Long recptId) { + return wmProductRecptLineMapper.deleteByRecptId(recptId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductRecptServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductRecptServiceImpl.java new file mode 100644 index 0000000..bd46e20 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductRecptServiceImpl.java @@ -0,0 +1,117 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.ProductRecptTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmProductRecptMapper; +import com.ktg.mes.wm.domain.WmProductRecpt; +import com.ktg.mes.wm.service.IWmProductRecptService; + +/** + * 产品入库录Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-22 + */ +@Service +public class WmProductRecptServiceImpl implements IWmProductRecptService +{ + @Autowired + private WmProductRecptMapper wmProductRecptMapper; + + /** + * 查询产品入库录 + * + * @param recptId 产品入库录主键 + * @return 产品入库录 + */ + @Override + public WmProductRecpt selectWmProductRecptByRecptId(Long recptId) + { + return wmProductRecptMapper.selectWmProductRecptByRecptId(recptId); + } + + /** + * 查询产品入库录列表 + * + * @param wmProductRecpt 产品入库录 + * @return 产品入库录 + */ + @Override + public List selectWmProductRecptList(WmProductRecpt wmProductRecpt) + { + return wmProductRecptMapper.selectWmProductRecptList(wmProductRecpt); + } + + @Override + public String checkUnique(WmProductRecpt wmProductRecpt) { + WmProductRecpt recpt = wmProductRecptMapper.checkUnique(wmProductRecpt); + Long recptId = wmProductRecpt.getRecptId() ==null? -1L:wmProductRecpt.getRecptId(); + if(StringUtils.isNotNull(recpt) && recpt.getRecptId().longValue() != recptId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增产品入库录 + * + * @param wmProductRecpt 产品入库录 + * @return 结果 + */ + @Override + public int insertWmProductRecpt(WmProductRecpt wmProductRecpt) + { + wmProductRecpt.setCreateTime(DateUtils.getNowDate()); + return wmProductRecptMapper.insertWmProductRecpt(wmProductRecpt); + } + + /** + * 修改产品入库录 + * + * @param wmProductRecpt 产品入库录 + * @return 结果 + */ + @Override + public int updateWmProductRecpt(WmProductRecpt wmProductRecpt) + { + wmProductRecpt.setUpdateTime(DateUtils.getNowDate()); + return wmProductRecptMapper.updateWmProductRecpt(wmProductRecpt); + } + + /** + * 批量删除产品入库录 + * + * @param recptIds 需要删除的产品入库录主键 + * @return 结果 + */ + @Override + public int deleteWmProductRecptByRecptIds(Long[] recptIds) + { + return wmProductRecptMapper.deleteWmProductRecptByRecptIds(recptIds); + } + + /** + * 删除产品入库录信息 + * + * @param recptId 产品入库录主键 + * @return 结果 + */ + @Override + public int deleteWmProductRecptByRecptId(Long recptId) + { + return wmProductRecptMapper.deleteWmProductRecptByRecptId(recptId); + } + + @Override + public List getTxBean(Long recptId) { + return wmProductRecptMapper.getTxBean(recptId); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductSalseLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductSalseLineServiceImpl.java new file mode 100644 index 0000000..45e75b3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductSalseLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmProductSalseLineMapper; +import com.ktg.mes.wm.domain.WmProductSalseLine; +import com.ktg.mes.wm.service.IWmProductSalseLineService; + +/** + * 产品销售出库行Service业务层处理 + * + * @author yinjinlu + * @date 2022-10-05 + */ +@Service +public class WmProductSalseLineServiceImpl implements IWmProductSalseLineService +{ + @Autowired + private WmProductSalseLineMapper wmProductSalseLineMapper; + + /** + * 查询产品销售出库行 + * + * @param lineId 产品销售出库行主键 + * @return 产品销售出库行 + */ + @Override + public WmProductSalseLine selectWmProductSalseLineByLineId(Long lineId) + { + return wmProductSalseLineMapper.selectWmProductSalseLineByLineId(lineId); + } + + /** + * 查询产品销售出库行列表 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 产品销售出库行 + */ + @Override + public List selectWmProductSalseLineList(WmProductSalseLine wmProductSalseLine) + { + return wmProductSalseLineMapper.selectWmProductSalseLineList(wmProductSalseLine); + } + + /** + * 新增产品销售出库行 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 结果 + */ + @Override + public int insertWmProductSalseLine(WmProductSalseLine wmProductSalseLine) + { + wmProductSalseLine.setCreateTime(DateUtils.getNowDate()); + return wmProductSalseLineMapper.insertWmProductSalseLine(wmProductSalseLine); + } + + /** + * 修改产品销售出库行 + * + * @param wmProductSalseLine 产品销售出库行 + * @return 结果 + */ + @Override + public int updateWmProductSalseLine(WmProductSalseLine wmProductSalseLine) + { + wmProductSalseLine.setUpdateTime(DateUtils.getNowDate()); + return wmProductSalseLineMapper.updateWmProductSalseLine(wmProductSalseLine); + } + + /** + * 批量删除产品销售出库行 + * + * @param lineIds 需要删除的产品销售出库行主键 + * @return 结果 + */ + @Override + public int deleteWmProductSalseLineByLineIds(Long[] lineIds) + { + return wmProductSalseLineMapper.deleteWmProductSalseLineByLineIds(lineIds); + } + + /** + * 删除产品销售出库行信息 + * + * @param lineId 产品销售出库行主键 + * @return 结果 + */ + @Override + public int deleteWmProductSalseLineByLineId(Long lineId) + { + return wmProductSalseLineMapper.deleteWmProductSalseLineByLineId(lineId); + } + + @Override + public int deleteBySalseId(Long salseId) { + return wmProductSalseLineMapper.deleteBySalseId(salseId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductSalseServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductSalseServiceImpl.java new file mode 100644 index 0000000..0967104 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmProductSalseServiceImpl.java @@ -0,0 +1,118 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.ProductSalseTxBean; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmProductSalseMapper; +import com.ktg.mes.wm.domain.WmProductSalse; +import com.ktg.mes.wm.service.IWmProductSalseService; + +/** + * 销售出库单Service业务层处理 + * + * @author yinjinlu + * @date 2022-10-04 + */ +@Service +public class WmProductSalseServiceImpl implements IWmProductSalseService +{ + @Autowired + private WmProductSalseMapper wmProductSalseMapper; + + /** + * 查询销售出库单 + * + * @param salseId 销售出库单主键 + * @return 销售出库单 + */ + @Override + public WmProductSalse selectWmProductSalseBySalseId(Long salseId) + { + return wmProductSalseMapper.selectWmProductSalseBySalseId(salseId); + } + + /** + * 查询销售出库单列表 + * + * @param wmProductSalse 销售出库单 + * @return 销售出库单 + */ + @Override + public List selectWmProductSalseList(WmProductSalse wmProductSalse) + { + return wmProductSalseMapper.selectWmProductSalseList(wmProductSalse); + } + + @Override + public List getTxBeans(Long salseId) { + return wmProductSalseMapper.getTxBeans(salseId); + } + + @Override + public String checkUnique(WmProductSalse wmProductSalse) { + WmProductSalse salse = wmProductSalseMapper.checkUnique(wmProductSalse); + Long salseId = wmProductSalse.getSalseId() ==null? -1L:wmProductSalse.getSalseId(); + if(StringUtils.isNotNull(salse) && salseId.longValue() != salse.getSalseId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增销售出库单 + * + * @param wmProductSalse 销售出库单 + * @return 结果 + */ + @Override + public int insertWmProductSalse(WmProductSalse wmProductSalse) + { + wmProductSalse.setCreateTime(DateUtils.getNowDate()); + return wmProductSalseMapper.insertWmProductSalse(wmProductSalse); + } + + /** + * 修改销售出库单 + * + * @param wmProductSalse 销售出库单 + * @return 结果 + */ + @Override + public int updateWmProductSalse(WmProductSalse wmProductSalse) + { + wmProductSalse.setUpdateTime(DateUtils.getNowDate()); + return wmProductSalseMapper.updateWmProductSalse(wmProductSalse); + } + + /** + * 批量删除销售出库单 + * + * @param salseIds 需要删除的销售出库单主键 + * @return 结果 + */ + @Override + public int deleteWmProductSalseBySalseIds(Long[] salseIds) + { + return wmProductSalseMapper.deleteWmProductSalseBySalseIds(salseIds); + } + + /** + * 删除销售出库单信息 + * + * @param salseId 销售出库单主键 + * @return 结果 + */ + @Override + public int deleteWmProductSalseBySalseId(Long salseId) + { + return wmProductSalseMapper.deleteWmProductSalseBySalseId(salseId); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueLineServiceImpl.java new file mode 100644 index 0000000..f28cf34 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtIssueLineMapper; +import com.ktg.mes.wm.domain.WmRtIssueLine; +import com.ktg.mes.wm.service.IWmRtIssueLineService; + +/** + * 生产退料单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-15 + */ +@Service +public class WmRtIssueLineServiceImpl implements IWmRtIssueLineService +{ + @Autowired + private WmRtIssueLineMapper wmRtIssueLineMapper; + + /** + * 查询生产退料单行 + * + * @param lineId 生产退料单行主键 + * @return 生产退料单行 + */ + @Override + public WmRtIssueLine selectWmRtIssueLineByLineId(Long lineId) + { + return wmRtIssueLineMapper.selectWmRtIssueLineByLineId(lineId); + } + + /** + * 查询生产退料单行列表 + * + * @param wmRtIssueLine 生产退料单行 + * @return 生产退料单行 + */ + @Override + public List selectWmRtIssueLineList(WmRtIssueLine wmRtIssueLine) + { + return wmRtIssueLineMapper.selectWmRtIssueLineList(wmRtIssueLine); + } + + /** + * 新增生产退料单行 + * + * @param wmRtIssueLine 生产退料单行 + * @return 结果 + */ + @Override + public int insertWmRtIssueLine(WmRtIssueLine wmRtIssueLine) + { + wmRtIssueLine.setCreateTime(DateUtils.getNowDate()); + return wmRtIssueLineMapper.insertWmRtIssueLine(wmRtIssueLine); + } + + /** + * 修改生产退料单行 + * + * @param wmRtIssueLine 生产退料单行 + * @return 结果 + */ + @Override + public int updateWmRtIssueLine(WmRtIssueLine wmRtIssueLine) + { + wmRtIssueLine.setUpdateTime(DateUtils.getNowDate()); + return wmRtIssueLineMapper.updateWmRtIssueLine(wmRtIssueLine); + } + + /** + * 批量删除生产退料单行 + * + * @param lineIds 需要删除的生产退料单行主键 + * @return 结果 + */ + @Override + public int deleteWmRtIssueLineByLineIds(Long[] lineIds) + { + return wmRtIssueLineMapper.deleteWmRtIssueLineByLineIds(lineIds); + } + + /** + * 删除生产退料单行信息 + * + * @param lineId 生产退料单行主键 + * @return 结果 + */ + @Override + public int deleteWmRtIssueLineByLineId(Long lineId) + { + return wmRtIssueLineMapper.deleteWmRtIssueLineByLineId(lineId); + } + + @Override + public int deleteByRtId(Long rtId) { + return wmRtIssueLineMapper.deleteByRtId(rtId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueServiceImpl.java new file mode 100644 index 0000000..7999870 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.RtIssueTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtIssueMapper; +import com.ktg.mes.wm.domain.WmRtIssue; +import com.ktg.mes.wm.service.IWmRtIssueService; + +/** + * 生产退料单头Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-15 + */ +@Service +public class WmRtIssueServiceImpl implements IWmRtIssueService +{ + @Autowired + private WmRtIssueMapper wmRtIssueMapper; + + /** + * 查询生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 生产退料单头 + */ + @Override + public WmRtIssue selectWmRtIssueByRtId(Long rtId) + { + return wmRtIssueMapper.selectWmRtIssueByRtId(rtId); + } + + /** + * 查询生产退料单头列表 + * + * @param wmRtIssue 生产退料单头 + * @return 生产退料单头 + */ + @Override + public List selectWmRtIssueList(WmRtIssue wmRtIssue) + { + return wmRtIssueMapper.selectWmRtIssueList(wmRtIssue); + } + + @Override + public String checkUnique(WmRtIssue wmRtIssue) { + WmRtIssue issue = wmRtIssueMapper.checkUnique(wmRtIssue); + Long rtId = wmRtIssue.getRtId() == null? -1L: wmRtIssue.getRtId(); + if(StringUtils.isNotNull(issue) && issue.getRtId().longValue() != rtId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + @Override + public int insertWmRtIssue(WmRtIssue wmRtIssue) + { + wmRtIssue.setCreateTime(DateUtils.getNowDate()); + return wmRtIssueMapper.insertWmRtIssue(wmRtIssue); + } + + /** + * 修改生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + @Override + public int updateWmRtIssue(WmRtIssue wmRtIssue) + { + wmRtIssue.setUpdateTime(DateUtils.getNowDate()); + return wmRtIssueMapper.updateWmRtIssue(wmRtIssue); + } + + /** + * 批量删除生产退料单头 + * + * @param rtIds 需要删除的生产退料单头主键 + * @return 结果 + */ + @Override + public int deleteWmRtIssueByRtIds(Long[] rtIds) + { + return wmRtIssueMapper.deleteWmRtIssueByRtIds(rtIds); + } + + /** + * 删除生产退料单头信息 + * + * @param rtId 生产退料单头主键 + * @return 结果 + */ + @Override + public int deleteWmRtIssueByRtId(Long rtId) + { + return wmRtIssueMapper.deleteWmRtIssueByRtId(rtId); + } + + @Override + public List getTxBeans(Long rtId) { + return wmRtIssueMapper.getTxBeans(rtId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtSalseLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtSalseLineServiceImpl.java new file mode 100644 index 0000000..f544e25 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtSalseLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtSalseLineMapper; +import com.ktg.mes.wm.domain.WmRtSalseLine; +import com.ktg.mes.wm.service.IWmRtSalseLineService; + +/** + * 产品销售退货行Service业务层处理 + * + * @author yinjinlu + * @date 2022-10-06 + */ +@Service +public class WmRtSalseLineServiceImpl implements IWmRtSalseLineService +{ + @Autowired + private WmRtSalseLineMapper wmRtSalseLineMapper; + + /** + * 查询产品销售退货行 + * + * @param lineId 产品销售退货行主键 + * @return 产品销售退货行 + */ + @Override + public WmRtSalseLine selectWmRtSalseLineByLineId(Long lineId) + { + return wmRtSalseLineMapper.selectWmRtSalseLineByLineId(lineId); + } + + /** + * 查询产品销售退货行列表 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 产品销售退货行 + */ + @Override + public List selectWmRtSalseLineList(WmRtSalseLine wmRtSalseLine) + { + return wmRtSalseLineMapper.selectWmRtSalseLineList(wmRtSalseLine); + } + + /** + * 新增产品销售退货行 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 结果 + */ + @Override + public int insertWmRtSalseLine(WmRtSalseLine wmRtSalseLine) + { + wmRtSalseLine.setCreateTime(DateUtils.getNowDate()); + return wmRtSalseLineMapper.insertWmRtSalseLine(wmRtSalseLine); + } + + /** + * 修改产品销售退货行 + * + * @param wmRtSalseLine 产品销售退货行 + * @return 结果 + */ + @Override + public int updateWmRtSalseLine(WmRtSalseLine wmRtSalseLine) + { + wmRtSalseLine.setUpdateTime(DateUtils.getNowDate()); + return wmRtSalseLineMapper.updateWmRtSalseLine(wmRtSalseLine); + } + + /** + * 批量删除产品销售退货行 + * + * @param lineIds 需要删除的产品销售退货行主键 + * @return 结果 + */ + @Override + public int deleteWmRtSalseLineByLineIds(Long[] lineIds) + { + return wmRtSalseLineMapper.deleteWmRtSalseLineByLineIds(lineIds); + } + + /** + * 删除产品销售退货行信息 + * + * @param lineId 产品销售退货行主键 + * @return 结果 + */ + @Override + public int deleteWmRtSalseLineByLineId(Long lineId) + { + return wmRtSalseLineMapper.deleteWmRtSalseLineByLineId(lineId); + } + + @Override + public int deleteByRtId(Long rtId) { + return wmRtSalseLineMapper.deleteByRtId(rtId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtSalseServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtSalseServiceImpl.java new file mode 100644 index 0000000..058bb22 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtSalseServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtSalseMapper; +import com.ktg.mes.wm.domain.WmRtSalse; +import com.ktg.mes.wm.service.IWmRtSalseService; + +/** + * 产品销售退货单Service业务层处理 + * + * @author yinjinlu + * @date 2022-10-06 + */ +@Service +public class WmRtSalseServiceImpl implements IWmRtSalseService +{ + @Autowired + private WmRtSalseMapper wmRtSalseMapper; + + /** + * 查询产品销售退货单 + * + * @param rtId 产品销售退货单主键 + * @return 产品销售退货单 + */ + @Override + public WmRtSalse selectWmRtSalseByRtId(Long rtId) + { + return wmRtSalseMapper.selectWmRtSalseByRtId(rtId); + } + + /** + * 查询产品销售退货单列表 + * + * @param wmRtSalse 产品销售退货单 + * @return 产品销售退货单 + */ + @Override + public List selectWmRtSalseList(WmRtSalse wmRtSalse) + { + return wmRtSalseMapper.selectWmRtSalseList(wmRtSalse); + } + + @Override + public List getTxBeans(Long rtId) { + return wmRtSalseMapper.getTxBeans(rtId); + } + + @Override + public String checkUnique(WmRtSalse wmRtSalse) { + WmRtSalse salse = wmRtSalseMapper.checkUnique(wmRtSalse); + Long rtId = wmRtSalse.getRtId() == null? -1L: wmRtSalse.getRtId(); + if(StringUtils.isNotNull(salse) && rtId.longValue() != salse.getRtId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增产品销售退货单 + * + * @param wmRtSalse 产品销售退货单 + * @return 结果 + */ + @Override + public int insertWmRtSalse(WmRtSalse wmRtSalse) + { + wmRtSalse.setCreateTime(DateUtils.getNowDate()); + return wmRtSalseMapper.insertWmRtSalse(wmRtSalse); + } + + /** + * 修改产品销售退货单 + * + * @param wmRtSalse 产品销售退货单 + * @return 结果 + */ + @Override + public int updateWmRtSalse(WmRtSalse wmRtSalse) + { + wmRtSalse.setUpdateTime(DateUtils.getNowDate()); + return wmRtSalseMapper.updateWmRtSalse(wmRtSalse); + } + + /** + * 批量删除产品销售退货单 + * + * @param rtIds 需要删除的产品销售退货单主键 + * @return 结果 + */ + @Override + public int deleteWmRtSalseByRtIds(Long[] rtIds) + { + return wmRtSalseMapper.deleteWmRtSalseByRtIds(rtIds); + } + + /** + * 删除产品销售退货单信息 + * + * @param rtId 产品销售退货单主键 + * @return 结果 + */ + @Override + public int deleteWmRtSalseByRtId(Long rtId) + { + return wmRtSalseMapper.deleteWmRtSalseByRtId(rtId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorLineServiceImpl.java new file mode 100644 index 0000000..813b488 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtVendorLineMapper; +import com.ktg.mes.wm.domain.WmRtVendorLine; +import com.ktg.mes.wm.service.IWmRtVendorLineService; + +/** + * 供应商退货行Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-13 + */ +@Service +public class WmRtVendorLineServiceImpl implements IWmRtVendorLineService +{ + @Autowired + private WmRtVendorLineMapper wmRtVendorLineMapper; + + /** + * 查询供应商退货行 + * + * @param lineId 供应商退货行主键 + * @return 供应商退货行 + */ + @Override + public WmRtVendorLine selectWmRtVendorLineByLineId(Long lineId) + { + return wmRtVendorLineMapper.selectWmRtVendorLineByLineId(lineId); + } + + /** + * 查询供应商退货行列表 + * + * @param wmRtVendorLine 供应商退货行 + * @return 供应商退货行 + */ + @Override + public List selectWmRtVendorLineList(WmRtVendorLine wmRtVendorLine) + { + return wmRtVendorLineMapper.selectWmRtVendorLineList(wmRtVendorLine); + } + + /** + * 新增供应商退货行 + * + * @param wmRtVendorLine 供应商退货行 + * @return 结果 + */ + @Override + public int insertWmRtVendorLine(WmRtVendorLine wmRtVendorLine) + { + wmRtVendorLine.setCreateTime(DateUtils.getNowDate()); + return wmRtVendorLineMapper.insertWmRtVendorLine(wmRtVendorLine); + } + + /** + * 修改供应商退货行 + * + * @param wmRtVendorLine 供应商退货行 + * @return 结果 + */ + @Override + public int updateWmRtVendorLine(WmRtVendorLine wmRtVendorLine) + { + wmRtVendorLine.setUpdateTime(DateUtils.getNowDate()); + return wmRtVendorLineMapper.updateWmRtVendorLine(wmRtVendorLine); + } + + /** + * 批量删除供应商退货行 + * + * @param lineIds 需要删除的供应商退货行主键 + * @return 结果 + */ + @Override + public int deleteWmRtVendorLineByLineIds(Long[] lineIds) + { + return wmRtVendorLineMapper.deleteWmRtVendorLineByLineIds(lineIds); + } + + /** + * 删除供应商退货行信息 + * + * @param lineId 供应商退货行主键 + * @return 结果 + */ + @Override + public int deleteWmRtVendorLineByLineId(Long lineId) + { + return wmRtVendorLineMapper.deleteWmRtVendorLineByLineId(lineId); + } + + @Override + public int deleteByRtId(Long rtId) { + return wmRtVendorLineMapper.deleteByRtId(rtId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorServiceImpl.java new file mode 100644 index 0000000..d495884 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.RtVendorTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtVendorMapper; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.service.IWmRtVendorService; + +/** + * 供应商退货Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-13 + */ +@Service +public class WmRtVendorServiceImpl implements IWmRtVendorService +{ + @Autowired + private WmRtVendorMapper wmRtVendorMapper; + + /** + * 查询供应商退货 + * + * @param rtId 供应商退货主键 + * @return 供应商退货 + */ + @Override + public WmRtVendor selectWmRtVendorByRtId(Long rtId) + { + return wmRtVendorMapper.selectWmRtVendorByRtId(rtId); + } + + /** + * 查询供应商退货列表 + * + * @param wmRtVendor 供应商退货 + * @return 供应商退货 + */ + @Override + public List selectWmRtVendorList(WmRtVendor wmRtVendor) + { + return wmRtVendorMapper.selectWmRtVendorList(wmRtVendor); + } + + @Override + public String checkCodeUnique(WmRtVendor wmRtVendor) { + WmRtVendor rt = wmRtVendorMapper.checkCodeUnique(wmRtVendor); + Long rtId = wmRtVendor.getRtId() ==null?-1L:wmRtVendor.getRtId(); + if(StringUtils.isNotNull(rt) && rt.getRtId().longValue() != rtId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + @Override + public int insertWmRtVendor(WmRtVendor wmRtVendor) + { + wmRtVendor.setCreateTime(DateUtils.getNowDate()); + return wmRtVendorMapper.insertWmRtVendor(wmRtVendor); + } + + /** + * 修改供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + @Override + public int updateWmRtVendor(WmRtVendor wmRtVendor) + { + wmRtVendor.setUpdateTime(DateUtils.getNowDate()); + return wmRtVendorMapper.updateWmRtVendor(wmRtVendor); + } + + /** + * 批量删除供应商退货 + * + * @param rtIds 需要删除的供应商退货主键 + * @return 结果 + */ + @Override + public int deleteWmRtVendorByRtIds(Long[] rtIds) + { + return wmRtVendorMapper.deleteWmRtVendorByRtIds(rtIds); + } + + /** + * 删除供应商退货信息 + * + * @param rtId 供应商退货主键 + * @return 结果 + */ + @Override + public int deleteWmRtVendorByRtId(Long rtId) + { + return wmRtVendorMapper.deleteWmRtVendorByRtId(rtId); + } + + @Override + public List getTxBeans(Long rtId) { + return wmRtVendorMapper.getTxBeans(rtId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmSnServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmSnServiceImpl.java new file mode 100644 index 0000000..186d5c5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmSnServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmSnMapper; +import com.ktg.mes.wm.domain.WmSn; +import com.ktg.mes.wm.service.IWmSnService; + +/** + * SN码Service业务层处理 + * + * @author yinjinlu + * @date 2022-12-08 + */ +@Service +public class WmSnServiceImpl implements IWmSnService +{ + @Autowired + private WmSnMapper wmSnMapper; + + /** + * 查询SN码 + * + * @param snId SN码主键 + * @return SN码 + */ + @Override + public WmSn selectWmSnBySnId(Long snId) + { + return wmSnMapper.selectWmSnBySnId(snId); + } + + /** + * 查询SN码列表 + * + * @param wmSn SN码 + * @return SN码 + */ + @Override + public List selectWmSnList(WmSn wmSn) + { + return wmSnMapper.selectWmSnList(wmSn); + } + + @Override + public List selectSnList(WmSn wmSn) { + return wmSnMapper.selectSnList(wmSn); + } + + /** + * 新增SN码 + * + * @param wmSn SN码 + * @return 结果 + */ + @Override + public int insertWmSn(WmSn wmSn) + { + wmSn.setCreateTime(DateUtils.getNowDate()); + return wmSnMapper.insertWmSn(wmSn); + } + + /** + * 修改SN码 + * + * @param wmSn SN码 + * @return 结果 + */ + @Override + public int updateWmSn(WmSn wmSn) + { + wmSn.setUpdateTime(DateUtils.getNowDate()); + return wmSnMapper.updateWmSn(wmSn); + } + + /** + * 批量删除SN码 + * + * @param snIds 需要删除的SN码主键 + * @return 结果 + */ + @Override + public int deleteWmSnBySnIds(Long[] snIds) + { + return wmSnMapper.deleteWmSnBySnIds(snIds); + } + + /** + * 删除SN码信息 + * + * @param snId SN码主键 + * @return 结果 + */ + @Override + public int deleteWmSnBySnId(Long snId) + { + return wmSnMapper.deleteWmSnBySnId(snId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java new file mode 100644 index 0000000..7cff9e0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingLineServiceImpl.java @@ -0,0 +1,103 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStockTakingLineMapper; +import com.ktg.mes.wm.domain.WmStockTakingLine; +import com.ktg.mes.wm.service.IWmStockTakingLineService; + +/** + * 库存盘点明细Service业务层处理 + * + * @author yinjinlu + * @date 2023-08-17 + */ +@Service +public class WmStockTakingLineServiceImpl implements IWmStockTakingLineService +{ + @Autowired + private WmStockTakingLineMapper wmStockTakingLineMapper; + + /** + * 查询库存盘点明细 + * + * @param lineId 库存盘点明细主键 + * @return 库存盘点明细 + */ + @Override + public WmStockTakingLine selectWmStockTakingLineByLineId(Long lineId) + { + return wmStockTakingLineMapper.selectWmStockTakingLineByLineId(lineId); + } + + /** + * 查询库存盘点明细列表 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 库存盘点明细 + */ + @Override + public List selectWmStockTakingLineList(WmStockTakingLine wmStockTakingLine) + { + return wmStockTakingLineMapper.selectWmStockTakingLineList(wmStockTakingLine); + } + + /** + * 新增库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + @Override + public int insertWmStockTakingLine(WmStockTakingLine wmStockTakingLine) + { + wmStockTakingLine.setCreateTime(DateUtils.getNowDate()); + return wmStockTakingLineMapper.insertWmStockTakingLine(wmStockTakingLine); + } + + /** + * 修改库存盘点明细 + * + * @param wmStockTakingLine 库存盘点明细 + * @return 结果 + */ + @Override + public int updateWmStockTakingLine(WmStockTakingLine wmStockTakingLine) + { + wmStockTakingLine.setUpdateTime(DateUtils.getNowDate()); + return wmStockTakingLineMapper.updateWmStockTakingLine(wmStockTakingLine); + } + + /** + * 批量删除库存盘点明细 + * + * @param lineIds 需要删除的库存盘点明细主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingLineByLineIds(Long[] lineIds) + { + return wmStockTakingLineMapper.deleteWmStockTakingLineByLineIds(lineIds); + } + + /** + * 删除库存盘点明细信息 + * + * @param lineId 库存盘点明细主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingLineByLineId(Long lineId) + { + return wmStockTakingLineMapper.deleteWmStockTakingLineByLineId(lineId); + } + + @Override + public int deleteByTakingId(Long takingId) { + return wmStockTakingLineMapper.deleteByTakingId(takingId); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java new file mode 100644 index 0000000..3580792 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingResultServiceImpl.java @@ -0,0 +1,112 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStockTakingResultMapper; +import com.ktg.mes.wm.domain.WmStockTakingResult; +import com.ktg.mes.wm.service.IWmStockTakingResultService; + +/** + * 库存盘点结果Service业务层处理 + * + * @author yinjinlu + * @date 2023-08-22 + */ +@Service +public class WmStockTakingResultServiceImpl implements IWmStockTakingResultService +{ + @Autowired + private WmStockTakingResultMapper wmStockTakingResultMapper; + + /** + * 查询库存盘点结果 + * + * @param resultId 库存盘点结果主键 + * @return 库存盘点结果 + */ + @Override + public WmStockTakingResult selectWmStockTakingResultByResultId(Long resultId) + { + return wmStockTakingResultMapper.selectWmStockTakingResultByResultId(resultId); + } + + /** + * 查询库存盘点结果列表 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 库存盘点结果 + */ + @Override + public List selectWmStockTakingResultList(WmStockTakingResult wmStockTakingResult) + { + return wmStockTakingResultMapper.selectWmStockTakingResultList(wmStockTakingResult); + } + + @Override + public void calculateOpenWmStockTakingResult(Long takingId) { + wmStockTakingResultMapper.calculateOpenWmStockTakingResult(takingId); + } + + @Override + public void calculateWmStockTakingResult(Long takingId) { + wmStockTakingResultMapper.calculateWmStockTakingResult(takingId); + } + + + /** + * 新增库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + @Override + public int insertWmStockTakingResult(WmStockTakingResult wmStockTakingResult) + { + wmStockTakingResult.setCreateTime(DateUtils.getNowDate()); + return wmStockTakingResultMapper.insertWmStockTakingResult(wmStockTakingResult); + } + + /** + * 修改库存盘点结果 + * + * @param wmStockTakingResult 库存盘点结果 + * @return 结果 + */ + @Override + public int updateWmStockTakingResult(WmStockTakingResult wmStockTakingResult) + { + wmStockTakingResult.setUpdateTime(DateUtils.getNowDate()); + return wmStockTakingResultMapper.updateWmStockTakingResult(wmStockTakingResult); + } + + /** + * 批量删除库存盘点结果 + * + * @param resultIds 需要删除的库存盘点结果主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingResultByResultIds(Long[] resultIds) + { + return wmStockTakingResultMapper.deleteWmStockTakingResultByResultIds(resultIds); + } + + /** + * 删除库存盘点结果信息 + * + * @param resultId 库存盘点结果主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingResultByResultId(Long resultId) + { + return wmStockTakingResultMapper.deleteWmStockTakingResultByResultId(resultId); + } + + @Override + public int deleteWmStockTakingResultByTakingId(Long takingId) { + return wmStockTakingResultMapper.deleteWmStockTakingResultByTakingId(takingId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java new file mode 100644 index 0000000..34a2420 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStockTakingServiceImpl.java @@ -0,0 +1,114 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStockTakingMapper; +import com.ktg.mes.wm.domain.WmStockTaking; +import com.ktg.mes.wm.service.IWmStockTakingService; + +/** + * 库存盘点记录Service业务层处理 + * + * @author yinjinlu + * @date 2023-08-17 + */ +@Service +public class WmStockTakingServiceImpl implements IWmStockTakingService +{ + @Autowired + private WmStockTakingMapper wmStockTakingMapper; + + /** + * 查询库存盘点记录 + * + * @param takingId 库存盘点记录主键 + * @return 库存盘点记录 + */ + @Override + public WmStockTaking selectWmStockTakingByTakingId(Long takingId) + { + return wmStockTakingMapper.selectWmStockTakingByTakingId(takingId); + } + + /** + * 查询库存盘点记录列表 + * + * @param wmStockTaking 库存盘点记录 + * @return 库存盘点记录 + */ + @Override + public List selectWmStockTakingList(WmStockTaking wmStockTaking) + { + return wmStockTakingMapper.selectWmStockTakingList(wmStockTaking); + } + + /** + * 检查编码是否唯一 + * @param stockTaking + * @return + */ + @Override + public String checkUnique(WmStockTaking stockTaking){ + WmStockTaking taking = wmStockTakingMapper.checkUnique(stockTaking); + Long takingId = stockTaking.getTakingId() == null ? -1L: stockTaking.getTakingId(); + if(StringUtils.isNotNull(taking) && taking.getTakingId().longValue() != takingId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + @Override + public int insertWmStockTaking(WmStockTaking wmStockTaking) + { + wmStockTaking.setCreateTime(DateUtils.getNowDate()); + return wmStockTakingMapper.insertWmStockTaking(wmStockTaking); + } + + /** + * 修改库存盘点记录 + * + * @param wmStockTaking 库存盘点记录 + * @return 结果 + */ + @Override + public int updateWmStockTaking(WmStockTaking wmStockTaking) + { + wmStockTaking.setUpdateTime(DateUtils.getNowDate()); + return wmStockTakingMapper.updateWmStockTaking(wmStockTaking); + } + + /** + * 批量删除库存盘点记录 + * + * @param takingIds 需要删除的库存盘点记录主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingByTakingIds(Long[] takingIds) + { + return wmStockTakingMapper.deleteWmStockTakingByTakingIds(takingIds); + } + + /** + * 删除库存盘点记录信息 + * + * @param takingId 库存盘点记录主键 + * @return 结果 + */ + @Override + public int deleteWmStockTakingByTakingId(Long takingId) + { + return wmStockTakingMapper.deleteWmStockTakingByTakingId(takingId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageAreaServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageAreaServiceImpl.java new file mode 100644 index 0000000..244b8e9 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageAreaServiceImpl.java @@ -0,0 +1,111 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStorageAreaMapper; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.service.IWmStorageAreaService; + +/** + * 库位设置Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-08 + */ +@Service +public class WmStorageAreaServiceImpl implements IWmStorageAreaService +{ + @Autowired + private WmStorageAreaMapper wmStorageAreaMapper; + + /** + * 查询库位设置 + * + * @param areaId 库位设置主键 + * @return 库位设置 + */ + @Override + public WmStorageArea selectWmStorageAreaByAreaId(Long areaId) + { + return wmStorageAreaMapper.selectWmStorageAreaByAreaId(areaId); + } + + @Override + public WmStorageArea selectWmStorageAreaByAreaCode(String areaCode) { + return wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode); + } + + /** + * 查询库位设置列表 + * + * @param wmStorageArea 库位设置 + * @return 库位设置 + */ + @Override + public List selectWmStorageAreaList(WmStorageArea wmStorageArea) + { + return wmStorageAreaMapper.selectWmStorageAreaList(wmStorageArea); + } + + /** + * 新增库位设置 + * + * @param wmStorageArea 库位设置 + * @return 结果 + */ + @Override + public int insertWmStorageArea(WmStorageArea wmStorageArea) + { + wmStorageArea.setCreateTime(DateUtils.getNowDate()); + return wmStorageAreaMapper.insertWmStorageArea(wmStorageArea); + } + + /** + * 修改库位设置 + * + * @param wmStorageArea 库位设置 + * @return 结果 + */ + @Override + public int updateWmStorageArea(WmStorageArea wmStorageArea) + { + wmStorageArea.setUpdateTime(DateUtils.getNowDate()); + return wmStorageAreaMapper.updateWmStorageArea(wmStorageArea); + } + + /** + * 批量删除库位设置 + * + * @param areaIds 需要删除的库位设置主键 + * @return 结果 + */ + @Override + public int deleteWmStorageAreaByAreaIds(Long[] areaIds) + { + return wmStorageAreaMapper.deleteWmStorageAreaByAreaIds(areaIds); + } + + /** + * 删除库位设置信息 + * + * @param areaId 库位设置主键 + * @return 结果 + */ + @Override + public int deleteWmStorageAreaByAreaId(Long areaId) + { + return wmStorageAreaMapper.deleteWmStorageAreaByAreaId(areaId); + } + + @Override + public int deleteByWarehouseId(Long warehouseId) { + return wmStorageAreaMapper.deleteByWarehouseId(warehouseId); + } + + @Override + public int deleteByLocationId(Long locationId) { + return wmStorageAreaMapper.deleteByLocationId(locationId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageLocationServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageLocationServiceImpl.java new file mode 100644 index 0000000..2339f77 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageLocationServiceImpl.java @@ -0,0 +1,130 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStorageLocationMapper; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.service.IWmStorageLocationService; + +/** + * 库区设置Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-07 + */ +@Service +public class WmStorageLocationServiceImpl implements IWmStorageLocationService +{ + @Autowired + private WmStorageLocationMapper wmStorageLocationMapper; + + /** + * 查询库区设置 + * + * @param locationId 库区设置主键 + * @return 库区设置 + */ + @Override + public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) + { + return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId); + } + + @Override + public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) { + return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode); + } + + /** + * 查询库区设置列表 + * + * @param wmStorageLocation 库区设置 + * @return 库区设置 + */ + @Override + public List selectWmStorageLocationList(WmStorageLocation wmStorageLocation) + { + return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation); + } + + @Override + public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) { + WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation); + Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId(); + if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) { + WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation); + Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId(); + if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + @Override + public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) + { + wmStorageLocation.setCreateTime(DateUtils.getNowDate()); + return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation); + } + + /** + * 修改库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + @Override + public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) + { + wmStorageLocation.setUpdateTime(DateUtils.getNowDate()); + return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation); + } + + /** + * 批量删除库区设置 + * + * @param locationIds 需要删除的库区设置主键 + * @return 结果 + */ + @Override + public int deleteWmStorageLocationByLocationIds(Long[] locationIds) + { + return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds); + } + + /** + * 删除库区设置信息 + * + * @param locationId 库区设置主键 + * @return 结果 + */ + @Override + public int deleteWmStorageLocationByLocationId(Long locationId) + { + return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId); + } + + @Override + public int deleteByWarehouseId(Long warehouseId) { + return wmStorageLocationMapper.deleteByWarehouseId(warehouseId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransactionServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransactionServiceImpl.java new file mode 100644 index 0000000..727e612 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransactionServiceImpl.java @@ -0,0 +1,261 @@ +package com.ktg.mes.wm.service.impl; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.exception.BussinessException; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.mapper.MdItemMapper; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.mapper.WmMaterialStockMapper; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmTransactionMapper; +import com.ktg.mes.wm.service.IWmTransactionService; + +/** + * 库存事务Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-24 + */ +@Service +public class WmTransactionServiceImpl implements IWmTransactionService +{ + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private WmTransactionMapper wmTransactionMapper; + + @Autowired + private WmMaterialStockMapper wmMaterialStockMapper; + + @Autowired + private MdItemMapper mdItemMapper; + + @Override + public synchronized WmTransaction processTransaction(WmTransaction wmTransaction) { + WmMaterialStock stock = new WmMaterialStock(); + + validate(wmTransaction); //先效验业务传递的库存事务参数是否完整 + initStock(wmTransaction,stock); //用库存事务来初始化一个MSD对象 + + WmMaterialStock ms =wmMaterialStockMapper.loadMaterialStock(stock); //用MSD对象查询库存现有量,看是否已经存在相应的记录;如果存在则只对数量进行更新,不存在则需要新增MSD。 + + checkFrozen(ms,stock); //冻结检测 + BigDecimal quantity = wmTransaction.getTransactionQuantity().multiply(new BigDecimal(wmTransaction.getTransactionFlag())); + if(StringUtils.isNotNull(ms)){ + //MS已存在 + BigDecimal resultQuantity =ms.getQuantityOnhand().add(quantity); + if(wmTransaction.isStorageCheckFlag() && resultQuantity.compareTo(new BigDecimal(0))<0){ + throw new BussinessException("库存数量不足!"); + } + stock.setQuantityOnhand(resultQuantity); + stock.setMaterialStockId(ms.getMaterialStockId()); + wmMaterialStockMapper.updateWmMaterialStock(stock); + }else { + //MS不存在 + + //TODO:需要为库存增加一个效验逻辑:同一个库位上不能放不同批次和属性的物资 + + stock.setQuantityOnhand(quantity); + wmMaterialStockMapper.insertWmMaterialStock(stock); + } + wmTransaction.setMaterialStockId(stock.getMaterialStockId()); + wmTransaction.setTransactionQuantity(quantity); + wmTransactionMapper.insertWmTransaction(wmTransaction); + return wmTransaction; + } + + + private void validate(WmTransaction transaction){ + if(StringUtils.isNull(transaction.getTransactionType())){ + throw new BussinessException("库存事务不能为空"); + } + + if(StringUtils.isNull(transaction.getTransactionQuantity())){ + throw new BussinessException("事务数量不能为空"); + } + + if(StringUtils.isNull(transaction.getSourceDocCode())){ + throw new BussinessException("来源单据号不能为空"); + } + + if(StringUtils.isNull(transaction.getSourceDocLineId())){ + throw new BussinessException("来源单据行ID不能为空"); + } + + if(StringUtils.isNull(transaction.getTransactionDate())){ + transaction.setTransactionDate(new Date()); + } + } + + + public void initStock(WmTransaction transaction,WmMaterialStock stock){ + + if(StringUtils.isNotNull(transaction.getMaterialStockId())){ + WmMaterialStock st = wmMaterialStockMapper.selectWmMaterialStockByMaterialStockId(transaction.getMaterialStockId()); + BeanUtils.copyProperties(st,stock); + }else{ + MdItem item =mdItemMapper.selectMdItemById(transaction.getItemId()); + stock.setItemTypeId(item.getItemTypeId()); + stock.setItemId(transaction.getItemId()); + stock.setItemCode(transaction.getItemCode()); + stock.setItemName(transaction.getItemName()); + stock.setSpecification(transaction.getSpecification()); + stock.setUnitOfMeasure(transaction.getUnitOfMeasure()); + stock.setBatchCode(transaction.getBatchCode()); + stock.setWarehouseId(transaction.getWarehouseId()); + stock.setWarehouseCode(transaction.getWarehouseCode()); + stock.setWarehouseName(transaction.getWarehouseName()); + stock.setLocationId(transaction.getLocationId()); + stock.setLocationCode(transaction.getLocationCode()); + stock.setLocationName(transaction.getLocationName()); + if(StringUtils.isNotNull(transaction.getAreaId())){ + stock.setAreaId(transaction.getAreaId()); + stock.setAreaCode(transaction.getAreaCode()); + stock.setAreaName(transaction.getAreaName()); + } + if(StringUtils.isNotNull(transaction.getVendorId())){ + stock.setVendorId(transaction.getVendorId()); + stock.setVendorCode(transaction.getVendorCode()); + stock.setVendorName(transaction.getVendorName()); + stock.setVendorNick(transaction.getVendorNick()); + } + //使用库存事务日期初始化入库日期 + //一般在入库的时候才会涉及到materialStock的新增,出库的时候都是出的现有库存 + if(StringUtils.isNotNull(transaction.getRecptDate())){ + stock.setRecptDate(transaction.getRecptDate()); + }else{ + stock.setRecptDate(new Date()); + } + + //使用库存事务上的生产工单初始化库存记录上的生产工单,以支持某些情况下库存需要标记生产工单的情况 + if(StringUtils.isNotNull(transaction.getWorkorderId())){ + stock.setWorkorderId(transaction.getWorkorderId()); + stock.setWorkorderCode(transaction.getWorkorderCode()); + } + stock.setExpireDate(transaction.getExpireDate()); + } + } + + /** + * 检查库存冻结情况 + * @param ms + */ + private void checkFrozen(WmMaterialStock ms,WmMaterialStock org){ + //检查仓库冻结 + WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(org.getWarehouseId()); + if(UserConstants.YES.equals(warehouse.getFrozenFlag())){ + throw new BussinessException("仓库"+warehouse.getWarehouseName()+"已被冻结!"); + } + //检查库区冻结 + WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(org.getLocationId()); + if(UserConstants.YES.equals(location.getFrozenFlag())){ + throw new BussinessException("库区"+location.getLocationName()+"已被冻结!"); + } + //检查库位冻结 + WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(org.getAreaId()); + if(UserConstants.YES.equals(area.getFrozenFlag())){ + throw new BussinessException("库位"+area.getAreaName()+"已被冻结!"); + } + //检查具体的MS冻结 + if(ms!=null && StringUtils.isNotNull(ms.getMaterialStockId())){ + if(UserConstants.YES.equals(ms.getFrozenFlag())){ + throw new BussinessException(new StringBuilder("存放于").append(ms.getWarehouseName()).append("/") + .append(ms.getLocationName()).append("/").append(ms.getAreaName()).append("下的") + .append(ms.getItemName()).append("已被冻结!").toString()); + } + } + } + + + /** + * 查询库存事务 + * + * @param transactionId 库存事务主键 + * @return 库存事务 + */ + @Override + public WmTransaction selectWmTransactionByTransactionId(Long transactionId) + { + return wmTransactionMapper.selectWmTransactionByTransactionId(transactionId); + } + + /** + * 查询库存事务列表 + * + * @param wmTransaction 库存事务 + * @return 库存事务 + */ + @Override + public List selectWmTransactionList(WmTransaction wmTransaction) + { + return wmTransactionMapper.selectWmTransactionList(wmTransaction); + } + + /** + * 新增库存事务 + * + * @param wmTransaction 库存事务 + * @return 结果 + */ + @Override + public int insertWmTransaction(WmTransaction wmTransaction) + { + wmTransaction.setCreateTime(DateUtils.getNowDate()); + return wmTransactionMapper.insertWmTransaction(wmTransaction); + } + + /** + * 修改库存事务 + * + * @param wmTransaction 库存事务 + * @return 结果 + */ + @Override + public int updateWmTransaction(WmTransaction wmTransaction) + { + wmTransaction.setUpdateTime(DateUtils.getNowDate()); + return wmTransactionMapper.updateWmTransaction(wmTransaction); + } + + /** + * 批量删除库存事务 + * + * @param transactionIds 需要删除的库存事务主键 + * @return 结果 + */ + @Override + public int deleteWmTransactionByTransactionIds(Long[] transactionIds) + { + return wmTransactionMapper.deleteWmTransactionByTransactionIds(transactionIds); + } + + /** + * 删除库存事务信息 + * + * @param transactionId 库存事务主键 + * @return 结果 + */ + @Override + public int deleteWmTransactionByTransactionId(Long transactionId) + { + return wmTransactionMapper.deleteWmTransactionByTransactionId(transactionId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransferLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransferLineServiceImpl.java new file mode 100644 index 0000000..ccc1526 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransferLineServiceImpl.java @@ -0,0 +1,101 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmTransferLineMapper; +import com.ktg.mes.wm.domain.WmTransferLine; +import com.ktg.mes.wm.service.IWmTransferLineService; + +/** + * 转移单行Service业务层处理 + * + * @author yinjinlu + * @date 2022-11-28 + */ +@Service +public class WmTransferLineServiceImpl implements IWmTransferLineService +{ + @Autowired + private WmTransferLineMapper wmTransferLineMapper; + + /** + * 查询转移单行 + * + * @param lineId 转移单行主键 + * @return 转移单行 + */ + @Override + public WmTransferLine selectWmTransferLineByLineId(Long lineId) + { + return wmTransferLineMapper.selectWmTransferLineByLineId(lineId); + } + + /** + * 查询转移单行列表 + * + * @param wmTransferLine 转移单行 + * @return 转移单行 + */ + @Override + public List selectWmTransferLineList(WmTransferLine wmTransferLine) + { + return wmTransferLineMapper.selectWmTransferLineList(wmTransferLine); + } + + /** + * 新增转移单行 + * + * @param wmTransferLine 转移单行 + * @return 结果 + */ + @Override + public int insertWmTransferLine(WmTransferLine wmTransferLine) + { + wmTransferLine.setCreateTime(DateUtils.getNowDate()); + return wmTransferLineMapper.insertWmTransferLine(wmTransferLine); + } + + /** + * 修改转移单行 + * + * @param wmTransferLine 转移单行 + * @return 结果 + */ + @Override + public int updateWmTransferLine(WmTransferLine wmTransferLine) + { + wmTransferLine.setUpdateTime(DateUtils.getNowDate()); + return wmTransferLineMapper.updateWmTransferLine(wmTransferLine); + } + + /** + * 批量删除转移单行 + * + * @param lineIds 需要删除的转移单行主键 + * @return 结果 + */ + @Override + public int deleteWmTransferLineByLineIds(Long[] lineIds) + { + return wmTransferLineMapper.deleteWmTransferLineByLineIds(lineIds); + } + + /** + * 删除转移单行信息 + * + * @param lineId 转移单行主键 + * @return 结果 + */ + @Override + public int deleteWmTransferLineByLineId(Long lineId) + { + return wmTransferLineMapper.deleteWmTransferLineByLineId(lineId); + } + + @Override + public int deleteByTransferId(Long transferId) { + return wmTransferLineMapper.deleteByTransferId(transferId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransferServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransferServiceImpl.java new file mode 100644 index 0000000..0f38971 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmTransferServiceImpl.java @@ -0,0 +1,115 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.tx.TransferTxBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmTransferMapper; +import com.ktg.mes.wm.domain.WmTransfer; +import com.ktg.mes.wm.service.IWmTransferService; + +/** + * 转移单Service业务层处理 + * + * @author yinjinlu + * @date 2022-11-28 + */ +@Service +public class WmTransferServiceImpl implements IWmTransferService +{ + @Autowired + private WmTransferMapper wmTransferMapper; + + /** + * 查询转移单 + * + * @param transferId 转移单主键 + * @return 转移单 + */ + @Override + public WmTransfer selectWmTransferByTransferId(Long transferId) + { + return wmTransferMapper.selectWmTransferByTransferId(transferId); + } + + /** + * 查询转移单列表 + * + * @param wmTransfer 转移单 + * @return 转移单 + */ + @Override + public List selectWmTransferList(WmTransfer wmTransfer) + { + return wmTransferMapper.selectWmTransferList(wmTransfer); + } + + @Override + public List getTxBeans(Long transferid) { + return wmTransferMapper.getTxBeans(transferid); + } + + @Override + public String checkUnique(WmTransfer wmTransfer) { + WmTransfer transfer = wmTransferMapper.checkUnique(wmTransfer); + Long transferId = wmTransfer.getTransferId() == null?-1L:wmTransfer.getTransferId(); + if(StringUtils.isNotNull(transfer) && transferId.longValue() != transfer.getTransferId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增转移单 + * + * @param wmTransfer 转移单 + * @return 结果 + */ + @Override + public int insertWmTransfer(WmTransfer wmTransfer) + { + wmTransfer.setCreateTime(DateUtils.getNowDate()); + return wmTransferMapper.insertWmTransfer(wmTransfer); + } + + /** + * 修改转移单 + * + * @param wmTransfer 转移单 + * @return 结果 + */ + @Override + public int updateWmTransfer(WmTransfer wmTransfer) + { + wmTransfer.setUpdateTime(DateUtils.getNowDate()); + return wmTransferMapper.updateWmTransfer(wmTransfer); + } + + /** + * 批量删除转移单 + * + * @param transferIds 需要删除的转移单主键 + * @return 结果 + */ + @Override + public int deleteWmTransferByTransferIds(Long[] transferIds) + { + return wmTransferMapper.deleteWmTransferByTransferIds(transferIds); + } + + /** + * 删除转移单信息 + * + * @param transferId 转移单主键 + * @return 结果 + */ + @Override + public int deleteWmTransferByTransferId(Long transferId) + { + return wmTransferMapper.deleteWmTransferByTransferId(transferId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java new file mode 100644 index 0000000..ba4ba65 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java @@ -0,0 +1,176 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.mapper.WmStorageAreaMapper; +import com.ktg.mes.wm.mapper.WmStorageLocationMapper; +import org.apache.catalina.User; +import org.checkerframework.checker.units.qual.A; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmWarehouseMapper; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmWarehouseService; + +/** + * 仓库设置Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-07 + */ +@Service +public class WmWarehouseServiceImpl implements IWmWarehouseService +{ + @Autowired + private WmWarehouseMapper wmWarehouseMapper; + + @Autowired + private WmStorageLocationMapper wmStorageLocationMapper; + + @Autowired + private WmStorageAreaMapper wmStorageAreaMapper; + + /** + * 查询仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 仓库设置 + */ + @Override + public WmWarehouse selectWmWarehouseByWarehouseId(Long warehouseId) + { + return wmWarehouseMapper.selectWmWarehouseByWarehouseId(warehouseId); + } + + @Override + public WmWarehouse selectWmWarehouseByWarehouseCode(String warehouseCdoe) { + return wmWarehouseMapper.selectWmWarehouseByWarehouseCode(warehouseCdoe); + } + + /** + * 查询仓库设置列表 + * + * @param wmWarehouse 仓库设置 + * @return 仓库设置 + */ + @Override + public List selectWmWarehouseList(WmWarehouse wmWarehouse) + { + return wmWarehouseMapper.selectWmWarehouseList(wmWarehouse); + } + + @Override + public List getTreeList() { + return wmWarehouseMapper.getTreeList(); + } + + @Override + public String checkWarehouseCodeUnique(WmWarehouse wmWarehouse) { + WmWarehouse warehouse = wmWarehouseMapper.checkWarehouseCodeUnique(wmWarehouse); + Long warehouseId = wmWarehouse.getWarehouseId()==null?-1L:wmWarehouse.getWarehouseId(); + if(StringUtils.isNotNull(warehouse) && warehouse.getWarehouseId().longValue() != warehouseId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkWarehouseNameUnique(WmWarehouse wmWarehouse) { + WmWarehouse warehouse = wmWarehouseMapper.checkWarehouseNameUnique(wmWarehouse); + Long warehouseId = wmWarehouse.getWarehouseId()==null?-1L:wmWarehouse.getWarehouseId(); + if(StringUtils.isNotNull(warehouse) && warehouse.getWarehouseId().longValue() != warehouseId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + @Override + public int insertWmWarehouse(WmWarehouse wmWarehouse) + { + wmWarehouse.setCreateTime(DateUtils.getNowDate()); + return wmWarehouseMapper.insertWmWarehouse(wmWarehouse); + } + + /** + * 修改仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + @Override + public int updateWmWarehouse(WmWarehouse wmWarehouse) + { + wmWarehouse.setUpdateTime(DateUtils.getNowDate()); + return wmWarehouseMapper.updateWmWarehouse(wmWarehouse); + } + + /** + * 批量删除仓库设置 + * + * @param warehouseIds 需要删除的仓库设置主键 + * @return 结果 + */ + @Override + public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds) + { + return wmWarehouseMapper.deleteWmWarehouseByWarehouseIds(warehouseIds); + } + + /** + * 删除仓库设置信息 + * + * @param warehouseId 仓库设置主键 + * @return 结果 + */ + @Override + public int deleteWmWarehouseByWarehouseId(Long warehouseId) + { + return wmWarehouseMapper.deleteWmWarehouseByWarehouseId(warehouseId); + } + + @Override + public WmWarehouse initVirtualWarehouse() { + + WmWarehouse warehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH); + if(!StringUtils.isNotNull(warehouse)){ + warehouse = new WmWarehouse(); + warehouse.setWarehouseCode(UserConstants.VIRTUAL_WH); + warehouse.setWarehouseName("线边库-虚拟"); + wmWarehouseMapper.insertWmWarehouse(warehouse); + } + + + WmStorageLocation location = wmStorageLocationMapper.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS); + if(!StringUtils.isNotNull(location)){ + location = new WmStorageLocation(); + location.setWarehouseId(warehouse.getWarehouseId()); + location.setLocationCode(UserConstants.VIRTUAL_WS); + location.setLocationName("线边库库区-虚拟"); + location.setAreaFlag(UserConstants.YES); + wmStorageLocationMapper.insertWmStorageLocation(location); + } + + + WmStorageArea area = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA); + if(!StringUtils.isNotNull(area)){ + area = new WmStorageArea(); + area.setLocationId(location.getLocationId()); + area.setAreaCode(UserConstants.VIRTUAL_WA); + area.setAreaName("线边库库位-虚拟"); + wmStorageAreaMapper.insertWmStorageArea(area); + } + + return warehouse; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/utils/WmBarCodeUtil.java b/ktg-mes/src/main/java/com/ktg/mes/wm/utils/WmBarCodeUtil.java new file mode 100644 index 0000000..f961036 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/utils/WmBarCodeUtil.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.utils; + +import com.ktg.common.constant.UserConstants; +import com.ktg.mes.wm.domain.WmBarcode; +import com.ktg.mes.wm.domain.WmBarcodeConfig; +import com.ktg.mes.wm.service.IWmBarcodeConfigService; +import com.ktg.mes.wm.service.IWmBarcodeService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +@Component +public class WmBarCodeUtil { + + private static final Logger log = LoggerFactory.getLogger(WmBarCodeUtil.class); + + @Autowired + private IWmBarcodeConfigService wmBarcodeConfigService; + + @Autowired + private IWmBarcodeService wmBarcodeService; + + public void generateBarCode(String type,Long businessId,String businessCode,String businessName){ + //先判断当前类型的业务是否配置了需要自动生成条码 + if(!wmBarcodeConfigService.isAutoGen(type)){ + //无需自动生成条码 + return ; + } + WmBarcodeConfig param = new WmBarcodeConfig(); + param.setBarcodeType(type); + List confgs = wmBarcodeConfigService.selectWmBarcodeConfigList(param); + if(CollectionUtils.isEmpty(confgs)){ + log.warn("当前类型的业务未配置对应的条码生成规则!{}",type); + return ; + } + + WmBarcodeConfig config = confgs.get(0); + WmBarcode barcode = new WmBarcode(); + barcode.setBarcodeFormart(config.getBarcodeFormart()); + barcode.setBarcodeType(type); + barcode.setBarcodeContent(config.getContentFormart().replace("{BUSINESSCODE}",businessCode)); + barcode.setBussinessCode(businessCode); + barcode.setEnableFlag(UserConstants.YES); + barcode.setBussinessId(businessId); + + if(UserConstants.NOT_UNIQUE.equals(wmBarcodeService.checkBarcodeUnique(barcode))){ + log.warn("当前业务对象的赋码已存在!{} {}",type,businessCode); + return ; + } + + String path = wmBarcodeService.generateBarcode(barcode); + barcode.setBarcodeUrl(path); + wmBarcodeService.insertWmBarcode(barcode); + } + + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/utils/WmStockUtil.java b/ktg-mes/src/main/java/com/ktg/mes/wm/utils/WmStockUtil.java new file mode 100644 index 0000000..80bdcae --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/utils/WmStockUtil.java @@ -0,0 +1,9 @@ +package com.ktg.mes.wm.utils; + +public class WmStockUtil { + + + + + +} diff --git a/ktg-mes/src/main/resources/jasperreports_extension.properties b/ktg-mes/src/main/resources/jasperreports_extension.properties new file mode 100644 index 0000000..dcbf3ad --- /dev/null +++ b/ktg-mes/src/main/resources/jasperreports_extension.properties @@ -0,0 +1,2 @@ +net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory +net.sf.jasperreports.extension.simple.font.families.lobstertwo=reports/fonts/fonts.xml \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalHolidayMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalHolidayMapper.xml new file mode 100644 index 0000000..cfea6a7 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalHolidayMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + select holiday_id, the_day, holiday_type, start_time, end_time, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_holiday + + + + + + + + insert into cal_holiday + + the_day, + holiday_type, + start_time, + end_time, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{theDay}, + #{holidayType}, + #{startTime}, + #{endTime}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_holiday + + the_day = #{theDay}, + holiday_type = #{holidayType}, + start_time = #{startTime}, + end_time = #{endTime}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where holiday_id = #{holidayId} + + + + delete from cal_holiday where holiday_id = #{holidayId} + + + + delete from cal_holiday where holiday_id in + + #{holidayId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalPlanMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalPlanMapper.xml new file mode 100644 index 0000000..d3bf2ca --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalPlanMapper.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select plan_id, plan_code, plan_name,calendar_type, start_date, end_date, shift_type, shift_method, shift_count,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_plan + + + + + + + + insert into cal_plan + + plan_code, + plan_name, + calendar_type, + start_date, + end_date, + shift_type, + shift_method, + shift_count, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{planCode}, + #{planName}, + #{calendarType}, + #{startDate}, + #{endDate}, + #{shiftType}, + #{shiftMethod}, + #{shiftCount}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_plan + + plan_code = #{planCode}, + plan_name = #{planName}, + calendar_type = #{calendarType}, + start_date = #{startDate}, + end_date = #{endDate}, + shift_type = #{shiftType}, + shift_method = #{shiftMethod}, + shift_count = #{shiftCount}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where plan_id = #{planId} + + + + delete from cal_plan where plan_id = #{planId} + + + + delete from cal_plan where plan_id in + + #{planId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalPlanTeamMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalPlanTeamMapper.xml new file mode 100644 index 0000000..b249108 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalPlanTeamMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + select record_id, plan_id, team_id, team_code, team_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_plan_team + + + + + + + + + + insert into cal_plan_team + + plan_id, + team_id, + team_code, + team_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{planId}, + #{teamId}, + #{teamCode}, + #{teamName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_plan_team + + plan_id = #{planId}, + team_id = #{teamId}, + team_code = #{teamCode}, + team_name = #{teamName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from cal_plan_team where record_id = #{recordId} + + + + delete from cal_plan_team where record_id in + + #{recordId} + + + + + delete from cal_plan_team where plan_id = #{planId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalShiftMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalShiftMapper.xml new file mode 100644 index 0000000..83c03de --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalShiftMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select shift_id, plan_id, order_num, shift_name, start_time, end_time, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_shift + + + + + + + + + + insert into cal_shift + + plan_id, + order_num, + shift_name, + start_time, + end_time, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{planId}, + #{orderNum}, + #{shiftName}, + #{startTime}, + #{endTime}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_shift + + plan_id = #{planId}, + order_num = #{orderNum}, + shift_name = #{shiftName}, + start_time = #{startTime}, + end_time = #{endTime}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where shift_id = #{shiftId} + + + + delete from cal_shift where shift_id = #{shiftId} + + + + delete from cal_shift where shift_id in + + #{shiftId} + + + + + delete from cal_shift where plan_id = #{planId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalTeamMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalTeamMapper.xml new file mode 100644 index 0000000..c7802bc --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalTeamMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + select team_id, team_code, team_name,calendar_type, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_team + + + + + + + + insert into cal_team + + team_code, + team_name, + calendar_type, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{teamCode}, + #{teamName}, + #{calendarType}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_team + + team_code = #{teamCode}, + team_name = #{teamName}, + calendar_type = #{calendarType}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where team_id = #{teamId} + + + + delete from cal_team where team_id = #{teamId} + + + + delete from cal_team where team_id in + + #{teamId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalTeamMemberMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalTeamMemberMapper.xml new file mode 100644 index 0000000..1704ed8 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalTeamMemberMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select member_id, team_id, user_id, user_name, nick_name, tel, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_team_member + + + + + + + + + + insert into cal_team_member + + team_id, + user_id, + user_name, + nick_name, + tel, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{teamId}, + #{userId}, + #{userName}, + #{nickName}, + #{tel}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_team_member + + team_id = #{teamId}, + user_id = #{userId}, + user_name = #{userName}, + nick_name = #{nickName}, + tel = #{tel}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where member_id = #{memberId} + + + + delete from cal_team_member where member_id = #{memberId} + + + + delete from cal_team_member where member_id in + + #{memberId} + + + + + delete from cal_team_member where team_id = #{teamId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/cal/CalTeamshiftMapper.xml b/ktg-mes/src/main/resources/mapper/cal/CalTeamshiftMapper.xml new file mode 100644 index 0000000..22186e0 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/cal/CalTeamshiftMapper.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, the_day, team_id, team_name, shift_id, shift_name, order_num, plan_id,calendar_type, shift_type, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_teamshift + + + + + + + + insert into cal_teamshift + + the_day, + team_id, + team_name, + shift_id, + shift_name, + order_num, + plan_id, + calendar_type, + shift_type, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{theDay}, + #{teamId}, + #{teamName}, + #{shiftId}, + #{shiftName}, + #{orderNum}, + #{planId}, + #{calendarType}, + #{shiftType}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update cal_teamshift + + the_day = #{theDay}, + team_id = #{teamId}, + team_name = #{teamName}, + shift_id = #{shiftId}, + shift_name = #{shiftName}, + order_num = #{orderNum}, + plan_id = #{planId}, + calendar_type = #{calendarType}, + shift_type = #{shiftType}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from cal_teamshift where record_id = #{recordId} + + + + delete from cal_teamshift where record_id in + + #{recordId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvCheckMachineryMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvCheckMachineryMapper.xml new file mode 100644 index 0000000..14b4f34 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvCheckMachineryMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, plan_id, machinery_id, machinery_code, machinery_name, machinery_brand, machinery_spec, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_machinery + + + + + + + + + + insert into dv_check_machinery + + plan_id, + machinery_id, + machinery_code, + machinery_name, + machinery_brand, + machinery_spec, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{planId}, + #{machineryId}, + #{machineryCode}, + #{machineryName}, + #{machineryBrand}, + #{machinerySpec}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_check_machinery + + plan_id = #{planId}, + machinery_id = #{machineryId}, + machinery_code = #{machineryCode}, + machinery_name = #{machineryName}, + machinery_brand = #{machineryBrand}, + machinery_spec = #{machinerySpec}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from dv_check_machinery where record_id = #{recordId} + + + + delete from dv_check_machinery where record_id in + + #{recordId} + + + + + delete from dv_check_machinery where plan_id = #{planId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvCheckPlanMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvCheckPlanMapper.xml new file mode 100644 index 0000000..1e509f1 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvCheckPlanMapper.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select plan_id, plan_code, plan_name,plan_type, start_date, end_date, cycle_type, cycle_count,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_plan + + + + + + + + + + insert into dv_check_plan + + plan_code, + plan_name, + plan_type, + start_date, + end_date, + cycle_type, + cycle_count, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{planCode}, + #{planName}, + #{planType}, + #{startDate}, + #{endDate}, + #{cycleType}, + #{cycleCount}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_check_plan + + plan_code = #{planCode}, + plan_name = #{planName}, + plan_type = #{planType}, + start_date = #{startDate}, + end_date = #{endDate}, + cycle_type = #{cycleType}, + cycle_count = #{cycleCount}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where plan_id = #{planId} + + + + delete from dv_check_plan where plan_id = #{planId} + + + + delete from dv_check_plan where plan_id in + + #{planId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvCheckSubjectMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvCheckSubjectMapper.xml new file mode 100644 index 0000000..e7c97ff --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvCheckSubjectMapper.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, plan_id, subject_id, subject_code, subject_name, subject_type, subject_content, subject_standard, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_subject + + + + + + + + + + insert into dv_check_subject + + plan_id, + subject_id, + subject_code, + subject_name, + subject_type, + subject_content, + subject_standard, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{planId}, + #{subjectId}, + #{subjectCode}, + #{subjectName}, + #{subjectType}, + #{subjectContent}, + #{subjectStandard}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_check_subject + + plan_id = #{planId}, + subject_id = #{subjectId}, + subject_code = #{subjectCode}, + subject_name = #{subjectName}, + subject_type = #{subjectType}, + subject_content = #{subjectContent}, + subject_standard = #{subjectStandard}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from dv_check_subject where record_id = #{recordId} + + + + delete from dv_check_subject where record_id in + + #{recordId} + + + + + delete from dv_check_subject where plan_id = #{planId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvMachineryMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvMachineryMapper.xml new file mode 100644 index 0000000..e31f10a --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvMachineryMapper.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select machinery_id, machinery_code, machinery_name, machinery_brand, machinery_spec, machinery_type_id, machinery_type_code, machinery_type_name, workshop_id, workshop_code, workshop_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_machinery + + + + + + + + + + insert into dv_machinery + + machinery_code, + machinery_name, + machinery_brand, + machinery_spec, + machinery_type_id, + machinery_type_code, + machinery_type_name, + workshop_id, + workshop_code, + workshop_name, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{machineryCode}, + #{machineryName}, + #{machineryBrand}, + #{machinerySpec}, + #{machineryTypeId}, + #{machineryTypeCode}, + #{machineryTypeName}, + #{workshopId}, + #{workshopCode}, + #{workshopName}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_machinery + + machinery_code = #{machineryCode}, + machinery_name = #{machineryName}, + machinery_brand = #{machineryBrand}, + machinery_spec = #{machinerySpec}, + machinery_type_id = #{machineryTypeId}, + machinery_type_code = #{machineryTypeCode}, + machinery_type_name = #{machineryTypeName}, + workshop_id = #{workshopId}, + workshop_code = #{workshopCode}, + workshop_name = #{workshopName}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where machinery_id = #{machineryId} + + + + delete from dv_machinery where machinery_id = #{machineryId} + + + + delete from dv_machinery where machinery_id in + + #{machineryId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvMachineryTypeMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvMachineryTypeMapper.xml new file mode 100644 index 0000000..67244f0 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvMachineryTypeMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + select machinery_type_id, machinery_type_code, machinery_type_name, parent_type_id, ancestors, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_machinery_type + + + + + + + + insert into dv_machinery_type + + machinery_type_code, + machinery_type_name, + parent_type_id, + ancestors, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{machineryTypeCode}, + #{machineryTypeName}, + #{parentTypeId}, + #{ancestors}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_machinery_type + + machinery_type_code = #{machineryTypeCode}, + machinery_type_name = #{machineryTypeName}, + parent_type_id = #{parentTypeId}, + ancestors = #{ancestors}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where machinery_type_id = #{machineryTypeId} + + + + delete from dv_machinery_type where machinery_type_id = #{machineryTypeId} + + + + delete from dv_machinery_type where machinery_type_id in + + #{machineryTypeId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvRepairLineMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvRepairLineMapper.xml new file mode 100644 index 0000000..34b8dde --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvRepairLineMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, repair_id, subject_id, subject_code, subject_name, subject_type, subject_content, subject_standard, malfunction, malfunction_url, repair_des, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_repair_line + + + + + + + + insert into dv_repair_line + + repair_id, + subject_id, + subject_code, + subject_name, + subject_type, + subject_content, + subject_standard, + malfunction, + malfunction_url, + repair_des, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{repairId}, + #{subjectId}, + #{subjectCode}, + #{subjectName}, + #{subjectType}, + #{subjectContent}, + #{subjectStandard}, + #{malfunction}, + #{malfunctionUrl}, + #{repairDes}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_repair_line + + repair_id = #{repairId}, + subject_id = #{subjectId}, + subject_code = #{subjectCode}, + subject_name = #{subjectName}, + subject_type = #{subjectType}, + subject_content = #{subjectContent}, + subject_standard = #{subjectStandard}, + malfunction = #{malfunction}, + malfunction_url = #{malfunctionUrl}, + repair_des = #{repairDes}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from dv_repair_line where line_id = #{lineId} + + + + delete from dv_repair_line where line_id in + + #{lineId} + + + + + delete from dv_repair_line where repair_id = #{repairId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvRepairMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvRepairMapper.xml new file mode 100644 index 0000000..ca8d843 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvRepairMapper.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select repair_id, repair_code, repair_name, machinery_id, machinery_code, machinery_name, machinery_brand, machinery_spec, machinery_type_id, require_date, finish_date, confirm_date, repair_result, accepted_by, confirm_by, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_repair + + + + + + + + + + insert into dv_repair + + repair_code, + repair_name, + machinery_id, + machinery_code, + machinery_name, + machinery_brand, + machinery_spec, + machinery_type_id, + require_date, + finish_date, + confirm_date, + repair_result, + accepted_by, + confirm_by, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{repairCode}, + #{repairName}, + #{machineryId}, + #{machineryCode}, + #{machineryName}, + #{machineryBrand}, + #{machinerySpec}, + #{machineryTypeId}, + #{requireDate}, + #{finishDate}, + #{confirmDate}, + #{repairResult}, + #{acceptedBy}, + #{confirmBy}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_repair + + repair_code = #{repairCode}, + repair_name = #{repairName}, + machinery_id = #{machineryId}, + machinery_code = #{machineryCode}, + machinery_name = #{machineryName}, + machinery_brand = #{machineryBrand}, + machinery_spec = #{machinerySpec}, + machinery_type_id = #{machineryTypeId}, + require_date = #{requireDate}, + finish_date = #{finishDate}, + confirm_date = #{confirmDate}, + repair_result = #{repairResult}, + accepted_by = #{acceptedBy}, + confirm_by = #{confirmBy}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where repair_id = #{repairId} + + + + delete from dv_repair where repair_id = #{repairId} + + + + delete from dv_repair where repair_id in + + #{repairId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/dv/DvSubjectMapper.xml b/ktg-mes/src/main/resources/mapper/dv/DvSubjectMapper.xml new file mode 100644 index 0000000..2f7c328 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/dv/DvSubjectMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select subject_id, subject_code, subject_name, subject_type, subject_content, subject_standard, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_subject + + + + + + + + + + insert into dv_subject + + subject_code, + subject_name, + subject_type, + subject_content, + subject_standard, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{subjectCode}, + #{subjectName}, + #{subjectType}, + #{subjectContent}, + #{subjectStandard}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dv_subject + + subject_code = #{subjectCode}, + subject_name = #{subjectName}, + subject_type = #{subjectType}, + subject_content = #{subjectContent}, + subject_standard = #{subjectStandard}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where subject_id = #{subjectId} + + + + delete from dv_subject where subject_id = #{subjectId} + + + + delete from dv_subject where subject_id in + + #{subjectId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/ItemTypeMapper.xml b/ktg-mes/src/main/resources/mapper/md/ItemTypeMapper.xml new file mode 100644 index 0000000..44e6fe8 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/ItemTypeMapper.xml @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select d.item_type_id,d.item_type_code,d.item_type_name,d.parent_type_id,d.ancestors, d.item_or_product, d.order_num, d.enable_flag, d.remark,d.attr1,d.attr2,d.attr3,d.attr4, d.create_by, d.create_time + from md_item_type d + + + + + + + + + + + + + + + + + + + + + + + insert into md_item_type( + item_type_id, + parent_type_id, + ancestors, + item_type_code, + item_type_name, + order_num, + item_or_product, + enable_flag, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time + )values( + #{itemTypeId}, + #{parentTypeId}, + #{ancestors}, + #{itemTypeCode}, + #{itemTypeName}, + #{orderNum}, + #{itemOrProduct}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + sysdate() + ) + + + + update md_item_type + + parent_type_id = #{parentTypeId}, + item_type_name = #{itemTypeName}, + item_type_code = #{itemTypeCode}, + item_or_product = #{itemOrProduct}, + order_num = #{orderNum}, + remark = #{remark}, + enable_flag = #{enableFlag}, + update_by = #{updateBy}, + update_time = sysdate() + + where item_type_id = #{itemTypeId} + + + + + update md_item_type set enable_flag = 'N' where item_type_id in + + #{itemTypeId} + + + + + delete from md_item_type where item_type_id = #{itemTypeId} + + + + delete from md_item_type where item_type_id in + + #{itemTypeId} + + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml new file mode 100644 index 0000000..cbd8530 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select client_id, client_code, client_name, client_nick, client_en, client_des, client_logo, client_type, address, website, email, tel, contact1, contact1_tel, contact1_email, contact2, contact2_tel, contact2_email, credit_code, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_client + + + + + + + + + + + + + + insert into md_client + + client_code, + client_name, + client_nick, + client_en, + client_des, + client_logo, + client_type, + address, + website, + email, + tel, + contact1, + contact1_tel, + contact1_email, + contact2, + contact2_tel, + contact2_email, + credit_code, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{clientCode}, + #{clientName}, + #{clientNick}, + #{clientEn}, + #{clientDes}, + #{clientLogo}, + #{clientType}, + #{address}, + #{website}, + #{email}, + #{tel}, + #{contact1}, + #{contact1Tel}, + #{contact1Email}, + #{contact2}, + #{contact2Tel}, + #{contact2Email}, + #{creditCode}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_client + + client_code = #{clientCode}, + client_name = #{clientName}, + client_nick = #{clientNick}, + client_en = #{clientEn}, + client_des = #{clientDes}, + client_logo = #{clientLogo}, + client_type = #{clientType}, + address = #{address}, + website = #{website}, + email = #{email}, + tel = #{tel}, + contact1 = #{contact1}, + contact1_tel = #{contact1Tel}, + contact1_email = #{contact1Email}, + contact2 = #{contact2}, + contact2_tel = #{contact2Tel}, + contact2_email = #{contact2Email}, + credit_code = #{creditCode}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where client_id = #{clientId} + + + + delete from md_client where client_id = #{clientId} + + + + delete from md_client where client_id in + + #{clientId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml new file mode 100644 index 0000000..6e78f4e --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select item_id, item_code, item_name, specification, unit_of_measure,unit_name, item_or_product, + item_type_id,item_type_code,item_type_name,enable_flag,safe_stock_flag,min_stock,max_stock,high_value, create_by, create_time, remark + from md_item + + + + + + + + + + + + + + + + insert into md_item( + item_code, + item_name, + specification, + unit_of_measure, + unit_name, + item_or_product, + item_type_id, + item_type_code, + item_type_name, + enable_flag, + safe_stock_flag, + min_stock, + max_stock, + high_value, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time + ) + values ( + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{unitName}, + #{itemOrProduct}, + #{itemTypeId}, + #{itemTypeCode}, + #{itemTypeName}, + #{enableFlag}, + #{safeStockFlag}, + #{minStock}, + #{maxStock}, + #{highValue}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + sysdate() + ) + + + + update md_item + + item_name = #{itemName}, + item_type_id = #{itemTypeId}, + item_type_code = #{itemTypeCode}, + item_type_name = #{itemTypeName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + unit_name = #{unitName}, + item_or_product = #{itemOrProduct}, + enable_flag = #{enableFlag}, + safe_stock_flag = #{safeStockFlag}, + min_stock = #{minStock}, + max_stock = #{maxStock}, + high_value = #{highValue}, + remark = #{remark}, + attr1=#{attr1}, + attr2=#{attr2}, + attr3=#{attr3}, + attr4=#{attr4}, + update_by=#{updateBy}, + update_time = sysdate() + + where item_id = #{itemId} + + + + delete from md_item where item_id =#{itemId} + + + + delete from md_item where item_id in + + #{itemId} + + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml new file mode 100644 index 0000000..d656b71 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select bom_id, item_id, bom_item_id, bom_item_code, bom_item_name, bom_item_spec, unit_of_measure, item_or_product, quantity, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_product_bom + + + + + + + + insert into md_product_bom + + item_id, + bom_item_id, + bom_item_code, + bom_item_name, + bom_item_spec, + unit_of_measure, + item_or_product, + quantity, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{itemId}, + #{bomItemId}, + #{bomItemCode}, + #{bomItemName}, + #{bomItemSpec}, + #{unitOfMeasure}, + #{itemOrProduct}, + #{quantity}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_product_bom + + item_id = #{itemId}, + bom_item_id = #{bomItemId}, + bom_item_code = #{bomItemCode}, + bom_item_name = #{bomItemName}, + bom_item_spec = #{bomItemSpec}, + unit_of_measure = #{unitOfMeasure}, + item_or_product = #{itemOrProduct}, + quantity = #{quantity}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where bom_id = #{bomId} + + + + delete from md_product_bom where bom_id = #{bomId} + + + + delete from md_product_bom where bom_id in + + #{bomId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdProductSipMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdProductSipMapper.xml new file mode 100644 index 0000000..5ffae51 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdProductSipMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select sip_id, item_id, order_num, process_id, process_code, process_name, sip_title, sip_description, sip_url, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_product_sip + + + + + + + + insert into md_product_sip + + item_id, + order_num, + process_id, + process_code, + process_name, + sip_title, + sip_description, + sip_url, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{itemId}, + #{orderNum}, + #{processId}, + #{processCode}, + #{processName}, + #{sipTitle}, + #{sipDescription}, + #{sipUrl}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_product_sip + + item_id = #{itemId}, + order_num = #{orderNum}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + sip_title = #{sipTitle}, + sip_description = #{sipDescription}, + sip_url = #{sipUrl}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where sip_id = #{sipId} + + + + delete from md_product_sip where sip_id = #{sipId} + + + + delete from md_product_sip where sip_id in + + #{sipId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdProductSopMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdProductSopMapper.xml new file mode 100644 index 0000000..8a1128f --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdProductSopMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select sop_id, item_id, order_num, process_id, process_code, process_name, sop_title, sop_description, sop_url, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_product_sop + + + + + + + + insert into md_product_sop + + item_id, + order_num, + process_id, + process_code, + process_name, + sop_title, + sop_description, + sop_url, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{itemId}, + #{orderNum}, + #{processId}, + #{processCode}, + #{processName}, + #{sopTitle}, + #{sopDescription}, + #{sopUrl}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_product_sop + + item_id = #{itemId}, + order_num = #{orderNum}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + sop_title = #{sopTitle}, + sop_description = #{sopDescription}, + sop_url = #{sopUrl}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where sop_id = #{sopId} + + + + delete from md_product_sop where sop_id = #{sopId} + + + + delete from md_product_sop where sop_id in + + #{sopId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdUnitMeasureMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdUnitMeasureMapper.xml new file mode 100644 index 0000000..eace785 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdUnitMeasureMapper.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select measure_id, measure_code, measure_name, primary_flag, primary_id, change_rate, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_unit_measure + + + + + + + + + + insert into md_unit_measure + + measure_code, + measure_name, + primary_flag, + primary_id, + change_rate, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{measureCode}, + #{measureName}, + #{primaryFlag}, + #{primaryId}, + #{changeRate}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_unit_measure + + measure_code = #{measureCode}, + measure_name = #{measureName}, + primary_flag = #{primaryFlag}, + primary_id = #{primaryId}, + change_rate = #{changeRate}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where measure_id = #{measureId} + + + + delete from md_unit_measure where measure_id = #{measureId} + + + + delete from md_unit_measure where measure_id in + + #{measureId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml new file mode 100644 index 0000000..a88af99 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select vendor_id, vendor_code, vendor_name, vendor_nick, vendor_en, vendor_des, vendor_logo, vendor_level, vendor_score, address, website, email, tel, contact1, contact1_tel, contact1_email, contact2, contact2_tel, contact2_email, credit_code, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_vendor + + + + + + + + + + + + + + insert into md_vendor + + vendor_code, + vendor_name, + vendor_nick, + vendor_en, + vendor_des, + vendor_logo, + vendor_level, + vendor_score, + address, + website, + email, + tel, + contact1, + contact1_tel, + contact1_email, + contact2, + contact2_tel, + contact2_email, + credit_code, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{vendorEn}, + #{vendorDes}, + #{vendorLogo}, + #{vendorLevel}, + #{vendorScore}, + #{address}, + #{website}, + #{email}, + #{tel}, + #{contact1}, + #{contact1Tel}, + #{contact1Email}, + #{contact2}, + #{contact2Tel}, + #{contact2Email}, + #{creditCode}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_vendor + + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + vendor_en = #{vendorEn}, + vendor_des = #{vendorDes}, + vendor_logo = #{vendorLogo}, + vendor_level = #{vendorLevel}, + vendor_score = #{vendorScore}, + address = #{address}, + website = #{website}, + email = #{email}, + tel = #{tel}, + contact1 = #{contact1}, + contact1_tel = #{contact1Tel}, + contact1_email = #{contact1Email}, + contact2 = #{contact2}, + contact2_tel = #{contact2Tel}, + contact2_email = #{contact2Email}, + credit_code = #{creditCode}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where vendor_id = #{vendorId} + + + + delete from md_vendor where vendor_id = #{vendorId} + + + + delete from md_vendor where vendor_id in + + #{vendorId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml new file mode 100644 index 0000000..ea2dfaf --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select workshop_id, workshop_code, workshop_name, area, charge, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workshop + + + + + + + + + + + + insert into md_workshop + + workshop_code, + workshop_name, + area, + charge, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workshopCode}, + #{workshopName}, + #{area}, + #{charge}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_workshop + + workshop_code = #{workshopCode}, + workshop_name = #{workshopName}, + area = #{area}, + charge = #{charge}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where workshop_id = #{workshopId} + + + + delete from md_workshop where workshop_id = #{workshopId} + + + + delete from md_workshop where workshop_id in + + #{workshopId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdWorkstationMachineMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdWorkstationMachineMapper.xml new file mode 100644 index 0000000..73eeafe --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdWorkstationMachineMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + select record_id, workstation_id, machinery_id, machinery_code, machinery_name, quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workstation_machine + + + + + + + + + + insert into md_workstation_machine + + workstation_id, + machinery_id, + machinery_code, + machinery_name, + quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workstationId}, + #{machineryId}, + #{machineryCode}, + #{machineryName}, + #{quantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_workstation_machine + + workstation_id = #{workstationId}, + machinery_id = #{machineryId}, + machinery_code = #{machineryCode}, + machinery_name = #{machineryName}, + quantity = #{quantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from md_workstation_machine where record_id = #{recordId} + + + + delete from md_workstation_machine where record_id in + + #{recordId} + + + + + delete from md_workstation_machine where workstation_id = #{workstationId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdWorkstationMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdWorkstationMapper.xml new file mode 100644 index 0000000..e194e55 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdWorkstationMapper.xml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select workstation_id, workstation_code, workstation_name, workstation_address, workshop_id, workshop_code, workshop_name, process_id, process_code, process_name,warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workstation + + + + + + + + + + + + insert into md_workstation + + workstation_code, + workstation_name, + workstation_address, + workshop_id, + workshop_code, + workshop_name, + process_id, + process_code, + process_name, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workstationCode}, + #{workstationName}, + #{workstationAddress}, + #{workshopId}, + #{workshopCode}, + #{workshopName}, + #{processId}, + #{processCode}, + #{processName}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_workstation + + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + workstation_address = #{workstationAddress}, + workshop_id = #{workshopId}, + workshop_code = #{workshopCode}, + workshop_name = #{workshopName}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where workstation_id = #{workstationId} + + + + delete from md_workstation where workstation_id = #{workstationId} + + + + delete from md_workstation where workstation_id in + + #{workstationId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdWorkstationToolMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdWorkstationToolMapper.xml new file mode 100644 index 0000000..d13b9ad --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdWorkstationToolMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + select record_id, workstation_id, tool_type_id, tool_type_code, tool_type_name, quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workstation_tool + + + + + + + + + + insert into md_workstation_tool + + workstation_id, + tool_type_id, + tool_type_code, + tool_type_name, + quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workstationId}, + #{toolTypeId}, + #{toolTypeCode}, + #{toolTypeName}, + #{quantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_workstation_tool + + workstation_id = #{workstationId}, + tool_type_id = #{toolTypeId}, + tool_type_code = #{toolTypeCode}, + tool_type_name = #{toolTypeName}, + quantity = #{quantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from md_workstation_tool where record_id = #{recordId} + + + + delete from md_workstation_tool where record_id in + + #{recordId} + + + + + delete from md_workstation_tool where workstation_id = #{workstationId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdWorkstationWorkerMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdWorkstationWorkerMapper.xml new file mode 100644 index 0000000..1e666e3 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/MdWorkstationWorkerMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + select record_id, workstation_id, post_id, post_code, post_name, quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workstation_worker + + + + + + + + + + insert into md_workstation_worker + + workstation_id, + post_id, + post_code, + post_name, + quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workstationId}, + #{postId}, + #{postCode}, + #{postName}, + #{quantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update md_workstation_worker + + workstation_id = #{workstationId}, + post_id = #{postId}, + post_code = #{postCode}, + post_name = #{postName}, + quantity = #{quantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from md_workstation_worker where record_id = #{recordId} + + + + delete from md_workstation_worker where record_id in + + #{recordId} + + + + + delete from md_workstation_worker where workstation_id = #{workstationId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml new file mode 100644 index 0000000..3abd340 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select f.record_id,f.feedback_type, f.workstation_id, f.workstation_code, f.workstation_name,f.route_id,f.route_code, f.process_id, f.process_code, f.process_name,p.is_check, f.workorder_id, f.workorder_code, f.workorder_name, f.task_id, f.task_code,f.item_id,f.item_code,f.item_name,f.specification,f.unit_of_measure, f.quantity, f.quantity_feedback, f.quantity_qualified, f.quantity_unquanlified,f.quantity_uncheck, f.user_name, f.nick_name, f.feedback_channel, f.feedback_time,f.record_user,f.record_nick,f.status, f.remark, f.attr1, f.attr2, f.attr3, f.attr4, f.create_by, f.create_time, f.update_by, f.update_time + from pro_feedback f + left join pro_route_process p + on f.process_id = p.process_id and f.route_id = p.route_id + + + + + + + + insert into pro_feedback + + feedback_type, + feedback_code, + workstation_id, + workstation_code, + workstation_name, + route_id, + route_code, + process_id, + process_code, + process_name, + workorder_id, + workorder_code, + workorder_name, + task_id, + task_code, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity, + quantity_feedback, + quantity_qualified, + quantity_unquanlified, + quantity_uncheck, + user_name, + nick_name, + feedback_channel, + feedback_time, + record_user, + record_nick, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{feedbackType}, + #{feedbackCode}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{routeId}, + #{routeCode}, + #{processId}, + #{processCode}, + #{processName}, + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{taskId}, + #{taskCode}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantity}, + #{quantityFeedback}, + #{quantityQualified}, + #{quantityUnquanlified}, + #{quantityUncheck}, + #{userName}, + #{nickName}, + #{feedbackChannel}, + #{feedbackTime}, + #{recordUser}, + #{recordNick}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_feedback + + feedback_type = #{feedbackType}, + feedback_code = #{feedbackCode}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + route_id = #{routeId}, + route_code = #{routeCode}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + task_id = #{taskId}, + task_code = #{taskCode}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity = #{quantity}, + quantity_feedback = #{quantityFeedback}, + quantity_qualified = #{quantityQualified}, + quantity_unquanlified = #{quantityUnquanlified}, + quantity_uncheck = #{quantityUncheck}, + user_name = #{userName}, + nick_name = #{nickName}, + feedback_channel = #{feedbackChannel}, + feedback_time = #{feedbackTime}, + record_user = #{recordUser}, + record_nick = #{recordNick}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_feedback where record_id = #{recordId} + + + + delete from pro_feedback where record_id in + + #{recordId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProProcessContentMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProProcessContentMapper.xml new file mode 100644 index 0000000..164d5ff --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProProcessContentMapper.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select content_id, process_id, order_num, content_text, device, material, doc_url, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_process_content + + + + + + + + insert into pro_process_content + + process_id, + order_num, + content_text, + device, + material, + doc_url, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{processId}, + #{orderNum}, + #{contentText}, + #{device}, + #{material}, + #{docUrl}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_process_content + + process_id = #{processId}, + order_num = #{orderNum}, + content_text = #{contentText}, + device = #{device}, + material = #{material}, + doc_url = #{docUrl}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where content_id = #{contentId} + + + + delete from pro_process_content where content_id = #{contentId} + + + + delete from pro_process_content where content_id in + + #{contentId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProProcessMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProProcessMapper.xml new file mode 100644 index 0000000..b762d3e --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProProcessMapper.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + select process_id, process_code, process_name, attention, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_process + + + + + + + + + + + + insert into pro_process + + process_code, + process_name, + attention, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{processCode}, + #{processName}, + #{attention}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_process + + process_code = #{processCode}, + process_name = #{processName}, + attention = #{attention}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where process_id = #{processId} + + + + delete from pro_process where process_id = #{processId} + + + + delete from pro_process where process_id in + + #{processId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProRouteMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProRouteMapper.xml new file mode 100644 index 0000000..47f9c6a --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProRouteMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + select route_id, route_code, route_name, route_desc, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route + + + + + + + + + + + + insert into pro_route + + route_code, + route_name, + route_desc, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{routeCode}, + #{routeName}, + #{routeDesc}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_route + + route_code = #{routeCode}, + route_name = #{routeName}, + route_desc = #{routeDesc}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where route_id = #{routeId} + + + + delete from pro_route where route_id = #{routeId} + + + + delete from pro_route where route_id in + + #{routeId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProRouteProcessMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProRouteProcessMapper.xml new file mode 100644 index 0000000..d6e8411 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProRouteProcessMapper.xml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, route_id, process_id, process_code, process_name, order_num, next_process_id, next_process_code, next_process_name, link_type, default_pre_time, default_suf_time, color_code,key_flag,is_check, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route_process + + + + + + + + + + + + + + + + + + + insert into pro_route_process + + route_id, + process_id, + process_code, + process_name, + order_num, + next_process_id, + next_process_code, + next_process_name, + link_type, + default_pre_time, + default_suf_time, + color_code, + key_flag, + is_check, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{routeId}, + #{processId}, + #{processCode}, + #{processName}, + #{orderNum}, + #{nextProcessId}, + #{nextProcessCode}, + #{nextProcessName}, + #{linkType}, + #{defaultPreTime}, + #{defaultSufTime}, + #{colorCode}, + #{keyFlag}, + #{isCheck}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_route_process + + route_id = #{routeId}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + order_num = #{orderNum}, + next_process_id = #{nextProcessId}, + next_process_code = #{nextProcessCode}, + next_process_name = #{nextProcessName}, + link_type = #{linkType}, + default_pre_time = #{defaultPreTime}, + default_suf_time = #{defaultSufTime}, + key_flag = #{keyFlag}, + is_check = #{isCheck}, + color_code = #{colorCode}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_route_process where record_id = #{recordId} + + + + delete from pro_route_process where record_id in + + #{recordId} + + + + + delete from pro_route_process where route_id = #{routeId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProRouteProductBomMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProRouteProductBomMapper.xml new file mode 100644 index 0000000..d3a6fe9 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProRouteProductBomMapper.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, route_id, process_id, product_id, item_id, item_code, item_name, specification, unit_of_measure, quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route_product_bom + + + + + + + + + + insert into pro_route_product_bom + + route_id, + process_id, + product_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{routeId}, + #{processId}, + #{productId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_route_product_bom + + route_id = #{routeId}, + process_id = #{processId}, + product_id = #{productId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity = #{quantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_route_product_bom where record_id = #{recordId} + + + + delete from pro_route_product_bom where record_id in + + #{recordId} + + + + + delete from pro_route_product_bom where route_id = #{routeId} + + + + delete from pro_route_product_bom where route_id = #{routeId} and product_id = #{productId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProRouteProductMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProRouteProductMapper.xml new file mode 100644 index 0000000..16283b1 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProRouteProductMapper.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, route_id, item_id, item_code, item_name, specification, unit_of_measure, quantity, production_time, time_unit_type, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_route_product + + + + + + + + + + + insert into pro_route_product + + route_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity, + production_time, + time_unit_type, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{routeId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantity}, + #{productionTime}, + #{timeUnitType}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_route_product + + route_id = #{routeId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity = #{quantity}, + production_time = #{productionTime}, + time_unit_type = #{timeUnitType}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_route_product where record_id = #{recordId} + + + + delete from pro_route_product where record_id in + + #{recordId} + + + + + delete from pro_route_product where route_id = #{routeId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProTaskIssueMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProTaskIssueMapper.xml new file mode 100644 index 0000000..bda65bc --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProTaskIssueMapper.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, task_id, workorder_id, workstation_id, source_doc_id, source_doc_code, source_doc_type, batch_code, source_line_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_issued, quantity_available, quantity_used, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_task_issue + + + + + + + + + + insert into pro_task_issue + + task_id, + workorder_id, + workstation_id, + source_doc_id, + source_doc_code, + source_doc_type, + batch_code, + source_line_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_issued, + quantity_available, + quantity_used, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{taskId}, + #{workorderId}, + #{workstationId}, + #{sourceDocId}, + #{sourceDocCode}, + #{sourceDocType}, + #{batchCode}, + #{sourceLineId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityIssued}, + #{quantityAvailable}, + #{quantityUsed}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_task_issue + + task_id = #{taskId}, + workorder_id = #{workorderId}, + workstation_id = #{workstationId}, + source_doc_id = #{sourceDocId}, + source_doc_code = #{sourceDocCode}, + source_doc_type = #{sourceDocType}, + batch_code = #{batchCode}, + source_line_id = #{sourceLineId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_issued = #{quantityIssued}, + quantity_available = #{quantityAvailable}, + quantity_used = #{quantityUsed}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_task_issue where record_id = #{recordId} + + + + delete from pro_task_issue where record_id in + + #{recordId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProTaskMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProTaskMapper.xml new file mode 100644 index 0000000..ca1dc13 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProTaskMapper.xml @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select t.task_id, t.task_code, t.task_name, t.workorder_id, t.workorder_code, t.workorder_name, + t.workstation_id, t.workstation_code, t.workstation_name, + t.route_id, t.route_code, + t.process_id, t.process_code, t.process_name,p.is_check, + t.item_id, t.item_code, t.item_name, t.specification, t.unit_of_measure, + t.quantity, t.quantity_produced, t.quantity_changed, + t.client_id, t.client_code, t.client_name, t.client_nick, + t.start_time, t.duration, t.end_time, t.color_code, t.request_date, + t.remark, t.attr1, t.attr2, t.attr3, t.attr4, t.create_by, t.create_time, t.update_by, t.update_time, + t.status, t.quantity_quanlify, t.quantity_unquanlify + from pro_task t + left join pro_route_process p + on t.route_id = p.route_id and t.process_id = p.process_id + + + + + + + + + + insert into pro_task + + task_code, + task_name, + workorder_id, + workorder_code, + workorder_name, + workstation_id, + workstation_code, + workstation_name, + route_id, + route_code, + process_id, + process_code, + process_name, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity, + quantity_produced, + quantity_quanlify, + quantity_unquanlify, + quantity_changed, + client_id, + client_code, + client_name, + client_nick, + start_time, + duration, + end_time, + color_code, + request_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{taskCode}, + #{taskName}, + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{routeId}, + #{routeCode}, + #{processId}, + #{processCode}, + #{processName}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantity}, + #{quantityProduced}, + #{quantityQuanlify}, + #{quantityUnquanlify}, + #{quantityChanged}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{clientNick}, + #{startTime}, + #{duration}, + #{endTime}, + #{colorCode}, + #{requestDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_task + + task_code = #{taskCode}, + task_name = #{taskName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + route_id = #{routeId}, + route_code = #{routeCode}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity = #{quantity}, + quantity_produced = #{quantityProduced}, + quantity_quanlify = #{quantityQuanlify}, + quantity_unquanlify = #{quantityUnquanlify}, + quantity_changed = #{quantityChanged}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + client_nick = #{clientNick}, + start_time = #{startTime}, + duration = #{duration}, + end_time = #{endTime}, + color_code = #{colorCode}, + request_date = #{requestDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where task_id = #{taskId} + + + + delete from pro_task where task_id = #{taskId} + + + + delete from pro_task where task_id in + + #{taskId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProTransOrderMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProTransOrderMapper.xml new file mode 100644 index 0000000..f4ad787 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProTransOrderMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select trans_order_id, trans_order_code, task_id, task_code, workstation_id, workstation_code, workstation_name, process_id, process_code, process_name, workorder_id, workorder_code, workorder_name, batch_code, item_id, item_code, item_name, specification, unit_of_measure,barcode_url, quantity_transfered, produce_date, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_trans_order + + + + + + + + insert into pro_trans_order + + trans_order_code, + task_id, + task_code, + workstation_id, + workstation_code, + workstation_name, + process_id, + process_code, + process_name, + workorder_id, + workorder_code, + workorder_name, + batch_code, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + barcode_url, + quantity_transfered, + produce_date, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{transOrderCode}, + #{taskId}, + #{taskCode}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{processId}, + #{processCode}, + #{processName}, + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{batchCode}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{barCodeUrl}, + #{quantityTransfered}, + #{produceDate}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_trans_order + + trans_order_code = #{transOrderCode}, + task_id = #{taskId}, + task_code = #{taskCode}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + batch_code = #{batchCode}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + barcode_url = #{barCodeUrl}, + quantity_transfered = #{quantityTransfered}, + produce_date = #{produceDate}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where trans_order_id = #{transOrderId} + + + + delete from pro_trans_order where trans_order_id = #{transOrderId} + + + + delete from pro_trans_order where trans_order_id in + + #{transOrderId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProUserWorkstationMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProUserWorkstationMapper.xml new file mode 100644 index 0000000..339df00 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProUserWorkstationMapper.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, user_id, user_name, nick_name, workstation_id, workstation_code, workstation_name, operation_time, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_user_workstation + + + + + + + + insert into pro_user_workstation + + user_id, + user_name, + nick_name, + workstation_id, + workstation_code, + workstation_name, + operation_time, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{userId}, + #{userName}, + #{nickName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{operationTime}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_user_workstation + + user_id = #{userId}, + user_name = #{userName}, + nick_name = #{nickName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + operation_time = #{operationTime}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_user_workstation where record_id = #{recordId} + + + + delete from pro_user_workstation where record_id in + + #{recordId} + + + + + delete from pro_user_workstation where user_name = #{userName} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProWorkorderBomMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProWorkorderBomMapper.xml new file mode 100644 index 0000000..0ccd8a7 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProWorkorderBomMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, workorder_id, item_id, item_code, item_name, item_spc, unit_of_measure, item_or_product, quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_workorder_bom + + + + + + + + insert into pro_workorder_bom + + workorder_id, + item_id, + item_code, + item_name, + item_spc, + unit_of_measure, + item_or_product, + quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workorderId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{itemSpc}, + #{unitOfMeasure}, + #{itemOrProduct}, + #{quantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_workorder_bom + + workorder_id = #{workorderId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + item_spc = #{itemSpc}, + unit_of_measure = #{unitOfMeasure}, + item_or_product = #{itemOrProduct}, + quantity = #{quantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from pro_workorder_bom where line_id = #{lineId} + + + + delete from pro_workorder_bom where line_id in + + #{lineId} + + + + + delete from pro_workorder_bom where workorder_id = #{workorderId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProWorkorderMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProWorkorderMapper.xml new file mode 100644 index 0000000..c6405e5 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProWorkorderMapper.xml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select workorder_id, workorder_code, workorder_name, workorder_type, order_source, source_code, product_id, product_code, product_name, product_spc, unit_of_measure,batch_code, quantity,quantity_produced, client_id, client_code, client_name, vendor_id, vendor_code, vendor_name, request_date, parent_id, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_workorder + + + + + + + + + + insert into pro_workorder + + workorder_code, + workorder_name, + workorder_type, + order_source, + source_code, + product_id, + product_code, + product_name, + product_spc, + unit_of_measure, + batch_code, + quantity, + quantity_produced, + quantity_changed, + quantity_scheduled, + client_id, + client_code, + client_name, + vendor_id, + vendor_code, + vendor_name, + request_date, + finish_date, + parent_id, + ancestors, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workorderCode}, + #{workorderName}, + #{workorderType}, + #{orderSource}, + #{sourceCode}, + #{productId}, + #{productCode}, + #{productName}, + #{productSpc}, + #{unitOfMeasure}, + #{batchCode}, + #{quantity}, + #{quantityProduced}, + #{quantityChanged}, + #{quantityScheduled}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{requestDate}, + #{finishDate}, + #{parentId}, + #{ancestors}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_workorder + + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + workorder_type = #{workorderType}, + order_source = #{orderSource}, + source_code = #{sourceCode}, + product_id = #{productId}, + product_code = #{productCode}, + product_name = #{productName}, + product_spc = #{productSpc}, + unit_of_measure = #{unitOfMeasure}, + batch_code = #{batchCode}, + quantity = #{quantity}, + quantity_produced = #{quantityProduced}, + quantity_changed = #{quantityChanged}, + quantity_scheduled = #{quantityScheduled}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + request_date = #{requestDate}, + finish_date = #{finishDate}, + parent_id = #{parentId}, + ancestors = #{ancestors}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where workorder_id = #{workorderId} + + + + delete from pro_workorder where workorder_id = #{workorderId} + + + + delete from pro_workorder where workorder_id in + + #{workorderId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/pro/ProWorkrecordMapper.xml b/ktg-mes/src/main/resources/mapper/pro/ProWorkrecordMapper.xml new file mode 100644 index 0000000..0196735 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/pro/ProWorkrecordMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, user_id, user_name, nick_name, workstation_id, workstation_code, workstation_name, operation_flag, operation_time, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_workrecord + + + + + + + + insert into pro_workrecord + + user_id, + user_name, + nick_name, + workstation_id, + workstation_code, + workstation_name, + operation_flag, + operation_time, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{userId}, + #{userName}, + #{nickName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{operationFlag}, + #{operationTime}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update pro_workrecord + + user_id = #{userId}, + user_name = #{userName}, + nick_name = #{nickName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + operation_flag = #{operationFlag}, + operation_time = #{operationTime}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from pro_workrecord where record_id = #{recordId} + + + + delete from pro_workrecord where record_id in + + #{recordId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcDefectMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcDefectMapper.xml new file mode 100644 index 0000000..881b39c --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcDefectMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + select defect_id, defect_code, defect_name, index_type, defect_level, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_defect + + + + + + + + insert into qc_defect + + defect_code, + defect_name, + index_type, + defect_level, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{defectCode}, + #{defectName}, + #{indexType}, + #{defectLevel}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_defect + + defect_code = #{defectCode}, + defect_name = #{defectName}, + index_type = #{indexType}, + defect_level = #{defectLevel}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where defect_id = #{defectId} + + + + delete from qc_defect where defect_id = #{defectId} + + + + delete from qc_defect where defect_id in + + #{defectId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcDefectRecordMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcDefectRecordMapper.xml new file mode 100644 index 0000000..9a5d0f3 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcDefectRecordMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, qc_type, qc_id, line_id, defect_name, defect_level, defect_quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_defect_record + + + + + + + + insert into qc_defect_record + + qc_type, + qc_id, + line_id, + defect_name, + defect_level, + defect_quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{qcType}, + #{qcId}, + #{lineId}, + #{defectName}, + #{defectLevel}, + #{defectQuantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_defect_record + + qc_type = #{qcType}, + qc_id = #{qcId}, + line_id = #{lineId}, + defect_name = #{defectName}, + defect_level = #{defectLevel}, + defect_quantity = #{defectQuantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from qc_defect_record where record_id = #{recordId} + + + + delete from qc_defect_record where record_id in + + #{recordId} + + + + + delete from qc_defect_record where qc_id = #{qcId} and qc_type = #{qcType} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcIndexMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcIndexMapper.xml new file mode 100644 index 0000000..5f406e8 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcIndexMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + select index_id, index_code, index_name, index_type, qc_tool, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_index + + + + + + + + + + + + insert into qc_index + + index_code, + index_name, + index_type, + qc_tool, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{indexCode}, + #{indexName}, + #{indexType}, + #{qcTool}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_index + + index_code = #{indexCode}, + index_name = #{indexName}, + index_type = #{indexType}, + qc_tool = #{qcTool}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where index_id = #{indexId} + + + + delete from qc_index where index_id = #{indexId} + + + + delete from qc_index where index_id in + + #{indexId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcIpqcLineMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcIpqcLineMapper.xml new file mode 100644 index 0000000..c4db528 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcIpqcLineMapper.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, ipqc_id, index_id, index_code, index_name, index_type, qc_tool, check_method, stander_val, unit_of_measure, threshold_max, threshold_min, cr_quantity, maj_quantity, min_quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_ipqc_line + + + + + + + + insert into qc_ipqc_line + + ipqc_id, + index_id, + index_code, + index_name, + index_type, + qc_tool, + check_method, + stander_val, + unit_of_measure, + threshold_max, + threshold_min, + cr_quantity, + maj_quantity, + min_quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{ipqcId}, + #{indexId}, + #{indexCode}, + #{indexName}, + #{indexType}, + #{qcTool}, + #{checkMethod}, + #{standerVal}, + #{unitOfMeasure}, + #{thresholdMax}, + #{thresholdMin}, + #{crQuantity}, + #{majQuantity}, + #{minQuantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_ipqc_line + + ipqc_id = #{ipqcId}, + index_id = #{indexId}, + index_code = #{indexCode}, + index_name = #{indexName}, + index_type = #{indexType}, + qc_tool = #{qcTool}, + check_method = #{checkMethod}, + stander_val = #{standerVal}, + unit_of_measure = #{unitOfMeasure}, + threshold_max = #{thresholdMax}, + threshold_min = #{thresholdMin}, + cr_quantity = #{crQuantity}, + maj_quantity = #{majQuantity}, + min_quantity = #{minQuantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + UPDATE qc_ipqc_line a + INNER JOIN ( + SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity, + SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity, + SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity, + qid.`qc_id` as 'ipqc_id', + qid.`line_id` + FROM qc_defect_record qid + WHERE qid.qc_id = #{ipqcId} + AND qid.line_id = #{lineId} + and qid.qc_type = 'IPQC' + GROUP BY qid.qc_id,qid.line_id + )b + ON a.ipqc_id = b.ipqc_id AND a.line_id = b.line_id + SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity + WHERE a.ipqc_id = #{ipqcId} + AND a.line_id = #{lineId} + + + + delete from qc_ipqc_line where line_id = #{lineId} + + + + delete from qc_ipqc_line where line_id in + + #{lineId} + + + + + delete from qc_ipqc_line where ipqc_id = #{ipqcId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcIpqcMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcIpqcMapper.xml new file mode 100644 index 0000000..ee0b5aa --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcIpqcMapper.xml @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select ipqc_id, ipqc_code, ipqc_name, ipqc_type, template_id, source_doc_id,source_doc_type, source_doc_code, source_line_id, workorder_id, workorder_code, workorder_name, task_id, task_code, task_name, workstation_id, workstation_code, workstation_name, process_id, process_code, process_name, item_id, item_code, item_name, specification, unit_of_measure, quantity_check, quantity_unqualified, quantity_qualified, cr_rate, maj_rate, min_rate, cr_quantity, maj_quantity, min_quantity, check_result, inspect_date, inspector, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_ipqc + + + + + + + + + + + + + insert into qc_ipqc + + ipqc_code, + ipqc_name, + ipqc_type, + template_id, + source_doc_id, + source_doc_type, + source_doc_code, + source_line_id, + workorder_id, + workorder_code, + workorder_name, + task_id, + task_code, + task_name, + workstation_id, + workstation_code, + workstation_name, + process_id, + process_code, + process_name, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_check, + quantity_unqualified, + quantity_qualified, + cr_rate, + maj_rate, + min_rate, + cr_quantity, + maj_quantity, + min_quantity, + check_result, + inspect_date, + inspector, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{ipqcCode}, + #{ipqcName}, + #{ipqcType}, + #{templateId}, + #{sourceDocId}, + #{sourceDocType}, + #{sourceDocCode}, + #{sourceLineId}, + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{taskId}, + #{taskCode}, + #{taskName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{processId}, + #{processCode}, + #{processName}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityCheck}, + #{quantityUnqualified}, + #{quantityQualified}, + #{crRate}, + #{majRate}, + #{minRate}, + #{crQuantity}, + #{majQuantity}, + #{minQuantity}, + #{checkResult}, + #{inspectDate}, + #{inspector}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_ipqc + + ipqc_code = #{ipqcCode}, + ipqc_name = #{ipqcName}, + ipqc_type = #{ipqcType}, + template_id = #{templateId}, + source_doc_id = #{sourceDocId}, + source_doc_type = #{sourceDocType}, + source_doc_code = #{sourceDocCode}, + source_line_id = #{sourceLineId}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + task_id = #{taskId}, + task_code = #{taskCode}, + task_name = #{taskName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_check = #{quantityCheck}, + quantity_unqualified = #{quantityUnqualified}, + quantity_qualified = #{quantityQualified}, + cr_rate = #{crRate}, + maj_rate = #{majRate}, + min_rate = #{minRate}, + cr_quantity = #{crQuantity}, + maj_quantity = #{majQuantity}, + min_quantity = #{minQuantity}, + check_result = #{checkResult}, + inspect_date = #{inspectDate}, + inspector = #{inspector}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where ipqc_id = #{ipqcId} + + + + UPDATE qc_ipqc a + INNER JOIN ( + SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity, + SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity, + SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity, + qid.`qc_id` as 'ipqc_id' + FROM qc_defect_record qid + WHERE qid.qc_id = #{ipqcId} + and qid.qc_type = 'IPQC' + GROUP BY qid.qc_id + ) b + ON a.`ipqc_id` = b.ipqc_id + SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity, + a.`cr_rate`= ROUND(b.cr_quantity/a.`quantity_check`*100,2), + a.`maj_rate`= ROUND(b.maj_quantity/a.`quantity_check`*100,2), + a.`min_rate`= ROUND(b.min_quantity/a.`quantity_check`*100,2) + WHERE a.ipqc_id = #{ipqcId} + + + + delete from qc_ipqc where ipqc_id = #{ipqcId} + + + + delete from qc_ipqc where ipqc_id in + + #{ipqcId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcIqcLineMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcIqcLineMapper.xml new file mode 100644 index 0000000..685d4c5 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcIqcLineMapper.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, iqc_id, index_id, index_code, index_name, index_type, qc_tool, check_method, stander_val, unit_of_measure, threshold_max, threshold_min, cr_quantity, maj_quantity, min_quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_iqc_line + + + + + + + + insert into qc_iqc_line + + iqc_id, + index_id, + index_code, + index_name, + index_type, + qc_tool, + check_method, + stander_val, + unit_of_measure, + threshold_max, + threshold_min, + cr_quantity, + maj_quantity, + min_quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{iqcId}, + #{indexId}, + #{indexCode}, + #{indexName}, + #{indexType}, + #{qcTool}, + #{checkMethod}, + #{standerVal}, + #{unitOfMeasure}, + #{thresholdMax}, + #{thresholdMin}, + #{crQuantity}, + #{majQuantity}, + #{minQuantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + + UPDATE qc_iqc_line a + INNER JOIN ( + SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity, + SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity, + SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity, + qid.`qc_id` as 'iqc_id', + qid.`line_id` + FROM qc_defect_record qid + WHERE qid.qc_id = #{iqcId} + AND qid.line_id = #{lineId} + AND qid.qc_type = 'IQC' + GROUP BY qid.qc_id,qid.line_id + )b + ON a.iqc_id = b.iqc_id AND a.line_id = b.line_id + SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity + WHERE a.iqc_id = #{iqcId} + AND a.line_id = #{lineId} + + + + update qc_iqc_line + + iqc_id = #{iqcId}, + index_id = #{indexId}, + index_code = #{indexCode}, + index_name = #{indexName}, + index_type = #{indexType}, + qc_tool = #{qcTool}, + check_method = #{checkMethod}, + stander_val = #{standerVal}, + unit_of_measure = #{unitOfMeasure}, + threshold_max = #{thresholdMax}, + threshold_min = #{thresholdMin}, + cr_quantity = #{crQuantity}, + maj_quantity = #{majQuantity}, + min_quantity = #{minQuantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from qc_iqc_line where line_id = #{lineId} + + + + delete from qc_iqc_line where iqc_id =#{iqcId} + + + + delete from qc_iqc_line where line_id in + + #{lineId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcIqcMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcIqcMapper.xml new file mode 100644 index 0000000..1573106 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcIqcMapper.xml @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select iqc_id, iqc_code, iqc_name, template_id, source_doc_id,source_doc_type, source_doc_code, source_line_id, vendor_id, vendor_code, vendor_name, vendor_nick, vendor_batch, item_id, item_code, item_name, specification, unit_of_measure, quantity_min_check, quantity_max_unqualified, quantity_recived, quantity_check, quantity_unqualified, cr_rate, maj_rate, min_rate, cr_quantity, maj_quantity, min_quantity, check_result, recive_date, inspect_date, inspector,u.nick_name as inspector_name, q.status, q.remark, attr1, attr2, attr3, attr4, q.create_by, q.create_time, q.update_by, q.update_time from qc_iqc q left join sys_user u on u.user_name = q.inspector + + + + + + + + + + insert into qc_iqc + + iqc_code, + iqc_name, + template_id, + source_doc_id, + source_doc_type, + source_doc_code, + source_line_id, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + vendor_batch, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_min_check, + quantity_max_unqualified, + quantity_recived, + quantity_check, + quantity_unqualified, + cr_rate, + maj_rate, + min_rate, + cr_quantity, + maj_quantity, + min_quantity, + check_result, + recive_date, + inspect_date, + inspector, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{iqcCode}, + #{iqcName}, + #{templateId}, + #{sourceDocId}, + #{sourceDocType}, + #{sourceDocCode}, + #{sourceLineId}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{vendorBatch}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityMinCheck}, + #{quantityMaxUnqualified}, + #{quantityRecived}, + #{quantityCheck}, + #{quantityUnqualified}, + #{crRate}, + #{majRate}, + #{minRate}, + #{crQuantity}, + #{majQuantity}, + #{minQuantity}, + #{checkResult}, + #{reciveDate}, + #{inspectDate}, + #{inspector}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + UPDATE qc_iqc a + INNER JOIN ( + SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity, + SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity, + SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity, + qid.`qc_id` as 'iqc_id' + FROM qc_defect_record qid + WHERE qid.qc_id = #{iqcId} + and qc_type = 'IQC' + GROUP BY qid.qc_id + ) b + ON a.`iqc_id` = b.iqc_id + SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity, + a.`cr_rate`= ROUND(b.cr_quantity/a.`quantity_check`*100,2), + a.`maj_rate`= ROUND(b.maj_quantity/a.`quantity_check`*100,2), + a.`min_rate`= ROUND(b.min_quantity/a.`quantity_check`*100,2) + WHERE a.iqc_id = #{iqcId} + + + + + update qc_iqc + + iqc_code = #{iqcCode}, + iqc_name = #{iqcName}, + template_id = #{templateId}, + source_doc_id = #{sourceDocId}, + source_doc_type = #{sourceDocType}, + source_doc_code = #{sourceDocCode}, + source_line_id = #{sourceLineId}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + vendor_batch = #{vendorBatch}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_min_check = #{quantityMinCheck}, + quantity_max_unqualified = #{quantityMaxUnqualified}, + quantity_recived = #{quantityRecived}, + quantity_check = #{quantityCheck}, + quantity_unqualified = #{quantityUnqualified}, + cr_rate = #{crRate}, + maj_rate = #{majRate}, + min_rate = #{minRate}, + cr_quantity = #{crQuantity}, + maj_quantity = #{majQuantity}, + min_quantity = #{minQuantity}, + check_result = #{checkResult}, + recive_date = #{reciveDate}, + inspect_date = #{inspectDate}, + inspector = #{inspector}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where iqc_id = #{iqcId} + + + + delete from qc_iqc where iqc_id = #{iqcId} + + + + delete from qc_iqc where iqc_id in + + #{iqcId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcOqcLineMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcOqcLineMapper.xml new file mode 100644 index 0000000..dd34552 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcOqcLineMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, oqc_id, index_id, index_code, index_name, index_type, qc_tool, check_method, stander_val, unit_of_measure, threshold_max, threshold_min, cr_quantity, maj_quantity, min_quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_oqc_line + + + + + + + + insert into qc_oqc_line + + oqc_id, + index_id, + index_code, + index_name, + index_type, + qc_tool, + check_method, + stander_val, + unit_of_measure, + threshold_max, + threshold_min, + cr_quantity, + maj_quantity, + min_quantity, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{oqcId}, + #{indexId}, + #{indexCode}, + #{indexName}, + #{indexType}, + #{qcTool}, + #{checkMethod}, + #{standerVal}, + #{unitOfMeasure}, + #{thresholdMax}, + #{thresholdMin}, + #{crQuantity}, + #{majQuantity}, + #{minQuantity}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_oqc_line + + oqc_id = #{oqcId}, + index_id = #{indexId}, + index_code = #{indexCode}, + index_name = #{indexName}, + index_type = #{indexType}, + qc_tool = #{qcTool}, + check_method = #{checkMethod}, + stander_val = #{standerVal}, + unit_of_measure = #{unitOfMeasure}, + threshold_max = #{thresholdMax}, + threshold_min = #{thresholdMin}, + cr_quantity = #{crQuantity}, + maj_quantity = #{majQuantity}, + min_quantity = #{minQuantity}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + UPDATE qc_oqc_line a + INNER JOIN ( + SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity, + SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity, + SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity, + qid.`qc_id` as 'oqc_id', + qid.`line_id` + FROM qc_defect_record qid + WHERE qid.qc_id = #{oqcId} + AND qid.line_id = #{lineId} + AND qid.qc_type = 'OQC' + GROUP BY qid.qc_id,qid.line_id + )b + ON a.oqc_id = b.oqc_id AND a.line_id = b.line_id + SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity + WHERE a.oqc_id = #{oqcId} + AND a.line_id = #{lineId} + + + + delete from qc_oqc_line where line_id = #{lineId} + + + + delete from qc_oqc_line where line_id in + + #{lineId} + + + + + delete from qc_oqc_line where oqc_id = #{oqcId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcOqcMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcOqcMapper.xml new file mode 100644 index 0000000..4493653 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcOqcMapper.xml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select oqc_id, oqc_code, oqc_name, template_id, source_doc_id,source_doc_type, source_doc_code, source_line_id, client_id, client_code, client_name, batch_code, item_id, item_code, item_name, specification, unit_of_measure, quantity_min_check, quantity_max_unqualified, quantity_out, quantity_check, quantity_unqualified, quantity_quanlified, cr_rate, maj_rate, min_rate, cr_quantity, maj_quantity, min_quantity, check_result, out_date, inspect_date, inspector, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_oqc + + + + + + + + + + insert into qc_oqc + + oqc_code, + oqc_name, + template_id, + source_doc_id, + source_doc_type, + source_doc_code, + source_line_id, + client_id, + client_code, + client_name, + batch_code, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_min_check, + quantity_max_unqualified, + quantity_out, + quantity_check, + quantity_unqualified, + quantity_quanlified, + cr_rate, + maj_rate, + min_rate, + cr_quantity, + maj_quantity, + min_quantity, + check_result, + out_date, + inspect_date, + inspector, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{oqcCode}, + #{oqcName}, + #{templateId}, + #{sourceDocId}, + #{sourceDocType}, + #{sourceDocCode}, + #{sourceLineId}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{batchCode}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityMinCheck}, + #{quantityMaxUnqualified}, + #{quantityOut}, + #{quantityCheck}, + #{quantityUnqualified}, + #{quantityQuanlified}, + #{crRate}, + #{majRate}, + #{minRate}, + #{crQuantity}, + #{majQuantity}, + #{minQuantity}, + #{checkResult}, + #{outDate}, + #{inspectDate}, + #{inspector}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_oqc + + oqc_code = #{oqcCode}, + oqc_name = #{oqcName}, + template_id = #{templateId}, + source_doc_id = #{sourceDocId}, + source_doc_type = #{sourceDocType}, + source_doc_code = #{sourceDocCode}, + source_line_id = #{sourceLineId}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + batch_code = #{batchCode}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_min_check = #{quantityMinCheck}, + quantity_max_unqualified = #{quantityMaxUnqualified}, + quantity_out = #{quantityOut}, + quantity_check = #{quantityCheck}, + quantity_unqualified = #{quantityUnqualified}, + quantity_quanlified = #{quantityQuanlified}, + cr_rate = #{crRate}, + maj_rate = #{majRate}, + min_rate = #{minRate}, + cr_quantity = #{crQuantity}, + maj_quantity = #{majQuantity}, + min_quantity = #{minQuantity}, + check_result = #{checkResult}, + out_date = #{outDate}, + inspect_date = #{inspectDate}, + inspector = #{inspector}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where oqc_id = #{oqcId} + + + + + UPDATE qc_oqc a + INNER JOIN ( + SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity, + SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity, + SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity, + qid.`qc_id` as 'oqc_id' + FROM qc_defect_record qid + WHERE qid.qc_id = #{oqcId} + and qc_type = 'OQC' + GROUP BY qid.qc_id + ) b + ON a.`oqc_id` = b.oqc_id + SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity, + a.`cr_rate`= ROUND(b.cr_quantity/a.`quantity_check`*100,2), + a.`maj_rate`= ROUND(b.maj_quantity/a.`quantity_check`*100,2), + a.`min_rate`= ROUND(b.min_quantity/a.`quantity_check`*100,2) + WHERE a.oqc_id = #{oqcId} + + + + delete from qc_oqc where oqc_id = #{oqcId} + + + + delete from qc_oqc where oqc_id in + + #{oqcId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcPendingInspectMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcPendingInspectMapper.xml new file mode 100644 index 0000000..8cd26b4 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcPendingInspectMapper.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcTemplateIndexMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcTemplateIndexMapper.xml new file mode 100644 index 0000000..0c79b06 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcTemplateIndexMapper.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, template_id, index_id, index_code, index_name, index_type, qc_tool, check_method, stander_val, unit_of_measure, threshold_max, threshold_min, doc_url, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_template_index + + + + + + + + insert into qc_template_index + + template_id, + index_id, + index_code, + index_name, + index_type, + qc_tool, + check_method, + stander_val, + unit_of_measure, + threshold_max, + threshold_min, + doc_url, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{templateId}, + #{indexId}, + #{indexCode}, + #{indexName}, + #{indexType}, + #{qcTool}, + #{checkMethod}, + #{standerVal}, + #{unitOfMeasure}, + #{thresholdMax}, + #{thresholdMin}, + #{docUrl}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_template_index + + template_id = #{templateId}, + index_id = #{indexId}, + index_code = #{indexCode}, + index_name = #{indexName}, + index_type = #{indexType}, + qc_tool = #{qcTool}, + check_method = #{checkMethod}, + stander_val = #{standerVal}, + unit_of_measure = #{unitOfMeasure}, + threshold_max = #{thresholdMax}, + threshold_min = #{thresholdMin}, + doc_url = #{docUrl}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from qc_template_index where record_id = #{recordId} + + + + delete from qc_template_index where record_id in + + #{recordId} + + + + + delete from qc_template_index where template_id = #{templateId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml new file mode 100644 index 0000000..7c53bc2 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + select template_id, template_code, template_name, qc_types, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_template + + + + + + + + + + + + + + insert into qc_template + + template_code, + template_name, + qc_types, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{templateCode}, + #{templateName}, + #{qcTypes}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_template + + template_code = #{templateCode}, + template_name = #{templateName}, + qc_types = #{qcTypes}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where template_id = #{templateId} + + + + delete from qc_template where template_id = #{templateId} + + + + delete from qc_template where template_id in + + #{templateId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml new file mode 100644 index 0000000..5550a21 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, template_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_check, quantity_unqualified, cr_rate, maj_rate, min_rate, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_template_product + + + + + + + + + + insert into qc_template_product + + template_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_check, + quantity_unqualified, + cr_rate, + maj_rate, + min_rate, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{templateId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityCheck}, + #{quantityUnqualified}, + #{crRate}, + #{majRate}, + #{minRate}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_template_product + + template_id = #{templateId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_check = #{quantityCheck}, + quantity_unqualified = #{quantityUnqualified}, + cr_rate = #{crRate}, + maj_rate = #{majRate}, + min_rate = #{minRate}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from qc_template_product where record_id = #{recordId} + + + + delete from qc_template_product where record_id in + + #{recordId} + + + + + delete from qc_template_product where template_id = #{templateId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/report/UreportFileMapper.xml b/ktg-mes/src/main/resources/mapper/report/UreportFileMapper.xml new file mode 100644 index 0000000..05a35d8 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/report/UreportFileMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + delete from ureport_file_tbl where name_ = #{name} + + + + insert into ureport_file_tbl (name_, content_, create_time_, update_time_) values + (#{name}, #{content}, #{createTime}, #{updateTime}) + + + + + update ureport_file_tbl set + name_ = #{name} , + content_ = #{content}, + create_time_ = #{createTime}, + update_time_ = #{updateTime} + where id_ = #{id} + + + diff --git a/ktg-mes/src/main/resources/mapper/report/UreportFileTblMapper.xml b/ktg-mes/src/main/resources/mapper/report/UreportFileTblMapper.xml new file mode 100644 index 0000000..f683e5a --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/report/UreportFileTblMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select id_, name_, content_, create_time_, update_time_ from ureport_file_tbl + + + + + + + + insert into ureport_file_tbl + + name_, + content_, + create_time_, + update_time_, + + + #{name}, + #{content}, + #{createTime}, + #{updateTime}, + + + + + update ureport_file_tbl + + name_ = #{name}, + content_ = #{content}, + create_time_ = #{createTime}, + update_time_ = #{updateTime}, + + where id_ = #{id} + + + + delete from ureport_file_tbl where id_ = #{id} + + + + delete from ureport_file_tbl where id_ in + + #{id} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml b/ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml new file mode 100644 index 0000000..4a33eb9 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select tool_id, tool_code, tool_name, brand, spec, tool_type_id, tool_type_code, tool_type_name, code_flag, quantity, quantity_avail, mainten_type, next_mainten_period, next_mainten_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from tm_tool + + + + + + + + + + insert into tm_tool + + tool_code, + tool_name, + brand, + spec, + tool_type_id, + tool_type_code, + tool_type_name, + code_flag, + quantity, + quantity_avail, + mainten_type, + next_mainten_period, + next_mainten_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{toolCode}, + #{toolName}, + #{brand}, + #{spec}, + #{toolTypeId}, + #{toolTypeCode}, + #{toolTypeName}, + #{codeFlag}, + #{quantity}, + #{quantityAvail}, + #{maintenType}, + #{nextMaintenPeriod}, + #{nextMaintenDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update tm_tool + + tool_code = #{toolCode}, + tool_name = #{toolName}, + brand = #{brand}, + spec = #{spec}, + tool_type_id = #{toolTypeId}, + tool_type_code = #{toolTypeCode}, + tool_type_name = #{toolTypeName}, + code_flag = #{codeFlag}, + quantity = #{quantity}, + quantity_avail = #{quantityAvail}, + mainten_type = #{maintenType}, + next_mainten_period = #{nextMaintenPeriod}, + next_mainten_date = #{nextMaintenDate}, + next_mainten_period = null, + next_mainten_date = null, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where tool_id = #{toolId} + + + + delete from tm_tool where tool_id = #{toolId} + + + + delete from tm_tool where tool_id in + + #{toolId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/tm/TmToolTypeMapper.xml b/ktg-mes/src/main/resources/mapper/tm/TmToolTypeMapper.xml new file mode 100644 index 0000000..bd00320 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/tm/TmToolTypeMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select tool_type_id, tool_type_code, tool_type_name, code_flag, mainten_type, mainten_period, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from tm_tool_type + + + + + + + + + + + + insert into tm_tool_type + + tool_type_code, + tool_type_name, + code_flag, + mainten_type, + mainten_period, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{toolTypeCode}, + #{toolTypeName}, + #{codeFlag}, + #{maintenType}, + #{maintenPeriod}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update tm_tool_type + + tool_type_code = #{toolTypeCode}, + tool_type_name = #{toolTypeName}, + code_flag = #{codeFlag}, + mainten_type = #{maintenType}, + mainten_period = #{maintenPeriod}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where tool_type_id = #{toolTypeId} + + + + delete from tm_tool_type where tool_type_id = #{toolTypeId} + + + + delete from tm_tool_type where tool_type_id in + + #{toolTypeId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmBarcodeConfigMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmBarcodeConfigMapper.xml new file mode 100644 index 0000000..a12ec09 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmBarcodeConfigMapper.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select config_id, barcode_formart, barcode_type, content_formart, content_example, auto_gen_flag,default_template, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_barcode_config + + + + + + + + insert into wm_barcode_config + + barcode_formart, + barcode_type, + content_formart, + content_example, + auto_gen_flag, + default_template, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{barcodeFormart}, + #{barcodeType}, + #{contentFormart}, + #{contentExample}, + #{autoGenFlag}, + #{defaultTemplate}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_barcode_config + + barcode_formart = #{barcodeFormart}, + barcode_type = #{barcodeType}, + content_formart = #{contentFormart}, + content_example = #{contentExample}, + auto_gen_flag = #{autoGenFlag}, + default_template = #{defaultTemplate}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where config_id = #{configId} + + + + delete from wm_barcode_config where config_id = #{configId} + + + + delete from wm_barcode_config where config_id in + + #{configId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmBarcodeMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmBarcodeMapper.xml new file mode 100644 index 0000000..249ac4d --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmBarcodeMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select barcode_id, barcode_formart, barcode_type, barcode_content,bussiness_id,bussiness_code,bussiness_name, barcode_url, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_barcode + + + + + + + + + + insert into wm_barcode + + barcode_formart, + barcode_type, + barcode_content, + bussiness_id, + bussiness_code, + bussiness_name, + barcode_url, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{barcodeFormart}, + #{barcodeType}, + #{barcodeContent}, + #{bussinessId}, + #{bussinessCode}, + #{bussinessName}, + #{barcodeUrl}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_barcode + + barcode_formart = #{barcodeFormart}, + barcode_type = #{barcodeType}, + barcode_content = #{barcodeContent}, + bussiness_id = #{bussinessId}, + bussiness_code = #{bussinessCode}, + bussiness_name = #{bussinessName}, + barcode_url = #{barcodeUrl}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where barcode_id = #{barcodeId} + + + + delete from wm_barcode where barcode_id = #{barcodeId} + + + + delete from wm_barcode where barcode_id in + + #{barcodeId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmIssueHeaderMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmIssueHeaderMapper.xml new file mode 100644 index 0000000..5628c90 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmIssueHeaderMapper.xml @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select issue_id, issue_code, issue_name, workstation_id, workstation_code,workstation_name, workorder_id, workorder_code, task_id, task_code, client_id, client_code, client_name, client_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, issue_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_issue_header + + + + + + + + + + + + insert into wm_issue_header + + issue_code, + issue_name, + workstation_id, + workstation_code, + workstation_name, + workorder_id, + workorder_code, + task_id, + task_code, + client_id, + client_code, + client_name, + client_nick, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + issue_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{issueCode}, + #{issueName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{workorderId}, + #{workorderCode}, + #{taskId}, + #{taskCode}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{clientNick}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{issueDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_issue_header + + issue_code = #{issueCode}, + issue_name = #{issueName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + task_id = #{taskId}, + task_code = #{taskCode}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + client_nick = #{clientNick}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + issue_date = #{issueDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where issue_id = #{issueId} + + + + delete from wm_issue_header where issue_id = #{issueId} + + + + delete from wm_issue_header where issue_id in + + #{issueId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmIssueLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmIssueLineMapper.xml new file mode 100644 index 0000000..9c5462f --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmIssueLineMapper.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, issue_id,material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_issued, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_issue_line + + + + + + + + insert into wm_issue_line + + issue_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_issued, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{issueId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityIssued}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_issue_line + + issue_id = #{issueId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_issued = #{quantityIssued}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_issue_line where line_id = #{lineId} + + + + delete from wm_issue_line where line_id in + + #{lineId} + + + + + delete from wm_issue_line where issue_id = #{issueId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmItemConsumeLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmItemConsumeLineMapper.xml new file mode 100644 index 0000000..aa8c420 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmItemConsumeLineMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, record_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_consume, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_item_consume_line + + + + + + + + insert into wm_item_consume_line + + record_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_consume, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recordId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityConsume}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_item_consume_line + + record_id = #{recordId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_consume = #{quantityConsume}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_item_consume_line where line_id = #{lineId} + + + + delete from wm_item_consume_line where line_id in + + #{lineId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmItemConsumeMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmItemConsumeMapper.xml new file mode 100644 index 0000000..5f2520e --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmItemConsumeMapper.xml @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, workorder_id, workorder_code, workorder_name, task_id, task_code, task_name, workstation_id, workstation_code, workstation_name, process_id, process_code, process_name, consume_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_item_consume + + + + + + + + + + insert into wm_item_consume + + workorder_id, + workorder_code, + workorder_name, + task_id, + task_code, + task_name, + workstation_id, + workstation_code, + workstation_name, + process_id, + process_code, + process_name, + consume_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{taskId}, + #{taskCode}, + #{taskName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{processId}, + #{processCode}, + #{processName}, + #{consumeDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_item_consume + + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + task_id = #{taskId}, + task_code = #{taskCode}, + task_name = #{taskName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + consume_date = #{consumeDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from wm_item_consume where record_id = #{recordId} + + + + delete from wm_item_consume where record_id in + + #{recordId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmItemRecptLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmItemRecptLineMapper.xml new file mode 100644 index 0000000..eb5d9df --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmItemRecptLineMapper.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, recpt_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_recived, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, expire_date,iqc_check,iqc_id,iqc_code, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_item_recpt_line + + + + + + + + insert into wm_item_recpt_line + + recpt_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_recived, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + expire_date, + iqc_check, + iqc_id, + iqc_code, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recptId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityRecived}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{expireDate}, + #{iqcCheck}, + #{iqcId}, + #{iqcCode}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_item_recpt_line + + recpt_id = #{recptId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_recived = #{quantityRecived}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + expire_date = #{expireDate}, + iqc_check = #{iqcCheck}, + iqc_id = #{iqcId}, + iqc_code = #{iqcCode}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_item_recpt_line where line_id = #{lineId} + + + + delete from wm_item_recpt_line where line_id in + + #{lineId} + + + + + delete from wm_item_recpt_line where recpt_id = #{recptId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmItemRecptMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmItemRecptMapper.xml new file mode 100644 index 0000000..36329b6 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmItemRecptMapper.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select recpt_id, recpt_code, recpt_name, iqc_id, iqc_code, po_code, vendor_id, vendor_code, vendor_name, vendor_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, recpt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_item_recpt + + + + + + + + + + + + + + insert into wm_item_recpt + + recpt_code, + recpt_name, + iqc_id, + iqc_code, + po_code, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + recpt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recptCode}, + #{recptName}, + #{iqcId}, + #{iqcCode}, + #{poCode}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{recptDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_item_recpt + + recpt_code = #{recptCode}, + recpt_name = #{recptName}, + iqc_id = #{iqcId}, + iqc_code = #{iqcCode}, + po_code = #{poCode}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + recpt_date = #{recptDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where recpt_id = #{recptId} + + + + delete from wm_item_recpt where recpt_id = #{recptId} + + + + delete from wm_item_recpt where recpt_id in + + #{recptId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmMaterialStockMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmMaterialStockMapper.xml new file mode 100644 index 0000000..81bbe39 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmMaterialStockMapper.xml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select material_stock_id, item_type_id, item_id, item_code, item_name, specification, unit_of_measure, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, vendor_id, vendor_code, vendor_name, vendor_nick, quantity_onhand,recpt_date,workorder_id,workorder_code, expire_date, production_date,frozen_flag, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_material_stock + + + + + + + + + + + + + insert into wm_material_stock + + item_type_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + quantity_onhand, + recpt_date, + workorder_id, + workorder_code, + expire_date, + production_date, + frozen_flag, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{itemTypeId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{quantityOnhand}, + #{recptDate}, + #{workorderId}, + #{workorderCode}, + #{expireDate}, + #{productionDate}, + #{frozenFlag}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_material_stock + + item_type_id = #{itemTypeId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + quantity_onhand = #{quantityOnhand}, + recpt_date = #{recptDate}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + expire_date = #{expireDate}, + production_date = #{productionDate}, + frozen_flag = #{frozenFlag}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where material_stock_id = #{materialStockId} + + + + delete from wm_material_stock where material_stock_id = #{materialStockId} + + + + delete from wm_material_stock where material_stock_id in + + #{materialStockId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmOutsourceIssueLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceIssueLineMapper.xml new file mode 100644 index 0000000..84b7322 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceIssueLineMapper.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, issue_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_issued, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_outsource_issue_line + + + + + + + + + + insert into wm_outsource_issue_line + + issue_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_issued, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{issueId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityIssued}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_outsource_issue_line + + issue_id = #{issueId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_issued = #{quantityIssued}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_outsource_issue_line where line_id = #{lineId} + + + + delete from wm_outsource_issue_line where issue_id = #{issueId} + + + + delete from wm_outsource_issue_line where line_id in + + #{lineId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmOutsourceIssueMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceIssueMapper.xml new file mode 100644 index 0000000..b490b04 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceIssueMapper.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select issue_id, issue_code, issue_name, workorder_id, workorder_code, vendor_id, vendor_code, vendor_name, vendor_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, issue_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_outsource_issue + + + + + + + + + + insert into wm_outsource_issue + + issue_code, + issue_name, + workorder_id, + workorder_code, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + issue_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{issueCode}, + #{issueName}, + #{workorderId}, + #{workorderCode}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{issueDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_outsource_issue + + issue_code = #{issueCode}, + issue_name = #{issueName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + issue_date = #{issueDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where issue_id = #{issueId} + + + + delete from wm_outsource_issue where issue_id = #{issueId} + + + + delete from wm_outsource_issue where issue_id in + + #{issueId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmOutsourceRecptLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceRecptLineMapper.xml new file mode 100644 index 0000000..54d68a8 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceRecptLineMapper.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, recpt_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_recived, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, expire_date, iqc_check, iqc_id, iqc_code, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_outsource_recpt_line + + + + + + + + + + insert into wm_outsource_recpt_line + + recpt_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_recived, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + expire_date, + iqc_check, + iqc_id, + iqc_code, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recptId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityRecived}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{expireDate}, + #{iqcCheck}, + #{iqcId}, + #{iqcCode}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_outsource_recpt_line + + recpt_id = #{recptId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_recived = #{quantityRecived}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + expire_date = #{expireDate}, + iqc_check = #{iqcCheck}, + iqc_id = #{iqcId}, + iqc_code = #{iqcCode}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_outsource_recpt_line where line_id = #{lineId} + + + + delete from wm_outsource_recpt_line where recpt_id = #{recptId} + + + + delete from wm_outsource_recpt_line where line_id in + + #{lineId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmOutsourceRecptMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceRecptMapper.xml new file mode 100644 index 0000000..48b97ef --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmOutsourceRecptMapper.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select recpt_id, recpt_code, recpt_name, iqc_id, iqc_code, workorder_id, workorder_code, vendor_id, vendor_code, vendor_name, vendor_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, recpt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_outsource_recpt + + + + + + + + + + insert into wm_outsource_recpt + + recpt_code, + recpt_name, + iqc_id, + iqc_code, + workorder_id, + workorder_code, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + recpt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recptCode}, + #{recptName}, + #{iqcId}, + #{iqcCode}, + #{workorderId}, + #{workorderCode}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{recptDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_outsource_recpt + + recpt_code = #{recptCode}, + recpt_name = #{recptName}, + iqc_id = #{iqcId}, + iqc_code = #{iqcCode}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + recpt_date = #{recptDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where recpt_id = #{recptId} + + + + delete from wm_outsource_recpt where recpt_id = #{recptId} + + + + delete from wm_outsource_recpt where recpt_id in + + #{recptId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmPackageLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmPackageLineMapper.xml new file mode 100644 index 0000000..2618e0b --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmPackageLineMapper.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, package_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_package, workorder_id, workorder_code, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, expire_date, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_package_line + + + + + + + + insert into wm_package_line + + package_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_package, + workorder_id, + workorder_code, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + expire_date, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{packageId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityPackage}, + #{workorderId}, + #{workorderCode}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{expireDate}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_package_line + + package_id = #{packageId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_package = #{quantityPackage}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + expire_date = #{expireDate}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_package_line where line_id = #{lineId} + + + + delete from wm_package_line where line_id in + + #{lineId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmPackageMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmPackageMapper.xml new file mode 100644 index 0000000..d761e6f --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmPackageMapper.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select package_id, parent_id, ancestors, package_code, barcode_id, barcode_content, barcode_url, package_date, so_code, invoice_code, client_id, client_code, client_name, client_nick, package_length, package_width, package_height, size_unit, net_weight, cross_weight, weight_unit, inspector, inspector_name, enable_flag, status,remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_package + + + + + + + + + + insert into wm_package + + parent_id, + ancestors, + package_code, + barcode_id, + barcode_content, + barcode_url, + package_date, + so_code, + invoice_code, + client_id, + client_code, + client_name, + client_nick, + package_length, + package_width, + package_height, + size_unit, + net_weight, + cross_weight, + weight_unit, + inspector, + inspector_name, + enable_flag, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{parentId}, + #{ancestors}, + #{packageCode}, + #{barcodeId}, + #{barcodeContent}, + #{barcodeUrl}, + #{packageDate}, + #{soCode}, + #{invoiceCode}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{clientNick}, + #{packageLength}, + #{packageWidth}, + #{packageHeight}, + #{sizeUnit}, + #{netWeight}, + #{crossWeight}, + #{weightUnit}, + #{inspector}, + #{inspectorName}, + #{enableFlag}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_package + + parent_id = #{parentId}, + ancestors = #{ancestors}, + package_code = #{packageCode}, + barcode_id = #{barcodeId}, + barcode_content = #{barcodeContent}, + barcode_url = #{barcodeUrl}, + package_date = #{packageDate}, + so_code = #{soCode}, + invoice_code = #{invoiceCode}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + client_nick = #{clientNick}, + package_length = #{packageLength}, + package_width = #{packageWidth}, + package_height = #{packageHeight}, + size_unit = #{sizeUnit}, + net_weight = #{netWeight}, + cross_weight = #{crossWeight}, + weight_unit = #{weightUnit}, + inspector = #{inspector}, + inspector_name = #{inspectorName}, + enable_flag = #{enableFlag}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where package_id = #{packageId} + + + + delete from wm_package where package_id = #{packageId} + + + + delete from wm_package where package_id in + + #{packageId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmProductProduceLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmProductProduceLineMapper.xml new file mode 100644 index 0000000..2393f47 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmProductProduceLineMapper.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, record_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_produce, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_produce_line + + + + + + + + insert into wm_product_produce_line + + record_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_produce, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recordId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityProduce}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_product_produce_line + + record_id = #{recordId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_produce = #{quantityProduce}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_product_produce_line where line_id = #{lineId} + + + + delete from wm_product_produce_line where line_id in + + #{lineId} + + + + + delete from wm_product_produce_line where record_id = #{record_id} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmProductProduceMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmProductProduceMapper.xml new file mode 100644 index 0000000..e66e2bb --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmProductProduceMapper.xml @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, workorder_id, workorder_code, workorder_name, task_id, task_code, task_name, workstation_id, workstation_code, workstation_name, process_id, process_code, process_name, produce_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_produce + + + + + + + + + + insert into wm_product_produce + + workorder_id, + workorder_code, + workorder_name, + task_id, + task_code, + task_name, + workstation_id, + workstation_code, + workstation_name, + process_id, + process_code, + process_name, + produce_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{taskId}, + #{taskCode}, + #{taskName}, + #{workstationId}, + #{workstationCode}, + #{workstationName}, + #{processId}, + #{processCode}, + #{processName}, + #{produceDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_product_produce + + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + task_id = #{taskId}, + task_code = #{taskCode}, + task_name = #{taskName}, + workstation_id = #{workstationId}, + workstation_code = #{workstationCode}, + workstation_name = #{workstationName}, + process_id = #{processId}, + process_code = #{processCode}, + process_name = #{processName}, + produce_date = #{produceDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from wm_product_produce where record_id = #{recordId} + + + + delete from wm_product_produce where record_id in + + #{recordId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmProductRecptLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmProductRecptLineMapper.xml new file mode 100644 index 0000000..766f4f1 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmProductRecptLineMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, recpt_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_recived, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_recpt_line + + + + + + + + insert into wm_product_recpt_line + + recpt_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_recived, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recptId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityRecived}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_product_recpt_line + + recpt_id = #{recptId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_recived = #{quantityRecived}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_product_recpt_line where line_id = #{lineId} + + + + delete from wm_product_recpt_line where line_id in + + #{lineId} + + + + + delete from wm_product_recpt_line where recpt_id = #{recptId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmProductRecptMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmProductRecptMapper.xml new file mode 100644 index 0000000..181a7e9 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmProductRecptMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select recpt_id, recpt_code, recpt_name, workorder_id, workorder_code, workorder_name,item_id, item_code, item_name, specification, unit_of_measure, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, recpt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_recpt + + + + + + + + + + + + insert into wm_product_recpt + + recpt_code, + recpt_name, + workorder_id, + workorder_code, + workorder_name, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + recpt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{recptCode}, + #{recptName}, + #{workorderId}, + #{workorderCode}, + #{workorderName}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{recptDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_product_recpt + + recpt_code = #{recptCode}, + recpt_name = #{recptName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + workorder_name = #{workorderName}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + recpt_date = #{recptDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where recpt_id = #{recptId} + + + + delete from wm_product_recpt where recpt_id = #{recptId} + + + + delete from wm_product_recpt where recpt_id in + + #{recptId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmProductSalseLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmProductSalseLineMapper.xml new file mode 100644 index 0000000..e190efc --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmProductSalseLineMapper.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, salse_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_salse, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, oqc_check,oqc_id,oqc_code, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_salse_line + + + + + + + + insert into wm_product_salse_line + + salse_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_salse, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + oqc_check, + oqc_id, + oqc_code, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{salseId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantitySalse}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{oqcCheck}, + #{oqcId}, + #{oqcCode}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_product_salse_line + + salse_id = #{salseId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_salse = #{quantitySalse}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + oqc_check = #{oqcCheck}, + oqc_id = #{oqcId}, + oqc_code = #{oqcCode}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_product_salse_line where line_id = #{lineId} + + + + delete from wm_product_salse_line where line_id in + + #{lineId} + + + + + delete from wm_product_salse_line where salse_id = #{salseId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmProductSalseMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmProductSalseMapper.xml new file mode 100644 index 0000000..3f95548 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmProductSalseMapper.xml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select salse_id, salse_code, salse_name, oqc_id, oqc_code, so_code, client_id, client_code, client_name, client_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, salse_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_salse + + + + + + + + + + + + insert into wm_product_salse + + salse_code, + salse_name, + oqc_id, + oqc_code, + so_code, + client_id, + client_code, + client_name, + client_nick, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + salse_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{salseCode}, + #{salseName}, + #{oqcId}, + #{oqcCode}, + #{soCode}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{clientNick}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{salseDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_product_salse + + salse_code = #{salseCode}, + salse_name = #{salseName}, + oqc_id = #{oqcId}, + oqc_code = #{oqcCode}, + so_code = #{soCode}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + client_nick = #{clientNick}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + salse_date = #{salseDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where salse_id = #{salseId} + + + + delete from wm_product_salse where salse_id = #{salseId} + + + + delete from wm_product_salse where salse_id in + + #{salseId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtIssueLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtIssueLineMapper.xml new file mode 100644 index 0000000..37d323f --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtIssueLineMapper.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, rt_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_rt, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_issue_line + + + + + + + + insert into wm_rt_issue_line + + rt_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_rt, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityRt}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_issue_line + + rt_id = #{rtId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_rt = #{quantityRt}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_rt_issue_line where line_id = #{lineId} + + + + delete from wm_rt_issue_line where line_id in + + #{lineId} + + + + + delete from wm_rt_issue_line where rt_id = #{rtId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtIssueMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtIssueMapper.xml new file mode 100644 index 0000000..6f1b37b --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtIssueMapper.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select rt_id, rt_code, rt_name, workorder_id, workorder_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, rt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_issue + + + + + + + + + + + + insert into wm_rt_issue + + rt_code, + rt_name, + workorder_id, + workorder_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + rt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtCode}, + #{rtName}, + #{workorderId}, + #{workorderCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{rtDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_issue + + rt_code = #{rtCode}, + rt_name = #{rtName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + rt_date = #{rtDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where rt_id = #{rtId} + + + + delete from wm_rt_issue where rt_id = #{rtId} + + + + delete from wm_rt_issue where rt_id in + + #{rtId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtSalseLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtSalseLineMapper.xml new file mode 100644 index 0000000..351b004 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtSalseLineMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, rt_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_rted, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, expire_date, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_salse_line + + + + + + + + insert into wm_rt_salse_line + + rt_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_rted, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + expire_date, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityRted}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{expireDate}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_salse_line + + rt_id = #{rtId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_rted = #{quantityRted}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + expire_date = #{expireDate}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_rt_salse_line where line_id = #{lineId} + + + + delete from wm_rt_salse_line where line_id in + + #{lineId} + + + + + delete from wm_rt_salse_line where rt_id = #{rtId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtSalseMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtSalseMapper.xml new file mode 100644 index 0000000..ba95433 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtSalseMapper.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select rt_id, rt_code, rt_name, so_code, client_id, client_code, client_name, client_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, rt_date, rt_reason, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_salse + + + + + + + + + + + + + insert into wm_rt_salse + + rt_code, + rt_name, + so_code, + client_id, + client_code, + client_name, + client_nick, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + rt_date, + rt_reason, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtCode}, + #{rtName}, + #{soCode}, + #{clientId}, + #{clientCode}, + #{clientName}, + #{clientNick}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{rtDate}, + #{rtReason}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_salse + + rt_code = #{rtCode}, + rt_name = #{rtName}, + so_code = #{soCode}, + client_id = #{clientId}, + client_code = #{clientCode}, + client_name = #{clientName}, + client_nick = #{clientNick}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + rt_date = #{rtDate}, + rt_reason = #{rtReason}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where rt_id = #{rtId} + + + + delete from wm_rt_salse where rt_id = #{rtId} + + + + delete from wm_rt_salse where rt_id in + + #{rtId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtVendorLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtVendorLineMapper.xml new file mode 100644 index 0000000..7366bad --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtVendorLineMapper.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, rt_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_rted, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_vendor_line + + + + + + + + insert into wm_rt_vendor_line + + rt_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_rted, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityRted}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_vendor_line + + rt_id = #{rtId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_rted = #{quantityRted}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_rt_vendor_line where line_id = #{lineId} + + + + delete from wm_rt_vendor_line where line_id in + + #{lineId} + + + + + delete from wm_rt_vendor_line where rt_id =#{rtId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtVendorMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtVendorMapper.xml new file mode 100644 index 0000000..19242b4 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtVendorMapper.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select rt_id, rt_code, rt_name, po_code, vendor_id, vendor_code, vendor_name, vendor_nick, batch_code, rt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_vendor + + + + + + + + + + + + insert into wm_rt_vendor + + rt_code, + rt_name, + po_code, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + batch_code, + rt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtCode}, + #{rtName}, + #{poCode}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{batchCode}, + #{rtDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_vendor + + rt_code = #{rtCode}, + rt_name = #{rtName}, + po_code = #{poCode}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + batch_code = #{batchCode}, + rt_date = #{rtDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where rt_id = #{rtId} + + + + delete from wm_rt_vendor where rt_id = #{rtId} + + + + delete from wm_rt_vendor where rt_id in + + #{rtId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmSnMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmSnMapper.xml new file mode 100644 index 0000000..1abf016 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmSnMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select sn_id, sn_code, item_id, item_code, item_name, specification, unit_of_measure, batch_code,gen_date, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_sn + + + + + + + + + + insert into wm_sn + + sn_code, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + batch_code, + gen_date, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{snCode}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{batchCode}, + #{genDate}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_sn + + sn_code = #{snCode}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + batch_code = #{batchCode}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where sn_id = #{snId} + + + + delete from wm_sn where sn_id = #{snId} + + + + delete from wm_sn where sn_id in + + #{snId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml new file mode 100644 index 0000000..ddb689c --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingLineMapper.xml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, taking_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, unit_name, quantity, taking_quantity, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, taking_status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_stock_taking_line + + + + + + + + insert into wm_stock_taking_line + + taking_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + unit_name, + quantity, + taking_quantity, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + taking_status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{takingId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{unitName}, + #{quantity}, + #{takingQuantity}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{takingStatus}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_stock_taking_line + + taking_id = #{takingId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + unit_name = #{unitName}, + quantity = #{quantity}, + taking_quantity = #{takingQuantity}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + taking_status = #{takingStatus}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_stock_taking_line where line_id = #{lineId} + + + + delete from wm_stock_taking_line where line_id in + + #{lineId} + + + + + delete from wm_stock_taking_line where taking_id = #{takingId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml new file mode 100644 index 0000000..b2ddf40 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select taking_id, taking_code, taking_name, taking_date, user_name, nick_name, taking_type, warehouse_id, warehouse_code, warehouse_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_stock_taking + + + + + + + + + + insert into wm_stock_taking + + taking_code, + taking_name, + taking_date, + user_name, + nick_name, + taking_type, + warehouse_id, + warehouse_code, + warehouse_name, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{takingCode}, + #{takingName}, + #{takingDate}, + #{userName}, + #{nickName}, + #{takingType}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_stock_taking + + taking_code = #{takingCode}, + taking_name = #{takingName}, + taking_date = #{takingDate}, + user_name = #{userName}, + nick_name = #{nickName}, + taking_type = #{takingType}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where taking_id = #{takingId} + + + + delete from wm_stock_taking where taking_id = #{takingId} + + + + delete from wm_stock_taking where taking_id in + + #{takingId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml new file mode 100644 index 0000000..d0280ed --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select result_id, taking_id, item_id, item_code, item_name, specification, unit_of_measure, unit_name, quantity, taking_quantity, taking_status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_stock_taking_result + + + + + + + + insert into wm_stock_taking_result (taking_id,item_id,item_code,item_name,specification,taking_quantity,quantity,taking_status) + select sl.taking_id,sl.item_id,sl.item_code,sl.item_name,sl.specification,taking_quantity,quantity, + case when IFNULL(taking_quantity,0) > IFNULL(quantity,0) then 'PROFIT' + when IFNULL(taking_quantity,0) < IFNULL(quantity,0) then 'LOSS' + else 'NORMAL' end as taking_status + from wm_stock_taking_line sl + where sl.taking_id = #{takingId} + + + + insert into wm_stock_taking_result (item_id,item_code,item_name,specification,taking_quantity,quantity,taking_status) + select IFNULL(m.item_id,t.item_id) as item_id, IFNULL(m.item_code,t.item_code) as item_code,IFNULL(m.item_name,t.item_name) as item_name,IFNULL(m.specification,t.specification) as specification, + IFNULL(t.taking_quantity,0) as taking_quantity,IFNULL(m.onhand,0) as quantity, + case when IFNULL(t.taking_quantity,0) > IFNULL(m.onhand,0) then 'PROFIT' + when IFNULL(t.taking_quantity,0) < IFNULL(m.onhand,0) then 'LOSS' + else 'NORMAL' end as taking_status + from ( + select sl.item_id,sl.item_code,sl.item_name,sl.specification,sum(sl.taking_quantity) as taking_quantity + from wm_stock_taking_line sl + where sl.taking_id = #{takingId} + group by sl.item_id,sl.item_code,sl.item_name,sl.specification + ) t + left join ( + select ms.item_id,ms.item_code,ms.item_name,ms.specification,sum(ms.quantity_onhand) as onhand + from wm_material_stock ms + where (ms.warehouse_id,ms.location_id,ms.area_id) in ( + select warehouse_id,location_id,area_id + from wm_stock_taking + where taking_id = #{takingId} + ) + group by ms.item_id,ms.item_code,ms.item_name,ms.specification + ) m + on t.item_id = m.item_id + and t.item_code = m.item_code + where t.taking_quantity !=0 + + union + + select IFNULL(t.item_id,m.item_id) as item_id,IFNULL(t.item_code,m.item_code) as item_code,IFNULL(t.item_name,m.item_name) as item_name,IFNULL(t.specification,m.specification) as specification, + IFNULL(t.taking_quantity,0) as taking_quantity,IFNULL(m.onhand,0) as quantity, + case when IFNULL(t.taking_quantity,0) > IFNULL(m.onhand,0) then 'PROFIT' + when IFNULL(t.taking_quantity,0) < IFNULL(m.onhand,0) then 'LOSS' + else 'NORMAL' end as taking_status + from ( + select ms.item_id,ms.item_code,ms.item_name,ms.specification,sum(ms.quantity_onhand) as onhand + from wm_material_stock ms + where (ms.warehouse_id,ms.location_id,ms.area_id) in ( + select warehouse_id,location_id,area_id + from wm_stock_taking + where taking_id = #{takingId} + ) + group by ms.item_id,ms.item_code,ms.item_name,ms.specification + ) m + left join ( + select sl.item_id,sl.item_code,sl.item_name,sl.specification,sum(sl.taking_quantity) as taking_quantity + from wm_stock_taking_line sl + where sl.taking_id = #{takingId} + group by sl.item_id,sl.item_code,sl.item_name,sl.specification + ) t + on t.item_id = m.item_id + and t.item_code = m.item_code + where m.onhand !=0 + + + + insert into wm_stock_taking_result + + taking_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + unit_name, + quantity, + taking_quantity, + taking_status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{takingId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{unitName}, + #{quantity}, + #{takingQuantity}, + #{takingStatus}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_stock_taking_result + + taking_id = #{takingId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + unit_name = #{unitName}, + quantity = #{quantity}, + taking_quantity = #{takingQuantity}, + taking_status = #{takingStatus}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where result_id = #{resultId} + + + + delete from wm_stock_taking_result where result_id = #{resultId} + + + + delete from wm_stock_taking_result where result_id in + + #{resultId} + + + + + delete from wm_stock_taking_result where taking_id = #{takingId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStorageAreaMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStorageAreaMapper.xml new file mode 100644 index 0000000..4a13c81 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStorageAreaMapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, enable_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area + + + + + + + + + + insert into wm_storage_area + + area_code, + area_name, + location_id, + area, + max_loa, + position_x, + position_y, + position_z, + enable_flag, + frozen_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{areaCode}, + #{areaName}, + #{locationId}, + #{area}, + #{maxLoa}, + #{positionX}, + #{positionY}, + #{positionZ}, + #{enableFlag}, + #{frozenFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_storage_area + + area_code = #{areaCode}, + area_name = #{areaName}, + location_id = #{locationId}, + area = #{area}, + max_loa = #{maxLoa}, + position_x = #{positionX}, + position_y = #{positionY}, + position_z = #{positionZ}, + enable_flag = #{enableFlag}, + frozen_flag = #{frozenFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where area_id = #{areaId} + + + + delete from wm_storage_area where area_id = #{areaId} + + + + delete from wm_storage_area where area_id in + + #{areaId} + + + + + delete from wm_storage_area where location_id in ( select location_id from wm_storage_location where warehouse_id = #{warehouseId}) + + + + delete form wm_storage_area where location_id = #{locationId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml new file mode 100644 index 0000000..b64c93f --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select location_id, location_code, location_name, warehouse_id, area, area_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_location + + + + + + + + + + + + + + insert into wm_storage_location + + location_code, + location_name, + warehouse_id, + area, + area_flag, + frozen_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{locationCode}, + #{locationName}, + #{warehouseId}, + #{area}, + #{areaFlag}, + #{frozenFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_storage_location + + location_code = #{locationCode}, + location_name = #{locationName}, + warehouse_id = #{warehouseId}, + area = #{area}, + area_flag = #{areaFlag}, + frozen_flag = #{frozenFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where location_id = #{locationId} + + + + delete from wm_storage_location where location_id = #{locationId} + + + + delete from wm_storage_location where location_id in + + #{locationId} + + + + + delete from wm_storage_location where warehouse_id = #{warehouseId} + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmTransactionMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmTransactionMapper.xml new file mode 100644 index 0000000..eeb75dc --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmTransactionMapper.xml @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select transaction_id, transaction_type, item_id, item_code, item_name, specification, unit_of_measure, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, vendor_id, vendor_code, vendor_name, vendor_nick, source_doc_type, source_doc_id, source_doc_code, source_doc_line_id, material_stock_id, transaction_flag, transaction_quantity, transaction_date, related_transaction_id, erp_date,workorder_id,workorder_code,recpt_date, expire_date, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_transaction + + + + + + + + insert into wm_transaction + + transaction_type, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + batch_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + source_doc_type, + source_doc_id, + source_doc_code, + source_doc_line_id, + material_stock_id, + transaction_flag, + transaction_quantity, + transaction_date, + related_transaction_id, + erp_date, + recpt_date, + workorder_id, + workorder_code, + expire_date, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{transactionType}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{batchCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{sourceDocType}, + #{sourceDocId}, + #{sourceDocCode}, + #{sourceDocLineId}, + #{materialStockId}, + #{transactionFlag}, + #{transactionQuantity}, + #{transactionDate}, + #{relatedTransactionId}, + #{erpDate}, + #{recptDate}, + #{workorderId}, + #{workorderCode}, + #{expireDate}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_transaction + + transaction_type = #{transactionType}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + batch_code = #{batchCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + source_doc_type = #{sourceDocType}, + source_doc_id = #{sourceDocId}, + source_doc_code = #{sourceDocCode}, + source_doc_line_id = #{sourceDocLineId}, + material_stock_id = #{materialStockId}, + transaction_flag = #{transactionFlag}, + transaction_quantity = #{transactionQuantity}, + transaction_date = #{transactionDate}, + related_transaction_id = #{relatedTransactionId}, + erp_date = #{erpDate}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + recp_date = #{recptDate}, + expire_date = #{expireDate}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where transaction_id = #{transactionId} + + + + delete from wm_transaction where transaction_id = #{transactionId} + + + + delete from wm_transaction where transaction_id in + + #{transactionId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmTransferLineMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmTransferLineMapper.xml new file mode 100644 index 0000000..00dc4cf --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmTransferLineMapper.xml @@ -0,0 +1,263 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select line_id, transfer_id, material_stock_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_transfer, workorder_id, workorder_code, batch_code, from_warehouse_id, from_warehouse_code, from_warehouse_name, from_location_id, from_location_code, from_location_name, from_area_id, from_area_code, from_area_name, to_warehouse_id, to_warehouse_code, to_warehouse_name, to_location_id, to_location_code, to_location_name, to_area_id, to_area_code, to_area_name, expire_date, vendor_id, vendor_code, vendor_name, vendor_nick, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_transfer_line + + + + + + + + insert into wm_transfer_line + + transfer_id, + material_stock_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_transfer, + workorder_id, + workorder_code, + batch_code, + from_warehouse_id, + from_warehouse_code, + from_warehouse_name, + from_location_id, + from_location_code, + from_location_name, + from_area_id, + from_area_code, + from_area_name, + to_warehouse_id, + to_warehouse_code, + to_warehouse_name, + to_location_id, + to_location_code, + to_location_name, + to_area_id, + to_area_code, + to_area_name, + expire_date, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{transferId}, + #{materialStockId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityTransfer}, + #{workorderId}, + #{workorderCode}, + #{batchCode}, + #{fromWarehouseId}, + #{fromWarehouseCode}, + #{fromWarehouseName}, + #{fromLocationId}, + #{fromLocationCode}, + #{fromLocationName}, + #{fromAreaId}, + #{fromAreaCode}, + #{fromAreaName}, + #{toWarehouseId}, + #{toWarehouseCode}, + #{toWarehouseName}, + #{toLocationId}, + #{toLocationCode}, + #{toLocationName}, + #{toAreaId}, + #{toAreaCode}, + #{toAreaName}, + #{expireDate}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_transfer_line + + transfer_id = #{transferId}, + material_stock_id = #{materialStockId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_transfer = #{quantityTransfer}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + batch_code = #{batchCode}, + from_warehouse_id = #{fromWarehouseId}, + from_warehouse_code = #{fromWarehouseCode}, + from_warehouse_name = #{fromWarehouseName}, + from_location_id = #{fromLocationId}, + from_location_code = #{fromLocationCode}, + from_location_name = #{fromLocationName}, + from_area_id = #{fromAreaId}, + from_area_code = #{fromAreaCode}, + from_area_name = #{fromAreaName}, + to_warehouse_id = #{toWarehouseId}, + to_warehouse_code = #{toWarehouseCode}, + to_warehouse_name = #{toWarehouseName}, + to_location_id = #{toLocationId}, + to_location_code = #{toLocationCode}, + to_location_name = #{toLocationName}, + to_area_id = #{toAreaId}, + to_area_code = #{toAreaCode}, + to_area_name = #{toAreaName}, + expire_date = #{expireDate}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where line_id = #{lineId} + + + + delete from wm_transfer_line where line_id = #{lineId} + + + + delete from wm_transfer_line where line_id in + + #{lineId} + + + + + delete from wm_transfer_line where transfer_id = #{transferId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmTransferMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmTransferMapper.xml new file mode 100644 index 0000000..07c5f24 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmTransferMapper.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select transfer_id, transfer_code, transfer_name, transfer_type, destination, carrier, booking_note,receiver,receiver_nick, from_warehouse_id, from_warehouse_code, from_warehouse_name, to_warehouse_id, to_warehouse_code, to_warehouse_name, transfer_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_transfer + + + + + + + + + + + + insert into wm_transfer + + transfer_code, + transfer_name, + transfer_type, + destination, + carrier, + booking_note, + receiver, + receiver_nick, + from_warehouse_id, + from_warehouse_code, + from_warehouse_name, + to_warehouse_id, + to_warehouse_code, + to_warehouse_name, + transfer_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{transferCode}, + #{transferName}, + #{transferType}, + #{destination}, + #{carrier}, + #{bookingNote}, + #{receiver}, + #{receiverNick}, + #{fromWarehouseId}, + #{fromWarehouseCode}, + #{fromWarehouseName}, + #{toWarehouseId}, + #{toWarehouseCode}, + #{toWarehouseName}, + #{transferDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_transfer + + transfer_code = #{transferCode}, + transfer_name = #{transferName}, + transfer_type = #{transferType}, + destination = #{destination}, + carrier = #{carrier}, + booking_note = #{bookingNote}, + receiver = #{receiver}, + receiver_nick = #{receiverNick}, + from_warehouse_id = #{fromWarehouseId}, + from_warehouse_code = #{fromWarehouseCode}, + from_warehouse_name = #{fromWarehouseName}, + to_warehouse_id = #{toWarehouseId}, + to_warehouse_code = #{toWarehouseCode}, + to_warehouse_name = #{toWarehouseName}, + transfer_date = #{transferDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where transfer_id = #{transferId} + + + + delete from wm_transfer where transfer_id = #{transferId} + + + + delete from wm_transfer where transfer_id in + + #{transferId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml new file mode 100644 index 0000000..5b2894d --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select warehouse_id, warehouse_code, warehouse_name, location, area, charge, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_warehouse + + + + + + + + + + + + + + + + insert into wm_warehouse + + warehouse_code, + warehouse_name, + location, + area, + charge, + frozen_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{warehouseCode}, + #{warehouseName}, + #{location}, + #{area}, + #{charge}, + #{frozenFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_warehouse + + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location = #{location}, + area = #{area}, + charge = #{charge}, + frozen_flag = #{frozenFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where warehouse_id = #{warehouseId} + + + + delete from wm_warehouse where warehouse_id = #{warehouseId} + + + + delete from wm_warehouse where warehouse_id in + + #{warehouseId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/reports/fonts/fonts.xml b/ktg-mes/src/main/resources/reports/fonts/fonts.xml new file mode 100644 index 0000000..0542524 --- /dev/null +++ b/ktg-mes/src/main/resources/reports/fonts/fonts.xml @@ -0,0 +1,16 @@ + + + + + reports/fonts/msyh.ttf + reports/fonts/msyh.ttf + reports/fonts/msyh.ttf + reports/fonts/msyh.ttf + Identity-H + true + + '微软雅黑', Arial, Helvetica, sans-serif + '微软雅黑', Arial, Helvetica, sans-serif + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/reports/fonts/msyh.ttf b/ktg-mes/src/main/resources/reports/fonts/msyh.ttf new file mode 100644 index 0000000..a526593 Binary files /dev/null and b/ktg-mes/src/main/resources/reports/fonts/msyh.ttf differ diff --git a/ktg-mes/src/main/resources/reports/jasper/IQC.jasper b/ktg-mes/src/main/resources/reports/jasper/IQC.jasper new file mode 100644 index 0000000..e909efc Binary files /dev/null and b/ktg-mes/src/main/resources/reports/jasper/IQC.jasper differ diff --git a/ktg-mes/src/main/resources/reports/jasper/Test.jasper b/ktg-mes/src/main/resources/reports/jasper/Test.jasper new file mode 100644 index 0000000..f008209 Binary files /dev/null and b/ktg-mes/src/main/resources/reports/jasper/Test.jasper differ diff --git a/ktg-mes/src/main/resources/reports/jrxml/IQC.jrxml b/ktg-mes/src/main/resources/reports/jrxml/IQC.jrxml new file mode 100644 index 0000000..1dfbd3f --- /dev/null +++ b/ktg-mes/src/main/resources/reports/jrxml/IQC.jrxml @@ -0,0 +1,712 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="270" splitType="Stretch"> + <staticText> + <reportElement x="345" y="30" width="70" height="30" uuid="c0322d2e-0617-46d0-8530-37480dd2f435"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[单据名称]]></text> + </staticText> + <staticText> + <reportElement x="345" y="0" width="70" height="30" uuid="a38cbf3a-4def-4b9d-bb1c-5f422264fb53"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[单据编号]]></text> + </staticText> + <textField> + <reportElement x="415" y="0" width="140" height="30" uuid="2024fada-a3a7-4537-b28f-f9395f6bcfd7"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{iqcCode}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="415" y="30" width="140" height="30" uuid="ec5c9e40-f01a-4b1a-8507-bd41bec6b865"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{iqcName}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="30" width="345" height="30" uuid="bc15f6bb-d141-4a55-9305-870eaffeb045"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[IQC来料检验单]]></text> + </staticText> + <textField> + <reportElement x="0" y="0" width="345" height="30" uuid="3e367393-cf32-4a9f-b99e-c62201b8e7f4"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="14"/> + </textElement> + <textFieldExpression><![CDATA[$P{CompanyName}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="415" y="60" width="70" height="30" uuid="b095b7c8-330a-4557-ad01-478f2016cd61"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[来料数量]]></text> + </staticText> + <staticText> + <reportElement x="415" y="90" width="70" height="30" uuid="8d68a624-9eef-4755-9ba8-303769eff5af"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[检测数量]]></text> + </staticText> + <staticText> + <reportElement x="415" y="120" width="70" height="30" uuid="cd4fed4c-16d9-418a-ad60-17687c072587"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[检测结论]]></text> + </staticText> + <textField> + <reportElement x="485" y="60" width="70" height="30" uuid="504c5a36-0397-40aa-ad3b-6d79674d83cf"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{quantity_recived}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="485" y="90" width="70" height="30" uuid="419d27ea-8a60-4364-aa0a-2ff03b30bdf2"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{quantity_check}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="485" y="120" width="70" height="30" uuid="6545b673-3e63-41f7-a21a-f702d046ec71"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{check_result}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="205" y="60" width="70" height="30" uuid="ef05d3a8-643e-41e1-8cc0-216ba0a0088d"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[来料日期]]></text> + </staticText> + <staticText> + <reportElement x="205" y="90" width="70" height="30" uuid="0d52b9a8-4c2d-4fe3-8b16-34aebfb16d90"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[检测日期]]></text> + </staticText> + <staticText> + <reportElement x="205" y="120" width="70" height="30" uuid="76f9a4d3-a601-4cd3-9fa2-80adbfaac3cd"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[供应商批次]]></text> + </staticText> + <textField pattern="yyyy-MM-dd"> + <reportElement x="275" y="60" width="140" height="30" uuid="1d427252-34cc-45e8-b1c6-7f0dec5768e4"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{recive_date}]]></textFieldExpression> + </textField> + <textField pattern="yyyy-MM-dd"> + <reportElement x="275" y="90" width="140" height="30" uuid="802b6110-9057-4728-b55e-2d8d86e1df94"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{inspect_date}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="275" y="120" width="140" height="30" uuid="ff7464f5-54ec-4074-9269-3db11f952592"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{vendor_batch}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="60" width="65" height="30" uuid="9c5a58d3-7d3e-4110-8e2f-8ebb17c6729a"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[产品编码]]></text> + </staticText> + <staticText> + <reportElement x="0" y="90" width="65" height="30" uuid="83ab7751-a28e-4a84-95b9-c9e88b6aa74b"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[产品名称]]></text> + </staticText> + <staticText> + <reportElement x="0" y="120" width="65" height="30" uuid="206f790e-225f-4cd4-b2dd-f8a431e4faeb"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[供应商名称]]></text> + </staticText> + <textField> + <reportElement x="65" y="60" width="140" height="30" uuid="8afa0f71-05e3-4d6c-8269-6b40b42e1b67"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{itemCode}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="65" y="90" width="140" height="30" uuid="73960c5b-8da3-4d59-a3db-02b6faacd03d"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{itemName}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="65" y="120" width="140" height="30" uuid="f424d4f0-a168-4b12-bcb7-345a952c1da1"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{vendorName}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="485" y="150" width="70" height="30" uuid="e9c99552-bdc5-467b-9287-cd54a98e9dba"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[轻微缺陷]]></text> + </staticText> + <staticText> + <reportElement x="415" y="150" width="70" height="30" uuid="bb72998e-77ec-46ba-bcd7-4e621f7f2104"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[严重缺陷]]></text> + </staticText> + <staticText> + <reportElement x="345" y="150" width="70" height="30" uuid="b5215a9e-7b43-4cdb-9d18-2bad6414df0c"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[致命缺陷]]></text> + </staticText> + <staticText> + <reportElement x="275" y="150" width="70" height="30" uuid="1bad0dee-3ad1-4da6-a995-259e3cb71ea0"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[不良品数量]]></text> + </staticText> + <textField> + <reportElement x="345" y="180" width="70" height="30" uuid="90a4a922-2bb9-4e37-9ba2-4da0e36a8b78"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{cr_rate}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="415" y="180" width="70" height="30" uuid="ecdcd7d8-5bd1-4ca7-a51f-df78631b7414"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{maj_rate}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="485" y="180" width="70" height="30" uuid="dcac35cd-8caf-48a9-b148-9fdb7513a61c"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{min_rate}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="275" y="180" width="70" height="30" uuid="c335f554-a348-498a-b867-3c834993e0ea"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{quantity_max_unqualified}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="150" width="275" height="60" uuid="ff2aacb3-398e-4411-abcd-eee60f54ca44"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[AQL收货标准]]></text> + </staticText> + <staticText> + <reportElement x="0" y="210" width="275" height="60" uuid="fee1cba1-777a-4b15-ab14-fb6df739fdc7"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[检测结果]]></text> + </staticText> + <staticText> + <reportElement x="275" y="210" width="70" height="30" uuid="e09a71d5-99e4-4d5c-95ab-aa07ab0a43e4"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[不良品数量]]></text> + </staticText> + <staticText> + <reportElement x="345" y="210" width="70" height="30" uuid="88a1cb41-ad4b-4cc1-b4ba-47d4ff3839e5"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[致命缺陷]]></text> + </staticText> + <staticText> + <reportElement x="415" y="210" width="70" height="30" uuid="34b485c5-5f28-4308-bae2-300003bf5800"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[严重缺陷]]></text> + </staticText> + <staticText> + <reportElement x="485" y="210" width="70" height="30" uuid="c9a0a319-c39d-4035-86b5-7bcbf81fc7ff"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[轻微缺陷]]></text> + </staticText> + <textField> + <reportElement x="345" y="240" width="70" height="30" uuid="f73fc702-9a22-48c0-bbab-1c71582abb05"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{cr_quantity}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="415" y="240" width="70" height="30" uuid="528ff6a3-2a6d-46ca-8954-379fbde7c6d0"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{maj_quantity}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="485" y="240" width="70" height="30" uuid="60486212-eec7-4f05-aae5-91915ca2a0ff"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{min_quantity}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="275" y="240" width="70" height="30" uuid="d187681d-396d-4c62-a1f8-e8992bd57cdc"/> + <box> + <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{quantity_unqualified}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ktg-mes/src/main/resources/reports/jrxml/Test.jrxml b/ktg-mes/src/main/resources/reports/jrxml/Test.jrxml new file mode 100644 index 0000000..b034305 --- /dev/null +++ b/ktg-mes/src/main/resources/reports/jrxml/Test.jrxml @@ -0,0 +1,45 @@ + + + + + + + + + + + + <band height="79" splitType="Stretch"> + <staticText> + <reportElement x="0" y="13" width="163" height="53" uuid="25318a60-d2bb-42b2-9f08-c6277232a0da"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font fontName="微软雅黑" size="20"/> + </textElement> + <text><![CDATA[IQC来料检验]]></text> + </staticText> + <textField> + <reportElement x="330" y="13" width="214" height="53" uuid="92efd0d6-6694-4cca-a831-721efc02256c"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font fontName="微软雅黑" size="14"/> + </textElement> + <textFieldExpression><![CDATA[$P{VendorName}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="181" y="22" width="100" height="30" uuid="26473f08-8c2e-4048-893e-3b0eb476f4cb"/> + <textElement> + <font fontName="微软雅黑"/> + </textElement> + <text><![CDATA[来料检验单]]></text> + </staticText> + </band> + + + + + + + + + + + diff --git a/ktg-print/pom.xml b/ktg-print/pom.xml new file mode 100644 index 0000000..5b4d998 --- /dev/null +++ b/ktg-print/pom.xml @@ -0,0 +1,37 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-print + + + 8 + 8 + + + + + io.netty + netty-all + 4.1.65.Final + + + + com.google.protobuf + protobuf-java + 3.20.3 + + + + com.ktg + ktg-common + + + \ No newline at end of file diff --git a/ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java b/ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java new file mode 100644 index 0000000..96d87b9 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java @@ -0,0 +1,106 @@ +package com.ktg.print.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.print.domain.PrintPrinterConfig; +import com.ktg.print.service.IPrintPrinterConfigService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; + +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 打印机配置Controller + * + * @author yinjinlu + * @date 2023-09-01 + */ +@RestController +@RequestMapping("/print/printerconfig") +public class PrintPrinterConfigController extends BaseController +{ + @Autowired + private IPrintPrinterConfigService printPrinterConfigService; + + /** + * 查询打印机配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:list')") + @GetMapping("/list") + public TableDataInfo list(PrintPrinterConfig printPrinterConfig) + { + startPage(); + List list = printPrinterConfigService.selectPrintPrinterConfigList(printPrinterConfig); + return getDataTable(list); + } + + /** + * 导出打印机配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:export')") + @Log(title = "打印机配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PrintPrinterConfig printPrinterConfig) + { + List list = printPrinterConfigService.selectPrintPrinterConfigList(printPrinterConfig); + ExcelUtil util = new ExcelUtil(PrintPrinterConfig.class); + util.exportExcel(response, list, "打印机配置数据"); + } + + /** + * 获取打印机配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:query')") + @GetMapping(value = "/{printerId}") + public AjaxResult getInfo(@PathVariable("printerId") Long printerId) + { + return AjaxResult.success(printPrinterConfigService.selectPrintPrinterConfigByPrinterId(printerId)); + } + + /** + * 新增打印机配置 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:add')") + @Log(title = "打印机配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PrintPrinterConfig printPrinterConfig) + { + return toAjax(printPrinterConfigService.insertPrintPrinterConfig(printPrinterConfig)); + } + + /** + * 修改打印机配置 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:edit')") + @Log(title = "打印机配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PrintPrinterConfig printPrinterConfig) + { + return toAjax(printPrinterConfigService.updatePrintPrinterConfig(printPrinterConfig)); + } + + /** + * 删除打印机配置 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:remove')") + @Log(title = "打印机配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{printerIds}") + public AjaxResult remove(@PathVariable Long[] printerIds) + { + return toAjax(printPrinterConfigService.deletePrintPrinterConfigByPrinterIds(printerIds)); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java b/ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java new file mode 100644 index 0000000..02a0857 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java @@ -0,0 +1,105 @@ +package com.ktg.print.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.print.domain.PrintTemplate; +import com.ktg.print.service.IPrintTemplateService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 打印模板配置Controller + * + * @author yinjinlu + * @date 2024-04-17 + */ +@RestController +@RequestMapping("/print/template") +public class PrintTemplateController extends BaseController +{ + @Autowired + private IPrintTemplateService printTemplateService; + + /** + * 查询打印模板配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:template:list')") + @GetMapping("/list") + public TableDataInfo list(PrintTemplate printTemplate) + { + startPage(); + List list = printTemplateService.selectPrintTemplateList(printTemplate); + return getDataTable(list); + } + + /** + * 导出打印模板配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:template:export')") + @Log(title = "打印模板配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PrintTemplate printTemplate) + { + List list = printTemplateService.selectPrintTemplateList(printTemplate); + ExcelUtil util = new ExcelUtil(PrintTemplate.class); + util.exportExcel(response, list, "打印模板配置数据"); + } + + /** + * 获取打印模板配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('print:template:query')") + @GetMapping(value = "/{templateId}") + public AjaxResult getInfo(@PathVariable("templateId") Long templateId) + { + return AjaxResult.success(printTemplateService.selectPrintTemplateByTemplateId(templateId)); + } + + /** + * 新增打印模板配置 + */ + @PreAuthorize("@ss.hasPermi('print:template:add')") + @Log(title = "打印模板配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PrintTemplate printTemplate) + { + printTemplateService.insertPrintTemplate(printTemplate); + return AjaxResult.success(printTemplate); + } + + /** + * 修改打印模板配置 + */ + @PreAuthorize("@ss.hasPermi('print:template:edit')") + @Log(title = "打印模板配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PrintTemplate printTemplate) + { + return toAjax(printTemplateService.updatePrintTemplate(printTemplate)); + } + + /** + * 删除打印模板配置 + */ + @PreAuthorize("@ss.hasPermi('print:template:remove')") + @Log(title = "打印模板配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{templateIds}") + public AjaxResult remove(@PathVariable Long[] templateIds) + { + return toAjax(printTemplateService.deletePrintTemplateByTemplateIds(templateIds)); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java b/ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java new file mode 100644 index 0000000..5ff98e9 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java @@ -0,0 +1,276 @@ +package com.ktg.print.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 打印机配置对象 print_printer_config + * + * @author yinjinlu + * @date 2023-09-01 + */ +public class PrintPrinterConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 打印机ID */ + private Long printerId; + + /** 打印机类型 */ + @Excel(name = "打印机类型") + private String printerType; + + /** 打印机名称 */ + @Excel(name = "打印机名称") + private String printerName; + + /** 品牌 */ + @Excel(name = "品牌") + private String brand; + + /** 型号 */ + @Excel(name = "型号") + private String printerModel; + + /** 连接类型 */ + @Excel(name = "连接类型") + private String connectionType; + + /** 图片URL */ + @Excel(name = "图片URL") + private String printerUrl; + + /** 打印机IP */ + @Excel(name = "打印机IP") + private String printerIp; + + /** 打印机端口 */ + @Excel(name = "打印机端口") + private Long printerPort; + + /** 打印客户端SID */ + @Excel(name = "打印客户端SID") + private String clientSid; + + /** 打印客户端IP */ + @Excel(name = "打印客户端IP") + private String clientIp; + + /** 打印客户端端口 */ + @Excel(name = "打印客户端端口") + private Long clientPort; + + /** 启用状态 */ + @Excel(name = "启用状态") + private String enableFlag; + + /** 打印机状态 */ + @Excel(name = "打印机状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setPrinterId(Long printerId) + { + this.printerId = printerId; + } + + public Long getPrinterId() + { + return printerId; + } + public void setPrinterType(String printerType) + { + this.printerType = printerType; + } + + public String getPrinterType() + { + return printerType; + } + public void setPrinterName(String printerName) + { + this.printerName = printerName; + } + + public String getPrinterName() + { + return printerName; + } + public void setBrand(String brand) + { + this.brand = brand; + } + + public String getBrand() + { + return brand; + } + public void setPrinterModel(String printerModel) + { + this.printerModel = printerModel; + } + + public String getPrinterModel() + { + return printerModel; + } + public void setConnectionType(String connectionType) + { + this.connectionType = connectionType; + } + + public String getConnectionType() + { + return connectionType; + } + public void setPrinterUrl(String printerUrl) + { + this.printerUrl = printerUrl; + } + + public String getPrinterUrl() + { + return printerUrl; + } + public void setPrinterIp(String printerIp) + { + this.printerIp = printerIp; + } + + public String getPrinterIp() + { + return printerIp; + } + public void setPrinterPort(Long printerPort) + { + this.printerPort = printerPort; + } + + public Long getPrinterPort() + { + return printerPort; + } + public void setClientSid(String clientSid) + { + this.clientSid = clientSid; + } + + public String getClientSid() + { + return clientSid; + } + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public String getClientIp() + { + return clientIp; + } + public void setClientPort(Long clientPort) + { + this.clientPort = clientPort; + } + + public Long getClientPort() + { + return clientPort; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("printerId", getPrinterId()) + .append("printerType", getPrinterType()) + .append("printerName", getPrinterName()) + .append("brand", getBrand()) + .append("printerModel", getPrinterModel()) + .append("connectionType", getConnectionType()) + .append("printerUrl", getPrinterUrl()) + .append("printerIp", getPrinterIp()) + .append("printerPort", getPrinterPort()) + .append("clientSid", getClientSid()) + .append("clientIp", getClientIp()) + .append("clientPort", getClientPort()) + .append("enableFlag", getEnableFlag()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java b/ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java new file mode 100644 index 0000000..62d7569 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java @@ -0,0 +1,223 @@ +package com.ktg.print.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 打印模板配置对象 print_template + * + * @author yinjinlu + * @date 2024-04-17 + */ +public class PrintTemplate extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 模板ID */ + private Long templateId; + + /** 模板编号 */ + @Excel(name = "模板编号") + private String templateCode; + + /** 模板名称 */ + @Excel(name = "模板名称") + private String templateName; + + /** 模板类型 */ + @Excel(name = "模板类型") + private String templateType; + + /** 模板内容 */ + @Excel(name = "模板内容") + private String templateJson; + + private String paperType; + + private Integer templateWidth; + + private Integer templateHeight; + + /** 是否默认 */ + @Excel(name = "是否默认") + private String isDefault; + + /** 启用状态 */ + @Excel(name = "启用状态") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + /** $column.columnComment */ + @Excel(name = "启用状态") + private String templatePic; + + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + public void setTemplateCode(String templateCode) + { + this.templateCode = templateCode; + } + + public String getTemplateCode() + { + return templateCode; + } + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + public String getTemplateName() + { + return templateName; + } + public void setTemplateType(String templateType) + { + this.templateType = templateType; + } + + public String getTemplateType() + { + return templateType; + } + public void setTemplateJson(String templateJson) + { + this.templateJson = templateJson; + } + + public String getTemplateJson() + { + return templateJson; + } + + public String getPaperType() { + return paperType; + } + + public void setPaperType(String paperType) { + this.paperType = paperType; + } + + public Integer getTemplateWidth() { + return templateWidth; + } + + public void setTemplateWidth(Integer templateWidth) { + this.templateWidth = templateWidth; + } + + public Integer getTemplateHeight() { + return templateHeight; + } + + public void setTemplateHeight(Integer templateHeight) { + this.templateHeight = templateHeight; + } + + public void setIsDefault(String isDefault) + { + this.isDefault = isDefault; + } + + public String getIsDefault() + { + return isDefault; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + public void setTemplatePic(String templatePic) + { + this.templatePic = templatePic; + } + + public String getTemplatePic() + { + return templatePic; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("templateId", getTemplateId()) + .append("templateCode", getTemplateCode()) + .append("templateName", getTemplateName()) + .append("templateType", getTemplateType()) + .append("templateJson", getTemplateJson()) + .append("isDefault", getIsDefault()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("templatePic", getTemplatePic()) + .toString(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java b/ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java new file mode 100644 index 0000000..5ee8a11 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java @@ -0,0 +1,63 @@ +package com.ktg.print.mapper; + +import com.ktg.print.domain.PrintPrinterConfig; + +import java.util.List; + + +/** + * 打印机配置Mapper接口 + * + * @author yinjinlu + * @date 2023-09-01 + */ +public interface PrintPrinterConfigMapper +{ + /** + * 查询打印机配置 + * + * @param printerId 打印机配置主键 + * @return 打印机配置 + */ + public PrintPrinterConfig selectPrintPrinterConfigByPrinterId(Long printerId); + + /** + * 查询打印机配置列表 + * + * @param printPrinterConfig 打印机配置 + * @return 打印机配置集合 + */ + public List selectPrintPrinterConfigList(PrintPrinterConfig printPrinterConfig); + + /** + * 新增打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int insertPrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 修改打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int updatePrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 删除打印机配置 + * + * @param printerId 打印机配置主键 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterId(Long printerId); + + /** + * 批量删除打印机配置 + * + * @param printerIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterIds(Long[] printerIds); +} diff --git a/ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java b/ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java new file mode 100644 index 0000000..0162670 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java @@ -0,0 +1,61 @@ +package com.ktg.print.mapper; + +import java.util.List; +import com.ktg.print.domain.PrintTemplate; + +/** + * 打印模板配置Mapper接口 + * + * @author yinjinlu + * @date 2024-04-17 + */ +public interface PrintTemplateMapper +{ + /** + * 查询打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 打印模板配置 + */ + public PrintTemplate selectPrintTemplateByTemplateId(Long templateId); + + /** + * 查询打印模板配置列表 + * + * @param printTemplate 打印模板配置 + * @return 打印模板配置集合 + */ + public List selectPrintTemplateList(PrintTemplate printTemplate); + + /** + * 新增打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int insertPrintTemplate(PrintTemplate printTemplate); + + /** + * 修改打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int updatePrintTemplate(PrintTemplate printTemplate); + + /** + * 删除打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 结果 + */ + public int deletePrintTemplateByTemplateId(Long templateId); + + /** + * 批量删除打印模板配置 + * + * @param templateIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePrintTemplateByTemplateIds(Long[] templateIds); +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java new file mode 100644 index 0000000..7cea204 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java @@ -0,0 +1,35 @@ +package com.ktg.print.printserver; + +import com.ktg.print.protocol.PrintMessageProto; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.group.ChannelGroup; +import io.netty.channel.group.DefaultChannelGroup; +import io.netty.util.concurrent.GlobalEventExecutor; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +public class PrintClientInfoMessageHandler extends SimpleChannelInboundHandler { + + //接收到客户端发送的客户端信息后才会保存client信息 + private Map clients = new ConcurrentHashMap<>(); + private ChannelGroup group = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); + + @Override + protected void channelRead0(ChannelHandlerContext channelHandlerContext, PrintMessageProto.PrintClientInfoMessage clientInfoMessag) throws Exception { + if(!clients.containsKey(clientInfoMessag.getSid())){ + clients.put(clientInfoMessag.getSid(),channelHandlerContext.channel()); + } + channelHandlerContext.fireChannelRead(clientInfoMessag); + group.add(channelHandlerContext.channel()); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + group.remove(ctx.channel()); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java new file mode 100644 index 0000000..c5a9a3f --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java @@ -0,0 +1,30 @@ +package com.ktg.print.printserver; + +import com.ktg.print.protocol.PrintMessageProto; +import io.netty.channel.Channel; +import io.netty.channel.ChannelInitializer; +import io.netty.handler.codec.protobuf.ProtobufDecoder; +import io.netty.handler.codec.protobuf.ProtobufEncoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class PrintServerChannelInitializer extends ChannelInitializer { + @Autowired + private PrintServerDefaultHandler serverDefaultHandler; + + @Autowired + private PrintClientInfoMessageHandler printClientInfoMessageHandler; + + @Override + protected void initChannel(Channel ch) throws Exception { + ch.pipeline().addLast(new ProtobufVarint32FrameDecoder()); + ch.pipeline().addLast(new ProtobufDecoder(PrintMessageProto.PrintClientInfoMessage.getDefaultInstance())); + ch.pipeline().addLast(new ProtobufEncoder()); + ch.pipeline().addLast(new ProtobufVarint32LengthFieldPrepender()); + ch.pipeline().addLast(printClientInfoMessageHandler); + ch.pipeline().addLast(serverDefaultHandler); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java new file mode 100644 index 0000000..37290f6 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java @@ -0,0 +1,18 @@ +package com.ktg.print.printserver; + +import org.springframework.beans.factory.DisposableBean; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +public class PrintServerCloseListener implements DisposableBean { + + @Resource + private PrinterServer printerServer; + + @Override + public void destroy() throws Exception { + printerServer.stop(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java new file mode 100644 index 0000000..398a556 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java @@ -0,0 +1,70 @@ +package com.ktg.print.printserver; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.group.ChannelGroup; +import io.netty.channel.group.DefaultChannelGroup; +import io.netty.util.CharsetUtil; +import io.netty.util.concurrent.GlobalEventExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +@ChannelHandler.Sharable +public class PrintServerDefaultHandler extends ChannelInboundHandlerAdapter { + + private static final Logger logger = LoggerFactory.getLogger("PrinterServerHandler"); + + /** + * 客户端连接建立 + * @param ctx + * @throws Exception + */ + @Override + public void handlerAdded(ChannelHandlerContext ctx) throws Exception { + logger.info("打印机客户端已连接!"); + } + + /** + * 客户端连接移除 + * @param ctx + * @throws Exception + */ + @Override + public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { + logger.info("打印机客户端已断开!"); + } + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg){ + try{ + ByteBuf data = (ByteBuf) msg; + logger.info("msg recived:"+data.toString(CharsetUtil.UTF_8)); + + String replyMessage = "Server reply: " + data.toString(CharsetUtil.UTF_8)+"\n"; + ByteBuf replyByteBuf = ctx.alloc().buffer(); + replyByteBuf.writeBytes(replyMessage.getBytes()); + ctx.writeAndFlush(replyByteBuf); + }catch (Exception e){ + logger.error(e.getMessage()); + } + } + + /** + * 异常发生,关闭通道,移除客户端 + * @param ctx + * @param cause + * @throws Exception + */ + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + ctx.channel().close(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java new file mode 100644 index 0000000..14fbf04 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java @@ -0,0 +1,20 @@ +package com.ktg.print.printserver; + +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +public class PrintServerOpenListener implements ApplicationRunner { + + @Resource + private PrinterServer printerServer; + + @Override + public void run(ApplicationArguments args) throws Exception { + printerServer.start(); + } + +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java new file mode 100644 index 0000000..0bc9786 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java @@ -0,0 +1,67 @@ +package com.ktg.print.printserver; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.protobuf.ProtobufDecoder; +import io.netty.handler.codec.protobuf.ProtobufEncoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 基于netty的socket服务器端,与标签打印机的客户端建立长连接,实现网络远程打印 + */ +@Component +public class PrinterServer { + + @Autowired + private PrintServerChannelInitializer printServerChannelInitializer; + + @Value("${netty.server.port}") + private int port; + + @Value("${netty.server.threadcount}") + private int bossThreadCount; + + private EventLoopGroup bossGroup; + private EventLoopGroup workerGroup; + private Channel serverChannel; + + PrinterServer(){ + bossGroup = new NioEventLoopGroup(); + workerGroup = new NioEventLoopGroup(); + } + + public void start(){ + try { + ServerBootstrap serverBootstrap = new ServerBootstrap(); + serverBootstrap.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .childHandler(printServerChannelInitializer); + ChannelFuture channelFuture = serverBootstrap.bind(port).sync(); + serverChannel = channelFuture.channel(); + serverChannel.closeFuture().sync(); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + bossGroup.shutdownGracefully(); + workerGroup.shutdownGracefully(); + } + } + + public void stop(){ + if(serverChannel !=null){ + serverChannel.close(); + serverChannel = null; + } + } + +} diff --git a/ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java b/ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java new file mode 100644 index 0000000..0ab6a3b --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java @@ -0,0 +1,4082 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: PrintMessage.proto + +package com.ktg.print.protocol; + +public final class PrintMessageProto { + private PrintMessageProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface IQCPrintMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.IQCPrintMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + String getSampleCode(); + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + com.google.protobuf.ByteString + getSampleCodeBytes(); + + /** + * string qcObject = 2; + * @return The qcObject. + */ + String getQcObject(); + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + com.google.protobuf.ByteString + getQcObjectBytes(); + + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + String getSampleTime(); + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + com.google.protobuf.ByteString + getSampleTimeBytes(); + + /** + * string batchCode = 4; + * @return The batchCode. + */ + String getBatchCode(); + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + com.google.protobuf.ByteString + getBatchCodeBytes(); + } + /** + * Protobuf type {@code com.ktg.print.protocol.IQCPrintMessage} + */ + public static final class IQCPrintMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.IQCPrintMessage) + IQCPrintMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use IQCPrintMessage.newBuilder() to construct. + private IQCPrintMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private IQCPrintMessage() { + sampleCode_ = ""; + qcObject_ = ""; + sampleTime_ = ""; + batchCode_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new IQCPrintMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + IQCPrintMessage.class, Builder.class); + } + + public static final int SAMPLECODE_FIELD_NUMBER = 1; + private volatile Object sampleCode_; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + @Override + public String getSampleCode() { + Object ref = sampleCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + @Override + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QCOBJECT_FIELD_NUMBER = 2; + private volatile Object qcObject_; + /** + * string qcObject = 2; + * @return The qcObject. + */ + @Override + public String getQcObject() { + Object ref = qcObject_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + @Override + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLETIME_FIELD_NUMBER = 3; + private volatile Object sampleTime_; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + @Override + public String getSampleTime() { + Object ref = sampleTime_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + @Override + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCHCODE_FIELD_NUMBER = 4; + private volatile Object batchCode_; + /** + * string batchCode = 4; + * @return The batchCode. + */ + @Override + public String getBatchCode() { + Object ref = batchCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + @Override + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, batchCode_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, batchCode_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof IQCPrintMessage)) { + return super.equals(obj); + } + IQCPrintMessage other = (IQCPrintMessage) obj; + + if (!getSampleCode() + .equals(other.getSampleCode())) return false; + if (!getQcObject() + .equals(other.getQcObject())) return false; + if (!getSampleTime() + .equals(other.getSampleTime())) return false; + if (!getBatchCode() + .equals(other.getBatchCode())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SAMPLECODE_FIELD_NUMBER; + hash = (53 * hash) + getSampleCode().hashCode(); + hash = (37 * hash) + QCOBJECT_FIELD_NUMBER; + hash = (53 * hash) + getQcObject().hashCode(); + hash = (37 * hash) + SAMPLETIME_FIELD_NUMBER; + hash = (53 * hash) + getSampleTime().hashCode(); + hash = (37 * hash) + BATCHCODE_FIELD_NUMBER; + hash = (53 * hash) + getBatchCode().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static IQCPrintMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IQCPrintMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IQCPrintMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IQCPrintMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IQCPrintMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static IQCPrintMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static IQCPrintMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static IQCPrintMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(IQCPrintMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.ktg.print.protocol.IQCPrintMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.IQCPrintMessage) + IQCPrintMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + IQCPrintMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.IQCPrintMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + sampleCode_ = ""; + + qcObject_ = ""; + + sampleTime_ = ""; + + batchCode_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + } + + @Override + public IQCPrintMessage getDefaultInstanceForType() { + return IQCPrintMessage.getDefaultInstance(); + } + + @Override + public IQCPrintMessage build() { + IQCPrintMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public IQCPrintMessage buildPartial() { + IQCPrintMessage result = new IQCPrintMessage(this); + result.sampleCode_ = sampleCode_; + result.qcObject_ = qcObject_; + result.sampleTime_ = sampleTime_; + result.batchCode_ = batchCode_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof IQCPrintMessage) { + return mergeFrom((IQCPrintMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(IQCPrintMessage other) { + if (other == IQCPrintMessage.getDefaultInstance()) return this; + if (!other.getSampleCode().isEmpty()) { + sampleCode_ = other.sampleCode_; + onChanged(); + } + if (!other.getQcObject().isEmpty()) { + qcObject_ = other.qcObject_; + onChanged(); + } + if (!other.getSampleTime().isEmpty()) { + sampleTime_ = other.sampleTime_; + onChanged(); + } + if (!other.getBatchCode().isEmpty()) { + batchCode_ = other.batchCode_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + sampleCode_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + qcObject_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sampleTime_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: { + batchCode_ = input.readStringRequireUtf8(); + + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object sampleCode_ = ""; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + public String getSampleCode() { + Object ref = sampleCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleCode = 1; + * @param value The sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleCode_ = value; + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @return This builder for chaining. + */ + public Builder clearSampleCode() { + + sampleCode_ = getDefaultInstance().getSampleCode(); + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @param value The bytes for sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleCode_ = value; + onChanged(); + return this; + } + + private Object qcObject_ = ""; + /** + * string qcObject = 2; + * @return The qcObject. + */ + public String getQcObject() { + Object ref = qcObject_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string qcObject = 2; + * @param value The qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObject( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + qcObject_ = value; + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @return This builder for chaining. + */ + public Builder clearQcObject() { + + qcObject_ = getDefaultInstance().getQcObject(); + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @param value The bytes for qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + qcObject_ = value; + onChanged(); + return this; + } + + private Object sampleTime_ = ""; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + public String getSampleTime() { + Object ref = sampleTime_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleTime = 3; + * @param value The sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTime( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleTime_ = value; + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @return This builder for chaining. + */ + public Builder clearSampleTime() { + + sampleTime_ = getDefaultInstance().getSampleTime(); + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @param value The bytes for sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTimeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleTime_ = value; + onChanged(); + return this; + } + + private Object batchCode_ = ""; + /** + * string batchCode = 4; + * @return The batchCode. + */ + public String getBatchCode() { + Object ref = batchCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string batchCode = 4; + * @param value The batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + batchCode_ = value; + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @return This builder for chaining. + */ + public Builder clearBatchCode() { + + batchCode_ = getDefaultInstance().getBatchCode(); + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @param value The bytes for batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + batchCode_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.IQCPrintMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.IQCPrintMessage) + private static final IQCPrintMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new IQCPrintMessage(); + } + + public static IQCPrintMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public IQCPrintMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public IQCPrintMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface PQCPrintMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.PQCPrintMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + String getSampleCode(); + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + com.google.protobuf.ByteString + getSampleCodeBytes(); + + /** + * string qcObject = 2; + * @return The qcObject. + */ + String getQcObject(); + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + com.google.protobuf.ByteString + getQcObjectBytes(); + + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + String getSampleTime(); + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + com.google.protobuf.ByteString + getSampleTimeBytes(); + + /** + * string sampleLocation = 4; + * @return The sampleLocation. + */ + String getSampleLocation(); + /** + * string sampleLocation = 4; + * @return The bytes for sampleLocation. + */ + com.google.protobuf.ByteString + getSampleLocationBytes(); + } + /** + * Protobuf type {@code com.ktg.print.protocol.PQCPrintMessage} + */ + public static final class PQCPrintMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.PQCPrintMessage) + PQCPrintMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use PQCPrintMessage.newBuilder() to construct. + private PQCPrintMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PQCPrintMessage() { + sampleCode_ = ""; + qcObject_ = ""; + sampleTime_ = ""; + sampleLocation_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new PQCPrintMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PQCPrintMessage.class, Builder.class); + } + + public static final int SAMPLECODE_FIELD_NUMBER = 1; + private volatile Object sampleCode_; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + @Override + public String getSampleCode() { + Object ref = sampleCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + @Override + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QCOBJECT_FIELD_NUMBER = 2; + private volatile Object qcObject_; + /** + * string qcObject = 2; + * @return The qcObject. + */ + @Override + public String getQcObject() { + Object ref = qcObject_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + @Override + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLETIME_FIELD_NUMBER = 3; + private volatile Object sampleTime_; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + @Override + public String getSampleTime() { + Object ref = sampleTime_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + @Override + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLELOCATION_FIELD_NUMBER = 4; + private volatile Object sampleLocation_; + /** + * string sampleLocation = 4; + * @return The sampleLocation. + */ + @Override + public String getSampleLocation() { + Object ref = sampleLocation_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleLocation_ = s; + return s; + } + } + /** + * string sampleLocation = 4; + * @return The bytes for sampleLocation. + */ + @Override + public com.google.protobuf.ByteString + getSampleLocationBytes() { + Object ref = sampleLocation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleLocation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleLocation_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, sampleLocation_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleLocation_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, sampleLocation_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof PQCPrintMessage)) { + return super.equals(obj); + } + PQCPrintMessage other = (PQCPrintMessage) obj; + + if (!getSampleCode() + .equals(other.getSampleCode())) return false; + if (!getQcObject() + .equals(other.getQcObject())) return false; + if (!getSampleTime() + .equals(other.getSampleTime())) return false; + if (!getSampleLocation() + .equals(other.getSampleLocation())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SAMPLECODE_FIELD_NUMBER; + hash = (53 * hash) + getSampleCode().hashCode(); + hash = (37 * hash) + QCOBJECT_FIELD_NUMBER; + hash = (53 * hash) + getQcObject().hashCode(); + hash = (37 * hash) + SAMPLETIME_FIELD_NUMBER; + hash = (53 * hash) + getSampleTime().hashCode(); + hash = (37 * hash) + SAMPLELOCATION_FIELD_NUMBER; + hash = (53 * hash) + getSampleLocation().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static PQCPrintMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PQCPrintMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PQCPrintMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PQCPrintMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PQCPrintMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PQCPrintMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static PQCPrintMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static PQCPrintMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(PQCPrintMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.ktg.print.protocol.PQCPrintMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.PQCPrintMessage) + PQCPrintMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PQCPrintMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.PQCPrintMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + sampleCode_ = ""; + + qcObject_ = ""; + + sampleTime_ = ""; + + sampleLocation_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + } + + @Override + public PQCPrintMessage getDefaultInstanceForType() { + return PQCPrintMessage.getDefaultInstance(); + } + + @Override + public PQCPrintMessage build() { + PQCPrintMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public PQCPrintMessage buildPartial() { + PQCPrintMessage result = new PQCPrintMessage(this); + result.sampleCode_ = sampleCode_; + result.qcObject_ = qcObject_; + result.sampleTime_ = sampleTime_; + result.sampleLocation_ = sampleLocation_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof PQCPrintMessage) { + return mergeFrom((PQCPrintMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(PQCPrintMessage other) { + if (other == PQCPrintMessage.getDefaultInstance()) return this; + if (!other.getSampleCode().isEmpty()) { + sampleCode_ = other.sampleCode_; + onChanged(); + } + if (!other.getQcObject().isEmpty()) { + qcObject_ = other.qcObject_; + onChanged(); + } + if (!other.getSampleTime().isEmpty()) { + sampleTime_ = other.sampleTime_; + onChanged(); + } + if (!other.getSampleLocation().isEmpty()) { + sampleLocation_ = other.sampleLocation_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + sampleCode_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + qcObject_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sampleTime_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: { + sampleLocation_ = input.readStringRequireUtf8(); + + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object sampleCode_ = ""; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + public String getSampleCode() { + Object ref = sampleCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleCode = 1; + * @param value The sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleCode_ = value; + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @return This builder for chaining. + */ + public Builder clearSampleCode() { + + sampleCode_ = getDefaultInstance().getSampleCode(); + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @param value The bytes for sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleCode_ = value; + onChanged(); + return this; + } + + private Object qcObject_ = ""; + /** + * string qcObject = 2; + * @return The qcObject. + */ + public String getQcObject() { + Object ref = qcObject_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string qcObject = 2; + * @param value The qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObject( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + qcObject_ = value; + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @return This builder for chaining. + */ + public Builder clearQcObject() { + + qcObject_ = getDefaultInstance().getQcObject(); + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @param value The bytes for qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + qcObject_ = value; + onChanged(); + return this; + } + + private Object sampleTime_ = ""; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + public String getSampleTime() { + Object ref = sampleTime_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleTime = 3; + * @param value The sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTime( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleTime_ = value; + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @return This builder for chaining. + */ + public Builder clearSampleTime() { + + sampleTime_ = getDefaultInstance().getSampleTime(); + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @param value The bytes for sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTimeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleTime_ = value; + onChanged(); + return this; + } + + private Object sampleLocation_ = ""; + /** + * string sampleLocation = 4; + * @return The sampleLocation. + */ + public String getSampleLocation() { + Object ref = sampleLocation_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleLocation_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleLocation = 4; + * @return The bytes for sampleLocation. + */ + public com.google.protobuf.ByteString + getSampleLocationBytes() { + Object ref = sampleLocation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleLocation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleLocation = 4; + * @param value The sampleLocation to set. + * @return This builder for chaining. + */ + public Builder setSampleLocation( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleLocation_ = value; + onChanged(); + return this; + } + /** + * string sampleLocation = 4; + * @return This builder for chaining. + */ + public Builder clearSampleLocation() { + + sampleLocation_ = getDefaultInstance().getSampleLocation(); + onChanged(); + return this; + } + /** + * string sampleLocation = 4; + * @param value The bytes for sampleLocation to set. + * @return This builder for chaining. + */ + public Builder setSampleLocationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleLocation_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.PQCPrintMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.PQCPrintMessage) + private static final PQCPrintMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new PQCPrintMessage(); + } + + public static PQCPrintMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public PQCPrintMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public PQCPrintMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface OQCPrintMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.OQCPrintMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + String getSampleCode(); + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + com.google.protobuf.ByteString + getSampleCodeBytes(); + + /** + * string qcObject = 2; + * @return The qcObject. + */ + String getQcObject(); + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + com.google.protobuf.ByteString + getQcObjectBytes(); + + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + String getSampleTime(); + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + com.google.protobuf.ByteString + getSampleTimeBytes(); + + /** + * string batchCode = 4; + * @return The batchCode. + */ + String getBatchCode(); + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + com.google.protobuf.ByteString + getBatchCodeBytes(); + + /** + * string packageType = 5; + * @return The packageType. + */ + String getPackageType(); + /** + * string packageType = 5; + * @return The bytes for packageType. + */ + com.google.protobuf.ByteString + getPackageTypeBytes(); + } + /** + * Protobuf type {@code com.ktg.print.protocol.OQCPrintMessage} + */ + public static final class OQCPrintMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.OQCPrintMessage) + OQCPrintMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use OQCPrintMessage.newBuilder() to construct. + private OQCPrintMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private OQCPrintMessage() { + sampleCode_ = ""; + qcObject_ = ""; + sampleTime_ = ""; + batchCode_ = ""; + packageType_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new OQCPrintMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + OQCPrintMessage.class, Builder.class); + } + + public static final int SAMPLECODE_FIELD_NUMBER = 1; + private volatile Object sampleCode_; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + @Override + public String getSampleCode() { + Object ref = sampleCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + @Override + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QCOBJECT_FIELD_NUMBER = 2; + private volatile Object qcObject_; + /** + * string qcObject = 2; + * @return The qcObject. + */ + @Override + public String getQcObject() { + Object ref = qcObject_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + @Override + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLETIME_FIELD_NUMBER = 3; + private volatile Object sampleTime_; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + @Override + public String getSampleTime() { + Object ref = sampleTime_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + @Override + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCHCODE_FIELD_NUMBER = 4; + private volatile Object batchCode_; + /** + * string batchCode = 4; + * @return The batchCode. + */ + @Override + public String getBatchCode() { + Object ref = batchCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + @Override + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PACKAGETYPE_FIELD_NUMBER = 5; + private volatile Object packageType_; + /** + * string packageType = 5; + * @return The packageType. + */ + @Override + public String getPackageType() { + Object ref = packageType_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + packageType_ = s; + return s; + } + } + /** + * string packageType = 5; + * @return The bytes for packageType. + */ + @Override + public com.google.protobuf.ByteString + getPackageTypeBytes() { + Object ref = packageType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + packageType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, batchCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(packageType_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, packageType_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, batchCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(packageType_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, packageType_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof OQCPrintMessage)) { + return super.equals(obj); + } + OQCPrintMessage other = (OQCPrintMessage) obj; + + if (!getSampleCode() + .equals(other.getSampleCode())) return false; + if (!getQcObject() + .equals(other.getQcObject())) return false; + if (!getSampleTime() + .equals(other.getSampleTime())) return false; + if (!getBatchCode() + .equals(other.getBatchCode())) return false; + if (!getPackageType() + .equals(other.getPackageType())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SAMPLECODE_FIELD_NUMBER; + hash = (53 * hash) + getSampleCode().hashCode(); + hash = (37 * hash) + QCOBJECT_FIELD_NUMBER; + hash = (53 * hash) + getQcObject().hashCode(); + hash = (37 * hash) + SAMPLETIME_FIELD_NUMBER; + hash = (53 * hash) + getSampleTime().hashCode(); + hash = (37 * hash) + BATCHCODE_FIELD_NUMBER; + hash = (53 * hash) + getBatchCode().hashCode(); + hash = (37 * hash) + PACKAGETYPE_FIELD_NUMBER; + hash = (53 * hash) + getPackageType().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static OQCPrintMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static OQCPrintMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static OQCPrintMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static OQCPrintMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static OQCPrintMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static OQCPrintMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static OQCPrintMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static OQCPrintMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(OQCPrintMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.ktg.print.protocol.OQCPrintMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.OQCPrintMessage) + OQCPrintMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + OQCPrintMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.OQCPrintMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + sampleCode_ = ""; + + qcObject_ = ""; + + sampleTime_ = ""; + + batchCode_ = ""; + + packageType_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + } + + @Override + public OQCPrintMessage getDefaultInstanceForType() { + return OQCPrintMessage.getDefaultInstance(); + } + + @Override + public OQCPrintMessage build() { + OQCPrintMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public OQCPrintMessage buildPartial() { + OQCPrintMessage result = new OQCPrintMessage(this); + result.sampleCode_ = sampleCode_; + result.qcObject_ = qcObject_; + result.sampleTime_ = sampleTime_; + result.batchCode_ = batchCode_; + result.packageType_ = packageType_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof OQCPrintMessage) { + return mergeFrom((OQCPrintMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(OQCPrintMessage other) { + if (other == OQCPrintMessage.getDefaultInstance()) return this; + if (!other.getSampleCode().isEmpty()) { + sampleCode_ = other.sampleCode_; + onChanged(); + } + if (!other.getQcObject().isEmpty()) { + qcObject_ = other.qcObject_; + onChanged(); + } + if (!other.getSampleTime().isEmpty()) { + sampleTime_ = other.sampleTime_; + onChanged(); + } + if (!other.getBatchCode().isEmpty()) { + batchCode_ = other.batchCode_; + onChanged(); + } + if (!other.getPackageType().isEmpty()) { + packageType_ = other.packageType_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + sampleCode_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + qcObject_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sampleTime_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: { + batchCode_ = input.readStringRequireUtf8(); + + break; + } // case 34 + case 42: { + packageType_ = input.readStringRequireUtf8(); + + break; + } // case 42 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object sampleCode_ = ""; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + public String getSampleCode() { + Object ref = sampleCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleCode = 1; + * @param value The sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleCode_ = value; + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @return This builder for chaining. + */ + public Builder clearSampleCode() { + + sampleCode_ = getDefaultInstance().getSampleCode(); + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @param value The bytes for sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleCode_ = value; + onChanged(); + return this; + } + + private Object qcObject_ = ""; + /** + * string qcObject = 2; + * @return The qcObject. + */ + public String getQcObject() { + Object ref = qcObject_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string qcObject = 2; + * @param value The qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObject( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + qcObject_ = value; + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @return This builder for chaining. + */ + public Builder clearQcObject() { + + qcObject_ = getDefaultInstance().getQcObject(); + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @param value The bytes for qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + qcObject_ = value; + onChanged(); + return this; + } + + private Object sampleTime_ = ""; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + public String getSampleTime() { + Object ref = sampleTime_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleTime = 3; + * @param value The sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTime( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleTime_ = value; + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @return This builder for chaining. + */ + public Builder clearSampleTime() { + + sampleTime_ = getDefaultInstance().getSampleTime(); + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @param value The bytes for sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTimeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleTime_ = value; + onChanged(); + return this; + } + + private Object batchCode_ = ""; + /** + * string batchCode = 4; + * @return The batchCode. + */ + public String getBatchCode() { + Object ref = batchCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string batchCode = 4; + * @param value The batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + batchCode_ = value; + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @return This builder for chaining. + */ + public Builder clearBatchCode() { + + batchCode_ = getDefaultInstance().getBatchCode(); + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @param value The bytes for batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + batchCode_ = value; + onChanged(); + return this; + } + + private Object packageType_ = ""; + /** + * string packageType = 5; + * @return The packageType. + */ + public String getPackageType() { + Object ref = packageType_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + packageType_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string packageType = 5; + * @return The bytes for packageType. + */ + public com.google.protobuf.ByteString + getPackageTypeBytes() { + Object ref = packageType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + packageType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string packageType = 5; + * @param value The packageType to set. + * @return This builder for chaining. + */ + public Builder setPackageType( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + packageType_ = value; + onChanged(); + return this; + } + /** + * string packageType = 5; + * @return This builder for chaining. + */ + public Builder clearPackageType() { + + packageType_ = getDefaultInstance().getPackageType(); + onChanged(); + return this; + } + /** + * string packageType = 5; + * @param value The bytes for packageType to set. + * @return This builder for chaining. + */ + public Builder setPackageTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + packageType_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.OQCPrintMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.OQCPrintMessage) + private static final OQCPrintMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new OQCPrintMessage(); + } + + public static OQCPrintMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public OQCPrintMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public OQCPrintMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface PrintClientInfoMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.PrintClientInfoMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string ip = 1; + * @return The ip. + */ + String getIp(); + /** + * string ip = 1; + * @return The bytes for ip. + */ + com.google.protobuf.ByteString + getIpBytes(); + + /** + * string location = 2; + * @return The location. + */ + String getLocation(); + /** + * string location = 2; + * @return The bytes for location. + */ + com.google.protobuf.ByteString + getLocationBytes(); + + /** + * string sid = 3; + * @return The sid. + */ + String getSid(); + /** + * string sid = 3; + * @return The bytes for sid. + */ + com.google.protobuf.ByteString + getSidBytes(); + } + /** + *
+   *客户端信息
+   * 
+ * + * Protobuf type {@code com.ktg.print.protocol.PrintClientInfoMessage} + */ + public static final class PrintClientInfoMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.PrintClientInfoMessage) + PrintClientInfoMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use PrintClientInfoMessage.newBuilder() to construct. + private PrintClientInfoMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PrintClientInfoMessage() { + ip_ = ""; + location_ = ""; + sid_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new PrintClientInfoMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PrintClientInfoMessage.class, Builder.class); + } + + public static final int IP_FIELD_NUMBER = 1; + private volatile Object ip_; + /** + * string ip = 1; + * @return The ip. + */ + @Override + public String getIp() { + Object ref = ip_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + ip_ = s; + return s; + } + } + /** + * string ip = 1; + * @return The bytes for ip. + */ + @Override + public com.google.protobuf.ByteString + getIpBytes() { + Object ref = ip_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + ip_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOCATION_FIELD_NUMBER = 2; + private volatile Object location_; + /** + * string location = 2; + * @return The location. + */ + @Override + public String getLocation() { + Object ref = location_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + * string location = 2; + * @return The bytes for location. + */ + @Override + public com.google.protobuf.ByteString + getLocationBytes() { + Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SID_FIELD_NUMBER = 3; + private volatile Object sid_; + /** + * string sid = 3; + * @return The sid. + */ + @Override + public String getSid() { + Object ref = sid_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sid_ = s; + return s; + } + } + /** + * string sid = 3; + * @return The bytes for sid. + */ + @Override + public com.google.protobuf.ByteString + getSidBytes() { + Object ref = sid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ip_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ip_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, location_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sid_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ip_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, ip_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, location_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sid_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof PrintClientInfoMessage)) { + return super.equals(obj); + } + PrintClientInfoMessage other = (PrintClientInfoMessage) obj; + + if (!getIp() + .equals(other.getIp())) return false; + if (!getLocation() + .equals(other.getLocation())) return false; + if (!getSid() + .equals(other.getSid())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + IP_FIELD_NUMBER; + hash = (53 * hash) + getIp().hashCode(); + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + hash = (37 * hash) + SID_FIELD_NUMBER; + hash = (53 * hash) + getSid().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static PrintClientInfoMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PrintClientInfoMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PrintClientInfoMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PrintClientInfoMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static PrintClientInfoMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static PrintClientInfoMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(PrintClientInfoMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     *客户端信息
+     * 
+ * + * Protobuf type {@code com.ktg.print.protocol.PrintClientInfoMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.PrintClientInfoMessage) + PrintClientInfoMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PrintClientInfoMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.PrintClientInfoMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + ip_ = ""; + + location_ = ""; + + sid_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + } + + @Override + public PrintClientInfoMessage getDefaultInstanceForType() { + return PrintClientInfoMessage.getDefaultInstance(); + } + + @Override + public PrintClientInfoMessage build() { + PrintClientInfoMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public PrintClientInfoMessage buildPartial() { + PrintClientInfoMessage result = new PrintClientInfoMessage(this); + result.ip_ = ip_; + result.location_ = location_; + result.sid_ = sid_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof PrintClientInfoMessage) { + return mergeFrom((PrintClientInfoMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(PrintClientInfoMessage other) { + if (other == PrintClientInfoMessage.getDefaultInstance()) return this; + if (!other.getIp().isEmpty()) { + ip_ = other.ip_; + onChanged(); + } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + onChanged(); + } + if (!other.getSid().isEmpty()) { + sid_ = other.sid_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + ip_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + location_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sid_ = input.readStringRequireUtf8(); + + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object ip_ = ""; + /** + * string ip = 1; + * @return The ip. + */ + public String getIp() { + Object ref = ip_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + ip_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string ip = 1; + * @return The bytes for ip. + */ + public com.google.protobuf.ByteString + getIpBytes() { + Object ref = ip_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + ip_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string ip = 1; + * @param value The ip to set. + * @return This builder for chaining. + */ + public Builder setIp( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + ip_ = value; + onChanged(); + return this; + } + /** + * string ip = 1; + * @return This builder for chaining. + */ + public Builder clearIp() { + + ip_ = getDefaultInstance().getIp(); + onChanged(); + return this; + } + /** + * string ip = 1; + * @param value The bytes for ip to set. + * @return This builder for chaining. + */ + public Builder setIpBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + ip_ = value; + onChanged(); + return this; + } + + private Object location_ = ""; + /** + * string location = 2; + * @return The location. + */ + public String getLocation() { + Object ref = location_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string location = 2; + * @return The bytes for location. + */ + public com.google.protobuf.ByteString + getLocationBytes() { + Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string location = 2; + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + location_ = value; + onChanged(); + return this; + } + /** + * string location = 2; + * @return This builder for chaining. + */ + public Builder clearLocation() { + + location_ = getDefaultInstance().getLocation(); + onChanged(); + return this; + } + /** + * string location = 2; + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + location_ = value; + onChanged(); + return this; + } + + private Object sid_ = ""; + /** + * string sid = 3; + * @return The sid. + */ + public String getSid() { + Object ref = sid_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sid_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sid = 3; + * @return The bytes for sid. + */ + public com.google.protobuf.ByteString + getSidBytes() { + Object ref = sid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sid = 3; + * @param value The sid to set. + * @return This builder for chaining. + */ + public Builder setSid( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sid_ = value; + onChanged(); + return this; + } + /** + * string sid = 3; + * @return This builder for chaining. + */ + public Builder clearSid() { + + sid_ = getDefaultInstance().getSid(); + onChanged(); + return this; + } + /** + * string sid = 3; + * @param value The bytes for sid to set. + * @return This builder for chaining. + */ + public Builder setSidBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sid_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.PrintClientInfoMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.PrintClientInfoMessage) + private static final PrintClientInfoMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new PrintClientInfoMessage(); + } + + public static PrintClientInfoMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public PrintClientInfoMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public PrintClientInfoMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + String[] descriptorData = { + "\n\022PrintMessage.proto\022\026com.ktg.print.prot" + + "ocol\"^\n\017IQCPrintMessage\022\022\n\nsampleCode\030\001 " + + "\001(\t\022\020\n\010qcObject\030\002 \001(\t\022\022\n\nsampleTime\030\003 \001(" + + "\t\022\021\n\tbatchCode\030\004 \001(\t\"c\n\017PQCPrintMessage\022" + + "\022\n\nsampleCode\030\001 \001(\t\022\020\n\010qcObject\030\002 \001(\t\022\022\n" + + "\nsampleTime\030\003 \001(\t\022\026\n\016sampleLocation\030\004 \001(" + + "\t\"s\n\017OQCPrintMessage\022\022\n\nsampleCode\030\001 \001(\t" + + "\022\020\n\010qcObject\030\002 \001(\t\022\022\n\nsampleTime\030\003 \001(\t\022\021" + + "\n\tbatchCode\030\004 \001(\t\022\023\n\013packageType\030\005 \001(\t\"C" + + "\n\026PrintClientInfoMessage\022\n\n\002ip\030\001 \001(\t\022\020\n\010" + + "location\030\002 \001(\t\022\013\n\003sid\030\003 \001(\tB+\n\026com.ktg.p" + + "rint.protocolB\021PrintMessageProtob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor, + new String[] { "SampleCode", "QcObject", "SampleTime", "BatchCode", }); + internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor, + new String[] { "SampleCode", "QcObject", "SampleTime", "SampleLocation", }); + internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor, + new String[] { "SampleCode", "QcObject", "SampleTime", "BatchCode", "PackageType", }); + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor, + new String[] { "Ip", "Location", "Sid", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto b/ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto new file mode 100644 index 0000000..41895da --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package com.ktg.print.protocol; + +option java_package = "com.ktg.print.protocol"; + +option java_outer_classname = "PrintMessageProto"; + +message IQCPrintMessage { + string sampleCode = 1; + string qcObject = 2; + string sampleTime = 3; + string batchCode = 4; +} + +message PQCPrintMessage { + string sampleCode = 1; + string qcObject = 2; + string sampleTime = 3; + string sampleLocation = 4; +} + +message OQCPrintMessage { + string sampleCode = 1; + string qcObject = 2; + string sampleTime = 3; + string batchCode = 4; + string packageType = 5; +} + +//客户端信息 +message PrintClientInfoMessage { + string ip = 1; + string location = 2; + string sid = 3; +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java b/ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java new file mode 100644 index 0000000..5eb9694 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java @@ -0,0 +1,62 @@ +package com.ktg.print.service; + +import com.ktg.print.domain.PrintPrinterConfig; + +import java.util.List; + +/** + * 打印机配置Service接口 + * + * @author yinjinlu + * @date 2023-09-01 + */ +public interface IPrintPrinterConfigService +{ + /** + * 查询打印机配置 + * + * @param printerId 打印机配置主键 + * @return 打印机配置 + */ + public PrintPrinterConfig selectPrintPrinterConfigByPrinterId(Long printerId); + + /** + * 查询打印机配置列表 + * + * @param printPrinterConfig 打印机配置 + * @return 打印机配置集合 + */ + public List selectPrintPrinterConfigList(PrintPrinterConfig printPrinterConfig); + + /** + * 新增打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int insertPrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 修改打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int updatePrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 批量删除打印机配置 + * + * @param printerIds 需要删除的打印机配置主键集合 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterIds(Long[] printerIds); + + /** + * 删除打印机配置信息 + * + * @param printerId 打印机配置主键 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterId(Long printerId); +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java b/ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java new file mode 100644 index 0000000..f82fc76 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java @@ -0,0 +1,61 @@ +package com.ktg.print.service; + +import java.util.List; +import com.ktg.print.domain.PrintTemplate; + +/** + * 打印模板配置Service接口 + * + * @author yinjinlu + * @date 2024-04-17 + */ +public interface IPrintTemplateService +{ + /** + * 查询打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 打印模板配置 + */ + public PrintTemplate selectPrintTemplateByTemplateId(Long templateId); + + /** + * 查询打印模板配置列表 + * + * @param printTemplate 打印模板配置 + * @return 打印模板配置集合 + */ + public List selectPrintTemplateList(PrintTemplate printTemplate); + + /** + * 新增打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int insertPrintTemplate(PrintTemplate printTemplate); + + /** + * 修改打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int updatePrintTemplate(PrintTemplate printTemplate); + + /** + * 批量删除打印模板配置 + * + * @param templateIds 需要删除的打印模板配置主键集合 + * @return 结果 + */ + public int deletePrintTemplateByTemplateIds(Long[] templateIds); + + /** + * 删除打印模板配置信息 + * + * @param templateId 打印模板配置主键 + * @return 结果 + */ + public int deletePrintTemplateByTemplateId(Long templateId); +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java new file mode 100644 index 0000000..f2ce98f --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.print.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import com.ktg.print.domain.PrintPrinterConfig; +import com.ktg.print.mapper.PrintPrinterConfigMapper; +import com.ktg.print.service.IPrintPrinterConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 打印机配置Service业务层处理 + * + * @author yinjinlu + * @date 2023-09-01 + */ +@Service +public class PrintPrinterConfigServiceImpl implements IPrintPrinterConfigService +{ + @Autowired + private PrintPrinterConfigMapper printPrinterConfigMapper; + + /** + * 查询打印机配置 + * + * @param printerId 打印机配置主键 + * @return 打印机配置 + */ + @Override + public PrintPrinterConfig selectPrintPrinterConfigByPrinterId(Long printerId) + { + return printPrinterConfigMapper.selectPrintPrinterConfigByPrinterId(printerId); + } + + /** + * 查询打印机配置列表 + * + * @param printPrinterConfig 打印机配置 + * @return 打印机配置 + */ + @Override + public List selectPrintPrinterConfigList(PrintPrinterConfig printPrinterConfig) + { + return printPrinterConfigMapper.selectPrintPrinterConfigList(printPrinterConfig); + } + + /** + * 新增打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + @Override + public int insertPrintPrinterConfig(PrintPrinterConfig printPrinterConfig) + { + printPrinterConfig.setCreateTime(DateUtils.getNowDate()); + return printPrinterConfigMapper.insertPrintPrinterConfig(printPrinterConfig); + } + + /** + * 修改打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + @Override + public int updatePrintPrinterConfig(PrintPrinterConfig printPrinterConfig) + { + printPrinterConfig.setUpdateTime(DateUtils.getNowDate()); + return printPrinterConfigMapper.updatePrintPrinterConfig(printPrinterConfig); + } + + /** + * 批量删除打印机配置 + * + * @param printerIds 需要删除的打印机配置主键 + * @return 结果 + */ + @Override + public int deletePrintPrinterConfigByPrinterIds(Long[] printerIds) + { + return printPrinterConfigMapper.deletePrintPrinterConfigByPrinterIds(printerIds); + } + + /** + * 删除打印机配置信息 + * + * @param printerId 打印机配置主键 + * @return 结果 + */ + @Override + public int deletePrintPrinterConfigByPrinterId(Long printerId) + { + return printPrinterConfigMapper.deletePrintPrinterConfigByPrinterId(printerId); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java new file mode 100644 index 0000000..d1f52f6 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.print.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.print.mapper.PrintTemplateMapper; +import com.ktg.print.domain.PrintTemplate; +import com.ktg.print.service.IPrintTemplateService; + +/** + * 打印模板配置Service业务层处理 + * + * @author yinjinlu + * @date 2024-04-17 + */ +@Service +public class PrintTemplateServiceImpl implements IPrintTemplateService +{ + @Autowired + private PrintTemplateMapper printTemplateMapper; + + /** + * 查询打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 打印模板配置 + */ + @Override + public PrintTemplate selectPrintTemplateByTemplateId(Long templateId) + { + return printTemplateMapper.selectPrintTemplateByTemplateId(templateId); + } + + /** + * 查询打印模板配置列表 + * + * @param printTemplate 打印模板配置 + * @return 打印模板配置 + */ + @Override + public List selectPrintTemplateList(PrintTemplate printTemplate) + { + return printTemplateMapper.selectPrintTemplateList(printTemplate); + } + + /** + * 新增打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + @Override + public int insertPrintTemplate(PrintTemplate printTemplate) + { + printTemplate.setCreateTime(DateUtils.getNowDate()); + return printTemplateMapper.insertPrintTemplate(printTemplate); + } + + /** + * 修改打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + @Override + public int updatePrintTemplate(PrintTemplate printTemplate) + { + printTemplate.setUpdateTime(DateUtils.getNowDate()); + return printTemplateMapper.updatePrintTemplate(printTemplate); + } + + /** + * 批量删除打印模板配置 + * + * @param templateIds 需要删除的打印模板配置主键 + * @return 结果 + */ + @Override + public int deletePrintTemplateByTemplateIds(Long[] templateIds) + { + return printTemplateMapper.deletePrintTemplateByTemplateIds(templateIds); + } + + /** + * 删除打印模板配置信息 + * + * @param templateId 打印模板配置主键 + * @return 结果 + */ + @Override + public int deletePrintTemplateByTemplateId(Long templateId) + { + return printTemplateMapper.deletePrintTemplateByTemplateId(templateId); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java b/ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java new file mode 100644 index 0000000..a3c6488 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java @@ -0,0 +1,9 @@ +package com.ktg.print.util; + +/** + * 负责将模板内容转换为具体的标签打印机协议 + */ +public class ContentConverter { + + +} diff --git a/ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml b/ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml new file mode 100644 index 0000000..903756e --- /dev/null +++ b/ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select printer_id, printer_type, printer_name, brand, printer_model, connection_type, printer_url, printer_ip, printer_port, client_sid, client_ip, client_port, enable_flag, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from print_printer_config + + + + + + + + insert into print_printer_config + + printer_type, + printer_name, + brand, + printer_model, + connection_type, + printer_url, + printer_ip, + printer_port, + client_sid, + client_ip, + client_port, + enable_flag, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{printerType}, + #{printerName}, + #{brand}, + #{printerModel}, + #{connectionType}, + #{printerUrl}, + #{printerIp}, + #{printerPort}, + #{clientSid}, + #{clientIp}, + #{clientPort}, + #{enableFlag}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update print_printer_config + + printer_type = #{printerType}, + printer_name = #{printerName}, + brand = #{brand}, + printer_model = #{printerModel}, + connection_type = #{connectionType}, + printer_url = #{printerUrl}, + printer_ip = #{printerIp}, + printer_port = #{printerPort}, + client_sid = #{clientSid}, + client_ip = #{clientIp}, + client_port = #{clientPort}, + enable_flag = #{enableFlag}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where printer_id = #{printerId} + + + + delete from print_printer_config where printer_id = #{printerId} + + + + delete from print_printer_config where printer_id in + + #{printerId} + + + \ No newline at end of file diff --git a/ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml b/ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml new file mode 100644 index 0000000..31f2fb6 --- /dev/null +++ b/ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select template_id, template_code, template_name, template_type, template_json, paper_type, template_width, template_height, is_default, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, template_pic from print_template + + + + + + + + insert into print_template + + template_code, + template_name, + template_type, + template_json, + paper_type, + template_width, + template_height, + is_default, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + template_pic, + + + #{templateCode}, + #{templateName}, + #{templateType}, + #{templateJson}, + #{paperType}, + #{templateWidth}, + #{templateHeight}, + #{isDefault}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{templatePic}, + + + + + update print_template + + template_code = #{templateCode}, + template_name = #{templateName}, + template_type = #{templateType}, + template_json = #{templateJson}, + paper_type = #{paperType}, + template_width = #{templateWidth}, + template_height = #{templateHeight}, + is_default = #{isDefault}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + template_pic = #{templatePic}, + + where template_id = #{templateId} + + + + delete from print_template where template_id = #{templateId} + + + + delete from print_template where template_id in + + #{templateId} + + + \ No newline at end of file diff --git a/ktg-quartz/pom.xml b/ktg-quartz/pom.xml new file mode 100644 index 0000000..e32bb5a --- /dev/null +++ b/ktg-quartz/pom.xml @@ -0,0 +1,40 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-quartz + + + quartz定时任务 + + + + + + + org.quartz-scheduler + quartz + + + com.mchange + c3p0 + + + + + + + com.ktg + ktg-common + + + + + \ No newline at end of file diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/config/ScheduleConfig.java b/ktg-quartz/src/main/java/com/ktg/quartz/config/ScheduleConfig.java new file mode 100644 index 0000000..36d43e4 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/config/ScheduleConfig.java @@ -0,0 +1,57 @@ +//package com.ktg.quartz.config; +// +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.scheduling.quartz.SchedulerFactoryBean; +//import javax.sql.DataSource; +//import java.util.Properties; +// +///** +// * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效) +// * +// * @author ruoyi +// */ +//@Configuration +//public class ScheduleConfig +//{ +// @Bean +// public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) +// { +// SchedulerFactoryBean factory = new SchedulerFactoryBean(); +// factory.setDataSource(dataSource); +// +// // quartz参数 +// Properties prop = new Properties(); +// prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler"); +// prop.put("org.quartz.scheduler.instanceId", "AUTO"); +// // 线程池配置 +// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); +// prop.put("org.quartz.threadPool.threadCount", "20"); +// prop.put("org.quartz.threadPool.threadPriority", "5"); +// // JobStore配置 +// prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore"); +// // 集群配置 +// prop.put("org.quartz.jobStore.isClustered", "true"); +// prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); +// prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); +// prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); +// +// // sqlserver 启用 +// // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); +// prop.put("org.quartz.jobStore.misfireThreshold", "12000"); +// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); +// factory.setQuartzProperties(prop); +// +// factory.setSchedulerName("RuoyiScheduler"); +// // 延时启动 +// factory.setStartupDelay(1); +// factory.setApplicationContextSchedulerContextKey("applicationContextKey"); +// // 可选,QuartzScheduler +// // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 +// factory.setOverwriteExistingJobs(true); +// // 设置自动启动,默认为true +// factory.setAutoStartup(true); +// +// return factory; +// } +//} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/controller/SysJobController.java b/ktg-quartz/src/main/java/com/ktg/quartz/controller/SysJobController.java new file mode 100644 index 0000000..d4ecb49 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/controller/SysJobController.java @@ -0,0 +1,185 @@ +package com.ktg.quartz.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.Constants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.exception.job.TaskException; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.quartz.domain.SysJob; +import com.ktg.quartz.service.ISysJobService; +import com.ktg.quartz.util.CronUtils; +import com.ktg.quartz.util.ScheduleUtils; + +/** + * 调度任务信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/job") +public class SysJobController extends BaseController +{ + @Autowired + private ISysJobService jobService; + + /** + * 查询定时任务列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:list')") + @GetMapping("/list") + public TableDataInfo list(SysJob sysJob) + { + startPage(); + List list = jobService.selectJobList(sysJob); + return getDataTable(list); + } + + /** + * 导出定时任务列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:export')") + @Log(title = "定时任务", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysJob sysJob) + { + List list = jobService.selectJobList(sysJob); + ExcelUtil util = new ExcelUtil(SysJob.class); + util.exportExcel(response, list, "定时任务"); + } + + /** + * 获取定时任务详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @GetMapping(value = "/{jobId}") + public AjaxResult getInfo(@PathVariable("jobId") Long jobId) + { + return AjaxResult.success(jobService.selectJobById(jobId)); + } + + /** + * 新增定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:add')") + @Log(title = "定时任务", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException + { + if (!CronUtils.isValid(job.getCronExpression())) + { + return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确"); + } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规"); + } + else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内"); + } + job.setCreateBy(getUsername()); + return toAjax(jobService.insertJob(job)); + } + + /** + * 修改定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:edit')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException + { + if (!CronUtils.isValid(job.getCronExpression())) + { + return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确"); + } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规"); + } + else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内"); + } + job.setUpdateBy(getUsername()); + return toAjax(jobService.updateJob(job)); + } + + /** + * 定时任务状态修改 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException + { + SysJob newJob = jobService.selectJobById(job.getJobId()); + newJob.setStatus(job.getStatus()); + return toAjax(jobService.changeStatus(newJob)); + } + + /** + * 定时任务立即执行一次 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping("/run") + public AjaxResult run(@RequestBody SysJob job) throws SchedulerException + { + jobService.run(job); + return AjaxResult.success(); + } + + /** + * 删除定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @Log(title = "定时任务", businessType = BusinessType.DELETE) + @DeleteMapping("/{jobIds}") + public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException + { + jobService.deleteJobByIds(jobIds); + return AjaxResult.success(); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/controller/SysJobLogController.java b/ktg-quartz/src/main/java/com/ktg/quartz/controller/SysJobLogController.java new file mode 100644 index 0000000..2bef79f --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/controller/SysJobLogController.java @@ -0,0 +1,92 @@ +package com.ktg.quartz.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.quartz.domain.SysJobLog; +import com.ktg.quartz.service.ISysJobLogService; + +/** + * 调度日志操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/jobLog") +public class SysJobLogController extends BaseController +{ + @Autowired + private ISysJobLogService jobLogService; + + /** + * 查询定时任务调度日志列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:list')") + @GetMapping("/list") + public TableDataInfo list(SysJobLog sysJobLog) + { + startPage(); + List list = jobLogService.selectJobLogList(sysJobLog); + return getDataTable(list); + } + + /** + * 导出定时任务调度日志列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:export')") + @Log(title = "任务调度日志", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysJobLog sysJobLog) + { + List list = jobLogService.selectJobLogList(sysJobLog); + ExcelUtil util = new ExcelUtil(SysJobLog.class); + util.exportExcel(response, list, "调度日志"); + } + + /** + * 根据调度编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long jobLogId) + { + return AjaxResult.success(jobLogService.selectJobLogById(jobLogId)); + } + + + /** + * 删除定时任务调度日志 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{jobLogIds}") + public AjaxResult remove(@PathVariable Long[] jobLogIds) + { + return toAjax(jobLogService.deleteJobLogByIds(jobLogIds)); + } + + /** + * 清空定时任务调度日志 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @Log(title = "调度日志", businessType = BusinessType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() + { + jobLogService.cleanJobLog(); + return AjaxResult.success(); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/domain/SysJob.java b/ktg-quartz/src/main/java/com/ktg/quartz/domain/SysJob.java new file mode 100644 index 0000000..1dff34a --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/domain/SysJob.java @@ -0,0 +1,171 @@ +package com.ktg.quartz.domain; + +import java.util.Date; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.constant.ScheduleConstants; +import com.ktg.common.core.domain.BaseEntity; +import com.ktg.common.utils.StringUtils; +import com.ktg.quartz.util.CronUtils; + +/** + * 定时任务调度表 sys_job + * + * @author ruoyi + */ +public class SysJob extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 任务ID */ + @Excel(name = "任务序号", cellType = ColumnType.NUMERIC) + private Long jobId; + + /** 任务名称 */ + @Excel(name = "任务名称") + private String jobName; + + /** 任务组名 */ + @Excel(name = "任务组名") + private String jobGroup; + + /** 调用目标字符串 */ + @Excel(name = "调用目标字符串") + private String invokeTarget; + + /** cron执行表达式 */ + @Excel(name = "执行表达式 ") + private String cronExpression; + + /** cron计划策略 */ + @Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行") + private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; + + /** 是否并发执行(0允许 1禁止) */ + @Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止") + private String concurrent; + + /** 任务状态(0正常 1暂停) */ + @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") + private String status; + + public Long getJobId() + { + return jobId; + } + + public void setJobId(Long jobId) + { + this.jobId = jobId; + } + + @NotBlank(message = "任务名称不能为空") + @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") + public String getJobName() + { + return jobName; + } + + public void setJobName(String jobName) + { + this.jobName = jobName; + } + + public String getJobGroup() + { + return jobGroup; + } + + public void setJobGroup(String jobGroup) + { + this.jobGroup = jobGroup; + } + + @NotBlank(message = "调用目标字符串不能为空") + @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") + public String getInvokeTarget() + { + return invokeTarget; + } + + public void setInvokeTarget(String invokeTarget) + { + this.invokeTarget = invokeTarget; + } + + @NotBlank(message = "Cron执行表达式不能为空") + @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") + public String getCronExpression() + { + return cronExpression; + } + + public void setCronExpression(String cronExpression) + { + this.cronExpression = cronExpression; + } + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date getNextValidTime() + { + if (StringUtils.isNotEmpty(cronExpression)) + { + return CronUtils.getNextExecution(cronExpression); + } + return null; + } + + public String getMisfirePolicy() + { + return misfirePolicy; + } + + public void setMisfirePolicy(String misfirePolicy) + { + this.misfirePolicy = misfirePolicy; + } + + public String getConcurrent() + { + return concurrent; + } + + public void setConcurrent(String concurrent) + { + this.concurrent = concurrent; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("jobId", getJobId()) + .append("jobName", getJobName()) + .append("jobGroup", getJobGroup()) + .append("cronExpression", getCronExpression()) + .append("nextValidTime", getNextValidTime()) + .append("misfirePolicy", getMisfirePolicy()) + .append("concurrent", getConcurrent()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/domain/SysJobLog.java b/ktg-quartz/src/main/java/com/ktg/quartz/domain/SysJobLog.java new file mode 100644 index 0000000..4809998 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/domain/SysJobLog.java @@ -0,0 +1,155 @@ +package com.ktg.quartz.domain; + +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 定时任务调度日志表 sys_job_log + * + * @author ruoyi + */ +public class SysJobLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + @Excel(name = "日志序号") + private Long jobLogId; + + /** 任务名称 */ + @Excel(name = "任务名称") + private String jobName; + + /** 任务组名 */ + @Excel(name = "任务组名") + private String jobGroup; + + /** 调用目标字符串 */ + @Excel(name = "调用目标字符串") + private String invokeTarget; + + /** 日志信息 */ + @Excel(name = "日志信息") + private String jobMessage; + + /** 执行状态(0正常 1失败) */ + @Excel(name = "执行状态", readConverterExp = "0=正常,1=失败") + private String status; + + /** 异常信息 */ + @Excel(name = "异常信息") + private String exceptionInfo; + + /** 开始时间 */ + private Date startTime; + + /** 停止时间 */ + private Date stopTime; + + public Long getJobLogId() + { + return jobLogId; + } + + public void setJobLogId(Long jobLogId) + { + this.jobLogId = jobLogId; + } + + public String getJobName() + { + return jobName; + } + + public void setJobName(String jobName) + { + this.jobName = jobName; + } + + public String getJobGroup() + { + return jobGroup; + } + + public void setJobGroup(String jobGroup) + { + this.jobGroup = jobGroup; + } + + public String getInvokeTarget() + { + return invokeTarget; + } + + public void setInvokeTarget(String invokeTarget) + { + this.invokeTarget = invokeTarget; + } + + public String getJobMessage() + { + return jobMessage; + } + + public void setJobMessage(String jobMessage) + { + this.jobMessage = jobMessage; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getExceptionInfo() + { + return exceptionInfo; + } + + public void setExceptionInfo(String exceptionInfo) + { + this.exceptionInfo = exceptionInfo; + } + + public Date getStartTime() + { + return startTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStopTime() + { + return stopTime; + } + + public void setStopTime(Date stopTime) + { + this.stopTime = stopTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("jobLogId", getJobLogId()) + .append("jobName", getJobName()) + .append("jobGroup", getJobGroup()) + .append("jobMessage", getJobMessage()) + .append("status", getStatus()) + .append("exceptionInfo", getExceptionInfo()) + .append("startTime", getStartTime()) + .append("stopTime", getStopTime()) + .toString(); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/mapper/SysJobLogMapper.java b/ktg-quartz/src/main/java/com/ktg/quartz/mapper/SysJobLogMapper.java new file mode 100644 index 0000000..cbba8c2 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/mapper/SysJobLogMapper.java @@ -0,0 +1,64 @@ +package com.ktg.quartz.mapper; + +import java.util.List; +import com.ktg.quartz.domain.SysJobLog; + +/** + * 调度任务日志信息 数据层 + * + * @author ruoyi + */ +public interface SysJobLogMapper +{ + /** + * 获取quartz调度器日志的计划任务 + * + * @param jobLog 调度日志信息 + * @return 调度任务日志集合 + */ + public List selectJobLogList(SysJobLog jobLog); + + /** + * 查询所有调度任务日志 + * + * @return 调度任务日志列表 + */ + public List selectJobLogAll(); + + /** + * 通过调度任务日志ID查询调度信息 + * + * @param jobLogId 调度任务日志ID + * @return 调度任务日志对象信息 + */ + public SysJobLog selectJobLogById(Long jobLogId); + + /** + * 新增任务日志 + * + * @param jobLog 调度日志信息 + * @return 结果 + */ + public int insertJobLog(SysJobLog jobLog); + + /** + * 批量删除调度日志信息 + * + * @param logIds 需要删除的数据ID + * @return 结果 + */ + public int deleteJobLogByIds(Long[] logIds); + + /** + * 删除任务日志 + * + * @param jobId 调度日志ID + * @return 结果 + */ + public int deleteJobLogById(Long jobId); + + /** + * 清空任务日志 + */ + public void cleanJobLog(); +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/mapper/SysJobMapper.java b/ktg-quartz/src/main/java/com/ktg/quartz/mapper/SysJobMapper.java new file mode 100644 index 0000000..99ce72f --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/mapper/SysJobMapper.java @@ -0,0 +1,67 @@ +package com.ktg.quartz.mapper; + +import java.util.List; +import com.ktg.quartz.domain.SysJob; + +/** + * 调度任务信息 数据层 + * + * @author ruoyi + */ +public interface SysJobMapper +{ + /** + * 查询调度任务日志集合 + * + * @param job 调度信息 + * @return 操作日志集合 + */ + public List selectJobList(SysJob job); + + /** + * 查询所有调度任务 + * + * @return 调度任务列表 + */ + public List selectJobAll(); + + /** + * 通过调度ID查询调度任务信息 + * + * @param jobId 调度ID + * @return 角色对象信息 + */ + public SysJob selectJobById(Long jobId); + + /** + * 通过调度ID删除调度任务信息 + * + * @param jobId 调度ID + * @return 结果 + */ + public int deleteJobById(Long jobId); + + /** + * 批量删除调度任务信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteJobByIds(Long[] ids); + + /** + * 修改调度任务信息 + * + * @param job 调度任务信息 + * @return 结果 + */ + public int updateJob(SysJob job); + + /** + * 新增调度任务信息 + * + * @param job 调度任务信息 + * @return 结果 + */ + public int insertJob(SysJob job); +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/service/ISysJobLogService.java b/ktg-quartz/src/main/java/com/ktg/quartz/service/ISysJobLogService.java new file mode 100644 index 0000000..1a5a8f3 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/service/ISysJobLogService.java @@ -0,0 +1,56 @@ +package com.ktg.quartz.service; + +import java.util.List; +import com.ktg.quartz.domain.SysJobLog; + +/** + * 定时任务调度日志信息信息 服务层 + * + * @author ruoyi + */ +public interface ISysJobLogService +{ + /** + * 获取quartz调度器日志的计划任务 + * + * @param jobLog 调度日志信息 + * @return 调度任务日志集合 + */ + public List selectJobLogList(SysJobLog jobLog); + + /** + * 通过调度任务日志ID查询调度信息 + * + * @param jobLogId 调度任务日志ID + * @return 调度任务日志对象信息 + */ + public SysJobLog selectJobLogById(Long jobLogId); + + /** + * 新增任务日志 + * + * @param jobLog 调度日志信息 + */ + public void addJobLog(SysJobLog jobLog); + + /** + * 批量删除调度日志信息 + * + * @param logIds 需要删除的日志ID + * @return 结果 + */ + public int deleteJobLogByIds(Long[] logIds); + + /** + * 删除任务日志 + * + * @param jobId 调度日志ID + * @return 结果 + */ + public int deleteJobLogById(Long jobId); + + /** + * 清空任务日志 + */ + public void cleanJobLog(); +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/service/ISysJobService.java b/ktg-quartz/src/main/java/com/ktg/quartz/service/ISysJobService.java new file mode 100644 index 0000000..c61bdd3 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/service/ISysJobService.java @@ -0,0 +1,102 @@ +package com.ktg.quartz.service; + +import java.util.List; +import org.quartz.SchedulerException; +import com.ktg.common.exception.job.TaskException; +import com.ktg.quartz.domain.SysJob; + +/** + * 定时任务调度信息信息 服务层 + * + * @author ruoyi + */ +public interface ISysJobService +{ + /** + * 获取quartz调度器的计划任务 + * + * @param job 调度信息 + * @return 调度任务集合 + */ + public List selectJobList(SysJob job); + + /** + * 通过调度任务ID查询调度信息 + * + * @param jobId 调度任务ID + * @return 调度任务对象信息 + */ + public SysJob selectJobById(Long jobId); + + /** + * 暂停任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int pauseJob(SysJob job) throws SchedulerException; + + /** + * 恢复任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int resumeJob(SysJob job) throws SchedulerException; + + /** + * 删除任务后,所对应的trigger也将被删除 + * + * @param job 调度信息 + * @return 结果 + */ + public int deleteJob(SysJob job) throws SchedulerException; + + /** + * 批量删除调度信息 + * + * @param jobIds 需要删除的任务ID + * @return 结果 + */ + public void deleteJobByIds(Long[] jobIds) throws SchedulerException; + + /** + * 任务调度状态修改 + * + * @param job 调度信息 + * @return 结果 + */ + public int changeStatus(SysJob job) throws SchedulerException; + + /** + * 立即运行任务 + * + * @param job 调度信息 + * @return 结果 + */ + public void run(SysJob job) throws SchedulerException; + + /** + * 新增任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int insertJob(SysJob job) throws SchedulerException, TaskException; + + /** + * 更新任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int updateJob(SysJob job) throws SchedulerException, TaskException; + + /** + * 校验cron表达式是否有效 + * + * @param cronExpression 表达式 + * @return 结果 + */ + public boolean checkCronExpressionIsValid(String cronExpression); +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/service/impl/SysJobLogServiceImpl.java b/ktg-quartz/src/main/java/com/ktg/quartz/service/impl/SysJobLogServiceImpl.java new file mode 100644 index 0000000..09fe8e8 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/service/impl/SysJobLogServiceImpl.java @@ -0,0 +1,87 @@ +package com.ktg.quartz.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.quartz.domain.SysJobLog; +import com.ktg.quartz.mapper.SysJobLogMapper; +import com.ktg.quartz.service.ISysJobLogService; + +/** + * 定时任务调度日志信息 服务层 + * + * @author ruoyi + */ +@Service +public class SysJobLogServiceImpl implements ISysJobLogService +{ + @Autowired + private SysJobLogMapper jobLogMapper; + + /** + * 获取quartz调度器日志的计划任务 + * + * @param jobLog 调度日志信息 + * @return 调度任务日志集合 + */ + @Override + public List selectJobLogList(SysJobLog jobLog) + { + return jobLogMapper.selectJobLogList(jobLog); + } + + /** + * 通过调度任务日志ID查询调度信息 + * + * @param jobLogId 调度任务日志ID + * @return 调度任务日志对象信息 + */ + @Override + public SysJobLog selectJobLogById(Long jobLogId) + { + return jobLogMapper.selectJobLogById(jobLogId); + } + + /** + * 新增任务日志 + * + * @param jobLog 调度日志信息 + */ + @Override + public void addJobLog(SysJobLog jobLog) + { + jobLogMapper.insertJobLog(jobLog); + } + + /** + * 批量删除调度日志信息 + * + * @param logIds 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteJobLogByIds(Long[] logIds) + { + return jobLogMapper.deleteJobLogByIds(logIds); + } + + /** + * 删除任务日志 + * + * @param jobId 调度日志ID + */ + @Override + public int deleteJobLogById(Long jobId) + { + return jobLogMapper.deleteJobLogById(jobId); + } + + /** + * 清空任务日志 + */ + @Override + public void cleanJobLog() + { + jobLogMapper.cleanJobLog(); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/service/impl/SysJobServiceImpl.java b/ktg-quartz/src/main/java/com/ktg/quartz/service/impl/SysJobServiceImpl.java new file mode 100644 index 0000000..34e0ba5 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/service/impl/SysJobServiceImpl.java @@ -0,0 +1,254 @@ +package com.ktg.quartz.service.impl; + +import java.util.List; +import javax.annotation.PostConstruct; +import org.quartz.JobDataMap; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ktg.common.constant.ScheduleConstants; +import com.ktg.common.exception.job.TaskException; +import com.ktg.quartz.domain.SysJob; +import com.ktg.quartz.mapper.SysJobMapper; +import com.ktg.quartz.service.ISysJobService; +import com.ktg.quartz.util.CronUtils; +import com.ktg.quartz.util.ScheduleUtils; + +/** + * 定时任务调度信息 服务层 + * + * @author ruoyi + */ +@Service +public class SysJobServiceImpl implements ISysJobService +{ + @Autowired + private Scheduler scheduler; + + @Autowired + private SysJobMapper jobMapper; + + /** + * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据) + */ + @PostConstruct + public void init() throws SchedulerException, TaskException + { + scheduler.clear(); + List jobList = jobMapper.selectJobAll(); + for (SysJob job : jobList) + { + ScheduleUtils.createScheduleJob(scheduler, job); + } + } + + /** + * 获取quartz调度器的计划任务列表 + * + * @param job 调度信息 + * @return + */ + @Override + public List selectJobList(SysJob job) + { + return jobMapper.selectJobList(job); + } + + /** + * 通过调度任务ID查询调度信息 + * + * @param jobId 调度任务ID + * @return 调度任务对象信息 + */ + @Override + public SysJob selectJobById(Long jobId) + { + return jobMapper.selectJobById(jobId); + } + + /** + * 暂停任务 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int pauseJob(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); + int rows = jobMapper.updateJob(job); + if (rows > 0) + { + scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + return rows; + } + + /** + * 恢复任务 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int resumeJob(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); + int rows = jobMapper.updateJob(job); + if (rows > 0) + { + scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + return rows; + } + + /** + * 删除任务后,所对应的trigger也将被删除 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteJob(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + int rows = jobMapper.deleteJobById(jobId); + if (rows > 0) + { + scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + return rows; + } + + /** + * 批量删除调度信息 + * + * @param jobIds 需要删除的任务ID + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteJobByIds(Long[] jobIds) throws SchedulerException + { + for (Long jobId : jobIds) + { + SysJob job = jobMapper.selectJobById(jobId); + deleteJob(job); + } + } + + /** + * 任务调度状态修改 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int changeStatus(SysJob job) throws SchedulerException + { + int rows = 0; + String status = job.getStatus(); + if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) + { + rows = resumeJob(job); + } + else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) + { + rows = pauseJob(job); + } + return rows; + } + + /** + * 立即运行任务 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void run(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + SysJob properties = selectJobById(job.getJobId()); + // 参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties); + scheduler.triggerJob(ScheduleUtils.getJobKey(jobId, jobGroup), dataMap); + } + + /** + * 新增任务 + * + * @param job 调度信息 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertJob(SysJob job) throws SchedulerException, TaskException + { + job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); + int rows = jobMapper.insertJob(job); + if (rows > 0) + { + ScheduleUtils.createScheduleJob(scheduler, job); + } + return rows; + } + + /** + * 更新任务的时间表达式 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int updateJob(SysJob job) throws SchedulerException, TaskException + { + SysJob properties = selectJobById(job.getJobId()); + int rows = jobMapper.updateJob(job); + if (rows > 0) + { + updateSchedulerJob(job, properties.getJobGroup()); + } + return rows; + } + + /** + * 更新任务 + * + * @param job 任务对象 + * @param jobGroup 任务组名 + */ + public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException + { + Long jobId = job.getJobId(); + // 判断是否存在 + JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup); + if (scheduler.checkExists(jobKey)) + { + // 防止创建时存在数据问题 先移除,然后在执行创建操作 + scheduler.deleteJob(jobKey); + } + ScheduleUtils.createScheduleJob(scheduler, job); + } + + /** + * 校验cron表达式是否有效 + * + * @param cronExpression 表达式 + * @return 结果 + */ + @Override + public boolean checkCronExpressionIsValid(String cronExpression) + { + return CronUtils.isValid(cronExpression); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/task/RyTask.java b/ktg-quartz/src/main/java/com/ktg/quartz/task/RyTask.java new file mode 100644 index 0000000..9560781 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/task/RyTask.java @@ -0,0 +1,28 @@ +package com.ktg.quartz.task; + +import org.springframework.stereotype.Component; +import com.ktg.common.utils.StringUtils; + +/** + * 定时任务调度测试 + * + * @author ruoyi + */ +@Component("ryTask") +public class RyTask +{ + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) + { + System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); + } + + public void ryParams(String params) + { + System.out.println("执行有参方法:" + params); + } + + public void ryNoParams() + { + System.out.println("执行无参方法"); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/util/AbstractQuartzJob.java b/ktg-quartz/src/main/java/com/ktg/quartz/util/AbstractQuartzJob.java new file mode 100644 index 0000000..4085ee0 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/util/AbstractQuartzJob.java @@ -0,0 +1,107 @@ +package com.ktg.quartz.util; + +import java.util.Date; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.ScheduleConstants; +import com.ktg.common.utils.ExceptionUtil; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.bean.BeanUtils; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.quartz.domain.SysJob; +import com.ktg.quartz.domain.SysJobLog; +import com.ktg.quartz.service.ISysJobLogService; + +/** + * 抽象quartz调用 + * + * @author ruoyi + */ +public abstract class AbstractQuartzJob implements Job +{ + private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); + + /** + * 线程本地变量 + */ + private static ThreadLocal threadLocal = new ThreadLocal<>(); + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException + { + SysJob sysJob = new SysJob(); + BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); + try + { + before(context, sysJob); + if (sysJob != null) + { + doExecute(context, sysJob); + } + after(context, sysJob, null); + } + catch (Exception e) + { + log.error("任务执行异常 - :", e); + after(context, sysJob, e); + } + } + + /** + * 执行前 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + */ + protected void before(JobExecutionContext context, SysJob sysJob) + { + threadLocal.set(new Date()); + } + + /** + * 执行后 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + */ + protected void after(JobExecutionContext context, SysJob sysJob, Exception e) + { + Date startTime = threadLocal.get(); + threadLocal.remove(); + + final SysJobLog sysJobLog = new SysJobLog(); + sysJobLog.setJobName(sysJob.getJobName()); + sysJobLog.setJobGroup(sysJob.getJobGroup()); + sysJobLog.setInvokeTarget(sysJob.getInvokeTarget()); + sysJobLog.setStartTime(startTime); + sysJobLog.setStopTime(new Date()); + long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime(); + sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒"); + if (e != null) + { + sysJobLog.setStatus(Constants.FAIL); + String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000); + sysJobLog.setExceptionInfo(errorMsg); + } + else + { + sysJobLog.setStatus(Constants.SUCCESS); + } + + // 写入数据库当中 + SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog); + } + + /** + * 执行方法,由子类重载 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + * @throws Exception 执行过程中的异常 + */ + protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception; +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/util/CronUtils.java b/ktg-quartz/src/main/java/com/ktg/quartz/util/CronUtils.java new file mode 100644 index 0000000..8bc29b9 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/util/CronUtils.java @@ -0,0 +1,63 @@ +package com.ktg.quartz.util; + +import java.text.ParseException; +import java.util.Date; +import org.quartz.CronExpression; + +/** + * cron表达式工具类 + * + * @author ruoyi + * + */ +public class CronUtils +{ + /** + * 返回一个布尔值代表一个给定的Cron表达式的有效性 + * + * @param cronExpression Cron表达式 + * @return boolean 表达式是否有效 + */ + public static boolean isValid(String cronExpression) + { + return CronExpression.isValidExpression(cronExpression); + } + + /** + * 返回一个字符串值,表示该消息无效Cron表达式给出有效性 + * + * @param cronExpression Cron表达式 + * @return String 无效时返回表达式错误描述,如果有效返回null + */ + public static String getInvalidMessage(String cronExpression) + { + try + { + new CronExpression(cronExpression); + return null; + } + catch (ParseException pe) + { + return pe.getMessage(); + } + } + + /** + * 返回下一个执行时间根据给定的Cron表达式 + * + * @param cronExpression Cron表达式 + * @return Date 下次Cron表达式执行时间 + */ + public static Date getNextExecution(String cronExpression) + { + try + { + CronExpression cron = new CronExpression(cronExpression); + return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); + } + catch (ParseException e) + { + throw new IllegalArgumentException(e.getMessage()); + } + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/util/JobInvokeUtil.java b/ktg-quartz/src/main/java/com/ktg/quartz/util/JobInvokeUtil.java new file mode 100644 index 0000000..ad0c6c5 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/util/JobInvokeUtil.java @@ -0,0 +1,182 @@ +package com.ktg.quartz.util; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.LinkedList; +import java.util.List; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.quartz.domain.SysJob; + +/** + * 任务执行工具 + * + * @author ruoyi + */ +public class JobInvokeUtil +{ + /** + * 执行方法 + * + * @param sysJob 系统任务 + */ + public static void invokeMethod(SysJob sysJob) throws Exception + { + String invokeTarget = sysJob.getInvokeTarget(); + String beanName = getBeanName(invokeTarget); + String methodName = getMethodName(invokeTarget); + List methodParams = getMethodParams(invokeTarget); + + if (!isValidClassName(beanName)) + { + Object bean = SpringUtils.getBean(beanName); + invokeMethod(bean, methodName, methodParams); + } + else + { + Object bean = Class.forName(beanName).newInstance(); + invokeMethod(bean, methodName, methodParams); + } + } + + /** + * 调用任务方法 + * + * @param bean 目标对象 + * @param methodName 方法名称 + * @param methodParams 方法参数 + */ + private static void invokeMethod(Object bean, String methodName, List methodParams) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException + { + if (StringUtils.isNotNull(methodParams) && methodParams.size() > 0) + { + Method method = bean.getClass().getDeclaredMethod(methodName, getMethodParamsType(methodParams)); + method.invoke(bean, getMethodParamsValue(methodParams)); + } + else + { + Method method = bean.getClass().getDeclaredMethod(methodName); + method.invoke(bean); + } + } + + /** + * 校验是否为为class包名 + * + * @param invokeTarget 名称 + * @return true是 false否 + */ + public static boolean isValidClassName(String invokeTarget) + { + return StringUtils.countMatches(invokeTarget, ".") > 1; + } + + /** + * 获取bean名称 + * + * @param invokeTarget 目标字符串 + * @return bean名称 + */ + public static String getBeanName(String invokeTarget) + { + String beanName = StringUtils.substringBefore(invokeTarget, "("); + return StringUtils.substringBeforeLast(beanName, "."); + } + + /** + * 获取bean方法 + * + * @param invokeTarget 目标字符串 + * @return method方法 + */ + public static String getMethodName(String invokeTarget) + { + String methodName = StringUtils.substringBefore(invokeTarget, "("); + return StringUtils.substringAfterLast(methodName, "."); + } + + /** + * 获取method方法参数相关列表 + * + * @param invokeTarget 目标字符串 + * @return method方法相关参数列表 + */ + public static List getMethodParams(String invokeTarget) + { + String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); + if (StringUtils.isEmpty(methodStr)) + { + return null; + } + String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)"); + List classs = new LinkedList<>(); + for (int i = 0; i < methodParams.length; i++) + { + String str = StringUtils.trimToEmpty(methodParams[i]); + // String字符串类型,以'或"开头 + if (StringUtils.startsWithAny(str, "'", "\"")) + { + classs.add(new Object[] { StringUtils.substring(str, 1, str.length() - 1), String.class }); + } + // boolean布尔类型,等于true或者false + else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str)) + { + classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); + } + // long长整形,以L结尾 + else if (StringUtils.endsWith(str, "L")) + { + classs.add(new Object[] { Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class }); + } + // double浮点类型,以D结尾 + else if (StringUtils.endsWith(str, "D")) + { + classs.add(new Object[] { Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class }); + } + // 其他类型归类为整形 + else + { + classs.add(new Object[] { Integer.valueOf(str), Integer.class }); + } + } + return classs; + } + + /** + * 获取参数类型 + * + * @param methodParams 参数相关列表 + * @return 参数类型列表 + */ + public static Class[] getMethodParamsType(List methodParams) + { + Class[] classs = new Class[methodParams.size()]; + int index = 0; + for (Object[] os : methodParams) + { + classs[index] = (Class) os[1]; + index++; + } + return classs; + } + + /** + * 获取参数值 + * + * @param methodParams 参数相关列表 + * @return 参数值列表 + */ + public static Object[] getMethodParamsValue(List methodParams) + { + Object[] classs = new Object[methodParams.size()]; + int index = 0; + for (Object[] os : methodParams) + { + classs[index] = (Object) os[0]; + index++; + } + return classs; + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/util/QuartzDisallowConcurrentExecution.java b/ktg-quartz/src/main/java/com/ktg/quartz/util/QuartzDisallowConcurrentExecution.java new file mode 100644 index 0000000..e0077b9 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/util/QuartzDisallowConcurrentExecution.java @@ -0,0 +1,21 @@ +package com.ktg.quartz.util; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import com.ktg.quartz.domain.SysJob; + +/** + * 定时任务处理(禁止并发执行) + * + * @author ruoyi + * + */ +@DisallowConcurrentExecution +public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/util/QuartzJobExecution.java b/ktg-quartz/src/main/java/com/ktg/quartz/util/QuartzJobExecution.java new file mode 100644 index 0000000..b5bc360 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/util/QuartzJobExecution.java @@ -0,0 +1,19 @@ +package com.ktg.quartz.util; + +import org.quartz.JobExecutionContext; +import com.ktg.quartz.domain.SysJob; + +/** + * 定时任务处理(允许并发执行) + * + * @author ruoyi + * + */ +public class QuartzJobExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/ktg-quartz/src/main/java/com/ktg/quartz/util/ScheduleUtils.java b/ktg-quartz/src/main/java/com/ktg/quartz/util/ScheduleUtils.java new file mode 100644 index 0000000..728fb48 --- /dev/null +++ b/ktg-quartz/src/main/java/com/ktg/quartz/util/ScheduleUtils.java @@ -0,0 +1,132 @@ +package com.ktg.quartz.util; + +import org.quartz.CronScheduleBuilder; +import org.quartz.CronTrigger; +import org.quartz.Job; +import org.quartz.JobBuilder; +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.TriggerBuilder; +import org.quartz.TriggerKey; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.ScheduleConstants; +import com.ktg.common.exception.job.TaskException; +import com.ktg.common.exception.job.TaskException.Code; +import com.ktg.common.utils.StringUtils; +import com.ktg.quartz.domain.SysJob; + +/** + * 定时任务工具类 + * + * @author ruoyi + * + */ +public class ScheduleUtils +{ + /** + * 得到quartz任务类 + * + * @param sysJob 执行计划 + * @return 具体执行任务类 + */ + private static Class getQuartzJobClass(SysJob sysJob) + { + boolean isConcurrent = "0".equals(sysJob.getConcurrent()); + return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; + } + + /** + * 构建任务触发对象 + */ + public static TriggerKey getTriggerKey(Long jobId, String jobGroup) + { + return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); + } + + /** + * 构建任务键对象 + */ + public static JobKey getJobKey(Long jobId, String jobGroup) + { + return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); + } + + /** + * 创建定时任务 + */ + public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException + { + Class jobClass = getQuartzJobClass(job); + // 构建job信息 + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build(); + + // 表达式调度构建器 + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); + cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); + + // 按新的cronExpression表达式构建一个新的trigger + CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup)) + .withSchedule(cronScheduleBuilder).build(); + + // 放入参数,运行时的方法可以获取 + jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); + + // 判断是否存在 + if (scheduler.checkExists(getJobKey(jobId, jobGroup))) + { + // 防止创建时存在数据问题 先移除,然后在执行创建操作 + scheduler.deleteJob(getJobKey(jobId, jobGroup)); + } + + scheduler.scheduleJob(jobDetail, trigger); + + // 暂停任务 + if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) + { + scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + } + + /** + * 设置定时任务策略 + */ + public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb) + throws TaskException + { + switch (job.getMisfirePolicy()) + { + case ScheduleConstants.MISFIRE_DEFAULT: + return cb; + case ScheduleConstants.MISFIRE_IGNORE_MISFIRES: + return cb.withMisfireHandlingInstructionIgnoreMisfires(); + case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED: + return cb.withMisfireHandlingInstructionFireAndProceed(); + case ScheduleConstants.MISFIRE_DO_NOTHING: + return cb.withMisfireHandlingInstructionDoNothing(); + default: + throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() + + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR); + } + } + + /** + * 检查包名是否为白名单配置 + * + * @param invokeTarget 目标字符串 + * @return 结果 + */ + public static boolean whiteList(String invokeTarget) + { + String packageName = StringUtils.substringBefore(invokeTarget, "("); + int count = StringUtils.countMatches(packageName, "."); + if (count > 1) + { + return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR); + } + return true; + } +} diff --git a/ktg-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml b/ktg-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml new file mode 100644 index 0000000..8cbd8d4 --- /dev/null +++ b/ktg-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time + from sys_job_log + + + + + + + + + + delete from sys_job_log where job_log_id = #{jobLogId} + + + + delete from sys_job_log where job_log_id in + + #{jobLogId} + + + + + truncate table sys_job_log + + + + insert into sys_job_log( + job_log_id, + job_name, + job_group, + invoke_target, + job_message, + status, + exception_info, + create_time + )values( + #{jobLogId}, + #{jobName}, + #{jobGroup}, + #{invokeTarget}, + #{jobMessage}, + #{status}, + #{exceptionInfo}, + sysdate() + ) + + + \ No newline at end of file diff --git a/ktg-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml b/ktg-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml new file mode 100644 index 0000000..f308817 --- /dev/null +++ b/ktg-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark + from sys_job + + + + + + + + + + delete from sys_job where job_id = #{jobId} + + + + delete from sys_job where job_id in + + #{jobId} + + + + + update sys_job + + job_name = #{jobName}, + job_group = #{jobGroup}, + invoke_target = #{invokeTarget}, + cron_expression = #{cronExpression}, + misfire_policy = #{misfirePolicy}, + concurrent = #{concurrent}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where job_id = #{jobId} + + + + insert into sys_job( + job_id, + job_name, + job_group, + invoke_target, + cron_expression, + misfire_policy, + concurrent, + status, + remark, + create_by, + create_time + )values( + #{jobId}, + #{jobName}, + #{jobGroup}, + #{invokeTarget}, + #{cronExpression}, + #{misfirePolicy}, + #{concurrent}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + \ No newline at end of file diff --git a/ktg-system/pom.xml b/ktg-system/pom.xml new file mode 100644 index 0000000..3d8eac4 --- /dev/null +++ b/ktg-system/pom.xml @@ -0,0 +1,28 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-system + + + system系统模块 + + + + + + + com.ktg + ktg-common + + + + + \ No newline at end of file diff --git a/ktg-system/src/main/java/com/ktg/system/domain/LoginParams.java b/ktg-system/src/main/java/com/ktg/system/domain/LoginParams.java new file mode 100644 index 0000000..a23509e --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/LoginParams.java @@ -0,0 +1,127 @@ +package com.ktg.system.domain; + + + +/** + * 登入参数实体 + */ +public class LoginParams { + + /** + * 用户名 + */ + private String phoneNo; + + /** + * 密码 + */ + private String username; + + /** + * 密码 + */ + private String password; + + /** + * 用户输入的验证码 + */ + private String validCode; + + /** + * session中的验证码 + */ + private String codeInSession; + /** + * 验证码类型1注册验证码2普通登录验证码 + */ + private String validCodeType; + + /** + * 登录来源 0 pc 1 app 2 mobile + */ + private int source; + /** + * 登录方式0验证码登录,1用户名密码登录,2本机一键登录,3微信单点登录 + */ + private String loginType; + + public void setFromApp() { + this.source = 1; + } + + /** + * 验证验证码 是否正确 (目前都不需要验证码) + * + * @return 正确返回true 否则返回false + */ + public boolean validateCode() { + + // 目前都不需要验证码 + return true; + } + + + public String getPhoneNo() { + return phoneNo; + } + + public void setPhoneNo(String phoneNo) { + this.phoneNo = phoneNo; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getValidCode() { + return validCode; + } + + public void setValidCode(String validCode) { + this.validCode = validCode; + } + + public String getCodeInSession() { + return codeInSession; + } + + public void setCodeInSession(String codeInSession) { + this.codeInSession = codeInSession; + } + + public String getValidCodeType() { + return validCodeType; + } + + public void setValidCodeType(String validCodeType) { + this.validCodeType = validCodeType; + } + + public int getSource() { + return source; + } + + public void setSource(int source) { + this.source = source; + } + + public String getLoginType() { + return loginType; + } + + public void setLoginType(String loginType) { + this.loginType = loginType; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysAttachment.java b/ktg-system/src/main/java/com/ktg/system/domain/SysAttachment.java new file mode 100644 index 0000000..1bc8f90 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysAttachment.java @@ -0,0 +1,207 @@ +package com.ktg.system.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 附件对象 sys_attachment + * + * @author yinjinlu + * @date 2022-07-26 + */ +public class SysAttachment extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 附件ID */ + private Long attachmentId; + + /** 关联的业务单据ID */ + @Excel(name = "关联的业务单据ID") + private Long sourceDocId; + + /** 业务单据类型 */ + @Excel(name = "业务单据类型") + private String sourceDocType; + + /** 访问URL */ + @Excel(name = "访问URL") + private String fileUrl; + + /** 域名 */ + @Excel(name = "域名") + private String basePath; + + /** 文件名 */ + @Excel(name = "文件名") + private String fileName; + + /** 原来的文件名 */ + @Excel(name = "原来的文件名") + private String orignalName; + + /** 文件类型 */ + @Excel(name = "文件类型") + private String fileType; + + /** 文件大小 */ + @Excel(name = "文件大小") + private BigDecimal fileSize; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setAttachmentId(Long attachmentId) + { + this.attachmentId = attachmentId; + } + + public Long getAttachmentId() + { + return attachmentId; + } + public void setSourceDocId(Long sourceDocId) + { + this.sourceDocId = sourceDocId; + } + + public Long getSourceDocId() + { + return sourceDocId; + } + public void setSourceDocType(String sourceDocType) + { + this.sourceDocType = sourceDocType; + } + + public String getSourceDocType() + { + return sourceDocType; + } + public void setFileUrl(String fileUrl) + { + this.fileUrl = fileUrl; + } + + public String getFileUrl() + { + return fileUrl; + } + public void setBasePath(String basePath) + { + this.basePath = basePath; + } + + public String getBasePath() + { + return basePath; + } + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + public String getFileName() + { + return fileName; + } + public void setOrignalName(String orignalName) + { + this.orignalName = orignalName; + } + + public String getOrignalName() + { + return orignalName; + } + public void setFileType(String fileType) + { + this.fileType = fileType; + } + + public String getFileType() + { + return fileType; + } + public void setFileSize(BigDecimal fileSize) + { + this.fileSize = fileSize; + } + + public BigDecimal getFileSize() + { + return fileSize; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("attachmentId", getAttachmentId()) + .append("sourceDocId", getSourceDocId()) + .append("sourceDocType", getSourceDocType()) + .append("fileUrl", getFileUrl()) + .append("basePath", getBasePath()) + .append("fileName", getFileName()) + .append("orignalName", getOrignalName()) + .append("fileType", getFileType()) + .append("fileSize", getFileSize()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysConfig.java b/ktg-system/src/main/java/com/ktg/system/domain/SysConfig.java new file mode 100644 index 0000000..7bfbcd1 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysConfig.java @@ -0,0 +1,111 @@ +package com.ktg.system.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 参数配置表 sys_config + * + * @author ktg + */ +public class SysConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 参数主键 */ + @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) + private Long configId; + + /** 参数名称 */ + @Excel(name = "参数名称") + private String configName; + + /** 参数键名 */ + @Excel(name = "参数键名") + private String configKey; + + /** 参数键值 */ + @Excel(name = "参数键值") + private String configValue; + + /** 系统内置(Y是 N否) */ + @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") + private String configType; + + public Long getConfigId() + { + return configId; + } + + public void setConfigId(Long configId) + { + this.configId = configId; + } + + @NotBlank(message = "参数名称不能为空") + @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") + public String getConfigName() + { + return configName; + } + + public void setConfigName(String configName) + { + this.configName = configName; + } + + @NotBlank(message = "参数键名长度不能为空") + @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") + public String getConfigKey() + { + return configKey; + } + + public void setConfigKey(String configKey) + { + this.configKey = configKey; + } + + @NotBlank(message = "参数键值不能为空") + @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") + public String getConfigValue() + { + return configValue; + } + + public void setConfigValue(String configValue) + { + this.configValue = configValue; + } + + public String getConfigType() + { + return configType; + } + + public void setConfigType(String configType) + { + this.configType = configType; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("configId", getConfigId()) + .append("configName", getConfigName()) + .append("configKey", getConfigKey()) + .append("configValue", getConfigValue()) + .append("configType", getConfigType()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysLogininfor.java b/ktg-system/src/main/java/com/ktg/system/domain/SysLogininfor.java new file mode 100644 index 0000000..0ff6a3d --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysLogininfor.java @@ -0,0 +1,144 @@ +package com.ktg.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 系统访问记录表 sys_logininfor + * + * @author ruoyi + */ +public class SysLogininfor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + @Excel(name = "序号", cellType = ColumnType.NUMERIC) + private Long infoId; + + /** 用户账号 */ + @Excel(name = "用户账号") + private String userName; + + /** 登录状态 0成功 1失败 */ + @Excel(name = "登录状态", readConverterExp = "0=成功,1=失败") + private String status; + + /** 登录IP地址 */ + @Excel(name = "登录地址") + private String ipaddr; + + /** 登录地点 */ + @Excel(name = "登录地点") + private String loginLocation; + + /** 浏览器类型 */ + @Excel(name = "浏览器") + private String browser; + + /** 操作系统 */ + @Excel(name = "操作系统") + private String os; + + /** 提示消息 */ + @Excel(name = "提示消息") + private String msg; + + /** 访问时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date loginTime; + + public Long getInfoId() + { + return infoId; + } + + public void setInfoId(Long infoId) + { + this.infoId = infoId; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public String getMsg() + { + return msg; + } + + public void setMsg(String msg) + { + this.msg = msg; + } + + public Date getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Date loginTime) + { + this.loginTime = loginTime; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysMessage.java b/ktg-system/src/main/java/com/ktg/system/domain/SysMessage.java new file mode 100644 index 0000000..b6a639e --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysMessage.java @@ -0,0 +1,293 @@ +package com.ktg.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 消息对象 sys_message + * + * @author yinjinlu + * @date 2023-03-06 + */ +public class SysMessage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 附件ID */ + private Long messageId; + + /** 消息类型 */ + @Excel(name = "消息类型") + private String messageType; + + /** 消息级别 */ + @Excel(name = "消息级别") + private String messageLevel; + + /** 标题 */ + @Excel(name = "标题") + private String messageTitle; + + /** 内容 */ + @Excel(name = "内容") + private String messageContent; + + /** 发送人ID */ + @Excel(name = "发送人ID") + private Long senderId; + + /** 发送人名称 */ + @Excel(name = "发送人名称") + private String senderName; + + /** 发送人昵称 */ + @Excel(name = "发送人昵称") + private String senderNick; + + /** 接收人ID */ + @Excel(name = "接收人ID") + private Long recipientId; + + /** 接收人名称 */ + @Excel(name = "接收人名称") + private String recipientName; + + /** 接收人昵称 */ + @Excel(name = "接收人昵称") + private String recipientNick; + + /** 处理时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date processTime; + + /** 回调地址 */ + @Excel(name = "回调地址") + private String callBack; + + /** 状态 */ + @Excel(name = "状态") + private String status; + + /** 是否删除 */ + @Excel(name = "是否删除") + private String deletedFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setMessageId(Long messageId) + { + this.messageId = messageId; + } + + public Long getMessageId() + { + return messageId; + } + public void setMessageType(String messageType) + { + this.messageType = messageType; + } + + public String getMessageType() + { + return messageType; + } + public void setMessageLevel(String messageLevel) + { + this.messageLevel = messageLevel; + } + + public String getMessageLevel() + { + return messageLevel; + } + public void setMessageTitle(String messageTitle) + { + this.messageTitle = messageTitle; + } + + public String getMessageTitle() + { + return messageTitle; + } + public void setMessageContent(String messageContent) + { + this.messageContent = messageContent; + } + + public String getMessageContent() + { + return messageContent; + } + public void setSenderId(Long senderId) + { + this.senderId = senderId; + } + + public Long getSenderId() + { + return senderId; + } + public void setSenderName(String senderName) + { + this.senderName = senderName; + } + + public String getSenderName() + { + return senderName; + } + public void setSenderNick(String senderNick) + { + this.senderNick = senderNick; + } + + public String getSenderNick() + { + return senderNick; + } + public void setRecipientId(Long recipientId) + { + this.recipientId = recipientId; + } + + public Long getRecipientId() + { + return recipientId; + } + public void setRecipientName(String recipientName) + { + this.recipientName = recipientName; + } + + public String getRecipientName() + { + return recipientName; + } + public void setRecipientNick(String recipientNick) + { + this.recipientNick = recipientNick; + } + + public String getRecipientNick() + { + return recipientNick; + } + public void setProcessTime(Date processTime) + { + this.processTime = processTime; + } + + public Date getProcessTime() + { + return processTime; + } + public void setCallBack(String callBack) + { + this.callBack = callBack; + } + + public String getCallBack() + { + return callBack; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setDeletedFlag(String deletedFlag) + { + this.deletedFlag = deletedFlag; + } + + public String getDeletedFlag() + { + return deletedFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("messageId", getMessageId()) + .append("messageType", getMessageType()) + .append("messageLevel", getMessageLevel()) + .append("messageTitle", getMessageTitle()) + .append("messageContent", getMessageContent()) + .append("senderId", getSenderId()) + .append("senderName", getSenderName()) + .append("senderNick", getSenderNick()) + .append("recipientId", getRecipientId()) + .append("recipientName", getRecipientName()) + .append("recipientNick", getRecipientNick()) + .append("processTime", getProcessTime()) + .append("callBack", getCallBack()) + .append("status", getStatus()) + .append("deletedFlag", getDeletedFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysNotice.java b/ktg-system/src/main/java/com/ktg/system/domain/SysNotice.java new file mode 100644 index 0000000..72450d6 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysNotice.java @@ -0,0 +1,102 @@ +package com.ktg.system.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.core.domain.BaseEntity; +import com.ktg.common.xss.Xss; + +/** + * 通知公告表 sys_notice + * + * @author ruoyi + */ +public class SysNotice extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 公告ID */ + private Long noticeId; + + /** 公告标题 */ + private String noticeTitle; + + /** 公告类型(1通知 2公告) */ + private String noticeType; + + /** 公告内容 */ + private String noticeContent; + + /** 公告状态(0正常 1关闭) */ + private String status; + + public Long getNoticeId() + { + return noticeId; + } + + public void setNoticeId(Long noticeId) + { + this.noticeId = noticeId; + } + + public void setNoticeTitle(String noticeTitle) + { + this.noticeTitle = noticeTitle; + } + + @Xss(message = "公告标题不能包含脚本字符") + @NotBlank(message = "公告标题不能为空") + @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") + public String getNoticeTitle() + { + return noticeTitle; + } + + public void setNoticeType(String noticeType) + { + this.noticeType = noticeType; + } + + public String getNoticeType() + { + return noticeType; + } + + public void setNoticeContent(String noticeContent) + { + this.noticeContent = noticeContent; + } + + public String getNoticeContent() + { + return noticeContent; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("noticeId", getNoticeId()) + .append("noticeTitle", getNoticeTitle()) + .append("noticeType", getNoticeType()) + .append("noticeContent", getNoticeContent()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysOperLog.java b/ktg-system/src/main/java/com/ktg/system/domain/SysOperLog.java new file mode 100644 index 0000000..4d2440b --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysOperLog.java @@ -0,0 +1,255 @@ +package com.ktg.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 操作日志记录表 oper_log + * + * @author ruoyi + */ +public class SysOperLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 日志主键 */ + @Excel(name = "操作序号", cellType = ColumnType.NUMERIC) + private Long operId; + + /** 操作模块 */ + @Excel(name = "操作模块") + private String title; + + /** 业务类型(0其它 1新增 2修改 3删除) */ + @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据") + private Integer businessType; + + /** 业务类型数组 */ + private Integer[] businessTypes; + + /** 请求方法 */ + @Excel(name = "请求方法") + private String method; + + /** 请求方式 */ + @Excel(name = "请求方式") + private String requestMethod; + + /** 操作类别(0其它 1后台用户 2手机端用户) */ + @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") + private Integer operatorType; + + /** 操作人员 */ + @Excel(name = "操作人员") + private String operName; + + /** 部门名称 */ + @Excel(name = "部门名称") + private String deptName; + + /** 请求url */ + @Excel(name = "请求地址") + private String operUrl; + + /** 操作地址 */ + @Excel(name = "操作地址") + private String operIp; + + /** 操作地点 */ + @Excel(name = "操作地点") + private String operLocation; + + /** 请求参数 */ + @Excel(name = "请求参数") + private String operParam; + + /** 返回参数 */ + @Excel(name = "返回参数") + private String jsonResult; + + /** 操作状态(0正常 1异常) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=异常") + private Integer status; + + /** 错误消息 */ + @Excel(name = "错误消息") + private String errorMsg; + + /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date operTime; + + public Long getOperId() + { + return operId; + } + + public void setOperId(Long operId) + { + this.operId = operId; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public Integer getBusinessType() + { + return businessType; + } + + public void setBusinessType(Integer businessType) + { + this.businessType = businessType; + } + + public Integer[] getBusinessTypes() + { + return businessTypes; + } + + public void setBusinessTypes(Integer[] businessTypes) + { + this.businessTypes = businessTypes; + } + + public String getMethod() + { + return method; + } + + public void setMethod(String method) + { + this.method = method; + } + + public String getRequestMethod() + { + return requestMethod; + } + + public void setRequestMethod(String requestMethod) + { + this.requestMethod = requestMethod; + } + + public Integer getOperatorType() + { + return operatorType; + } + + public void setOperatorType(Integer operatorType) + { + this.operatorType = operatorType; + } + + public String getOperName() + { + return operName; + } + + public void setOperName(String operName) + { + this.operName = operName; + } + + public String getDeptName() + { + return deptName; + } + + public void setDeptName(String deptName) + { + this.deptName = deptName; + } + + public String getOperUrl() + { + return operUrl; + } + + public void setOperUrl(String operUrl) + { + this.operUrl = operUrl; + } + + public String getOperIp() + { + return operIp; + } + + public void setOperIp(String operIp) + { + this.operIp = operIp; + } + + public String getOperLocation() + { + return operLocation; + } + + public void setOperLocation(String operLocation) + { + this.operLocation = operLocation; + } + + public String getOperParam() + { + return operParam; + } + + public void setOperParam(String operParam) + { + this.operParam = operParam; + } + + public String getJsonResult() + { + return jsonResult; + } + + public void setJsonResult(String jsonResult) + { + this.jsonResult = jsonResult; + } + + public Integer getStatus() + { + return status; + } + + public void setStatus(Integer status) + { + this.status = status; + } + + public String getErrorMsg() + { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) + { + this.errorMsg = errorMsg; + } + + public Date getOperTime() + { + return operTime; + } + + public void setOperTime(Date operTime) + { + this.operTime = operTime; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysPost.java b/ktg-system/src/main/java/com/ktg/system/domain/SysPost.java new file mode 100644 index 0000000..979614d --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysPost.java @@ -0,0 +1,123 @@ +package com.ktg.system.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.annotation.Excel.ColumnType; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 岗位表 sys_post + * + * @author ruoyi + */ +public class SysPost extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 岗位序号 */ + @Excel(name = "岗位序号", cellType = ColumnType.NUMERIC) + private Long postId; + + /** 岗位编码 */ + @Excel(name = "岗位编码") + private String postCode; + + /** 岗位名称 */ + @Excel(name = "岗位名称") + private String postName; + + /** 岗位排序 */ + @Excel(name = "岗位排序") + private String postSort; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 用户是否存在此岗位标识 默认不存在 */ + private boolean flag = false; + + public Long getPostId() + { + return postId; + } + + public void setPostId(Long postId) + { + this.postId = postId; + } + + @NotBlank(message = "岗位编码不能为空") + @Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符") + public String getPostCode() + { + return postCode; + } + + public void setPostCode(String postCode) + { + this.postCode = postCode; + } + + @NotBlank(message = "岗位名称不能为空") + @Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符") + public String getPostName() + { + return postName; + } + + public void setPostName(String postName) + { + this.postName = postName; + } + + @NotBlank(message = "显示顺序不能为空") + public String getPostSort() + { + return postSort; + } + + public void setPostSort(String postSort) + { + this.postSort = postSort; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public boolean isFlag() + { + return flag; + } + + public void setFlag(boolean flag) + { + this.flag = flag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("postId", getPostId()) + .append("postCode", getPostCode()) + .append("postName", getPostName()) + .append("postSort", getPostSort()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysRoleDept.java b/ktg-system/src/main/java/com/ktg/system/domain/SysRoleDept.java new file mode 100644 index 0000000..7327c26 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysRoleDept.java @@ -0,0 +1,46 @@ +package com.ktg.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和部门关联 sys_role_dept + * + * @author ruoyi + */ +public class SysRoleDept +{ + /** 角色ID */ + private Long roleId; + + /** 部门ID */ + private Long deptId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("deptId", getDeptId()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysRoleMenu.java b/ktg-system/src/main/java/com/ktg/system/domain/SysRoleMenu.java new file mode 100644 index 0000000..a6fbdb8 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysRoleMenu.java @@ -0,0 +1,46 @@ +package com.ktg.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和菜单关联 sys_role_menu + * + * @author ruoyi + */ +public class SysRoleMenu +{ + /** 角色ID */ + private Long roleId; + + /** 菜单ID */ + private Long menuId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("menuId", getMenuId()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysUserOnline.java b/ktg-system/src/main/java/com/ktg/system/domain/SysUserOnline.java new file mode 100644 index 0000000..b474a2f --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysUserOnline.java @@ -0,0 +1,113 @@ +package com.ktg.system.domain; + +/** + * 当前在线会话 + * + * @author ruoyi + */ +public class SysUserOnline +{ + /** 会话编号 */ + private String tokenId; + + /** 部门名称 */ + private String deptName; + + /** 用户名称 */ + private String userName; + + /** 登录IP地址 */ + private String ipaddr; + + /** 登录地址 */ + private String loginLocation; + + /** 浏览器类型 */ + private String browser; + + /** 操作系统 */ + private String os; + + /** 登录时间 */ + private Long loginTime; + + public String getTokenId() + { + return tokenId; + } + + public void setTokenId(String tokenId) + { + this.tokenId = tokenId; + } + + public String getDeptName() + { + return deptName; + } + + public void setDeptName(String deptName) + { + this.deptName = deptName; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public Long getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Long loginTime) + { + this.loginTime = loginTime; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysUserPost.java b/ktg-system/src/main/java/com/ktg/system/domain/SysUserPost.java new file mode 100644 index 0000000..a5fc333 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysUserPost.java @@ -0,0 +1,46 @@ +package com.ktg.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和岗位关联 sys_user_post + * + * @author ruoyi + */ +public class SysUserPost +{ + /** 用户ID */ + private Long userId; + + /** 岗位ID */ + private Long postId; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getPostId() + { + return postId; + } + + public void setPostId(Long postId) + { + this.postId = postId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("postId", getPostId()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/SysUserRole.java b/ktg-system/src/main/java/com/ktg/system/domain/SysUserRole.java new file mode 100644 index 0000000..6c31a55 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/SysUserRole.java @@ -0,0 +1,46 @@ +package com.ktg.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和角色关联 sys_user_role + * + * @author ruoyi + */ +public class SysUserRole +{ + /** 用户ID */ + private Long userId; + + /** 角色ID */ + private Long roleId; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("roleId", getRoleId()) + .toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/UserTask.java b/ktg-system/src/main/java/com/ktg/system/domain/UserTask.java new file mode 100644 index 0000000..840afbe --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/UserTask.java @@ -0,0 +1,111 @@ +package com.ktg.system.domain; + +import com.ktg.common.core.domain.BaseEntity; + +import java.util.Date; + +/** + * 所有用户相关的业务单据 + * 用于移动端展示待处理单据和已处理单据 + */ +public class UserTask extends BaseEntity { + + /** + * 单据类型 + */ + private String taskType; + + /** + * 单据的ID + */ + private String taskId; + + /** + * 单据编码 + */ + private String taskCode; + + /** + * 单据名称 + */ + private String taskName; + + + /** + * 单据的状态 + */ + private String status; + + private String nickName; + + private String userName; + + public String getTaskType() { + return taskType; + } + + public void setTaskType(String taskType) { + this.taskType = taskType; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + @Override + public String toString() { + return "UserTask{" + + "taskType='" + taskType + '\'' + + ", taskId='" + taskId + '\'' + + ", taskCode='" + taskCode + '\'' + + ", taskName='" + taskName + '\'' + + ", status='" + status + '\'' + + ", nickName='" + nickName + '\'' + + ", userName='" + userName + '\'' + + '}'; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/vo/MetaVo.java b/ktg-system/src/main/java/com/ktg/system/domain/vo/MetaVo.java new file mode 100644 index 0000000..c1330e0 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/vo/MetaVo.java @@ -0,0 +1,106 @@ +package com.ktg.system.domain.vo; + +import com.ktg.common.utils.StringUtils; + +/** + * 路由显示信息 + * + * @author ruoyi + */ +public class MetaVo +{ + /** + * 设置该路由在侧边栏和面包屑中展示的名字 + */ + private String title; + + /** + * 设置该路由的图标,对应路径src/assets/icons/svg + */ + private String icon; + + /** + * 设置为true,则不会被 缓存 + */ + private boolean noCache; + + /** + * 内链地址(http(s)://开头) + */ + private String link; + + public MetaVo() + { + } + + public MetaVo(String title, String icon) + { + this.title = title; + this.icon = icon; + } + + public MetaVo(String title, String icon, boolean noCache) + { + this.title = title; + this.icon = icon; + this.noCache = noCache; + } + + public MetaVo(String title, String icon, String link) + { + this.title = title; + this.icon = icon; + this.link = link; + } + + public MetaVo(String title, String icon, boolean noCache, String link) + { + this.title = title; + this.icon = icon; + this.noCache = noCache; + if (StringUtils.ishttp(link)) + { + this.link = link; + } + } + + public boolean isNoCache() + { + return noCache; + } + + public void setNoCache(boolean noCache) + { + this.noCache = noCache; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getIcon() + { + return icon; + } + + public void setIcon(String icon) + { + this.icon = icon; + } + + public String getLink() + { + return link; + } + + public void setLink(String link) + { + this.link = link; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/domain/vo/RouterVo.java b/ktg-system/src/main/java/com/ktg/system/domain/vo/RouterVo.java new file mode 100644 index 0000000..20b9b7e --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/domain/vo/RouterVo.java @@ -0,0 +1,148 @@ +package com.ktg.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +/** + * 路由配置信息 + * + * @author ruoyi + */ +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class RouterVo +{ + /** + * 路由名字 + */ + private String name; + + /** + * 路由地址 + */ + private String path; + + /** + * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 + */ + private boolean hidden; + + /** + * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + */ + private String redirect; + + /** + * 组件地址 + */ + private String component; + + /** + * 路由参数:如 {"id": 1, "name": "ry"} + */ + private String query; + + /** + * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + */ + private Boolean alwaysShow; + + /** + * 其他元素 + */ + private MetaVo meta; + + /** + * 子路由 + */ + private List children; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getPath() + { + return path; + } + + public void setPath(String path) + { + this.path = path; + } + + public boolean getHidden() + { + return hidden; + } + + public void setHidden(boolean hidden) + { + this.hidden = hidden; + } + + public String getRedirect() + { + return redirect; + } + + public void setRedirect(String redirect) + { + this.redirect = redirect; + } + + public String getComponent() + { + return component; + } + + public void setComponent(String component) + { + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public Boolean getAlwaysShow() + { + return alwaysShow; + } + + public void setAlwaysShow(Boolean alwaysShow) + { + this.alwaysShow = alwaysShow; + } + + public MetaVo getMeta() + { + return meta; + } + + public void setMeta(MetaVo meta) + { + this.meta = meta; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysAttachmentMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysAttachmentMapper.java new file mode 100644 index 0000000..f112c9e --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysAttachmentMapper.java @@ -0,0 +1,61 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysAttachment; + +/** + * 附件Mapper接口 + * + * @author yinjinlu + * @date 2022-07-26 + */ +public interface SysAttachmentMapper +{ + /** + * 查询附件 + * + * @param attachmentId 附件主键 + * @return 附件 + */ + public SysAttachment selectSysAttachmentByAttachmentId(Long attachmentId); + + /** + * 查询附件列表 + * + * @param sysAttachment 附件 + * @return 附件集合 + */ + public List selectSysAttachmentList(SysAttachment sysAttachment); + + /** + * 新增附件 + * + * @param sysAttachment 附件 + * @return 结果 + */ + public int insertSysAttachment(SysAttachment sysAttachment); + + /** + * 修改附件 + * + * @param sysAttachment 附件 + * @return 结果 + */ + public int updateSysAttachment(SysAttachment sysAttachment); + + /** + * 删除附件 + * + * @param attachmentId 附件主键 + * @return 结果 + */ + public int deleteSysAttachmentByAttachmentId(Long attachmentId); + + /** + * 批量删除附件 + * + * @param attachmentIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysAttachmentByAttachmentIds(Long[] attachmentIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodePartMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodePartMapper.java new file mode 100644 index 0000000..bf4dd31 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodePartMapper.java @@ -0,0 +1,19 @@ +package com.ktg.system.mapper; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; + +import java.util.List; + +public interface SysAutoCodePartMapper { + public List selectSysAutoCodePartList(SysAutoCodePart sysAutoCodePart); + + public SysAutoCodePart findById(Long partId); + + public SysAutoCodePart checkPartUnique(SysAutoCodePart sysAutoCodePart); + + public int add(SysAutoCodePart sysAutoCodePart); + + public int updateSysAutoCodePart(SysAutoCodePart sysAutoCodePart); + + public int deleteById(Long partId); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodeResultMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodeResultMapper.java new file mode 100644 index 0000000..51925d4 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodeResultMapper.java @@ -0,0 +1,17 @@ +package com.ktg.system.mapper; + +import com.ktg.common.core.domain.entity.SysAutoCodeResult; + +import java.util.List; + +public interface SysAutoCodeResultMapper { + public List selectSysAutoCodeResultList(SysAutoCodeResult sysAutoCodeResult); + + public void add(SysAutoCodeResult sysAutoCodeResult); + + public void updateAutoCodeResult(SysAutoCodeResult sysAutoCodeResult); + + public void deleteById(Long codeId); + + +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodeRuleMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodeRuleMapper.java new file mode 100644 index 0000000..2e0fde9 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysAutoCodeRuleMapper.java @@ -0,0 +1,22 @@ +package com.ktg.system.mapper; + +import com.ktg.common.core.domain.entity.SysAutoCodeRule; + +import java.util.List; + +public interface SysAutoCodeRuleMapper { + + public List selectSysAutoCodeResultList(SysAutoCodeRule sysAutoCodeRule); + + public SysAutoCodeRule findById(Long ruleId); + + public int add(SysAutoCodeRule sysAutoCodeRule); + + public int updateSysAutoCodeRule(SysAutoCodeRule sysAutoCodeRule); + + public int deleteById(Long ruleId); + + public SysAutoCodeRule checkRuleCodeUnique(String ruleCode); + + public SysAutoCodeRule checkRuleNameUnique(String ruleName); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysConfigMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysConfigMapper.java new file mode 100644 index 0000000..9a67a02 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysConfigMapper.java @@ -0,0 +1,68 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysConfig; + +/** + * 参数配置 数据层 + * + * @author ruoyi + */ +public interface SysConfigMapper +{ + /** + * 查询参数配置信息 + * + * @param config 参数配置信息 + * @return 参数配置信息 + */ + public SysConfig selectConfig(SysConfig config); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(SysConfig config); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数配置信息 + */ + public SysConfig checkConfigKeyUnique(String configKey); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(SysConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(SysConfig config); + + /** + * 删除参数配置 + * + * @param configId 参数ID + * @return 结果 + */ + public int deleteConfigById(Long configId); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + * @return 结果 + */ + public int deleteConfigByIds(Long[] configIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysDeptMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysDeptMapper.java new file mode 100644 index 0000000..01a6d58 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysDeptMapper.java @@ -0,0 +1,118 @@ +package com.ktg.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ktg.common.core.domain.entity.SysDept; + +/** + * 部门管理 数据层 + * + * @author ruoyi + */ +public interface SysDeptMapper +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(SysDept dept); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @param deptCheckStrictly 部门树选择项是否关联显示 + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门 + * + * @param deptId 部门ID + * @return 部门列表 + */ + public List selectChildrenDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public int hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 + */ + public int checkDeptExistUser(Long deptId); + + /** + * 校验部门名称是否唯一 + * + * @param deptName 部门名称 + * @param parentId 父部门ID + * @return 结果 + */ + public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); + + /** + * 新增部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 修改所在部门正常状态 + * + * @param deptIds 部门ID组 + */ + public void updateDeptStatusNormal(Long[] deptIds); + + /** + * 修改子元素关系 + * + * @param depts 子元素 + * @return 结果 + */ + public int updateDeptChildren(@Param("depts") List depts); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysDictDataMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysDictDataMapper.java new file mode 100644 index 0000000..4fd6314 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysDictDataMapper.java @@ -0,0 +1,95 @@ +package com.ktg.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ktg.common.core.domain.entity.SysDictData; + +/** + * 字典表 数据层 + * + * @author ktg + */ +public interface SysDictDataMapper +{ + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + public List selectDictDataList(SysDictData dictData); + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + public List selectDictDataByType(String dictType); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue); + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + public SysDictData selectDictDataById(Long dictCode); + + /** + * 查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据 + */ + public int countDictDataByType(String dictType); + + /** + * 通过字典ID删除字典数据信息 + * + * @param dictCode 字典数据ID + * @return 结果 + */ + public int deleteDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + public int deleteDictDataByIds(Long[] dictCodes); + + /** + * 新增字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int insertDictData(SysDictData dictData); + + /** + * 修改字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int updateDictData(SysDictData dictData); + + /** + * 同步修改字典类型 + * + * @param oldDictType 旧字典类型 + * @param newDictType 新旧字典类型 + * @return 结果 + */ + public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysDictTypeMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysDictTypeMapper.java new file mode 100644 index 0000000..f0b2200 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysDictTypeMapper.java @@ -0,0 +1,85 @@ +package com.ktg.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import com.ktg.common.core.domain.entity.SysDictType; + +/** + * 字典表 数据层 + * + * @author ruoyi + */ +@Mapper +public interface SysDictTypeMapper +{ + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + public List selectDictTypeList(SysDictType dictType); + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + public List selectDictTypeAll(); + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + public SysDictType selectDictTypeById(Long dictId); + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + public SysDictType selectDictTypeByType(String dictType); + + /** + * 通过字典ID删除字典信息 + * + * @param dictId 字典ID + * @return 结果 + */ + public int deleteDictTypeById(Long dictId); + + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + * @return 结果 + */ + public int deleteDictTypeByIds(Long[] dictIds); + + /** + * 新增字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int insertDictType(SysDictType dictType); + + /** + * 修改字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int updateDictType(SysDictType dictType); + + /** + * 校验字典类型称是否唯一 + * + * @param dictType 字典类型 + * @return 结果 + */ + public SysDictType checkDictTypeUnique(String dictType); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysLogininforMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysLogininforMapper.java new file mode 100644 index 0000000..e2096ae --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysLogininforMapper.java @@ -0,0 +1,42 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysLogininfor; + +/** + * 系统访问日志情况信息 数据层 + * + * @author ruoyi + */ +public interface SysLogininforMapper +{ + /** + * 新增系统登录日志 + * + * @param logininfor 访问日志对象 + */ + public void insertLogininfor(SysLogininfor logininfor); + + /** + * 查询系统登录日志集合 + * + * @param logininfor 访问日志对象 + * @return 登录记录集合 + */ + public List selectLogininforList(SysLogininfor logininfor); + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + public int deleteLogininforByIds(Long[] infoIds); + + /** + * 清空系统登录日志 + * + * @return 结果 + */ + public int cleanLogininfor(); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysMenuMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysMenuMapper.java new file mode 100644 index 0000000..23c41f6 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysMenuMapper.java @@ -0,0 +1,117 @@ +package com.ktg.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ktg.common.core.domain.entity.SysMenu; + +/** + * 菜单表 数据层 + * + * @author ruoyi + */ +public interface SysMenuMapper +{ + /** + * 查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuList(SysMenu menu); + + /** + * 根据用户所有权限 + * + * @return 权限列表 + */ + public List selectMenuPerms(); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuListByUserId(SysMenu menu); + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public List selectMenuPermsByUserId(Long userId); + + /** + * 根据用户ID查询菜单 + * + * @return 菜单列表 + */ + public List selectMenuTreeAll(); + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @param menuCheckStrictly 菜单树选择项是否关联显示 + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + public SysMenu selectMenuById(Long menuId); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int hasChildByMenuId(Long menuId); + + /** + * 新增菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int insertMenu(SysMenu menu); + + /** + * 修改菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(SysMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menuName 菜单名称 + * @param parentId 父菜单ID + * @return 结果 + */ + public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysMessageMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysMessageMapper.java new file mode 100644 index 0000000..7608daa --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysMessageMapper.java @@ -0,0 +1,61 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysMessage; + +/** + * 消息Mapper接口 + * + * @author yinjinlu + * @date 2023-03-06 + */ +public interface SysMessageMapper +{ + /** + * 查询消息 + * + * @param messageId 消息主键 + * @return 消息 + */ + public SysMessage selectSysMessageByMessageId(Long messageId); + + /** + * 查询消息列表 + * + * @param sysMessage 消息 + * @return 消息集合 + */ + public List selectSysMessageList(SysMessage sysMessage); + + /** + * 新增消息 + * + * @param sysMessage 消息 + * @return 结果 + */ + public int insertSysMessage(SysMessage sysMessage); + + /** + * 修改消息 + * + * @param sysMessage 消息 + * @return 结果 + */ + public int updateSysMessage(SysMessage sysMessage); + + /** + * 删除消息 + * + * @param messageId 消息主键 + * @return 结果 + */ + public int deleteSysMessageByMessageId(Long messageId); + + /** + * 批量删除消息 + * + * @param messageIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysMessageByMessageIds(Long[] messageIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysNoticeMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysNoticeMapper.java new file mode 100644 index 0000000..7a68798 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysNoticeMapper.java @@ -0,0 +1,60 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysNotice; + +/** + * 通知公告表 数据层 + * + * @author ruoyi + */ +public interface SysNoticeMapper +{ + /** + * 查询公告信息 + * + * @param noticeId 公告ID + * @return 公告信息 + */ + public SysNotice selectNoticeById(Long noticeId); + + /** + * 查询公告列表 + * + * @param notice 公告信息 + * @return 公告集合 + */ + public List selectNoticeList(SysNotice notice); + + /** + * 新增公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int insertNotice(SysNotice notice); + + /** + * 修改公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int updateNotice(SysNotice notice); + + /** + * 批量删除公告 + * + * @param noticeId 公告ID + * @return 结果 + */ + public int deleteNoticeById(Long noticeId); + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + public int deleteNoticeByIds(Long[] noticeIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysOperLogMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysOperLogMapper.java new file mode 100644 index 0000000..7d2b476 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysOperLogMapper.java @@ -0,0 +1,48 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysOperLog; + +/** + * 操作日志 数据层 + * + * @author ruoyi + */ +public interface SysOperLogMapper +{ + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + public void insertOperlog(SysOperLog operLog); + + /** + * 查询系统操作日志集合 + * + * @param operLog 操作日志对象 + * @return 操作日志集合 + */ + public List selectOperLogList(SysOperLog operLog); + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + public int deleteOperLogByIds(Long[] operIds); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public SysOperLog selectOperLogById(Long operId); + + /** + * 清空操作日志 + */ + public void cleanOperLog(); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysPostMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysPostMapper.java new file mode 100644 index 0000000..9fac1af --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysPostMapper.java @@ -0,0 +1,100 @@ +package com.ktg.system.mapper; + +import com.ktg.system.domain.SysPost; + +import java.util.List; + +/** + * 岗位信息 数据层 + * + * @author ruoyi + */ +public interface SysPostMapper +{ + /** + * 查询岗位数据集合 + * + * @param post 岗位信息 + * @return 岗位数据集合 + */ + public List selectPostList(SysPost post); + + /** + * 查询所有岗位 + * + * @return 岗位列表 + */ + public List selectPostAll(); + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + public SysPost selectPostById(Long postId); + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public List selectPostsByUserName(String userName); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public int deletePostById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + public int deletePostByIds(Long[] postIds); + + /** + * 修改岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(SysPost post); + + /** + * 新增岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int insertPost(SysPost post); + + /** + * 校验岗位名称 + * + * @param postName 岗位名称 + * @return 结果 + */ + public SysPost checkPostNameUnique(String postName); + + /** + * 校验岗位编码 + * + * @param postCode 岗位编码 + * @return 结果 + */ + public SysPost checkPostCodeUnique(String postCode); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleDeptMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleDeptMapper.java new file mode 100644 index 0000000..fe4d8f6 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleDeptMapper.java @@ -0,0 +1,44 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysRoleDept; + +/** + * 角色与部门关联表 数据层 + * + * @author ktg + */ +public interface SysRoleDeptMapper +{ + /** + * 通过角色ID删除角色和部门关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleDeptByRoleId(Long roleId); + + /** + * 批量删除角色部门关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteRoleDept(Long[] ids); + + /** + * 查询部门使用数量 + * + * @param deptId 部门ID + * @return 结果 + */ + public int selectCountRoleDeptByDeptId(Long deptId); + + /** + * 批量新增角色部门信息 + * + * @param roleDeptList 角色部门列表 + * @return 结果 + */ + public int batchRoleDept(List roleDeptList); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleMapper.java new file mode 100644 index 0000000..43912b1 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleMapper.java @@ -0,0 +1,107 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.common.core.domain.entity.SysRole; + +/** + * 角色表 数据层 + * + * @author ruoyi + */ +public interface SysRoleMapper +{ + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + public List selectRoleList(SysRole role); + + /** + * 根据用户ID查询角色 + * + * @param userId 用户ID + * @return 角色列表 + */ + public List selectRolePermissionByUserId(Long userId); + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + public List selectRoleAll(); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); + + /** + * 通过角色ID查询角色 + * + * @param roleId 角色ID + * @return 角色对象信息 + */ + public SysRole selectRoleById(Long roleId); + + /** + * 根据用户ID查询角色 + * + * @param userName 用户名 + * @return 角色列表 + */ + public List selectRolesByUserName(String userName); + + /** + * 校验角色名称是否唯一 + * + * @param roleName 角色名称 + * @return 角色信息 + */ + public SysRole checkRoleNameUnique(String roleName); + + /** + * 校验角色权限是否唯一 + * + * @param roleKey 角色权限 + * @return 角色信息 + */ + public SysRole checkRoleKeyUnique(String roleKey); + + /** + * 修改角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRole(SysRole role); + + /** + * 新增角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int insertRole(SysRole role); + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleById(Long roleId); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + public int deleteRoleByIds(Long[] roleIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleMenuMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleMenuMapper.java new file mode 100644 index 0000000..7856f21 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysRoleMenuMapper.java @@ -0,0 +1,44 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysRoleMenu; + +/** + * 角色与菜单关联表 数据层 + * + * @author ruoyi + */ +public interface SysRoleMenuMapper +{ + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int checkMenuExistRole(Long menuId); + + /** + * 通过角色ID删除角色和菜单关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleMenuByRoleId(Long roleId); + + /** + * 批量删除角色菜单关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteRoleMenu(Long[] ids); + + /** + * 批量新增角色菜单信息 + * + * @param roleMenuList 角色菜单列表 + * @return 结果 + */ + public int batchRoleMenu(List roleMenuList); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysUserMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysUserMapper.java new file mode 100644 index 0000000..aa973cc --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysUserMapper.java @@ -0,0 +1,134 @@ +package com.ktg.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ktg.common.core.domain.entity.SysUser; + +/** + * 用户表 数据层 + * + * @author ruoyi + */ +public interface SysUserMapper +{ + /** + * 根据条件分页查询用户列表 + * + * @param sysUser 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(SysUser sysUser); + + /** + * 根据条件分页查询已配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectAllocatedList(SysUser user); + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUnallocatedList(SysUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 根据手机号码查询 + * @param mobile + * @return + */ + public SysUser selectUserByMobile(String mobile); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(@Param("userName") String userName, @Param("password") String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + public int checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @param phonenumber 手机号码 + * @return 结果 + */ + public SysUser checkPhoneUnique(String phonenumber); + + /** + * 校验email是否唯一 + * + * @param email 用户邮箱 + * @return 结果 + */ + public SysUser checkEmailUnique(String email); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysUserPostMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysUserPostMapper.java new file mode 100644 index 0000000..f545919 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysUserPostMapper.java @@ -0,0 +1,44 @@ +package com.ktg.system.mapper; + +import java.util.List; +import com.ktg.system.domain.SysUserPost; + +/** + * 用户与岗位关联表 数据层 + * + * @author ruoyi + */ +public interface SysUserPostMapper +{ + /** + * 通过用户ID删除用户和岗位关联 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserPostByUserId(Long userId); + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + public int countUserPostById(Long postId); + + /** + * 批量删除用户和岗位关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteUserPost(Long[] ids); + + /** + * 批量新增用户岗位信息 + * + * @param userPostList 用户角色列表 + * @return 结果 + */ + public int batchUserPost(List userPostList); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/SysUserRoleMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..6034357 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/SysUserRoleMapper.java @@ -0,0 +1,62 @@ +package com.ktg.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ktg.system.domain.SysUserRole; + +/** + * 用户与角色关联表 数据层 + * + * @author ruoyi + */ +public interface SysUserRoleMapper +{ + /** + * 通过用户ID删除用户和角色关联 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserRoleByUserId(Long userId); + + /** + * 批量删除用户和角色关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteUserRole(Long[] ids); + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + public int countUserRoleByRoleId(Long roleId); + + /** + * 批量新增用户角色信息 + * + * @param userRoleList 用户角色列表 + * @return 结果 + */ + public int batchUserRole(List userRoleList); + + /** + * 删除用户和角色关联信息 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + public int deleteUserRoleInfo(SysUserRole userRole); + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要删除的用户数据ID + * @return 结果 + */ + public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/mapper/UserTaskMapper.java b/ktg-system/src/main/java/com/ktg/system/mapper/UserTaskMapper.java new file mode 100644 index 0000000..89127ed --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/mapper/UserTaskMapper.java @@ -0,0 +1,13 @@ +package com.ktg.system.mapper; + +import com.ktg.system.domain.UserTask; + +import java.util.List; + +public interface UserTaskMapper { + + public List listTodoList(String userName); + + public List listFinishedList(String userName); + +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/IAutoCodePartService.java b/ktg-system/src/main/java/com/ktg/system/service/IAutoCodePartService.java new file mode 100644 index 0000000..c1a79fc --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/IAutoCodePartService.java @@ -0,0 +1,22 @@ +package com.ktg.system.service; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; + +import java.util.List; + +public interface IAutoCodePartService { + + public List listPart(SysAutoCodePart sysAutoCodePart); + + public SysAutoCodePart findById(Long partId); + + public String checkPartUnique(SysAutoCodePart sysAutoCodePart); + + + public int insertPart(SysAutoCodePart sysAutoCodePart); + + public int updatePart(SysAutoCodePart sysAutoCodePart); + + public int deleteByIds(Long[] partIds); + +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/IAutoCodeResultService.java b/ktg-system/src/main/java/com/ktg/system/service/IAutoCodeResultService.java new file mode 100644 index 0000000..66c685b --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/IAutoCodeResultService.java @@ -0,0 +1,20 @@ +package com.ktg.system.service; + +import com.ktg.common.core.domain.entity.SysAutoCodeResult; + +import java.util.List; + +public interface IAutoCodeResultService { + + /** + * 根据条件查询当前的记录表中是否有满足指定条件的记录 + * gen_date条件要以like 'xxx%' 方式查询 + * @param sysAutoCodeResult + * @return + */ + public List list(SysAutoCodeResult sysAutoCodeResult); + + public void saveAutoCodeResult(SysAutoCodeResult sysAutoCodeResult); + + public void updateAutoCodeResult(SysAutoCodeResult sysAutoCodeResult); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/IAutoCodeRuleService.java b/ktg-system/src/main/java/com/ktg/system/service/IAutoCodeRuleService.java new file mode 100644 index 0000000..a247d72 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/IAutoCodeRuleService.java @@ -0,0 +1,27 @@ +package com.ktg.system.service; + +import com.ktg.common.core.domain.entity.SysAutoCodeRule; + +import java.util.List; + +public interface IAutoCodeRuleService { + + public SysAutoCodeRule getOne(String ruleCode); + + public List selectAutoCodeList(SysAutoCodeRule sysAutoCodeRule); + + public SysAutoCodeRule findById(Long ruleId); + + public String checkRuleCodeUnique(SysAutoCodeRule sysAutoCodeRule); + + public String checkRuleNameUnique(SysAutoCodeRule sysAutoCodeRule); + + public int insertInfo(SysAutoCodeRule rule); + + public int updateInfo(SysAutoCodeRule rule); + + public int deleteById(Long ruleId); + + public int deleteByIds(Long[] ruleIds); + +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysAttachmentService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysAttachmentService.java new file mode 100644 index 0000000..1e6501d --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysAttachmentService.java @@ -0,0 +1,61 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysAttachment; + +/** + * 附件Service接口 + * + * @author yinjinlu + * @date 2022-07-26 + */ +public interface ISysAttachmentService +{ + /** + * 查询附件 + * + * @param attachmentId 附件主键 + * @return 附件 + */ + public SysAttachment selectSysAttachmentByAttachmentId(Long attachmentId); + + /** + * 查询附件列表 + * + * @param sysAttachment 附件 + * @return 附件集合 + */ + public List selectSysAttachmentList(SysAttachment sysAttachment); + + /** + * 新增附件 + * + * @param sysAttachment 附件 + * @return 结果 + */ + public int insertSysAttachment(SysAttachment sysAttachment); + + /** + * 修改附件 + * + * @param sysAttachment 附件 + * @return 结果 + */ + public int updateSysAttachment(SysAttachment sysAttachment); + + /** + * 批量删除附件 + * + * @param attachmentIds 需要删除的附件主键集合 + * @return 结果 + */ + public int deleteSysAttachmentByAttachmentIds(Long[] attachmentIds); + + /** + * 删除附件信息 + * + * @param attachmentId 附件主键 + * @return 结果 + */ + public int deleteSysAttachmentByAttachmentId(Long attachmentId); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysConfigService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysConfigService.java new file mode 100644 index 0000000..a879e3f --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysConfigService.java @@ -0,0 +1,89 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysConfig; + +/** + * 参数配置 服务层 + * + * @author ruoyi + */ +public interface ISysConfigService +{ + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + public SysConfig selectConfigById(Long configId); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数键值 + */ + public String selectConfigByKey(String configKey); + + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + public boolean selectCaptchaOnOff(); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(SysConfig config); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(SysConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(SysConfig config); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + public void deleteConfigByIds(Long[] configIds); + + /** + * 加载参数缓存数据 + */ + public void loadingConfigCache(); + + /** + * 清空参数缓存数据 + */ + public void clearConfigCache(); + + /** + * 重置参数缓存数据 + */ + public void resetConfigCache(); + + /** + * 校验参数键名是否唯一 + * + * @param config 参数信息 + * @return 结果 + */ + public String checkConfigKeyUnique(SysConfig config); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysDeptService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysDeptService.java new file mode 100644 index 0000000..c4c7afa --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysDeptService.java @@ -0,0 +1,116 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.common.core.domain.TreeSelect; +import com.ktg.common.core.domain.entity.SysDept; + +/** + * 部门管理 服务层 + * + * @author ruoyi + */ +public interface ISysDeptService +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(SysDept dept); + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + public List buildDeptTree(List depts); + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + public List buildDeptTreeSelect(List depts); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(Long roleId); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在部门子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public boolean hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId); + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + public String checkDeptNameUnique(SysDept dept); + + /** + * 校验部门是否有数据权限 + * + * @param deptId 部门id + */ + public void checkDeptDataScope(Long deptId); + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysDictDataService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysDictDataService.java new file mode 100644 index 0000000..3003199 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysDictDataService.java @@ -0,0 +1,60 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.common.core.domain.entity.SysDictData; + +/** + * 字典 业务层 + * + * @author ruoyi + */ +public interface ISysDictDataService +{ + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + public List selectDictDataList(SysDictData dictData); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(String dictType, String dictValue); + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + public SysDictData selectDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + */ + public void deleteDictDataByIds(Long[] dictCodes); + + /** + * 新增保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int insertDictData(SysDictData dictData); + + /** + * 修改保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int updateDictData(SysDictData dictData); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysDictTypeService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysDictTypeService.java new file mode 100644 index 0000000..e85387a --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysDictTypeService.java @@ -0,0 +1,98 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.common.core.domain.entity.SysDictData; +import com.ktg.common.core.domain.entity.SysDictType; + +/** + * 字典 业务层 + * + * @author ruoyi + */ +public interface ISysDictTypeService +{ + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + public List selectDictTypeList(SysDictType dictType); + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + public List selectDictTypeAll(); + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + public List selectDictDataByType(String dictType); + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + public SysDictType selectDictTypeById(Long dictId); + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + public SysDictType selectDictTypeByType(String dictType); + + /** + * 批量删除字典信息 + * + * @param dictIds 需要删除的字典ID + */ + public void deleteDictTypeByIds(Long[] dictIds); + + /** + * 加载字典缓存数据 + */ + public void loadingDictCache(); + + /** + * 清空字典缓存数据 + */ + public void clearDictCache(); + + /** + * 重置字典缓存数据 + */ + public void resetDictCache(); + + /** + * 新增保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int insertDictType(SysDictType dictType); + + /** + * 修改保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int updateDictType(SysDictType dictType); + + /** + * 校验字典类型称是否唯一 + * + * @param dictType 字典类型 + * @return 结果 + */ + public String checkDictTypeUnique(SysDictType dictType); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysLogininforService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysLogininforService.java new file mode 100644 index 0000000..c1ff57a --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysLogininforService.java @@ -0,0 +1,40 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysLogininfor; + +/** + * 系统访问日志情况信息 服务层 + * + * @author ruoyi + */ +public interface ISysLogininforService +{ + /** + * 新增系统登录日志 + * + * @param logininfor 访问日志对象 + */ + public void insertLogininfor(SysLogininfor logininfor); + + /** + * 查询系统登录日志集合 + * + * @param logininfor 访问日志对象 + * @return 登录记录集合 + */ + public List selectLogininforList(SysLogininfor logininfor); + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + public int deleteLogininforByIds(Long[] infoIds); + + /** + * 清空系统登录日志 + */ + public void cleanLogininfor(); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysMenuService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysMenuService.java new file mode 100644 index 0000000..dd528ce --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysMenuService.java @@ -0,0 +1,136 @@ +package com.ktg.system.service; + +import java.util.List; +import java.util.Set; +import com.ktg.common.core.domain.TreeSelect; +import com.ktg.common.core.domain.entity.SysMenu; +import com.ktg.system.domain.vo.RouterVo; + +/** + * 菜单 业务层 + * + * @author ruoyi + */ +public interface ISysMenuService +{ + /** + * 根据用户查询系统菜单列表 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuList(Long userId); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuList(SysMenu menu, Long userId); + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public Set selectMenuPermsByUserId(Long userId); + + /** + * 根据用户ID查询菜单树信息 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(Long roleId); + + /** + * 构建前端路由所需要的菜单 + * + * @param menus 菜单列表 + * @return 路由列表 + */ + public List buildMenus(List menus); + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildMenuTree(List menus); + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + public List buildMenuTreeSelect(List menus); + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + public SysMenu selectMenuById(Long menuId); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean hasChildByMenuId(Long menuId); + + /** + * 查询菜单是否存在角色 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkMenuExistRole(Long menuId); + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int insertMenu(SysMenu menu); + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(SysMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + public String checkMenuNameUnique(SysMenu menu); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java new file mode 100644 index 0000000..47981ed --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java @@ -0,0 +1,61 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysMessage; + +/** + * 消息Service接口 + * + * @author yinjinlu + * @date 2023-03-06 + */ +public interface ISysMessageService +{ + /** + * 查询消息 + * + * @param messageId 消息主键 + * @return 消息 + */ + public SysMessage selectSysMessageByMessageId(Long messageId); + + /** + * 查询消息列表 + * + * @param sysMessage 消息 + * @return 消息集合 + */ + public List selectSysMessageList(SysMessage sysMessage); + + /** + * 新增消息 + * + * @param sysMessage 消息 + * @return 结果 + */ + public int insertSysMessage(SysMessage sysMessage); + + /** + * 修改消息 + * + * @param sysMessage 消息 + * @return 结果 + */ + public int updateSysMessage(SysMessage sysMessage); + + /** + * 批量删除消息 + * + * @param messageIds 需要删除的消息主键集合 + * @return 结果 + */ + public int deleteSysMessageByMessageIds(Long[] messageIds); + + /** + * 删除消息信息 + * + * @param messageId 消息主键 + * @return 结果 + */ + public int deleteSysMessageByMessageId(Long messageId); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysNoticeService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysNoticeService.java new file mode 100644 index 0000000..ee69a3c --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysNoticeService.java @@ -0,0 +1,60 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysNotice; + +/** + * 公告 服务层 + * + * @author ruoyi + */ +public interface ISysNoticeService +{ + /** + * 查询公告信息 + * + * @param noticeId 公告ID + * @return 公告信息 + */ + public SysNotice selectNoticeById(Long noticeId); + + /** + * 查询公告列表 + * + * @param notice 公告信息 + * @return 公告集合 + */ + public List selectNoticeList(SysNotice notice); + + /** + * 新增公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int insertNotice(SysNotice notice); + + /** + * 修改公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int updateNotice(SysNotice notice); + + /** + * 删除公告信息 + * + * @param noticeId 公告ID + * @return 结果 + */ + public int deleteNoticeById(Long noticeId); + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + public int deleteNoticeByIds(Long[] noticeIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysOperLogService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysOperLogService.java new file mode 100644 index 0000000..0d531cd --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysOperLogService.java @@ -0,0 +1,48 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysOperLog; + +/** + * 操作日志 服务层 + * + * @author ruoyi + */ +public interface ISysOperLogService +{ + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + public void insertOperlog(SysOperLog operLog); + + /** + * 查询系统操作日志集合 + * + * @param operLog 操作日志对象 + * @return 操作日志集合 + */ + public List selectOperLogList(SysOperLog operLog); + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + public int deleteOperLogByIds(Long[] operIds); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public SysOperLog selectOperLogById(Long operId); + + /** + * 清空操作日志 + */ + public void cleanOperLog(); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysPostService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysPostService.java new file mode 100644 index 0000000..a15f3f4 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysPostService.java @@ -0,0 +1,99 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.system.domain.SysPost; + +/** + * 岗位信息 服务层 + * + * @author ruoyi + */ +public interface ISysPostService +{ + /** + * 查询岗位信息集合 + * + * @param post 岗位信息 + * @return 岗位列表 + */ + public List selectPostList(SysPost post); + + /** + * 查询所有岗位 + * + * @return 岗位列表 + */ + public List selectPostAll(); + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + public SysPost selectPostById(Long postId); + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + + /** + * 校验岗位名称 + * + * @param post 岗位信息 + * @return 结果 + */ + public String checkPostNameUnique(SysPost post); + + /** + * 校验岗位编码 + * + * @param post 岗位信息 + * @return 结果 + */ + public String checkPostCodeUnique(SysPost post); + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + public int countUserPostById(Long postId); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public int deletePostById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + public int deletePostByIds(Long[] postIds); + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int insertPost(SysPost post); + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(SysPost post); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysRoleService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysRoleService.java new file mode 100644 index 0000000..bead11f --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysRoleService.java @@ -0,0 +1,173 @@ +package com.ktg.system.service; + +import java.util.List; +import java.util.Set; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.system.domain.SysUserRole; + +/** + * 角色业务层 + * + * @author ruoyi + */ +public interface ISysRoleService +{ + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + public List selectRoleList(SysRole role); + + /** + * 根据用户ID查询角色列表 + * + * @param userId 用户ID + * @return 角色列表 + */ + public List selectRolesByUserId(Long userId); + + /** + * 根据用户ID查询角色权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public Set selectRolePermissionByUserId(Long userId); + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + public List selectRoleAll(); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); + + /** + * 通过角色ID查询角色 + * + * @param roleId 角色ID + * @return 角色对象信息 + */ + public SysRole selectRoleById(Long roleId); + + /** + * 校验角色名称是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + public String checkRoleNameUnique(SysRole role); + + /** + * 校验角色权限是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + public String checkRoleKeyUnique(SysRole role); + + /** + * 校验角色是否允许操作 + * + * @param role 角色信息 + */ + public void checkRoleAllowed(SysRole role); + + /** + * 校验角色是否有数据权限 + * + * @param roleId 角色id + */ + public void checkRoleDataScope(Long roleId); + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + public int countUserRoleByRoleId(Long roleId); + + /** + * 新增保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int insertRole(SysRole role); + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRole(SysRole role); + + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRoleStatus(SysRole role); + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int authDataScope(SysRole role); + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleById(Long roleId); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + public int deleteRoleByIds(Long[] roleIds); + + /** + * 取消授权用户角色 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + public int deleteAuthUser(SysUserRole userRole); + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要取消授权的用户数据ID + * @return 结果 + */ + public int deleteAuthUsers(Long roleId, Long[] userIds); + + /** + * 批量选择授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要删除的用户数据ID + * @return 结果 + */ + public int insertAuthUsers(Long roleId, Long[] userIds); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysUserOnlineService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysUserOnlineService.java new file mode 100644 index 0000000..49c30ae --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysUserOnlineService.java @@ -0,0 +1,48 @@ +package com.ktg.system.service; + +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.system.domain.SysUserOnline; + +/** + * 在线用户 服务层 + * + * @author ruoyi + */ +public interface ISysUserOnlineService +{ + /** + * 通过登录地址查询信息 + * + * @param ipaddr 登录地址 + * @param user 用户信息 + * @return 在线用户信息 + */ + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); + + /** + * 通过用户名称查询信息 + * + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); + + /** + * 通过登录地址/用户名称查询信息 + * + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); + + /** + * 设置在线用户信息 + * + * @param user 用户信息 + * @return 在线用户 + */ + public SysUserOnline loginUserToUserOnline(LoginUser user); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysUserService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysUserService.java new file mode 100644 index 0000000..3db7c5b --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysUserService.java @@ -0,0 +1,213 @@ +package com.ktg.system.service; + +import java.util.List; +import com.ktg.common.core.domain.entity.SysUser; + +/** + * 用户 业务层 + * + * @author ruoyi + */ +public interface ISysUserService +{ + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(SysUser user); + + /** + * 根据条件分页查询已分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectAllocatedList(SysUser user); + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUnallocatedList(SysUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 通过手机号码查询用户 + * @param mobile + * @return + */ + public SysUser selectUserByMobile(String mobile); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + /** + * 根据用户ID查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserRoleGroup(String userName); + + /** + * 根据用户ID查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserPostGroup(String userName); + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + public String checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public String checkPhoneUnique(SysUser user); + + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public String checkEmailUnique(SysUser user); + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + public void checkUserAllowed(SysUser user); + + /** + * 校验用户是否有数据权限 + * + * @param userId 用户id + */ + public void checkUserDataScope(Long userId); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean registerUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserAuth(Long userId, Long[] roleIds); + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserStatus(SysUser user); + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserProfile(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public boolean updateUserAvatar(String userName, String avatar); + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + public int resetPwd(SysUser user); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(String userName, String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + public String importUser(List userList, Boolean isUpdateSupport, String operName); +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/IUserTaskService.java b/ktg-system/src/main/java/com/ktg/system/service/IUserTaskService.java new file mode 100644 index 0000000..d5ded08 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/IUserTaskService.java @@ -0,0 +1,13 @@ +package com.ktg.system.service; + +import com.ktg.system.domain.UserTask; + +import java.util.List; + +public interface IUserTaskService { + + public List listTodoList(String usesrName); + + public List listFinishedList(String usesrName); + +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysAttachmentServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAttachmentServiceImpl.java new file mode 100644 index 0000000..8fbe5b0 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAttachmentServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.system.mapper.SysAttachmentMapper; +import com.ktg.system.domain.SysAttachment; +import com.ktg.system.service.ISysAttachmentService; + +/** + * 附件Service业务层处理 + * + * @author yinjinlu + * @date 2022-07-26 + */ +@Service +public class SysAttachmentServiceImpl implements ISysAttachmentService +{ + @Autowired + private SysAttachmentMapper sysAttachmentMapper; + + /** + * 查询附件 + * + * @param attachmentId 附件主键 + * @return 附件 + */ + @Override + public SysAttachment selectSysAttachmentByAttachmentId(Long attachmentId) + { + return sysAttachmentMapper.selectSysAttachmentByAttachmentId(attachmentId); + } + + /** + * 查询附件列表 + * + * @param sysAttachment 附件 + * @return 附件 + */ + @Override + public List selectSysAttachmentList(SysAttachment sysAttachment) + { + return sysAttachmentMapper.selectSysAttachmentList(sysAttachment); + } + + /** + * 新增附件 + * + * @param sysAttachment 附件 + * @return 结果 + */ + @Override + public int insertSysAttachment(SysAttachment sysAttachment) + { + sysAttachment.setCreateTime(DateUtils.getNowDate()); + return sysAttachmentMapper.insertSysAttachment(sysAttachment); + } + + /** + * 修改附件 + * + * @param sysAttachment 附件 + * @return 结果 + */ + @Override + public int updateSysAttachment(SysAttachment sysAttachment) + { + sysAttachment.setUpdateTime(DateUtils.getNowDate()); + return sysAttachmentMapper.updateSysAttachment(sysAttachment); + } + + /** + * 批量删除附件 + * + * @param attachmentIds 需要删除的附件主键 + * @return 结果 + */ + @Override + public int deleteSysAttachmentByAttachmentIds(Long[] attachmentIds) + { + return sysAttachmentMapper.deleteSysAttachmentByAttachmentIds(attachmentIds); + } + + /** + * 删除附件信息 + * + * @param attachmentId 附件主键 + * @return 结果 + */ + @Override + public int deleteSysAttachmentByAttachmentId(Long attachmentId) + { + return sysAttachmentMapper.deleteSysAttachmentByAttachmentId(attachmentId); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodePartServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodePartServiceImpl.java new file mode 100644 index 0000000..a79392b --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodePartServiceImpl.java @@ -0,0 +1,59 @@ +package com.ktg.system.service.impl; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.mapper.SysAutoCodePartMapper; +import com.ktg.system.service.IAutoCodePartService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class SysAutoCodePartServiceImpl implements IAutoCodePartService { + + @Autowired + private SysAutoCodePartMapper sysAutoCodePartMapper; + + @Override + public List listPart(SysAutoCodePart sysAutoCodePart) { + return sysAutoCodePartMapper.selectSysAutoCodePartList(sysAutoCodePart); + } + + @Override + public SysAutoCodePart findById(Long partId) { + return sysAutoCodePartMapper.findById(partId); + } + + @Override + public String checkPartUnique(SysAutoCodePart sysAutoCodePart) { + SysAutoCodePart part = sysAutoCodePartMapper.checkPartUnique(sysAutoCodePart); + Long partId = StringUtils.isNull(sysAutoCodePart.getPartId())?-1L:sysAutoCodePart.getPartId(); + if(StringUtils.isNotNull(part) && partId.longValue() != part.getPartId().longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public int insertPart(SysAutoCodePart sysAutoCodePart) { + return sysAutoCodePartMapper.add(sysAutoCodePart); + } + + @Override + public int updatePart(SysAutoCodePart sysAutoCodePart) { + return sysAutoCodePartMapper.updateSysAutoCodePart(sysAutoCodePart); + } + + @Override + public int deleteByIds(Long[] partIds) { + for (Long partId:partIds + ) { + sysAutoCodePartMapper.deleteById(partId); + } + return 1; + } + + +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodeResultServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodeResultServiceImpl.java new file mode 100644 index 0000000..1649512 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodeResultServiceImpl.java @@ -0,0 +1,31 @@ +package com.ktg.system.service.impl; + +import com.ktg.common.core.domain.entity.SysAutoCodeResult; +import com.ktg.system.mapper.SysAutoCodeResultMapper; +import com.ktg.system.service.IAutoCodeResultService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class SysAutoCodeResultServiceImpl implements IAutoCodeResultService { + + @Autowired + private SysAutoCodeResultMapper sysAutoCodeResultMapper; + + @Override + public List list(SysAutoCodeResult sysAutoCodeResult) { + return sysAutoCodeResultMapper.selectSysAutoCodeResultList(sysAutoCodeResult); + } + + @Override + public void saveAutoCodeResult(SysAutoCodeResult sysAutoCodeResult) { + sysAutoCodeResultMapper.add(sysAutoCodeResult); + } + + @Override + public void updateAutoCodeResult(SysAutoCodeResult sysAutoCodeResult) { + sysAutoCodeResultMapper.updateAutoCodeResult(sysAutoCodeResult); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodeRuleServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodeRuleServiceImpl.java new file mode 100644 index 0000000..c6bf008 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysAutoCodeRuleServiceImpl.java @@ -0,0 +1,87 @@ +package com.ktg.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysAutoCodeRule; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.mapper.SysAutoCodeRuleMapper; +import com.ktg.system.service.IAutoCodeRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class SysAutoCodeRuleServiceImpl implements IAutoCodeRuleService { + + @Autowired + private SysAutoCodeRuleMapper sysAutoCodeRuleMapper; + + @Override + public SysAutoCodeRule getOne(String ruleCode) { + SysAutoCodeRule param = new SysAutoCodeRule(); + param.setRuleCode(ruleCode); + List rules = sysAutoCodeRuleMapper.selectSysAutoCodeResultList(param); + if(CollectionUtil.isNotEmpty(rules)){ + return rules.get(0); + } + return null; + } + + @Override + public List selectAutoCodeList(SysAutoCodeRule sysAutoCodeRule) { + return sysAutoCodeRuleMapper.selectSysAutoCodeResultList(sysAutoCodeRule); + } + + @Override + public SysAutoCodeRule findById(Long ruleId) { + return sysAutoCodeRuleMapper.findById(ruleId); + } + + @Override + public String checkRuleCodeUnique(SysAutoCodeRule sysAutoCodeRule) { + SysAutoCodeRule rule = sysAutoCodeRuleMapper.checkRuleCodeUnique(sysAutoCodeRule.getRuleCode()); + if (StringUtils.isNotNull(rule) && rule.getRuleId().longValue() != sysAutoCodeRule.getRuleId().longValue()) + { + return UserConstants.NOT_UNIQUE; + } + + return UserConstants.UNIQUE; + } + + @Override + public String checkRuleNameUnique(SysAutoCodeRule sysAutoCodeRule) { + SysAutoCodeRule rule = sysAutoCodeRuleMapper.checkRuleNameUnique(sysAutoCodeRule.getRuleName()); + if (StringUtils.isNotNull(rule) && rule.getRuleId().longValue() != sysAutoCodeRule.getRuleId().longValue()) + { + return UserConstants.NOT_UNIQUE; + } + + return UserConstants.UNIQUE; + } + + @Override + public int insertInfo(SysAutoCodeRule rule) { + return sysAutoCodeRuleMapper.add(rule); + } + + @Override + public int updateInfo(SysAutoCodeRule rule) { + return sysAutoCodeRuleMapper.updateSysAutoCodeRule(rule); + } + + @Override + public int deleteById(Long ruleId) { + + return sysAutoCodeRuleMapper.deleteById(ruleId); + } + + @Override + public int deleteByIds(Long[] ruleIds) { + for (Long ruleId: ruleIds + ) { + sysAutoCodeRuleMapper.deleteById(ruleId); + } + return 1; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysConfigServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysConfigServiceImpl.java new file mode 100644 index 0000000..562286d --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysConfigServiceImpl.java @@ -0,0 +1,226 @@ +package com.ktg.system.service.impl; + +import com.ktg.common.annotation.DataSource; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.redis.RedisCache; +import com.ktg.common.core.text.Convert; +import com.ktg.common.enums.DataSourceType; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.domain.SysConfig; +import com.ktg.system.mapper.SysConfigMapper; +import com.ktg.system.service.ISysConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import javax.annotation.PostConstruct; +import java.util.Collection; +import java.util.List; + +/** + * 参数配置 服务层实现 + * + * @author ruoyi + */ +@Service +public class SysConfigServiceImpl implements ISysConfigService +{ + @Autowired + private SysConfigMapper configMapper; + + @Autowired + private RedisCache redisCache; + + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() + { + loadingConfigCache(); + } + + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + @Override + @DataSource(DataSourceType.MASTER) + public SysConfig selectConfigById(Long configId) + { + SysConfig config = new SysConfig(); + config.setConfigId(configId); + return configMapper.selectConfig(config); + } + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数key + * @return 参数键值 + */ + @Override + public String selectConfigByKey(String configKey) + { + String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey))); + if (StringUtils.isNotEmpty(configValue)) + { + return configValue; + } + SysConfig config = new SysConfig(); + config.setConfigKey(configKey); + SysConfig retConfig = configMapper.selectConfig(config); + if (StringUtils.isNotNull(retConfig)) + { + redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); + return retConfig.getConfigValue(); + } + return StringUtils.EMPTY; + } + + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + @Override + public boolean selectCaptchaOnOff() + { + String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); + if (StringUtils.isEmpty(captchaOnOff)) + { + return true; + } + return Convert.toBool(captchaOnOff); + } + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + @Override + public List selectConfigList(SysConfig config) + { + return configMapper.selectConfigList(config); + } + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int insertConfig(SysConfig config) + { + int row = configMapper.insertConfig(config); + if (row > 0) + { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int updateConfig(SysConfig config) + { + int row = configMapper.updateConfig(config); + if (row > 0) + { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + @Override + public void deleteConfigByIds(Long[] configIds) + { + for (Long configId : configIds) + { + SysConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) + { + throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); + } + configMapper.deleteConfigById(configId); + redisCache.deleteObject(getCacheKey(config.getConfigKey())); + } + } + + /** + * 加载参数缓存数据 + */ + @Override + public void loadingConfigCache() + { + List configsList = configMapper.selectConfigList(new SysConfig()); + for (SysConfig config : configsList) + { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + } + + /** + * 清空参数缓存数据 + */ + @Override + public void clearConfigCache() + { + Collection keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*"); + redisCache.deleteObject(keys); + } + + /** + * 重置参数缓存数据 + */ + @Override + public void resetConfigCache() + { + clearConfigCache(); + loadingConfigCache(); + } + + /** + * 校验参数键名是否唯一 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public String checkConfigKeyUnique(SysConfig config) + { + Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); + if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + private String getCacheKey(String configKey) + { + return Constants.SYS_CONFIG_KEY + configKey; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysDeptServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysDeptServiceImpl.java new file mode 100644 index 0000000..485d8a1 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysDeptServiceImpl.java @@ -0,0 +1,329 @@ +package com.ktg.system.service.impl; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.common.annotation.DataScope; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.TreeSelect; +import com.ktg.common.core.domain.entity.SysDept; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.core.text.Convert; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.system.mapper.SysDeptMapper; +import com.ktg.system.mapper.SysRoleMapper; +import com.ktg.system.service.ISysDeptService; + +/** + * 部门管理 服务实现 + * + * @author ruoyi + */ +@Service +public class SysDeptServiceImpl implements ISysDeptService +{ + @Autowired + private SysDeptMapper deptMapper; + + @Autowired + private SysRoleMapper roleMapper; + + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @Override + @DataScope(deptAlias = "d") + public List selectDeptList(SysDept dept) + { + return deptMapper.selectDeptList(dept); + } + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + @Override + public List buildDeptTree(List depts) + { + List returnList = new ArrayList(); + List tempList = new ArrayList(); + for (SysDept dept : depts) + { + tempList.add(dept.getDeptId()); + } + for (SysDept dept : depts) + { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(dept.getParentId())) + { + recursionFn(depts, dept); + returnList.add(dept); + } + } + if (returnList.isEmpty()) + { + returnList = depts; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + @Override + public List buildDeptTreeSelect(List depts) + { + List deptTrees = buildDeptTree(depts); + return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + @Override + public List selectDeptListByRoleId(Long roleId) + { + SysRole role = roleMapper.selectRoleById(roleId); + return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); + } + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + @Override + public SysDept selectDeptById(Long deptId) + { + return deptMapper.selectDeptById(deptId); + } + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + @Override + public int selectNormalChildrenDeptById(Long deptId) + { + return deptMapper.selectNormalChildrenDeptById(deptId); + } + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + public boolean hasChildByDeptId(Long deptId) + { + int result = deptMapper.hasChildByDeptId(deptId); + return result > 0; + } + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + @Override + public boolean checkDeptExistUser(Long deptId) + { + int result = deptMapper.checkDeptExistUser(deptId); + return result > 0; + } + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public String checkDeptNameUnique(SysDept dept) + { + Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); + SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); + if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验部门是否有数据权限 + * + * @param deptId 部门id + */ + @Override + public void checkDeptDataScope(Long deptId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysDept dept = new SysDept(); + dept.setDeptId(deptId); + List depts = SpringUtils.getAopProxy(this).selectDeptList(dept); + if (StringUtils.isEmpty(depts)) + { + throw new ServiceException("没有权限访问部门数据!"); + } + } + } + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int insertDept(SysDept dept) + { + SysDept info = deptMapper.selectDeptById(dept.getParentId()); + // 如果父节点不为正常状态,则不允许新增子节点 + if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) + { + throw new ServiceException("部门停用,不允许新增"); + } + dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + return deptMapper.insertDept(dept); + } + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int updateDept(SysDept dept) + { + SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); + SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); + if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) + { + String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); + String oldAncestors = oldDept.getAncestors(); + dept.setAncestors(newAncestors); + updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); + } + int result = deptMapper.updateDept(dept); + if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) + && !StringUtils.equals("0", dept.getAncestors())) + { + // 如果该部门是启用状态,则启用该部门的所有上级部门 + updateParentDeptStatusNormal(dept); + } + return result; + } + + /** + * 修改该部门的父级部门状态 + * + * @param dept 当前部门 + */ + private void updateParentDeptStatusNormal(SysDept dept) + { + String ancestors = dept.getAncestors(); + Long[] deptIds = Convert.toLongArray(ancestors); + deptMapper.updateDeptStatusNormal(deptIds); + } + + /** + * 修改子元素关系 + * + * @param deptId 被修改的部门ID + * @param newAncestors 新的父ID集合 + * @param oldAncestors 旧的父ID集合 + */ + public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) + { + List children = deptMapper.selectChildrenDeptById(deptId); + for (SysDept child : children) + { + child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); + } + if (children.size() > 0) + { + deptMapper.updateDeptChildren(children); + } + } + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + public int deleteDeptById(Long deptId) + { + return deptMapper.deleteDeptById(deptId); + } + + /** + * 递归列表 + */ + private void recursionFn(List list, SysDept t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysDept tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysDept t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + SysDept n = (SysDept) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysDept t) + { + return getChildList(list, t).size() > 0; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysDictDataServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysDictDataServiceImpl.java new file mode 100644 index 0000000..8355a97 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysDictDataServiceImpl.java @@ -0,0 +1,111 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.common.core.domain.entity.SysDictData; +import com.ktg.common.utils.DictUtils; +import com.ktg.system.mapper.SysDictDataMapper; +import com.ktg.system.service.ISysDictDataService; + +/** + * 字典 业务层处理 + * + * @author ktg + */ +@Service +public class SysDictDataServiceImpl implements ISysDictDataService +{ + @Autowired + private SysDictDataMapper dictDataMapper; + + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataList(SysDictData dictData) + { + return dictDataMapper.selectDictDataList(dictData); + } + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + @Override + public String selectDictLabel(String dictType, String dictValue) + { + return dictDataMapper.selectDictLabel(dictType, dictValue); + } + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + @Override + public SysDictData selectDictDataById(Long dictCode) + { + return dictDataMapper.selectDictDataById(dictCode); + } + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + */ + @Override + public void deleteDictDataByIds(Long[] dictCodes) + { + for (Long dictCode : dictCodes) + { + SysDictData data = selectDictDataById(dictCode); + dictDataMapper.deleteDictDataById(dictCode); + List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + } + + /** + * 新增保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int insertDictData(SysDictData data) + { + int row = dictDataMapper.insertDictData(data); + if (row > 0) + { + List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } + + /** + * 修改保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int updateDictData(SysDictData data) + { + int row = dictDataMapper.updateDictData(data); + if (row > 0) + { + List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysDictTypeServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysDictTypeServiceImpl.java new file mode 100644 index 0000000..ed16f2a --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysDictTypeServiceImpl.java @@ -0,0 +1,223 @@ +package com.ktg.system.service.impl; + +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysDictData; +import com.ktg.common.core.domain.entity.SysDictType; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.DictUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.mapper.SysDictDataMapper; +import com.ktg.system.mapper.SysDictTypeMapper; +import com.ktg.system.service.ISysDictTypeService; + +/** + * 字典 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysDictTypeServiceImpl implements ISysDictTypeService +{ + @Autowired + private SysDictTypeMapper dictTypeMapper; + + @Autowired + private SysDictDataMapper dictDataMapper; + + /** + * 项目启动时,初始化字典到缓存 + */ + @PostConstruct + public void init() + { + loadingDictCache(); + } + + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeList(SysDictType dictType) + { + return dictTypeMapper.selectDictTypeList(dictType); + } + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeAll() + { + return dictTypeMapper.selectDictTypeAll(); + } + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataByType(String dictType) + { + List dictDatas = DictUtils.getDictCache(dictType); + if (StringUtils.isNotEmpty(dictDatas)) + { + return dictDatas; + } + dictDatas = dictDataMapper.selectDictDataByType(dictType); + if (StringUtils.isNotEmpty(dictDatas)) + { + DictUtils.setDictCache(dictType, dictDatas); + return dictDatas; + } + return null; + } + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeById(Long dictId) + { + return dictTypeMapper.selectDictTypeById(dictId); + } + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeByType(String dictType) + { + return dictTypeMapper.selectDictTypeByType(dictType); + } + + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + */ + @Override + public void deleteDictTypeByIds(Long[] dictIds) + { + for (Long dictId : dictIds) + { + SysDictType dictType = selectDictTypeById(dictId); + if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName())); + } + dictTypeMapper.deleteDictTypeById(dictId); + DictUtils.removeDictCache(dictType.getDictType()); + } + } + + /** + * 加载字典缓存数据 + */ + @Override + public void loadingDictCache() + { + SysDictData dictData = new SysDictData(); + dictData.setStatus("0"); + Map> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType)); + for (Map.Entry> entry : dictDataMap.entrySet()) + { + DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList())); + } + } + + /** + * 清空字典缓存数据 + */ + @Override + public void clearDictCache() + { + DictUtils.clearDictCache(); + } + + /** + * 重置字典缓存数据 + */ + @Override + public void resetDictCache() + { + clearDictCache(); + loadingDictCache(); + } + + /** + * 新增保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + public int insertDictType(SysDictType dict) + { + int row = dictTypeMapper.insertDictType(dict); + if (row > 0) + { + DictUtils.setDictCache(dict.getDictType(), null); + } + return row; + } + + /** + * 修改保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + @Transactional + public int updateDictType(SysDictType dict) + { + SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId()); + dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType()); + int row = dictTypeMapper.updateDictType(dict); + if (row > 0) + { + List dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); + DictUtils.setDictCache(dict.getDictType(), dictDatas); + } + return row; + } + + /** + * 校验字典类型称是否唯一 + * + * @param dict 字典类型 + * @return 结果 + */ + @Override + public String checkDictTypeUnique(SysDictType dict) + { + Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); + SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); + if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysLogininforServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysLogininforServiceImpl.java new file mode 100644 index 0000000..738441c --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysLogininforServiceImpl.java @@ -0,0 +1,65 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.system.domain.SysLogininfor; +import com.ktg.system.mapper.SysLogininforMapper; +import com.ktg.system.service.ISysLogininforService; + +/** + * 系统访问日志情况信息 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysLogininforServiceImpl implements ISysLogininforService +{ + + @Autowired + private SysLogininforMapper logininforMapper; + + /** + * 新增系统登录日志 + * + * @param logininfor 访问日志对象 + */ + @Override + public void insertLogininfor(SysLogininfor logininfor) + { + logininforMapper.insertLogininfor(logininfor); + } + + /** + * 查询系统登录日志集合 + * + * @param logininfor 访问日志对象 + * @return 登录记录集合 + */ + @Override + public List selectLogininforList(SysLogininfor logininfor) + { + return logininforMapper.selectLogininforList(logininfor); + } + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + @Override + public int deleteLogininforByIds(Long[] infoIds) + { + return logininforMapper.deleteLogininforByIds(infoIds); + } + + /** + * 清空系统登录日志 + */ + @Override + public void cleanLogininfor() + { + logininforMapper.cleanLogininfor(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysMenuServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysMenuServiceImpl.java new file mode 100644 index 0000000..98f0a7c --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysMenuServiceImpl.java @@ -0,0 +1,514 @@ +package com.ktg.system.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.common.constant.Constants; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.TreeSelect; +import com.ktg.common.core.domain.entity.SysMenu; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.domain.vo.MetaVo; +import com.ktg.system.domain.vo.RouterVo; +import com.ktg.system.mapper.SysMenuMapper; +import com.ktg.system.mapper.SysRoleMapper; +import com.ktg.system.mapper.SysRoleMenuMapper; +import com.ktg.system.service.ISysMenuService; + +/** + * 菜单 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysMenuServiceImpl implements ISysMenuService +{ + public static final String PREMISSION_STRING = "perms[\"{0}\"]"; + + @Autowired + private SysMenuMapper menuMapper; + + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysRoleMenuMapper roleMenuMapper; + + /** + * 根据用户查询系统菜单列表 + * + * @param userId 用户ID + * @return 菜单列表 + */ + @Override + public List selectMenuList(Long userId) + { + return selectMenuList(new SysMenu(), userId); + } + + /** + * 查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + @Override + public List selectMenuList(SysMenu menu, Long userId) + { + List menuList = null; + // 管理员显示所有菜单信息 + if (SysUser.isAdmin(userId)) + { + menuList = menuMapper.selectMenuList(menu); + } + else + { + menu.getParams().put("userId", userId); + menuList = menuMapper.selectMenuListByUserId(menu); + } + return menuList; + } + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + @Override + public Set selectMenuPermsByUserId(Long userId) + { + List perms = menuMapper.selectMenuPermsByUserId(userId); + Set permsSet = new HashSet<>(); + for (String perm : perms) + { + if (StringUtils.isNotEmpty(perm)) + { + permsSet.addAll(Arrays.asList(perm.trim().split(","))); + } + } + return permsSet; + } + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户名称 + * @return 菜单列表 + */ + @Override + public List selectMenuTreeByUserId(Long userId) + { + List menus = null; + if (SecurityUtils.isAdmin(userId)) + { + menus = menuMapper.selectMenuTreeAll(); + } + else + { + menus = menuMapper.selectMenuTreeByUserId(userId); + } + return getChildPerms(menus, 0); + } + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + @Override + public List selectMenuListByRoleId(Long roleId) + { + SysRole role = roleMapper.selectRoleById(roleId); + return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); + } + + /** + * 构建前端路由所需要的菜单 + * + * @param menus 菜单列表 + * @return 路由列表 + */ + @Override + public List buildMenus(List menus) + { + List routers = new LinkedList(); + for (SysMenu menu : menus) + { + RouterVo router = new RouterVo(); + router.setHidden("1".equals(menu.getVisible())); + router.setName(getRouteName(menu)); + router.setPath(getRouterPath(menu)); + router.setComponent(getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + List cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) + { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } + else if (isMenuFrame(menu)) + { + router.setMeta(null); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } + else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) + { + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); + router.setPath("/"); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + String routerPath = innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(UserConstants.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); + } + return routers; + } + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + @Override + public List buildMenuTree(List menus) + { + List returnList = new ArrayList(); + List tempList = new ArrayList(); + for (SysMenu dept : menus) + { + tempList.add(dept.getMenuId()); + } + for (Iterator iterator = menus.iterator(); iterator.hasNext();) + { + SysMenu menu = (SysMenu) iterator.next(); + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(menu.getParentId())) + { + recursionFn(menus, menu); + returnList.add(menu); + } + } + if (returnList.isEmpty()) + { + returnList = menus; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + @Override + public List buildMenuTreeSelect(List menus) + { + List menuTrees = buildMenuTree(menus); + return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + @Override + public SysMenu selectMenuById(Long menuId) + { + return menuMapper.selectMenuById(menuId); + } + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean hasChildByMenuId(Long menuId) + { + int result = menuMapper.hasChildByMenuId(menuId); + return result > 0 ? true : false; + } + + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean checkMenuExistRole(Long menuId) + { + int result = roleMenuMapper.checkMenuExistRole(menuId); + return result > 0 ? true : false; + } + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int insertMenu(SysMenu menu) + { + return menuMapper.insertMenu(menu); + } + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int updateMenu(SysMenu menu) + { + return menuMapper.updateMenu(menu); + } + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public int deleteMenuById(Long menuId) + { + return menuMapper.deleteMenuById(menuId); + } + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public String checkMenuNameUnique(SysMenu menu) + { + Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); + SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); + if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 获取路由名称 + * + * @param menu 菜单信息 + * @return 路由名称 + */ + public String getRouteName(SysMenu menu) + { + String routerName = StringUtils.capitalize(menu.getPath()); + // 非外链并且是一级目录(类型为目录) + if (isMenuFrame(menu)) + { + routerName = StringUtils.EMPTY; + } + return routerName; + } + + /** + * 获取路由地址 + * + * @param menu 菜单信息 + * @return 路由地址 + */ + public String getRouterPath(SysMenu menu) + { + String routerPath = menu.getPath(); + // 内链打开外网方式 + if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) + { + routerPath = innerLinkReplaceEach(routerPath); + } + // 非外链并且是一级目录(类型为目录) + if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) + && UserConstants.NO_FRAME.equals(menu.getIsFrame())) + { + routerPath = "/" + menu.getPath(); + } + // 非外链并且是一级目录(类型为菜单) + else if (isMenuFrame(menu)) + { + routerPath = "/"; + } + return routerPath; + } + + /** + * 获取组件信息 + * + * @param menu 菜单信息 + * @return 组件信息 + */ + public String getComponent(SysMenu menu) + { + String component = UserConstants.LAYOUT; + if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) + { + component = menu.getComponent(); + } + else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) + { + component = UserConstants.INNER_LINK; + } + else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) + { + component = UserConstants.PARENT_VIEW; + } + return component; + } + + /** + * 是否为菜单内部跳转 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isMenuFrame(SysMenu menu) + { + return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType()) + && menu.getIsFrame().equals(UserConstants.NO_FRAME); + } + + /** + * 是否为内链组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isInnerLink(SysMenu menu) + { + return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath()); + } + + /** + * 是否为parent_view组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isParentView(SysMenu menu) + { + return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); + } + + /** + * 根据父节点的ID获取所有子节点 + * + * @param list 分类表 + * @param parentId 传入的父节点ID + * @return String + */ + public List getChildPerms(List list, int parentId) + { + List returnList = new ArrayList(); + for (Iterator iterator = list.iterator(); iterator.hasNext();) + { + SysMenu t = (SysMenu) iterator.next(); + // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 + if (t.getParentId() == parentId) + { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 递归列表 + * + * @param list + * @param t + */ + private void recursionFn(List list, SysMenu t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysMenu tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysMenu t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + SysMenu n = (SysMenu) it.next(); + if (n.getParentId().longValue() == t.getMenuId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysMenu t) + { + return getChildList(list, t).size() > 0; + } + + /** + * 内链域名特殊字符替换 + * + * @return + */ + public String innerLinkReplaceEach(String path) + { + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS }, + new String[] { "", "" }); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java new file mode 100644 index 0000000..ecf4af2 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.system.mapper.SysMessageMapper; +import com.ktg.system.domain.SysMessage; +import com.ktg.system.service.ISysMessageService; + +/** + * 消息Service业务层处理 + * + * @author yinjinlu + * @date 2023-03-06 + */ +@Service +public class SysMessageServiceImpl implements ISysMessageService +{ + @Autowired + private SysMessageMapper sysMessageMapper; + + /** + * 查询消息 + * + * @param messageId 消息主键 + * @return 消息 + */ + @Override + public SysMessage selectSysMessageByMessageId(Long messageId) + { + return sysMessageMapper.selectSysMessageByMessageId(messageId); + } + + /** + * 查询消息列表 + * + * @param sysMessage 消息 + * @return 消息 + */ + @Override + public List selectSysMessageList(SysMessage sysMessage) + { + return sysMessageMapper.selectSysMessageList(sysMessage); + } + + /** + * 新增消息 + * + * @param sysMessage 消息 + * @return 结果 + */ + @Override + public int insertSysMessage(SysMessage sysMessage) + { + sysMessage.setCreateTime(DateUtils.getNowDate()); + return sysMessageMapper.insertSysMessage(sysMessage); + } + + /** + * 修改消息 + * + * @param sysMessage 消息 + * @return 结果 + */ + @Override + public int updateSysMessage(SysMessage sysMessage) + { + sysMessage.setUpdateTime(DateUtils.getNowDate()); + return sysMessageMapper.updateSysMessage(sysMessage); + } + + /** + * 批量删除消息 + * + * @param messageIds 需要删除的消息主键 + * @return 结果 + */ + @Override + public int deleteSysMessageByMessageIds(Long[] messageIds) + { + return sysMessageMapper.deleteSysMessageByMessageIds(messageIds); + } + + /** + * 删除消息信息 + * + * @param messageId 消息主键 + * @return 结果 + */ + @Override + public int deleteSysMessageByMessageId(Long messageId) + { + return sysMessageMapper.deleteSysMessageByMessageId(messageId); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysNoticeServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysNoticeServiceImpl.java new file mode 100644 index 0000000..87ddd1d --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysNoticeServiceImpl.java @@ -0,0 +1,92 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.system.domain.SysNotice; +import com.ktg.system.mapper.SysNoticeMapper; +import com.ktg.system.service.ISysNoticeService; + +/** + * 公告 服务层实现 + * + * @author ruoyi + */ +@Service +public class SysNoticeServiceImpl implements ISysNoticeService +{ + @Autowired + private SysNoticeMapper noticeMapper; + + /** + * 查询公告信息 + * + * @param noticeId 公告ID + * @return 公告信息 + */ + @Override + public SysNotice selectNoticeById(Long noticeId) + { + return noticeMapper.selectNoticeById(noticeId); + } + + /** + * 查询公告列表 + * + * @param notice 公告信息 + * @return 公告集合 + */ + @Override + public List selectNoticeList(SysNotice notice) + { + return noticeMapper.selectNoticeList(notice); + } + + /** + * 新增公告 + * + * @param notice 公告信息 + * @return 结果 + */ + @Override + public int insertNotice(SysNotice notice) + { + return noticeMapper.insertNotice(notice); + } + + /** + * 修改公告 + * + * @param notice 公告信息 + * @return 结果 + */ + @Override + public int updateNotice(SysNotice notice) + { + return noticeMapper.updateNotice(notice); + } + + /** + * 删除公告对象 + * + * @param noticeId 公告ID + * @return 结果 + */ + @Override + public int deleteNoticeById(Long noticeId) + { + return noticeMapper.deleteNoticeById(noticeId); + } + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + @Override + public int deleteNoticeByIds(Long[] noticeIds) + { + return noticeMapper.deleteNoticeByIds(noticeIds); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysOperLogServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysOperLogServiceImpl.java new file mode 100644 index 0000000..d433bb6 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysOperLogServiceImpl.java @@ -0,0 +1,76 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.system.domain.SysOperLog; +import com.ktg.system.mapper.SysOperLogMapper; +import com.ktg.system.service.ISysOperLogService; + +/** + * 操作日志 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysOperLogServiceImpl implements ISysOperLogService +{ + @Autowired + private SysOperLogMapper operLogMapper; + + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + @Override + public void insertOperlog(SysOperLog operLog) + { + operLogMapper.insertOperlog(operLog); + } + + /** + * 查询系统操作日志集合 + * + * @param operLog 操作日志对象 + * @return 操作日志集合 + */ + @Override + public List selectOperLogList(SysOperLog operLog) + { + return operLogMapper.selectOperLogList(operLog); + } + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + @Override + public int deleteOperLogByIds(Long[] operIds) + { + return operLogMapper.deleteOperLogByIds(operIds); + } + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + @Override + public SysOperLog selectOperLogById(Long operId) + { + return operLogMapper.selectOperLogById(operId); + } + + /** + * 清空操作日志 + */ + @Override + public void cleanOperLog() + { + operLogMapper.cleanOperLog(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysPostServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysPostServiceImpl.java new file mode 100644 index 0000000..3a4acc5 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysPostServiceImpl.java @@ -0,0 +1,178 @@ +package com.ktg.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.domain.SysPost; +import com.ktg.system.mapper.SysPostMapper; +import com.ktg.system.mapper.SysUserPostMapper; +import com.ktg.system.service.ISysPostService; + +/** + * 岗位信息 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysPostServiceImpl implements ISysPostService +{ + @Autowired + private SysPostMapper postMapper; + + @Autowired + private SysUserPostMapper userPostMapper; + + /** + * 查询岗位信息集合 + * + * @param post 岗位信息 + * @return 岗位信息集合 + */ + @Override + public List selectPostList(SysPost post) + { + return postMapper.selectPostList(post); + } + + /** + * 查询所有岗位 + * + * @return 岗位列表 + */ + @Override + public List selectPostAll() + { + return postMapper.selectPostAll(); + } + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + @Override + public SysPost selectPostById(Long postId) + { + return postMapper.selectPostById(postId); + } + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + @Override + public List selectPostListByUserId(Long userId) + { + return postMapper.selectPostListByUserId(userId); + } + + /** + * 校验岗位名称是否唯一 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public String checkPostNameUnique(SysPost post) + { + Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); + SysPost info = postMapper.checkPostNameUnique(post.getPostName()); + if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验岗位编码是否唯一 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public String checkPostCodeUnique(SysPost post) + { + Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); + SysPost info = postMapper.checkPostCodeUnique(post.getPostCode()); + if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + @Override + public int countUserPostById(Long postId) + { + return userPostMapper.countUserPostById(postId); + } + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + @Override + public int deletePostById(Long postId) + { + return postMapper.deletePostById(postId); + } + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + @Override + public int deletePostByIds(Long[] postIds) + { + for (Long postId : postIds) + { + SysPost post = selectPostById(postId); + if (countUserPostById(postId) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName())); + } + } + return postMapper.deletePostByIds(postIds); + } + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int insertPost(SysPost post) + { + return postMapper.insertPost(post); + } + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int updatePost(SysPost post) + { + return postMapper.updatePost(post); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysRoleServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..5584998 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,424 @@ +package com.ktg.system.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ktg.common.annotation.DataScope; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.system.domain.SysRoleDept; +import com.ktg.system.domain.SysRoleMenu; +import com.ktg.system.domain.SysUserRole; +import com.ktg.system.mapper.SysRoleDeptMapper; +import com.ktg.system.mapper.SysRoleMapper; +import com.ktg.system.mapper.SysRoleMenuMapper; +import com.ktg.system.mapper.SysUserRoleMapper; +import com.ktg.system.service.ISysRoleService; + +/** + * 角色 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysRoleServiceImpl implements ISysRoleService +{ + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysRoleMenuMapper roleMenuMapper; + + @Autowired + private SysUserRoleMapper userRoleMapper; + + @Autowired + private SysRoleDeptMapper roleDeptMapper; + + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + @Override + @DataScope(deptAlias = "d") + public List selectRoleList(SysRole role) + { + return roleMapper.selectRoleList(role); + } + + /** + * 根据用户ID查询角色 + * + * @param userId 用户ID + * @return 角色列表 + */ + @Override + public List selectRolesByUserId(Long userId) + { + List userRoles = roleMapper.selectRolePermissionByUserId(userId); + List roles = selectRoleAll(); + for (SysRole role : roles) + { + for (SysRole userRole : userRoles) + { + if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) + { + role.setFlag(true); + break; + } + } + } + return roles; + } + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + @Override + public Set selectRolePermissionByUserId(Long userId) + { + List perms = roleMapper.selectRolePermissionByUserId(userId); + Set permsSet = new HashSet<>(); + for (SysRole perm : perms) + { + if (StringUtils.isNotNull(perm)) + { + permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); + } + } + return permsSet; + } + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + @Override + public List selectRoleAll() + { + return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); + } + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + @Override + public List selectRoleListByUserId(Long userId) + { + return roleMapper.selectRoleListByUserId(userId); + } + + /** + * 通过角色ID查询角色 + * + * @param roleId 角色ID + * @return 角色对象信息 + */ + @Override + public SysRole selectRoleById(Long roleId) + { + return roleMapper.selectRoleById(roleId); + } + + /** + * 校验角色名称是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public String checkRoleNameUnique(SysRole role) + { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验角色权限是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public String checkRoleKeyUnique(SysRole role) + { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验角色是否允许操作 + * + * @param role 角色信息 + */ + @Override + public void checkRoleAllowed(SysRole role) + { + if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) + { + throw new ServiceException("不允许操作超级管理员角色"); + } + } + + /** + * 校验角色是否有数据权限 + * + * @param roleId 角色id + */ + @Override + public void checkRoleDataScope(Long roleId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysRole role = new SysRole(); + role.setRoleId(roleId); + List roles = SpringUtils.getAopProxy(this).selectRoleList(role); + if (StringUtils.isEmpty(roles)) + { + throw new ServiceException("没有权限访问角色数据!"); + } + } + } + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + @Override + public int countUserRoleByRoleId(Long roleId) + { + return userRoleMapper.countUserRoleByRoleId(roleId); + } + + /** + * 新增保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int insertRole(SysRole role) + { + // 新增角色信息 + roleMapper.insertRole(role); + return insertRoleMenu(role); + } + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int updateRole(SysRole role) + { + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); + return insertRoleMenu(role); + } + + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public int updateRoleStatus(SysRole role) + { + return roleMapper.updateRole(role); + } + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int authDataScope(SysRole role) + { + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId()); + // 新增角色和部门信息(数据权限) + return insertRoleDept(role); + } + + /** + * 新增角色菜单信息 + * + * @param role 角色对象 + */ + public int insertRoleMenu(SysRole role) + { + int rows = 1; + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long menuId : role.getMenuIds()) + { + SysRoleMenu rm = new SysRoleMenu(); + rm.setRoleId(role.getRoleId()); + rm.setMenuId(menuId); + list.add(rm); + } + if (list.size() > 0) + { + rows = roleMenuMapper.batchRoleMenu(list); + } + return rows; + } + + /** + * 新增角色部门信息(数据权限) + * + * @param role 角色对象 + */ + public int insertRoleDept(SysRole role) + { + int rows = 1; + // 新增角色与部门(数据权限)管理 + List list = new ArrayList(); + for (Long deptId : role.getDeptIds()) + { + SysRoleDept rd = new SysRoleDept(); + rd.setRoleId(role.getRoleId()); + rd.setDeptId(deptId); + list.add(rd); + } + if (list.size() > 0) + { + rows = roleDeptMapper.batchRoleDept(list); + } + return rows; + } + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + @Override + @Transactional + public int deleteRoleById(Long roleId) + { + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenuByRoleId(roleId); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDeptByRoleId(roleId); + return roleMapper.deleteRoleById(roleId); + } + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + @Override + @Transactional + public int deleteRoleByIds(Long[] roleIds) + { + for (Long roleId : roleIds) + { + checkRoleAllowed(new SysRole(roleId)); + checkRoleDataScope(roleId); + SysRole role = selectRoleById(roleId); + if (countUserRoleByRoleId(roleId) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); + } + } + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenu(roleIds); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDept(roleIds); + return roleMapper.deleteRoleByIds(roleIds); + } + + /** + * 取消授权用户角色 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + @Override + public int deleteAuthUser(SysUserRole userRole) + { + return userRoleMapper.deleteUserRoleInfo(userRole); + } + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要取消授权的用户数据ID + * @return 结果 + */ + @Override + public int deleteAuthUsers(Long roleId, Long[] userIds) + { + return userRoleMapper.deleteUserRoleInfos(roleId, userIds); + } + + /** + * 批量选择授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要授权的用户数据ID + * @return 结果 + */ + @Override + public int insertAuthUsers(Long roleId, Long[] userIds) + { + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long userId : userIds) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + return userRoleMapper.batchUserRole(list); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysUserOnlineServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysUserOnlineServiceImpl.java new file mode 100644 index 0000000..1fd92f0 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysUserOnlineServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.system.service.impl; + +import org.springframework.stereotype.Service; +import com.ktg.common.core.domain.model.LoginUser; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.domain.SysUserOnline; +import com.ktg.system.service.ISysUserOnlineService; + +/** + * 在线用户 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysUserOnlineServiceImpl implements ISysUserOnlineService +{ + /** + * 通过登录地址查询信息 + * + * @param ipaddr 登录地址 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user) + { + if (StringUtils.equals(ipaddr, user.getIpaddr())) + { + return loginUserToUserOnline(user); + } + return null; + } + + /** + * 通过用户名称查询信息 + * + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user) + { + if (StringUtils.equals(userName, user.getUsername())) + { + return loginUserToUserOnline(user); + } + return null; + } + + /** + * 通过登录地址/用户名称查询信息 + * + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user) + { + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) + { + return loginUserToUserOnline(user); + } + return null; + } + + /** + * 设置在线用户信息 + * + * @param user 用户信息 + * @return 在线用户 + */ + @Override + public SysUserOnline loginUserToUserOnline(LoginUser user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser())) + { + return null; + } + SysUserOnline sysUserOnline = new SysUserOnline(); + sysUserOnline.setTokenId(user.getToken()); + sysUserOnline.setUserName(user.getUsername()); + sysUserOnline.setIpaddr(user.getIpaddr()); + sysUserOnline.setLoginLocation(user.getLoginLocation()); + sysUserOnline.setBrowser(user.getBrowser()); + sysUserOnline.setOs(user.getOs()); + sysUserOnline.setLoginTime(user.getLoginTime()); + if (StringUtils.isNotNull(user.getUser().getDept())) + { + sysUserOnline.setDeptName(user.getUser().getDept().getDeptName()); + } + return sysUserOnline; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysUserServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..e43653b --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysUserServiceImpl.java @@ -0,0 +1,568 @@ +package com.ktg.system.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Validator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import com.ktg.common.annotation.DataScope; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.domain.entity.SysRole; +import com.ktg.common.core.domain.entity.SysUser; +import com.ktg.common.exception.ServiceException; +import com.ktg.common.utils.SecurityUtils; +import com.ktg.common.utils.StringUtils; +import com.ktg.common.utils.bean.BeanValidators; +import com.ktg.common.utils.spring.SpringUtils; +import com.ktg.system.domain.SysPost; +import com.ktg.system.domain.SysUserPost; +import com.ktg.system.domain.SysUserRole; +import com.ktg.system.mapper.SysPostMapper; +import com.ktg.system.mapper.SysRoleMapper; +import com.ktg.system.mapper.SysUserMapper; +import com.ktg.system.mapper.SysUserPostMapper; +import com.ktg.system.mapper.SysUserRoleMapper; +import com.ktg.system.service.ISysConfigService; +import com.ktg.system.service.ISysUserService; + +/** + * 用户 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysUserServiceImpl implements ISysUserService +{ + private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); + + @Autowired + private SysUserMapper userMapper; + + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysPostMapper postMapper; + + @Autowired + private SysUserRoleMapper userRoleMapper; + + @Autowired + private SysUserPostMapper userPostMapper; + + @Autowired + private ISysConfigService configService; + + @Autowired + protected Validator validator; + + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUserList(SysUser user) + { + return userMapper.selectUserList(user); + } + + /** + * 根据条件分页查询已分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectAllocatedList(SysUser user) + { + return userMapper.selectAllocatedList(user); + } + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUnallocatedList(SysUser user) + { + return userMapper.selectUnallocatedList(user); + } + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + @Override + public SysUser selectUserByUserName(String userName) + { + return userMapper.selectUserByUserName(userName); + } + + + @Override + public SysUser selectUserByMobile(String mobile) { + return userMapper.selectUserByMobile(mobile); + } + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + @Override + public SysUser selectUserById(Long userId) + { + return userMapper.selectUserById(userId); + } + + /** + * 查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserRoleGroup(String userName) + { + List list = roleMapper.selectRolesByUserName(userName); + if (CollectionUtils.isEmpty(list)) + { + return StringUtils.EMPTY; + } + return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); + } + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserPostGroup(String userName) + { + List list = postMapper.selectPostsByUserName(userName); + if (CollectionUtils.isEmpty(list)) + { + return StringUtils.EMPTY; + } + return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); + } + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + @Override + public String checkUserNameUnique(String userName) + { + int count = userMapper.checkUserNameUnique(userName); + if (count > 0) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return + */ + @Override + public String checkPhoneUnique(SysUser user) + { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return + */ + @Override + public String checkEmailUnique(SysUser user) + { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + SysUser info = userMapper.checkEmailUnique(user.getEmail()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + @Override + public void checkUserAllowed(SysUser user) + { + if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) + { + throw new ServiceException("不允许操作超级管理员用户"); + } + } + + /** + * 校验用户是否有数据权限 + * + * @param userId 用户id + */ + @Override + public void checkUserDataScope(Long userId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysUser user = new SysUser(); + user.setUserId(userId); + List users = SpringUtils.getAopProxy(this).selectUserList(user); + if (StringUtils.isEmpty(users)) + { + throw new ServiceException("没有权限访问用户数据!"); + } + } + } + + /** + * 新增保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int insertUser(SysUser user) + { + // 新增用户信息 + int rows = userMapper.insertUser(user); + // 新增用户岗位关联 + insertUserPost(user); + // 新增用户与角色管理 + insertUserRole(user); + return rows; + } + + /** + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public boolean registerUser(SysUser user) + { + return userMapper.insertUser(user) > 0; + } + + /** + * 修改保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int updateUser(SysUser user) + { + Long userId = user.getUserId(); + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + userPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return userMapper.updateUser(user); + } + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + @Override + @Transactional + public void insertUserAuth(Long userId, Long[] roleIds) + { + userRoleMapper.deleteUserRoleByUserId(userId); + insertUserRole(userId, roleIds); + } + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserStatus(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserProfile(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + @Override + public boolean updateUserAvatar(String userName, String avatar) + { + return userMapper.updateUserAvatar(userName, avatar) > 0; + } + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int resetPwd(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + @Override + public int resetUserPwd(String userName, String password) + { + return userMapper.resetUserPwd(userName, password); + } + + /** + * 新增用户角色信息 + * + * @param user 用户对象 + */ + public void insertUserRole(SysUser user) + { + Long[] roles = user.getRoleIds(); + if (StringUtils.isNotNull(roles)) + { + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long roleId : roles) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(user.getUserId()); + ur.setRoleId(roleId); + list.add(ur); + } + if (list.size() > 0) + { + userRoleMapper.batchUserRole(list); + } + } + } + + /** + * 新增用户岗位信息 + * + * @param user 用户对象 + */ + public void insertUserPost(SysUser user) + { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotNull(posts)) + { + // 新增用户与岗位管理 + List list = new ArrayList(); + for (Long postId : posts) + { + SysUserPost up = new SysUserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + if (list.size() > 0) + { + userPostMapper.batchUserPost(list); + } + } + } + + /** + * 新增用户角色信息 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserRole(Long userId, Long[] roleIds) + { + if (StringUtils.isNotNull(roleIds)) + { + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long roleId : roleIds) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + if (list.size() > 0) + { + userRoleMapper.batchUserRole(list); + } + } + } + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserById(Long userId) + { + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 删除用户与岗位表 + userPostMapper.deleteUserPostByUserId(userId); + return userMapper.deleteUserById(userId); + } + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserByIds(Long[] userIds) + { + for (Long userId : userIds) + { + checkUserAllowed(new SysUser(userId)); + checkUserDataScope(userId); + } + // 删除用户与角色关联 + userRoleMapper.deleteUserRole(userIds); + // 删除用户与岗位关联 + userPostMapper.deleteUserPost(userIds); + return userMapper.deleteUserByIds(userIds); + } + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + @Override + public String importUser(List userList, Boolean isUpdateSupport, String operName) + { + if (StringUtils.isNull(userList) || userList.size() == 0) + { + throw new ServiceException("导入用户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + String password = configService.selectConfigByKey("sys.user.initPassword"); + for (SysUser user : userList) + { + try + { + // 验证是否存在这个用户 + SysUser u = userMapper.selectUserByUserName(user.getUserName()); + if (StringUtils.isNull(u)) + { + BeanValidators.validateWithException(validator, user); + user.setPassword(SecurityUtils.encryptPassword(password)); + user.setCreateBy(operName); + this.insertUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 导入成功"); + } + else if (isUpdateSupport) + { + BeanValidators.validateWithException(validator, user); + user.setUpdateBy(operName); + this.updateUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 更新成功"); + } + else + { + failureNum++; + failureMsg.append("
" + failureNum + "、账号 " + user.getUserName() + " 已存在"); + } + } + catch (Exception e) + { + failureNum++; + String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/UserTaskServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/UserTaskServiceImpl.java new file mode 100644 index 0000000..9875e60 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/UserTaskServiceImpl.java @@ -0,0 +1,26 @@ +package com.ktg.system.service.impl; + +import com.ktg.system.domain.UserTask; +import com.ktg.system.mapper.UserTaskMapper; +import com.ktg.system.service.IUserTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class UserTaskServiceImpl implements IUserTaskService { + + @Autowired + private UserTaskMapper userTaskMapper; + + @Override + public List listTodoList(String userName) { + return userTaskMapper.listTodoList(userName); + } + + @Override + public List listFinishedList(String userName) { + return userTaskMapper.listFinishedList(userName); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/AutoCodeUtil.java b/ktg-system/src/main/java/com/ktg/system/strategy/AutoCodeUtil.java new file mode 100644 index 0000000..6fb53e3 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/AutoCodeUtil.java @@ -0,0 +1,141 @@ +package com.ktg.system.strategy; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import com.ktg.common.core.domain.entity.SysAutoCodeResult; +import com.ktg.common.core.domain.entity.SysAutoCodeRule; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.enums.PartTypeEnum; +import com.ktg.common.utils.StringUtils; +import com.ktg.system.service.IAutoCodePartService; +import com.ktg.system.service.IAutoCodeResultService; +import com.ktg.system.service.IAutoCodeRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class AutoCodeUtil { + public static ThreadLocal threadLocal = new ThreadLocal<>(); + + @Autowired + private IAutoCodeRuleService iAutoCodeRuleService; + + @Autowired + private IAutoCodePartService iAutoCodePartService; + + @Autowired + private IAutoCodeResultService iAutoCodeResultService; + + @Autowired + private PartTypeHandler partTypeHandler; + + private String lastSerialNo; + + @Log(title = "生成业务编号",businessType = BusinessType.INSERT) + synchronized + public String genSerialCode(String ruleCode,String inputCharacter){ + + //查找编码规则 + SysAutoCodeRule rule = iAutoCodeRuleService.getOne(ruleCode); + Assert.notNull(rule,"未获取到指定类型:[{}]的业务编码生成规则",ruleCode); + + //查找规则组成 + SysAutoCodePart partParam = new SysAutoCodePart(); + partParam.setRuleId(rule.getRuleId()); + List parts = iAutoCodePartService.listPart(partParam); + List collect = parts.stream().filter(part->PartTypeEnum.PART_TYPE_SERIALNO.getCode().equals(part.getPartType())).collect(Collectors.toList()); + + Assert.isTrue(collect.size()<2,"编码规则[{}]流水号方式的组成只能存在一个",ruleCode); + + StringBuilder buff = new StringBuilder(); + parts.forEach(codePart ->{ + codePart.setInputCharacter(inputCharacter); + //根据当前组成部分,获取当前组成部分的结果 + String partStr = partTypeHandler.choiceExecute(codePart); + + //如果是流水号部分,则进行记录 + if(StringUtils.equals(codePart.getPartType(),PartTypeEnum.PART_TYPE_SERIALNO.getCode())){ + lastSerialNo = partStr; + } + //将获取到的部分组装进整体编码中 + buff.append(partStr); + }); + + Assert.notBlank(buff.toString(),"规则:[{}]生成的编码为空!",ruleCode); + + String autoCode = paddingStr(rule,buff); + + //将生成结果保存到数据库 + saveAutoCodeResult(rule,autoCode,inputCharacter); + return autoCode; + } + + /** + * 根据编码规则的配置进行补齐操作 + * @param rule + * @param sb + * @return + */ + private String paddingStr(SysAutoCodeRule rule,StringBuilder sb){ + String isPadding = rule.getIsPadded(); + if("Y".equals(isPadding)){ + int maxLength = rule.getMaxLength(); + String paddingChar = rule.getPaddedChar(); + StringBuilder resultStr = new StringBuilder(); + long length = maxLength - sb.length(); + Assert.isTrue(maxLength>sb.length(),"生成的编码[{}]已经超出规则中配置的最大长度:[{}]",sb.toString(),maxLength); + + if("L".equals(rule.getPaddedMethod())){ + //左补齐 + //使用指定字符补齐左侧后,再将生成的编码添加到右侧 + for(;length>0;length --){ + resultStr.append(paddingChar); + } + resultStr.append(sb); + }else{ + //右补齐 + //将生成的编码添加到左侧后,再使用指定字符补齐右侧 + resultStr.append(sb); + for(;length>0;length --){ + resultStr.append(paddingChar); + } + } + return resultStr.toString(); + } + return sb.toString(); //如果不需要补齐,则直接返回 + } + + private void saveAutoCodeResult(SysAutoCodeRule rule,String autoCode,String inputChar){ + Boolean flag = threadLocal.get(); //针对当前线程的判断 flag = true则数据库中没有当前规则的生成记录 + if(flag !=null && flag){ + SysAutoCodeResult rs = new SysAutoCodeResult(); + rs.setRuleId(rule.getRuleId()); + rs.setGenDate(DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmmss")); + rs.setLastResult(autoCode); + rs.setGenIndex(1); + rs.setLastSerialNo(Integer.parseInt(lastSerialNo)); + rs.setLastInputChar(inputChar); + iAutoCodeResultService.saveAutoCodeResult(rs); + }else{ + //直接更新对应的记录(我们默认非流水号模式下一个RULE_CODE只有一种方式) + SysAutoCodeResult bo = new SysAutoCodeResult(); + bo.setRuleId(rule.getRuleId()); + List results = iAutoCodeResultService.list(bo); + Assert.notEmpty(results,"未查询到规则{[]}对应的结果记录",rule.getRuleCode()); + SysAutoCodeResult rs = results.get(0); + rs.setLastResult(autoCode); + rs.setGenDate(DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmmss")); + rs.setGenIndex(rs.getGenIndex()+1); + rs.setLastSerialNo(Integer.parseInt(lastSerialNo)); + rs.setLastInputChar(inputChar); + iAutoCodeResultService.updateAutoCodeResult(rs); + } + + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeFixCharHandler.java b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeFixCharHandler.java new file mode 100644 index 0000000..2489da0 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeFixCharHandler.java @@ -0,0 +1,14 @@ +package com.ktg.system.strategy; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +@Component +@Order(2) +public class PartTypeFixCharHandler implements PartTypeTemplate { + @Override + public String partHandle(SysAutoCodePart sysAutoCodePart) { + return sysAutoCodePart.getFixCharacter(); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeHandler.java b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeHandler.java new file mode 100644 index 0000000..b03725f --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeHandler.java @@ -0,0 +1,21 @@ +package com.ktg.system.strategy; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import com.ktg.common.enums.PartTypeEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class PartTypeHandler { + + @Autowired + List partTypeTemplates; + + public String choiceExecute(SysAutoCodePart sysAutoCodePart){ + String partType = sysAutoCodePart.getPartType(); + return partTypeTemplates.get(PartTypeEnum.getByCode(partType).getBeanIndex()).partHandle(sysAutoCodePart); + } + +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeInputCharHandler.java b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeInputCharHandler.java new file mode 100644 index 0000000..44eecc1 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeInputCharHandler.java @@ -0,0 +1,20 @@ +package com.ktg.system.strategy; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +@Component +@Order(0) +public class PartTypeInputCharHandler implements PartTypeTemplate { + + + @Override + public String partHandle(SysAutoCodePart sysAutoCodePart) { + String inputCharacter = sysAutoCodePart.getInputCharacter(); + Assert.notNull(inputCharacter,"编码规则传入字符不能为空!"); + Assert.isTrue(inputCharacter.length() == sysAutoCodePart.getPartLength(),"传入字符的长度错误!"); + return inputCharacter; + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeNowDateHandler.java b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeNowDateHandler.java new file mode 100644 index 0000000..fef67c7 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeNowDateHandler.java @@ -0,0 +1,19 @@ +package com.ktg.system.strategy; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@Component +@Order(1) +public class PartTypeNowDateHandler implements PartTypeTemplate { + + @Override + public String partHandle(SysAutoCodePart sysAutoCodePart) { + String formatDate = sysAutoCodePart.getDateFormat(); + return DateTimeFormatter.ofPattern(formatDate).format(LocalDateTime.now()); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeSerialNoHandler.java b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeSerialNoHandler.java new file mode 100644 index 0000000..7d39dea --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeSerialNoHandler.java @@ -0,0 +1,102 @@ +package com.ktg.system.strategy; + +import cn.hutool.core.collection.CollectionUtil; +import com.ktg.common.core.domain.entity.SysAutoCodePart; +import com.ktg.common.core.domain.entity.SysAutoCodeResult; +import com.ktg.common.enums.CycleMethodMnum; +import com.ktg.system.service.IAutoCodeResultService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; + +@Component +@Order(3) +public class PartTypeSerialNoHandler implements PartTypeTemplate { + + @Autowired + private IAutoCodeResultService iAutoCodeResultService; + + @Override + public String partHandle(SysAutoCodePart sysAutoCodePart) { + + if("Y".equals(sysAutoCodePart.getCycleFlag())){ + return cycleY(sysAutoCodePart); + }else{ + return cycleN(sysAutoCodePart); + } + } + + //循环方式(要传入当前的循环规则参数) + private String cycleY(SysAutoCodePart sysAutoCodePart){ + String method = sysAutoCodePart.getCycleMethod(); + String param =""; + if(CycleMethodMnum.CYCLE_METHOD_OTHER.getCode().equals(method)){ + param = sysAutoCodePart.getInputCharacter(); + }else{ + switch (CycleMethodMnum.getByCode(method)){ + case CYCLE_METHOD_YEAR: + param = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(),"yyyy"); + break; + case CYCLE_METHOD_MONTH: + param = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(),"yyyyMM"); + break; + case CYCLE_METHOD_DAY: + param = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(),"yyyyMMdd"); + break; + case CYCLE_METHOD_HOUR: + param = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(),"yyyyMMddHH"); + break; + case CYCLE_METHOD_MINUTE: + param = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(),"yyyyMMddHHmm"); + break; + default: + break; + } + } + + List rs = getAutoCodeResult(sysAutoCodePart.getRuleId(),param,method); + if(CollectionUtil.isNotEmpty(rs)){ + //如果在编码记录表中有记录,则在最后一个流水号上加上步长,返回新的流水号 + AutoCodeUtil.threadLocal.set(false); + Integer lastSerialNo = rs.get(0).getLastSerialNo(); + return String.format("%0"+sysAutoCodePart.getPartLength()+"d",lastSerialNo+sysAutoCodePart.getSeriaStep()); + }else { + //如果在编码记录表中不存在,则直接返回起始流水号 + AutoCodeUtil.threadLocal.set(true); + return String.format("%0"+sysAutoCodePart.getPartLength()+"d",sysAutoCodePart.getSeriaStartNo()); + } + } + + //不循环方式 + private String cycleN(SysAutoCodePart sysAutoCodePart){ + List rs = getAutoCodeResult(sysAutoCodePart.getRuleId(),"",""); + if(CollectionUtil.isNotEmpty(rs)){ + //存在记录则在当前记录加上步长 + Integer lastSerialNo = rs.get(0).getLastSerialNo(); + return String.format("%0"+sysAutoCodePart.getPartLength()+"d",lastSerialNo+sysAutoCodePart.getSeriaStep()); + }else{ + //不存在记录则从头开始 + AutoCodeUtil.threadLocal.set(true); + return String.format("%0"+sysAutoCodePart.getPartLength()+"d",sysAutoCodePart.getSeriaStartNo()); + } + + } + + //从编码结果记录表中查找当前指定循环规则的流水号记录 + private List getAutoCodeResult(Long ruleId,String param,String cycleMethod){ + SysAutoCodeResult queryParam = new SysAutoCodeResult(); + queryParam.setRuleId(ruleId);//ruleId要一致 + + if(CycleMethodMnum.CYCLE_METHOD_OTHER.getCode().equals(cycleMethod)){ + //如果循环方式是手工输入指定的字符 + queryParam.setLastInputChar(param); + }else{ + //如果循环方式是按格式化的日期 + queryParam.setGenDate(param);//这里的param将按照 gen_date like #{param}+'%' 的方式进行模糊查询,数据库中记录的永远都是yyyMMddHHmmss格式的 + } + return iAutoCodeResultService.list(queryParam); + } +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeTemplate.java b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeTemplate.java new file mode 100644 index 0000000..017c752 --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PartTypeTemplate.java @@ -0,0 +1,12 @@ +package com.ktg.system.strategy; + +import com.ktg.common.core.domain.entity.SysAutoCodePart; + +public interface PartTypeTemplate { + /** + * 分段的处理规则 + * @param sysAutoCodePart + * @return + */ + String partHandle(SysAutoCodePart sysAutoCodePart); +} diff --git a/ktg-system/src/main/java/com/ktg/system/strategy/PhoneUtils.java b/ktg-system/src/main/java/com/ktg/system/strategy/PhoneUtils.java new file mode 100644 index 0000000..92963ee --- /dev/null +++ b/ktg-system/src/main/java/com/ktg/system/strategy/PhoneUtils.java @@ -0,0 +1,47 @@ +package com.ktg.system.strategy; + +import com.ktg.common.utils.StringUtils; + +import java.util.regex.Pattern; + +public class PhoneUtils { + + private static final String REGEX_MOBILE = "((\\+86|0086)?\\s*)((134[0-8]\\d{7})|(((13([0-3]|[5-9]))|(14[5-9])|15([0-3]|[5-9])|(16(2|[5-7]))|17([0-3]|[5-8])|18[0-9]|19([0-9]))\\d{8})|(14(0|1|4)0\\d{7})|(1740([0-5]|[6-9]|[10-12])\\d{7}))"; + + /** + * 正则:固定电话号码,可带区号,然后至少6,8位数字 + */ + private static final String REGEX_TEL = "^(\\d{3,4}-)?\\d{6,8}$"; + private static final Pattern PATTERN_REGEX_TEL = Pattern.compile(REGEX_TEL); + + /** + * 判断是否是手机号 + * + * @param tel 手机号 + * @return boolean true:是 false:否 + */ + public static boolean isMobile(String tel) { + if (StringUtils.isEmpty(tel)) { + return false; + } + return Pattern.matches(REGEX_MOBILE, tel); + } + + /** + * 验证固定电话号码 + */ + public static boolean isTel(String str) { + return isMatch(PATTERN_REGEX_TEL, str); + } + + public static boolean isMatch(Pattern pattern, String str) { + return StringUtils.isNotEmpty(str) && pattern.matcher(str).matches(); + } + + public static void main(String[] args) { + System.out.println(isTel("2887438")); + } + +} + + diff --git a/ktg-system/src/main/resources/mapper/system/SysAttachmentMapper.xml b/ktg-system/src/main/resources/mapper/system/SysAttachmentMapper.xml new file mode 100644 index 0000000..5fab075 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysAttachmentMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select attachment_id, source_doc_id, source_doc_type, file_url, base_path, file_name, orignal_name, file_type, file_size, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from sys_attachment + + + + + + + + insert into sys_attachment + + source_doc_id, + source_doc_type, + file_url, + base_path, + file_name, + orignal_name, + file_type, + file_size, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{sourceDocId}, + #{sourceDocType}, + #{fileUrl}, + #{basePath}, + #{fileName}, + #{orignalName}, + #{fileType}, + #{fileSize}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update sys_attachment + + source_doc_id = #{sourceDocId}, + source_doc_type = #{sourceDocType}, + file_url = #{fileUrl}, + base_path = #{basePath}, + file_name = #{fileName}, + orignal_name = #{orignalName}, + file_type = #{fileType}, + file_size = #{fileSize}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where attachment_id = #{attachmentId} + + + + delete from sys_attachment where attachment_id = #{attachmentId} + + + + delete from sys_attachment where attachment_id in + + #{attachmentId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysAutoCodePartMapper.xml b/ktg-system/src/main/resources/mapper/system/SysAutoCodePartMapper.xml new file mode 100644 index 0000000..2a8687b --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysAutoCodePartMapper.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select d.part_id,d.rule_id,d.part_index,d.part_type,d.part_code, d.part_name, + d.part_length, d.date_format,d.input_character,d.fix_character,d.seria_start_no, + d.seria_step,d.seria_now_no,d.cycle_flag,d.cycle_method,d.remark,d.create_by, + d.create_time,d.update_by,d.update_time + from sys_auto_code_part d + + + + + + + + + + insert into sys_auto_code_part( + rule_id, + part_index, + part_type, + part_code, + part_name, + + part_length, + + + date_format, + + + input_character, + + + fix_character, + + + seria_start_no, + + + seria_step, + + + seria_now_no, + + + cycle_flag, + + + cycle_method, + + remark, + create_by, + create_time + )values( + #{ruleId}, + #{partIndex}, + #{partType}, + #{partCode}, + #{partName}, + + #{partLength}, + + + #{dateFormat}, + + + #{inputCharacter}, + + + #{fixCharacter}, + + + #{seriaStartNo}, + + + #{seriaStep}, + + + #{seriaNowNo}, + + + #{cycleFlag}, + + + #{cycleMethod}, + + #{remark}, + #{createBy}, + sysdate() + ) + + + + update sys_auto_code_part + + + part_index = #{partIndex}, + + + part_code = #{partCode}, + + + part_name = #{partName}, + + + part_length = #{partLength}, + + + date_format = #{dateFormat}, + + + input_character = #{inputCharacter}, + + + fix_character = #{fixCharacter}, + + + seria_start_no = #{seriaStartNo}, + + + seria_step = #{seriaStep}, + + + seria_now_no = #{seriaNowNo}, + + + cycle_flag = #{cycleFlag}, + + + cycle_method = #{cycleMethod}, + + + remark = #{remark}, + + update_by = #{updateBy}, + update_time = sysdate() + + where part_id = #{partId} + + + + delete from sys_auto_code_part where part_id = #{partId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysAutoCodeResultMapper.xml b/ktg-system/src/main/resources/mapper/system/SysAutoCodeResultMapper.xml new file mode 100644 index 0000000..4fefdf4 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysAutoCodeResultMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + select d.code_id, d.rule_id, d.gen_date, d.gen_index, d.last_result, d.last_serial_no, d.last_input_char + from sys_auto_code_result d + + + + + + insert into sys_auto_code_result( + rule_id, + gen_date, + gen_index, + last_result, + last_serial_no, + last_input_char, + create_time + )values( + #{ruleId}, + #{genDate}, + #{genIndex}, + #{lastResult}, + #{lastSerialNo}, + #{lastInputChar}, + sysdate() + ) + + + + update sys_auto_code_result + + gen_date = #{genDate}, + gen_index = #{genIndex}, + last_result = #{lastResult}, + last_serial_no = #{lastSerialNo}, + last_input_char = #{lastInputChar} + + where code_id = #{codeId} + + + + delete from sys_auto_code_result where code_id = #{codeId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysAutoCodeRuleMapper.xml b/ktg-system/src/main/resources/mapper/system/SysAutoCodeRuleMapper.xml new file mode 100644 index 0000000..7d6e8d6 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysAutoCodeRuleMapper.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + select d.rule_id, d.rule_code, d.rule_name, d.rule_desc, d.max_length, + is_padded,padded_char,padded_method,enable_flag,remark,create_by,create_time + from sys_auto_code_rule d + + + + + + + + + + + + insert into sys_auto_code_rule( + rule_code, + rule_name, + + rule_desc, + + max_length, + is_padded, + + padded_char, + + + padded_method, + + enable_flag, + remark, + create_by, + create_time + )values( + #{ruleCode}, + #{ruleName}, + + #{ruleDesc}, + + #{maxLength}, + #{isPadded}, + + #{paddedChar}, + + + #{paddedMethod}, + + #{enableFlag}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update sys_auto_code_rule + + rule_name = #{ruleName}, + rule_desc = #{ruleDesc}, + max_length = #{maxLength}, + is_padded = #{isPadded}, + + padded_char = #{paddedChar}, + + + padded_method = #{paddedMethod}, + + enable_flag = #{enableFlag}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where rule_id = #{ruleId} + + + + delete from sys_auto_code_rule where rule_id = #{ruleId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ktg-system/src/main/resources/mapper/system/SysConfigMapper.xml new file mode 100644 index 0000000..3728742 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysConfigMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark + from sys_config + + + + + + + and config_id = #{configId} + + + and config_key = #{configKey} + + + + + + + + + + + + insert into sys_config ( + config_name, + config_key, + config_value, + config_type, + create_by, + remark, + create_time + )values( + #{configName}, + #{configKey}, + #{configValue}, + #{configType}, + #{createBy}, + #{remark}, + sysdate() + ) + + + + update sys_config + + config_name = #{configName}, + config_key = #{configKey}, + config_value = #{configValue}, + config_type = #{configType}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where config_id = #{configId} + + + + delete from sys_config where config_id = #{configId} + + + + delete from sys_config where config_id in + + #{configId} + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ktg-system/src/main/resources/mapper/system/SysDeptMapper.xml new file mode 100644 index 0000000..989a246 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time + from sys_dept d + + + + + + + + + + + + + + + + + + + + insert into sys_dept( + dept_id, + parent_id, + dept_name, + ancestors, + order_num, + leader, + phone, + email, + status, + create_by, + create_time + )values( + #{deptId}, + #{parentId}, + #{deptName}, + #{ancestors}, + #{orderNum}, + #{leader}, + #{phone}, + #{email}, + #{status}, + #{createBy}, + sysdate() + ) + + + + update sys_dept + + parent_id = #{parentId}, + dept_name = #{deptName}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + leader = #{leader}, + phone = #{phone}, + email = #{email}, + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where dept_id = #{deptId} + + + + update sys_dept set ancestors = + + when #{item.deptId} then #{item.ancestors} + + where dept_id in + + #{item.deptId} + + + + + update sys_dept set status = '0' where dept_id in + + #{deptId} + + + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ktg-system/src/main/resources/mapper/system/SysDictDataMapper.xml new file mode 100644 index 0000000..02d1d03 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark + from sys_dict_data + + + + + + + + + + + + + + delete from sys_dict_data where dict_code = #{dictCode} + + + + delete from sys_dict_data where dict_code in + + #{dictCode} + + + + + update sys_dict_data + + dict_sort = #{dictSort}, + dict_label = #{dictLabel}, + dict_value = #{dictValue}, + dict_type = #{dictType}, + css_class = #{cssClass}, + list_class = #{listClass}, + is_default = #{isDefault}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where dict_code = #{dictCode} + + + + update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType} + + + + insert into sys_dict_data( + dict_sort, + dict_label, + dict_value, + dict_type, + css_class, + list_class, + is_default, + status, + remark, + create_by, + create_time + )values( + #{dictSort}, + #{dictLabel}, + #{dictValue}, + #{dictType}, + #{cssClass}, + #{listClass}, + #{isDefault}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ktg-system/src/main/resources/mapper/system/SysDictTypeMapper.xml new file mode 100644 index 0000000..0bc5b74 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysDictTypeMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + select dict_id, dict_name, dict_type, status, create_by, create_time, remark + from sys_dict_type + + + + + + + + + + + + + + delete from sys_dict_type where dict_id = #{dictId} + + + + delete from sys_dict_type where dict_id in + + #{dictId} + + + + + update sys_dict_type + + dict_name = #{dictName}, + dict_type = #{dictType}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where dict_id = #{dictId} + + + + insert into sys_dict_type( + dict_name, + dict_type, + status, + remark, + create_by, + create_time + )values( + #{dictName}, + #{dictType}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ktg-system/src/main/resources/mapper/system/SysLogininforMapper.xml new file mode 100644 index 0000000..3ed0a97 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysLogininforMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) + values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate()) + + + + + + delete from sys_logininfor where info_id in + + #{infoId} + + + + + truncate table sys_logininfor + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ktg-system/src/main/resources/mapper/system/SysMenuMapper.xml new file mode 100644 index 0000000..54a06b5 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time + from sys_menu + + + + + + + + + + + + + + + + + + + + + + + + update sys_menu + + menu_name = #{menuName}, + parent_id = #{parentId}, + order_num = #{orderNum}, + path = #{path}, + component = #{component}, + `query` = #{query}, + is_frame = #{isFrame}, + is_cache = #{isCache}, + menu_type = #{menuType}, + visible = #{visible}, + status = #{status}, + perms = #{perms}, + icon = #{icon}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where menu_id = #{menuId} + + + + insert into sys_menu( + menu_id, + parent_id, + menu_name, + order_num, + path, + component, + `query`, + is_frame, + is_cache, + menu_type, + visible, + status, + perms, + icon, + remark, + create_by, + create_time + )values( + #{menuId}, + #{parentId}, + #{menuName}, + #{orderNum}, + #{path}, + #{component}, + #{query}, + #{isFrame}, + #{isCache}, + #{menuType}, + #{visible}, + #{status}, + #{perms}, + #{icon}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + delete from sys_menu where menu_id = #{menuId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysMessageMapper.xml b/ktg-system/src/main/resources/mapper/system/SysMessageMapper.xml new file mode 100644 index 0000000..ad0f19b --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysMessageMapper.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select message_id, message_type, message_level, message_title, message_content, sender_id, sender_name, sender_nick, recipient_id, recipient_name, recipient_nick, process_time, call_back, status, deleted_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from sys_message + + + + + + + + insert into sys_message + + message_type, + message_level, + message_title, + message_content, + sender_id, + sender_name, + sender_nick, + recipient_id, + recipient_name, + recipient_nick, + process_time, + call_back, + status, + deleted_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{messageType}, + #{messageLevel}, + #{messageTitle}, + #{messageContent}, + #{senderId}, + #{senderName}, + #{senderNick}, + #{recipientId}, + #{recipientName}, + #{recipientNick}, + #{processTime}, + #{callBack}, + #{status}, + #{deletedFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update sys_message + + message_type = #{messageType}, + message_level = #{messageLevel}, + message_title = #{messageTitle}, + message_content = #{messageContent}, + sender_id = #{senderId}, + sender_name = #{senderName}, + sender_nick = #{senderNick}, + recipient_id = #{recipientId}, + recipient_name = #{recipientName}, + recipient_nick = #{recipientNick}, + process_time = #{processTime}, + call_back = #{callBack}, + status = #{status}, + deleted_flag = #{deletedFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where message_id = #{messageId} + + + + delete from sys_message where message_id = #{messageId} + + + + delete from sys_message where message_id in + + #{messageId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ktg-system/src/main/resources/mapper/system/SysNoticeMapper.xml new file mode 100644 index 0000000..68cc233 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark + from sys_notice + + + + + + + + insert into sys_notice ( + notice_title, + notice_type, + notice_content, + status, + remark, + create_by, + create_time + )values( + #{noticeTitle}, + #{noticeType}, + #{noticeContent}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update sys_notice + + notice_title = #{noticeTitle}, + notice_type = #{noticeType}, + notice_content = #{noticeContent}, + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where notice_id = #{noticeId} + + + + delete from sys_notice where notice_id = #{noticeId} + + + + delete from sys_notice where notice_id in + + #{noticeId} + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ktg-system/src/main/resources/mapper/system/SysOperLogMapper.xml new file mode 100644 index 0000000..d659db4 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time + from sys_oper_log + + + + insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time) + values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate()) + + + + + + delete from sys_oper_log where oper_id in + + #{operId} + + + + + + + truncate table sys_oper_log + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysPostMapper.xml b/ktg-system/src/main/resources/mapper/system/SysPostMapper.xml new file mode 100644 index 0000000..ef25643 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysPostMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark + from sys_post + + + + + + + + + + + + + + + + + + update sys_post + + post_code = #{postCode}, + post_name = #{postName}, + post_sort = #{postSort}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where post_id = #{postId} + + + + insert into sys_post( + post_id, + post_code, + post_name, + post_sort, + status, + remark, + create_by, + create_time + )values( + #{postId}, + #{postCode}, + #{postName}, + #{postSort}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + delete from sys_post where post_id = #{postId} + + + + delete from sys_post where post_id in + + #{postId} + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/ktg-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml new file mode 100644 index 0000000..b0a7d03 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + delete from sys_role_dept where role_id=#{roleId} + + + + + + delete from sys_role_dept where role_id in + + #{roleId} + + + + + insert into sys_role_dept(role_id, dept_id) values + + (#{item.roleId},#{item.deptId}) + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ktg-system/src/main/resources/mapper/system/SysRoleMapper.xml new file mode 100644 index 0000000..f0c6f97 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, + r.status, r.del_flag, r.create_time, r.remark + from sys_role r + left join sys_user_role ur on ur.role_id = r.role_id + left join sys_user u on u.user_id = ur.user_id + left join sys_dept d on u.dept_id = d.dept_id + + + + + + + + + + + + + + + + + + + + insert into sys_role( + role_id, + role_name, + role_key, + role_sort, + data_scope, + menu_check_strictly, + dept_check_strictly, + status, + remark, + create_by, + create_time + )values( + #{roleId}, + #{roleName}, + #{roleKey}, + #{roleSort}, + #{dataScope}, + #{menuCheckStrictly}, + #{deptCheckStrictly}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update sys_role + + role_name = #{roleName}, + role_key = #{roleKey}, + role_sort = #{roleSort}, + data_scope = #{dataScope}, + menu_check_strictly = #{menuCheckStrictly}, + dept_check_strictly = #{deptCheckStrictly}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where role_id = #{roleId} + + + + update sys_role set del_flag = '2' where role_id = #{roleId} + + + + update sys_role set del_flag = '2' where role_id in + + #{roleId} + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ktg-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml new file mode 100644 index 0000000..e1ea0c6 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + delete from sys_role_menu where role_id=#{roleId} + + + + delete from sys_role_menu where role_id in + + #{roleId} + + + + + insert into sys_role_menu(role_id, menu_id) values + + (#{item.roleId},#{item.menuId}) + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysUserMapper.xml b/ktg-system/src/main/resources/mapper/system/SysUserMapper.xml new file mode 100644 index 0000000..e1538a9 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status, + r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status + from sys_user u + left join sys_dept d on u.dept_id = d.dept_id + left join sys_user_role ur on u.user_id = ur.user_id + left join sys_role r on r.role_id = ur.role_id + + + + + + + + + + + + + + + + + + + + + + insert into sys_user( + user_id, + dept_id, + user_name, + nick_name, + email, + avatar, + phonenumber, + sex, + password, + status, + create_by, + remark, + create_time + )values( + #{userId}, + #{deptId}, + #{userName}, + #{nickName}, + #{email}, + #{avatar}, + #{phonenumber}, + #{sex}, + #{password}, + #{status}, + #{createBy}, + #{remark}, + sysdate() + ) + + + + update sys_user + + dept_id = #{deptId}, + user_name = #{userName}, + nick_name = #{nickName}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where user_id = #{userId} + + + + update sys_user set status = #{status} where user_id = #{userId} + + + + update sys_user set avatar = #{avatar} where user_name = #{userName} + + + + update sys_user set password = #{password} where user_name = #{userName} + + + + update sys_user set del_flag = '2' where user_id = #{userId} + + + + update sys_user set del_flag = '2' where user_id in + + #{userId} + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/ktg-system/src/main/resources/mapper/system/SysUserPostMapper.xml new file mode 100644 index 0000000..65ed0ba --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysUserPostMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + delete from sys_user_post where user_id=#{userId} + + + + + + delete from sys_user_post where user_id in + + #{userId} + + + + + insert into sys_user_post(user_id, post_id) values + + (#{item.userId},#{item.postId}) + + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ktg-system/src/main/resources/mapper/system/SysUserRoleMapper.xml new file mode 100644 index 0000000..53585d8 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + delete from sys_user_role where user_id=#{userId} + + + + + + delete from sys_user_role where user_id in + + #{userId} + + + + + insert into sys_user_role(user_id, role_id) values + + (#{item.userId},#{item.roleId}) + + + + + delete from sys_user_role where user_id=#{userId} and role_id=#{roleId} + + + + delete from sys_user_role where role_id=#{roleId} and user_id in + + #{userId} + + + \ No newline at end of file diff --git a/ktg-system/src/main/resources/mapper/system/UserTaskMapper.xml b/ktg-system/src/main/resources/mapper/system/UserTaskMapper.xml new file mode 100644 index 0000000..59fb405 --- /dev/null +++ b/ktg-system/src/main/resources/mapper/system/UserTaskMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..85da62e --- /dev/null +++ b/pom.xml @@ -0,0 +1,274 @@ + + + 4.0.0 + + com.ktg + ktg + 3.8.2 + + ktg + http://www.029tec.com + MES生产执行管理系统 + + + 3.8.2 + UTF-8 + UTF-8 + 1.8 + 3.1.1 + 1.2.8 + 1.21 + 3.0.0 + 2.3.2 + 2.2.2 + 1.4.1 + 1.2.80 + 6.1.2 + 5.10.0 + 2.11.0 + 1.4 + 3.2.2 + 4.1.2 + 1.7 + 0.9.1 + + + + + + + + + org.springframework.boot + spring-boot-dependencies + 2.5.12 + pom + import + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis-spring-boot.version} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.boot.version} + + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + net.java.dev.jna + jna + ${jna.version} + + + + net.java.dev.jna + jna-platform + ${jna.version} + + + + + io.springfox + springfox-boot-starter + ${swagger.version} + + + io.swagger + swagger-models + + + + + + + commons-io + commons-io + ${commons.io.version} + + + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + + org.apache.velocity + velocity + ${velocity.version} + + + commons-collections + commons-collections + + + + + + + commons-collections + commons-collections + ${commons.collections.version} + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + + com.github.penggle + kaptcha + ${kaptcha.version} + + + + + com.ktg + ktg-quartz + ${ktg.version} + + + + + com.ktg + ktg-generator + ${ktg.version} + + + + + com.ktg + ktg-framework + ${ktg.version} + + + + + com.ktg + ktg-system + ${ktg.version} + + + + + com.ktg + ktg-common + ${ktg.version} + + + + + com.ktg + ktg-mes + ${ktg.version} + + + + + + + ktg-admin + ktg-framework + ktg-system + ktg-quartz + ktg-generator + ktg-common + ktg-mes + + pom + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + false + + + + + \ No newline at end of file diff --git a/ry.bat b/ry.bat new file mode 100644 index 0000000..19529de --- /dev/null +++ b/ry.bat @@ -0,0 +1,67 @@ +@echo off + +rem jarƽ��Ŀ¼ +set AppName=ktg-admin.jar + +rem JVM���� +set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" + + +ECHO. + ECHO. [1] ����%AppName% + ECHO. [2] �ر�%AppName% + ECHO. [3] ����%AppName% + ECHO. [4] ����״̬ %AppName% + ECHO. [5] �� �� +ECHO. + +ECHO.������ѡ����Ŀ�����: +set /p ID= + IF "%id%"=="1" GOTO start + IF "%id%"=="2" GOTO stop + IF "%id%"=="3" GOTO restart + IF "%id%"=="4" GOTO status + IF "%id%"=="5" EXIT +PAUSE +:start + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if defined pid ( + echo %%is running + PAUSE + ) + +start javaw %JVM_OPTS% -jar %AppName% + +echo starting���� +echo Start %AppName% success... +goto:eof + +rem ����stopͨ��jps�������pid���������� +:stop + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if not defined pid (echo process %AppName% does not exists) else ( + echo prepare to kill %image_name% + echo start kill %pid% ... + rem ���ݽ���ID��kill���� + taskkill /f /pid %pid% + ) +goto:eof +:restart + call :stop + call :start +goto:eof +:status + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if not defined pid (echo process %AppName% is dead ) else ( + echo %image_name% is running + ) +goto:eof diff --git a/ry.sh b/ry.sh new file mode 100644 index 0000000..0bdcfe8 --- /dev/null +++ b/ry.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# ./ry.sh start 启动 stop 停止 restart 重启 status 状态 +AppName=ktg-admin.jar + +# JVM参数 +JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" +APP_HOME=`pwd` +LOG_PATH=$APP_HOME/logs/$AppName.log + +if [ "$1" = "" ]; +then + echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m" + exit 1 +fi + +if [ "$AppName" = "" ]; +then + echo -e "\033[0;31m 未输入应用名 \033[0m" + exit 1 +fi + +function start() +{ + PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'` + + if [ x"$PID" != x"" ]; then + echo "$AppName is running..." + else + nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 & + echo "Start $AppName success..." + fi +} + +function stop() +{ + echo "Stop $AppName" + + PID="" + query(){ + PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'` + } + + query + if [ x"$PID" != x"" ]; then + kill -TERM $PID + echo "$AppName (pid:$PID) exiting..." + while [ x"$PID" != x"" ] + do + sleep 1 + query + done + echo "$AppName exited." + else + echo "$AppName already stopped." + fi +} + +function restart() +{ + stop + sleep 2 + start +} + +function status() +{ + PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l` + if [ $PID != 0 ];then + echo "$AppName is running..." + else + echo "$AppName is not running..." + fi +} + +case $1 in + start) + start;; + stop) + stop;; + restart) + restart;; + status) + status;; + *) + +esac diff --git a/sql/quartz.sql b/sql/quartz.sql new file mode 100644 index 0000000..cee613b --- /dev/null +++ b/sql/quartz.sql @@ -0,0 +1,174 @@ +DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; +DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; +DROP TABLE IF EXISTS QRTZ_LOCKS; +DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; +DROP TABLE IF EXISTS QRTZ_CALENDARS; + +-- ---------------------------- +-- 1、存储每一个已配置的 jobDetail 的详细信息 +-- ---------------------------- +create table QRTZ_JOB_DETAILS ( + sched_name varchar(120) not null comment '调度名称', + job_name varchar(200) not null comment '任务名称', + job_group varchar(200) not null comment '任务组名', + description varchar(250) null comment '相关介绍', + job_class_name varchar(250) not null comment '执行任务类名称', + is_durable varchar(1) not null comment '是否持久化', + is_nonconcurrent varchar(1) not null comment '是否并发', + is_update_data varchar(1) not null comment '是否更新数据', + requests_recovery varchar(1) not null comment '是否接受恢复执行', + job_data blob null comment '存放持久化job对象', + primary key (sched_name, job_name, job_group) +) engine=innodb comment = '任务详细信息表'; + +-- ---------------------------- +-- 2、 存储已配置的 Trigger 的信息 +-- ---------------------------- +create table QRTZ_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment '触发器的名字', + trigger_group varchar(200) not null comment '触发器所属组的名字', + job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键', + job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键', + description varchar(250) null comment '相关介绍', + next_fire_time bigint(13) null comment '上一次触发时间(毫秒)', + prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发)', + priority integer null comment '优先级', + trigger_state varchar(16) not null comment '触发器状态', + trigger_type varchar(8) not null comment '触发器的类型', + start_time bigint(13) not null comment '开始时间', + end_time bigint(13) null comment '结束时间', + calendar_name varchar(200) null comment '日程表名称', + misfire_instr smallint(2) null comment '补偿执行的策略', + job_data blob null comment '存放持久化job对象', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, job_name, job_group) references QRTZ_JOB_DETAILS(sched_name, job_name, job_group) +) engine=innodb comment = '触发器详细信息表'; + +-- ---------------------------- +-- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数 +-- ---------------------------- +create table QRTZ_SIMPLE_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + repeat_count bigint(7) not null comment '重复的次数统计', + repeat_interval bigint(12) not null comment '重复的间隔时间', + times_triggered bigint(10) not null comment '已经触发的次数', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = '简单触发器的信息表'; + +-- ---------------------------- +-- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息 +-- ---------------------------- +create table QRTZ_CRON_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + cron_expression varchar(200) not null comment 'cron表达式', + time_zone_id varchar(80) comment '时区', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = 'Cron类型的触发器表'; + +-- ---------------------------- +-- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候) +-- ---------------------------- +create table QRTZ_BLOB_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + blob_data blob null comment '存放持久化Trigger对象', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = 'Blob类型的触发器表'; + +-- ---------------------------- +-- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围 +-- ---------------------------- +create table QRTZ_CALENDARS ( + sched_name varchar(120) not null comment '调度名称', + calendar_name varchar(200) not null comment '日历名称', + calendar blob not null comment '存放持久化calendar对象', + primary key (sched_name, calendar_name) +) engine=innodb comment = '日历信息表'; + +-- ---------------------------- +-- 7、 存储已暂停的 Trigger 组的信息 +-- ---------------------------- +create table QRTZ_PAUSED_TRIGGER_GRPS ( + sched_name varchar(120) not null comment '调度名称', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + primary key (sched_name, trigger_group) +) engine=innodb comment = '暂停的触发器表'; + +-- ---------------------------- +-- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息 +-- ---------------------------- +create table QRTZ_FIRED_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + entry_id varchar(95) not null comment '调度器实例id', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + instance_name varchar(200) not null comment '调度器实例名', + fired_time bigint(13) not null comment '触发的时间', + sched_time bigint(13) not null comment '定时器制定的时间', + priority integer not null comment '优先级', + state varchar(16) not null comment '状态', + job_name varchar(200) null comment '任务名称', + job_group varchar(200) null comment '任务组名', + is_nonconcurrent varchar(1) null comment '是否并发', + requests_recovery varchar(1) null comment '是否接受恢复执行', + primary key (sched_name, entry_id) +) engine=innodb comment = '已触发的触发器表'; + +-- ---------------------------- +-- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例 +-- ---------------------------- +create table QRTZ_SCHEDULER_STATE ( + sched_name varchar(120) not null comment '调度名称', + instance_name varchar(200) not null comment '实例名称', + last_checkin_time bigint(13) not null comment '上次检查时间', + checkin_interval bigint(13) not null comment '检查间隔时间', + primary key (sched_name, instance_name) +) engine=innodb comment = '调度器状态表'; + +-- ---------------------------- +-- 10、 存储程序的悲观锁的信息(假如使用了悲观锁) +-- ---------------------------- +create table QRTZ_LOCKS ( + sched_name varchar(120) not null comment '调度名称', + lock_name varchar(40) not null comment '悲观锁名称', + primary key (sched_name, lock_name) +) engine=innodb comment = '存储的悲观锁信息表'; + +-- ---------------------------- +-- 11、 Quartz集群实现同步机制的行锁表 +-- ---------------------------- +create table QRTZ_SIMPROP_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数', + str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数', + str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数', + int_prop_1 int null comment 'int类型的trigger的第一个参数', + int_prop_2 int null comment 'int类型的trigger的第二个参数', + long_prop_1 bigint null comment 'long类型的trigger的第一个参数', + long_prop_2 bigint null comment 'long类型的trigger的第二个参数', + dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数', + dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数', + bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数', + bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = '同步机制的行锁表'; + +commit; \ No newline at end of file diff --git a/sql/ry_20210908.sql b/sql/ry_20210908.sql new file mode 100644 index 0000000..4b6862a --- /dev/null +++ b/sql/ry_20210908.sql @@ -0,0 +1,688 @@ +-- ---------------------------- +-- 1、部门表 +-- ---------------------------- +drop table if exists sys_dept; +create table sys_dept ( + dept_id bigint(20) not null auto_increment comment '部门id', + parent_id bigint(20) default 0 comment '父部门id', + ancestors varchar(50) default '' comment '祖级列表', + dept_name varchar(30) default '' comment '部门名称', + order_num int(4) default 0 comment '显示顺序', + leader varchar(20) default null comment '负责人', + phone varchar(11) default null comment '联系电话', + email varchar(50) default null comment '邮箱', + status char(1) default '0' comment '部门状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (dept_id) +) engine=innodb auto_increment=200 comment = '部门表'; + +-- ---------------------------- +-- 初始化-部门表数据 +-- ---------------------------- +insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); + + +-- ---------------------------- +-- 2、用户信息表 +-- ---------------------------- +drop table if exists sys_user; +create table sys_user ( + user_id bigint(20) not null auto_increment comment '用户ID', + dept_id bigint(20) default null comment '部门ID', + user_name varchar(30) not null comment '用户账号', + nick_name varchar(30) not null comment '用户昵称', + user_type varchar(2) default '00' comment '用户类型(00系统用户)', + email varchar(50) default '' comment '用户邮箱', + phonenumber varchar(11) default '' comment '手机号码', + sex char(1) default '0' comment '用户性别(0男 1女 2未知)', + avatar varchar(100) default '' comment '头像地址', + password varchar(100) default '' comment '密码', + status char(1) default '0' comment '帐号状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + login_ip varchar(128) default '' comment '最后登录IP', + login_date datetime comment '最后登录时间', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (user_id) +) engine=innodb auto_increment=100 comment = '用户信息表'; + +-- ---------------------------- +-- 初始化-用户信息表数据 +-- ---------------------------- +insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员'); +insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试员'); + + +-- ---------------------------- +-- 3、岗位信息表 +-- ---------------------------- +drop table if exists sys_post; +create table sys_post +( + post_id bigint(20) not null auto_increment comment '岗位ID', + post_code varchar(64) not null comment '岗位编码', + post_name varchar(50) not null comment '岗位名称', + post_sort int(4) not null comment '显示顺序', + status char(1) not null comment '状态(0正常 1停用)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (post_id) +) engine=innodb comment = '岗位信息表'; + +-- ---------------------------- +-- 初始化-岗位信息表数据 +-- ---------------------------- +insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', sysdate(), '', null, ''); +insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', sysdate(), '', null, ''); +insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', sysdate(), '', null, ''); +insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate(), '', null, ''); + + +-- ---------------------------- +-- 4、角色信息表 +-- ---------------------------- +drop table if exists sys_role; +create table sys_role ( + role_id bigint(20) not null auto_increment comment '角色ID', + role_name varchar(30) not null comment '角色名称', + role_key varchar(100) not null comment '角色权限字符串', + role_sort int(4) not null comment '显示顺序', + data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示', + dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示', + status char(1) not null comment '角色状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (role_id) +) engine=innodb auto_increment=100 comment = '角色信息表'; + +-- ---------------------------- +-- 初始化-角色信息表数据 +-- ---------------------------- +insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员'); +insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色'); + + +-- ---------------------------- +-- 5、菜单权限表 +-- ---------------------------- +drop table if exists sys_menu; +create table sys_menu ( + menu_id bigint(20) not null auto_increment comment '菜单ID', + menu_name varchar(50) not null comment '菜单名称', + parent_id bigint(20) default 0 comment '父菜单ID', + order_num int(4) default 0 comment '显示顺序', + path varchar(200) default '' comment '路由地址', + component varchar(255) default null comment '组件路径', + query varchar(255) default null comment '路由参数', + is_frame int(1) default 1 comment '是否为外链(0是 1否)', + is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)', + menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', + visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', + status char(1) default 0 comment '菜单状态(0正常 1停用)', + perms varchar(100) default null comment '权限标识', + icon varchar(100) default '#' comment '菜单图标', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default '' comment '备注', + primary key (menu_id) +) engine=innodb auto_increment=2000 comment = '菜单权限表'; + +-- ---------------------------- +-- 初始化-菜单信息表数据 +-- ---------------------------- +-- 一级菜单 +insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录'); +insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录'); +insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录'); +insert into sys_menu values('4', '苦糖果MES官网', '0', '4', 'http://029tec.com', null, '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '苦糖果MES官网地址'); +-- 二级菜单 +insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单'); +insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单'); +insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单'); +insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单'); +insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单'); +insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单'); +insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单'); +insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单'); +insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单'); +insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单'); +insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单'); +insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单'); +insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); +insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单'); +insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单'); +insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单'); +insert into sys_menu values('116', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单'); +-- 三级菜单 +insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单'); +insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单'); +-- 用户管理按钮 +insert into sys_menu values('1001', '用户查询', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1002', '用户新增', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1003', '用户修改', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1004', '用户删除', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1005', '用户导出', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1006', '用户导入', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1007', '重置密码', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, ''); +-- 角色管理按钮 +insert into sys_menu values('1008', '角色查询', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1009', '角色新增', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1010', '角色修改', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1011', '角色删除', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1012', '角色导出', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, ''); +-- 菜单管理按钮 +insert into sys_menu values('1013', '菜单查询', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1014', '菜单新增', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1015', '菜单修改', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1016', '菜单删除', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, ''); +-- 部门管理按钮 +insert into sys_menu values('1017', '部门查询', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1018', '部门新增', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1019', '部门修改', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1020', '部门删除', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, ''); +-- 岗位管理按钮 +insert into sys_menu values('1021', '岗位查询', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1022', '岗位新增', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1023', '岗位修改', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1024', '岗位删除', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1025', '岗位导出', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, ''); +-- 字典管理按钮 +insert into sys_menu values('1026', '字典查询', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1027', '字典新增', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1028', '字典修改', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1029', '字典删除', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1030', '字典导出', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, ''); +-- 参数设置按钮 +insert into sys_menu values('1031', '参数查询', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1032', '参数新增', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1033', '参数修改', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1034', '参数删除', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1035', '参数导出', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, ''); +-- 通知公告按钮 +insert into sys_menu values('1036', '公告查询', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1037', '公告新增', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1038', '公告修改', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1039', '公告删除', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, ''); +-- 操作日志按钮 +insert into sys_menu values('1040', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1041', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1042', '日志导出', '500', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, ''); +-- 登录日志按钮 +insert into sys_menu values('1043', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1044', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1045', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, ''); +-- 在线用户按钮 +insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, ''); +-- 定时任务按钮 +insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1054', '任务导出', '110', '7', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, ''); +-- 代码生成按钮 +insert into sys_menu values('1055', '生成查询', '115', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1056', '生成修改', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1057', '生成删除', '115', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1058', '导入代码', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1059', '预览代码', '115', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1060', '生成代码', '115', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, ''); + + +-- ---------------------------- +-- 6、用户和角色关联表 用户N-1角色 +-- ---------------------------- +drop table if exists sys_user_role; +create table sys_user_role ( + user_id bigint(20) not null comment '用户ID', + role_id bigint(20) not null comment '角色ID', + primary key(user_id, role_id) +) engine=innodb comment = '用户和角色关联表'; + +-- ---------------------------- +-- 初始化-用户和角色关联表数据 +-- ---------------------------- +insert into sys_user_role values ('1', '1'); +insert into sys_user_role values ('2', '2'); + + +-- ---------------------------- +-- 7、角色和菜单关联表 角色1-N菜单 +-- ---------------------------- +drop table if exists sys_role_menu; +create table sys_role_menu ( + role_id bigint(20) not null comment '角色ID', + menu_id bigint(20) not null comment '菜单ID', + primary key(role_id, menu_id) +) engine=innodb comment = '角色和菜单关联表'; + +-- ---------------------------- +-- 初始化-角色和菜单关联表数据 +-- ---------------------------- +insert into sys_role_menu values ('2', '1'); +insert into sys_role_menu values ('2', '2'); +insert into sys_role_menu values ('2', '3'); +insert into sys_role_menu values ('2', '4'); +insert into sys_role_menu values ('2', '100'); +insert into sys_role_menu values ('2', '101'); +insert into sys_role_menu values ('2', '102'); +insert into sys_role_menu values ('2', '103'); +insert into sys_role_menu values ('2', '104'); +insert into sys_role_menu values ('2', '105'); +insert into sys_role_menu values ('2', '106'); +insert into sys_role_menu values ('2', '107'); +insert into sys_role_menu values ('2', '108'); +insert into sys_role_menu values ('2', '109'); +insert into sys_role_menu values ('2', '110'); +insert into sys_role_menu values ('2', '111'); +insert into sys_role_menu values ('2', '112'); +insert into sys_role_menu values ('2', '113'); +insert into sys_role_menu values ('2', '114'); +insert into sys_role_menu values ('2', '115'); +insert into sys_role_menu values ('2', '116'); +insert into sys_role_menu values ('2', '500'); +insert into sys_role_menu values ('2', '501'); +insert into sys_role_menu values ('2', '1000'); +insert into sys_role_menu values ('2', '1001'); +insert into sys_role_menu values ('2', '1002'); +insert into sys_role_menu values ('2', '1003'); +insert into sys_role_menu values ('2', '1004'); +insert into sys_role_menu values ('2', '1005'); +insert into sys_role_menu values ('2', '1006'); +insert into sys_role_menu values ('2', '1007'); +insert into sys_role_menu values ('2', '1008'); +insert into sys_role_menu values ('2', '1009'); +insert into sys_role_menu values ('2', '1010'); +insert into sys_role_menu values ('2', '1011'); +insert into sys_role_menu values ('2', '1012'); +insert into sys_role_menu values ('2', '1013'); +insert into sys_role_menu values ('2', '1014'); +insert into sys_role_menu values ('2', '1015'); +insert into sys_role_menu values ('2', '1016'); +insert into sys_role_menu values ('2', '1017'); +insert into sys_role_menu values ('2', '1018'); +insert into sys_role_menu values ('2', '1019'); +insert into sys_role_menu values ('2', '1020'); +insert into sys_role_menu values ('2', '1021'); +insert into sys_role_menu values ('2', '1022'); +insert into sys_role_menu values ('2', '1023'); +insert into sys_role_menu values ('2', '1024'); +insert into sys_role_menu values ('2', '1025'); +insert into sys_role_menu values ('2', '1026'); +insert into sys_role_menu values ('2', '1027'); +insert into sys_role_menu values ('2', '1028'); +insert into sys_role_menu values ('2', '1029'); +insert into sys_role_menu values ('2', '1030'); +insert into sys_role_menu values ('2', '1031'); +insert into sys_role_menu values ('2', '1032'); +insert into sys_role_menu values ('2', '1033'); +insert into sys_role_menu values ('2', '1034'); +insert into sys_role_menu values ('2', '1035'); +insert into sys_role_menu values ('2', '1036'); +insert into sys_role_menu values ('2', '1037'); +insert into sys_role_menu values ('2', '1038'); +insert into sys_role_menu values ('2', '1039'); +insert into sys_role_menu values ('2', '1040'); +insert into sys_role_menu values ('2', '1041'); +insert into sys_role_menu values ('2', '1042'); +insert into sys_role_menu values ('2', '1043'); +insert into sys_role_menu values ('2', '1044'); +insert into sys_role_menu values ('2', '1045'); +insert into sys_role_menu values ('2', '1046'); +insert into sys_role_menu values ('2', '1047'); +insert into sys_role_menu values ('2', '1048'); +insert into sys_role_menu values ('2', '1049'); +insert into sys_role_menu values ('2', '1050'); +insert into sys_role_menu values ('2', '1051'); +insert into sys_role_menu values ('2', '1052'); +insert into sys_role_menu values ('2', '1053'); +insert into sys_role_menu values ('2', '1054'); +insert into sys_role_menu values ('2', '1055'); +insert into sys_role_menu values ('2', '1056'); +insert into sys_role_menu values ('2', '1057'); +insert into sys_role_menu values ('2', '1058'); +insert into sys_role_menu values ('2', '1059'); +insert into sys_role_menu values ('2', '1060'); + +-- ---------------------------- +-- 8、角色和部门关联表 角色1-N部门 +-- ---------------------------- +drop table if exists sys_role_dept; +create table sys_role_dept ( + role_id bigint(20) not null comment '角色ID', + dept_id bigint(20) not null comment '部门ID', + primary key(role_id, dept_id) +) engine=innodb comment = '角色和部门关联表'; + +-- ---------------------------- +-- 初始化-角色和部门关联表数据 +-- ---------------------------- +insert into sys_role_dept values ('2', '100'); +insert into sys_role_dept values ('2', '101'); +insert into sys_role_dept values ('2', '105'); + + +-- ---------------------------- +-- 9、用户与岗位关联表 用户1-N岗位 +-- ---------------------------- +drop table if exists sys_user_post; +create table sys_user_post +( + user_id bigint(20) not null comment '用户ID', + post_id bigint(20) not null comment '岗位ID', + primary key (user_id, post_id) +) engine=innodb comment = '用户与岗位关联表'; + +-- ---------------------------- +-- 初始化-用户与岗位关联表数据 +-- ---------------------------- +insert into sys_user_post values ('1', '1'); +insert into sys_user_post values ('2', '2'); + + +-- ---------------------------- +-- 10、操作日志记录 +-- ---------------------------- +drop table if exists sys_oper_log; +create table sys_oper_log ( + oper_id bigint(20) not null auto_increment comment '日志主键', + title varchar(50) default '' comment '模块标题', + business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)', + method varchar(100) default '' comment '方法名称', + request_method varchar(10) default '' comment '请求方式', + operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)', + oper_name varchar(50) default '' comment '操作人员', + dept_name varchar(50) default '' comment '部门名称', + oper_url varchar(255) default '' comment '请求URL', + oper_ip varchar(128) default '' comment '主机地址', + oper_location varchar(255) default '' comment '操作地点', + oper_param varchar(2000) default '' comment '请求参数', + json_result varchar(2000) default '' comment '返回参数', + status int(1) default 0 comment '操作状态(0正常 1异常)', + error_msg varchar(2000) default '' comment '错误消息', + oper_time datetime comment '操作时间', + primary key (oper_id) +) engine=innodb auto_increment=100 comment = '操作日志记录'; + + +-- ---------------------------- +-- 11、字典类型表 +-- ---------------------------- +drop table if exists sys_dict_type; +create table sys_dict_type +( + dict_id bigint(20) not null auto_increment comment '字典主键', + dict_name varchar(100) default '' comment '字典名称', + dict_type varchar(100) default '' comment '字典类型', + status char(1) default '0' comment '状态(0正常 1停用)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (dict_id), + unique (dict_type) +) engine=innodb auto_increment=100 comment = '字典类型表'; + +insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表'); +insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', sysdate(), '', null, '菜单状态列表'); +insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', sysdate(), '', null, '系统开关列表'); +insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', sysdate(), '', null, '任务状态列表'); +insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', sysdate(), '', null, '任务分组列表'); +insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', sysdate(), '', null, '系统是否列表'); +insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', sysdate(), '', null, '通知类型列表'); +insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', sysdate(), '', null, '通知状态列表'); +insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表'); +insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表'); + + +-- ---------------------------- +-- 12、字典数据表 +-- ---------------------------- +drop table if exists sys_dict_data; +create table sys_dict_data +( + dict_code bigint(20) not null auto_increment comment '字典编码', + dict_sort int(4) default 0 comment '字典排序', + dict_label varchar(100) default '' comment '字典标签', + dict_value varchar(100) default '' comment '字典键值', + dict_type varchar(100) default '' comment '字典类型', + css_class varchar(100) default null comment '样式属性(其他样式扩展)', + list_class varchar(100) default null comment '表格回显样式', + is_default char(1) default 'N' comment '是否默认(Y是 N否)', + status char(1) default '0' comment '状态(0正常 1停用)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (dict_code) +) engine=innodb auto_increment=100 comment = '字典数据表'; + +insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate(), '', null, '性别男'); +insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别女'); +insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别未知'); +insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '显示菜单'); +insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '隐藏菜单'); +insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); +insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); +insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', sysdate(), '', null, '默认分组'); +insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', sysdate(), '', null, '系统分组'); +insert into sys_dict_data values(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '系统默认是'); +insert into sys_dict_data values(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '系统默认否'); +insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate(), '', null, '通知'); +insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate(), '', null, '公告'); +insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '关闭状态'); +insert into sys_dict_data values(18, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新增操作'); +insert into sys_dict_data values(19, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作'); +insert into sys_dict_data values(20, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作'); +insert into sys_dict_data values(21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作'); +insert into sys_dict_data values(22, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作'); +insert into sys_dict_data values(23, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作'); +insert into sys_dict_data values(24, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作'); +insert into sys_dict_data values(25, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作'); +insert into sys_dict_data values(26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作'); +insert into sys_dict_data values(27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); + + +-- ---------------------------- +-- 13、参数配置表 +-- ---------------------------- +drop table if exists sys_config; +create table sys_config ( + config_id int(5) not null auto_increment comment '参数主键', + config_name varchar(100) default '' comment '参数名称', + config_key varchar(100) default '' comment '参数键名', + config_value varchar(500) default '' comment '参数键值', + config_type char(1) default 'N' comment '系统内置(Y是 N否)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (config_id) +) engine=innodb auto_increment=100 comment = '参数配置表'; + +insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' ); +insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456' ); +insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' ); +insert into sys_config values(4, '账号自助-验证码开关', 'sys.account.captchaOnOff', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启验证码功能(true开启,false关闭)'); +insert into sys_config values(5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能(true开启,false关闭)'); + + +-- ---------------------------- +-- 14、系统访问记录 +-- ---------------------------- +drop table if exists sys_logininfor; +create table sys_logininfor ( + info_id bigint(20) not null auto_increment comment '访问ID', + user_name varchar(50) default '' comment '用户账号', + ipaddr varchar(128) default '' comment '登录IP地址', + login_location varchar(255) default '' comment '登录地点', + browser varchar(50) default '' comment '浏览器类型', + os varchar(50) default '' comment '操作系统', + status char(1) default '0' comment '登录状态(0成功 1失败)', + msg varchar(255) default '' comment '提示消息', + login_time datetime comment '访问时间', + primary key (info_id) +) engine=innodb auto_increment=100 comment = '系统访问记录'; + + +-- ---------------------------- +-- 15、定时任务调度表 +-- ---------------------------- +drop table if exists sys_job; +create table sys_job ( + job_id bigint(20) not null auto_increment comment '任务ID', + job_name varchar(64) default '' comment '任务名称', + job_group varchar(64) default 'DEFAULT' comment '任务组名', + invoke_target varchar(500) not null comment '调用目标字符串', + cron_expression varchar(255) default '' comment 'cron执行表达式', + misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', + concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)', + status char(1) default '0' comment '状态(0正常 1暂停)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default '' comment '备注信息', + primary key (job_id, job_name, job_group) +) engine=innodb auto_increment=100 comment = '定时任务调度表'; + +insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); +insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); +insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); + + +-- ---------------------------- +-- 16、定时任务调度日志表 +-- ---------------------------- +drop table if exists sys_job_log; +create table sys_job_log ( + job_log_id bigint(20) not null auto_increment comment '任务日志ID', + job_name varchar(64) not null comment '任务名称', + job_group varchar(64) not null comment '任务组名', + invoke_target varchar(500) not null comment '调用目标字符串', + job_message varchar(500) comment '日志信息', + status char(1) default '0' comment '执行状态(0正常 1失败)', + exception_info varchar(2000) default '' comment '异常信息', + create_time datetime comment '创建时间', + primary key (job_log_id) +) engine=innodb comment = '定时任务调度日志表'; + + +-- ---------------------------- +-- 17、通知公告表 +-- ---------------------------- +drop table if exists sys_notice; +create table sys_notice ( + notice_id int(4) not null auto_increment comment '公告ID', + notice_title varchar(50) not null comment '公告标题', + notice_type char(1) not null comment '公告类型(1通知 2公告)', + notice_content longblob default null comment '公告内容', + status char(1) default '0' comment '公告状态(0正常 1关闭)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(255) default null comment '备注', + primary key (notice_id) +) engine=innodb auto_increment=10 comment = '通知公告表'; + +-- ---------------------------- +-- 初始化-公告信息表数据 +-- ---------------------------- +insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员'); +insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员'); + + +-- ---------------------------- +-- 18、代码生成业务表 +-- ---------------------------- +drop table if exists gen_table; +create table gen_table ( + table_id bigint(20) not null auto_increment comment '编号', + table_name varchar(200) default '' comment '表名称', + table_comment varchar(500) default '' comment '表描述', + sub_table_name varchar(64) default null comment '关联子表的表名', + sub_table_fk_name varchar(64) default null comment '子表关联的外键名', + class_name varchar(100) default '' comment '实体类名称', + tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)', + package_name varchar(100) comment '生成包路径', + module_name varchar(30) comment '生成模块名', + business_name varchar(30) comment '生成业务名', + function_name varchar(50) comment '生成功能名', + function_author varchar(50) comment '生成功能作者', + gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)', + gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)', + options varchar(1000) comment '其它生成选项', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (table_id) +) engine=innodb auto_increment=1 comment = '代码生成业务表'; + + +-- ---------------------------- +-- 19、代码生成业务表字段 +-- ---------------------------- +drop table if exists gen_table_column; +create table gen_table_column ( + column_id bigint(20) not null auto_increment comment '编号', + table_id varchar(64) comment '归属表编号', + column_name varchar(200) comment '列名称', + column_comment varchar(500) comment '列描述', + column_type varchar(100) comment '列类型', + java_type varchar(500) comment 'JAVA类型', + java_field varchar(200) comment 'JAVA字段名', + is_pk char(1) comment '是否主键(1是)', + is_increment char(1) comment '是否自增(1是)', + is_required char(1) comment '是否必填(1是)', + is_insert char(1) comment '是否为插入字段(1是)', + is_edit char(1) comment '是否编辑字段(1是)', + is_list char(1) comment '是否列表字段(1是)', + is_query char(1) comment '是否查询字段(1是)', + query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)', + html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)', + dict_type varchar(200) default '' comment '字典类型', + sort int comment '排序', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (column_id) +) engine=innodb auto_increment=1 comment = '代码生成业务表字段'; \ No newline at end of file