Compare commits
349 Commits
51cca2796d
...
0.8.X
| Author | SHA1 | Date | |
|---|---|---|---|
| 0968dcaded | |||
| cced2ff4aa | |||
| f197462b11 | |||
| 9559e5810e | |||
| 92ad229104 | |||
| ee1cb31321 | |||
| f0de25a3a2 | |||
| 0d40774194 | |||
| 948e62daae | |||
| 48d12fe056 | |||
| 6edc6e1100 | |||
| 12ea9b0b83 | |||
| c149216ebd | |||
| 325a93fd84 | |||
| f0656b57d4 | |||
| 9c7d2dca65 | |||
| 36b1e3da82 | |||
| c83eb79d25 | |||
| e0cf4b46b6 | |||
| 00972112d2 | |||
| 2559dc27cb | |||
| 7a0d7e1b12 | |||
| 1cd2cf2b9a | |||
| 98116fa042 | |||
| d3c6790603 | |||
| c1e3fa5141 | |||
| f319308196 | |||
| 185745b7da | |||
| 7440706e2e | |||
| 0adb29139e | |||
| 2148a068f8 | |||
| e1bb9e5431 | |||
| 8b2039f06a | |||
| 9761faa2d2 | |||
| d5f00a4b0b | |||
| b9fb4b4611 | |||
| 7d76ef0c52 | |||
| ea71a6dd93 | |||
| b9b6ae7e79 | |||
| 20a75aec4b | |||
| 3ad7bf40b5 | |||
| 196e628665 | |||
| 7c61c42eb5 | |||
| 1223b634b7 | |||
| 87913ba0a0 | |||
| eab45a8706 | |||
| a9a7a0889e | |||
| cd2e4016a6 | |||
| 87d72b2a0d | |||
| 4342215c00 | |||
| 7bf7d24f29 | |||
| 4da8d8d297 | |||
| c4eab467ee | |||
| fd50118161 | |||
| cc63aa80b2 | |||
| c95ea7db61 | |||
| f50c240bbe | |||
| 66278e635b | |||
| 74d0ba57e2 | |||
| e00d1357b0 | |||
| b9f87c6cc4 | |||
| 7c9c99bf45 | |||
| fdb13b7261 | |||
| 74a3803290 | |||
| 76497eece7 | |||
| d231d3619a | |||
| 20966157c5 | |||
| 59e58e5206 | |||
| 59ceeed4a4 | |||
| fac59f4346 | |||
| f6a74e58ea | |||
| 857a3948d6 | |||
| 47b3fb24b7 | |||
| 97e0df7ae1 | |||
| 7c87670896 | |||
| cd3cc85c0a | |||
| d70bb77755 | |||
| b00db10a37 | |||
| dbeb99d9e5 | |||
| 1a2fc9852d | |||
| 7aaa59cee1 | |||
| cbebd5b6d6 | |||
| 24a9784035 | |||
| de7ec604dd | |||
| 696f6d9ee0 | |||
| 050dd1a965 | |||
| 724c1dd16f | |||
| 0e85153b3d | |||
| af728f8ea6 | |||
| 7e07b6f970 | |||
| 8a0f5e65bb | |||
| 1947a5c2d5 | |||
| d8498728ee | |||
| 53e948b3e0 | |||
| 3ebc0cb86a | |||
| 8059b0a0bb | |||
| 1792196dc7 | |||
| d8051abf8e | |||
| 5e0cb69bb8 | |||
| 37a69b563b | |||
| 66f0b3fdd7 | |||
| 5e0dc848bb | |||
| a5323aea76 | |||
| cac747d158 | |||
| 705d929d6e | |||
| 29c21fd64f | |||
| 5236500f04 | |||
| 600867f386 | |||
| 8183bae824 | |||
| 37d6830947 | |||
| c71dfe3ff2 | |||
| ff139759d4 | |||
| 5176c80344 | |||
| 31f7a9c0cb | |||
| 9d208770d8 | |||
| 31d8d1ee16 | |||
| b4fbb8dfc8 | |||
| 40ebca2573 | |||
| ec08a360a0 | |||
| 977ea2b021 | |||
| e507887a27 | |||
| 12a887e074 | |||
| 577de8eb64 | |||
| 03add7c96b | |||
| 42e5b6dd2b | |||
| 88149561c5 | |||
| 51bb7593c7 | |||
| c34fc1e477 | |||
| 9bd6077599 | |||
| 6fe1f668d3 | |||
| 53b991242c | |||
| 91017f7c84 | |||
| 7b80ef035a | |||
| e54efab7c8 | |||
| 715c1b9728 | |||
| 8723924002 | |||
| cbaa47b34e | |||
| fe24426f59 | |||
| ef04d73e0c | |||
| b7d47a5d9d | |||
| 021c1c908a | |||
| cd3b25fa30 | |||
| 3106b2c530 | |||
| f4e6b24c92 | |||
| d6620e2449 | |||
| b59bb1789e | |||
| 4295a28f33 | |||
| 8572a60044 | |||
| 29328d70e9 | |||
| 12545f7c8b | |||
| 6ec4275088 | |||
| 14dbd633b5 | |||
| 8d68d2bdee | |||
| 6b8eac4139 | |||
| 13780c635b | |||
| a425a9052a | |||
| f64da15bc3 | |||
| b134539e53 | |||
| effc1f6f2e | |||
| ca285f78c6 | |||
| 0cfffcc60d | |||
| 37b2987279 | |||
| 59bdcf96dc | |||
| 8f602d80a9 | |||
| 7bddfad80f | |||
| 8b1d7ed280 | |||
| 285775c733 | |||
| 7e6bc1e8b4 | |||
| bf3967d7b5 | |||
| a0cd885fc7 | |||
| 481188f654 | |||
| c8fe545950 | |||
| 94840b2153 | |||
| c5ce33f71a | |||
| 43f4692a72 | |||
| 9af5284ff3 | |||
| 62da44382a | |||
| 6a5220ad78 | |||
| 3b7ae10499 | |||
| 6044413384 | |||
| 91d1236c37 | |||
| 020863d1ef | |||
| 6832209e98 | |||
| 3a0f729669 | |||
| aad568f320 | |||
| d6099a781f | |||
| e23098b766 | |||
| 37ea2b7d78 | |||
| c707a0356f | |||
| 484f63f9cc | |||
| 1f32171800 | |||
| 5a16a9d2b1 | |||
| 6147ad2252 | |||
| 5e9bf6069e | |||
| 3cc37ae3d3 | |||
| 5b4ea8f486 | |||
| b8ed505971 | |||
| 6f488c74fc | |||
| 1b65444ab3 | |||
| 125e07eed4 | |||
| 82a54e3200 | |||
| 327ae685c1 | |||
| df643a8e4e | |||
| 8684bc4a63 | |||
| c53befe9d6 | |||
| 5f9876343c | |||
| 1f4dcea63a | |||
| 8e6ae90690 | |||
| f33170de75 | |||
| 7e8509e2e3 | |||
| 56622548cf | |||
| 31d6b02f8b | |||
| 9cfb96f2c3 | |||
| 73e98af96e | |||
| d9f9c948cc | |||
| 1c272792f7 | |||
| 4fcbf10afd | |||
| e4f1c8d2b1 | |||
| 6de1bbfe0b | |||
| d0a15032f2 | |||
| d2f6086093 | |||
| 2aaef6bb86 | |||
| 6b36697e56 | |||
| 1697942d98 | |||
| 05676c7c04 | |||
| 50298c3ec9 | |||
| 17af108940 | |||
| 11c1594169 | |||
| d8a39f67c8 | |||
| 405f388702 | |||
| e95e9adfcd | |||
| 454d8de6a2 | |||
| b9da496f79 | |||
| c8ac535ffb | |||
| 281023a2a1 | |||
| b788074af7 | |||
| de744c861b | |||
| 6f3bd2165f | |||
| 6f7a85025d | |||
| 95c23462c9 | |||
| 9b5ae03c37 | |||
| 501abc4821 | |||
| bd67df3c05 | |||
| 015ec7d70b | |||
| 3d13302370 | |||
| 1df397f821 | |||
| e04a4a0b99 | |||
| 8b3ace4d1b | |||
| 85bb87e9fb | |||
| cb18132ec6 | |||
| 0179cf986b | |||
| 69ea51ec93 | |||
| 3d92528179 | |||
| cd099f2e6b | |||
| 35ad50a79d | |||
| af6eb19952 | |||
| faa3784eae | |||
| dc3f20ebc9 | |||
| 13ad671b29 | |||
| eb8e797a4d | |||
| 09535d884c | |||
| 50192174e8 | |||
| a33db26838 | |||
| 74c7618e9a | |||
| 40067a3680 | |||
| a81032dedf | |||
| b34dad1237 | |||
|
|
6f5d09beef | ||
| e9de87a7b6 | |||
| a5b1a19a2b | |||
| 26f285ec80 | |||
|
|
3718132a59 | ||
| be75c1a4b8 | |||
| d81773b1ab | |||
| 749ae46490 | |||
| e084576f1e | |||
| 30f9b533b2 | |||
| b7016b3591 | |||
| 0a286023c7 | |||
| 2fb5b58c99 | |||
| 7b2881c45f | |||
| bb5c09fd6d | |||
| b14f4f69c7 | |||
| c2b7a08414 | |||
| 80fbe70ab7 | |||
| a9edc8fcf3 | |||
| 903c354add | |||
| fe5188e8fc | |||
| 35e4e4bbb0 | |||
|
|
efc6a9f0df | ||
| 049c3353b3 | |||
| b9d8c17953 | |||
| ae6878c00b | |||
| a3d80b09cb | |||
| 0abd3668ad | |||
| 66dae17caf | |||
| cb23f659b9 | |||
| d60508364b | |||
|
|
5a4ab2f65e | ||
| 8f3d08334e | |||
| 110f862f15 | |||
| 2590876da3 | |||
| eeda1dc8d9 | |||
| 6442a1ff32 | |||
| a05ecbf3a7 | |||
| 92e01a029d | |||
| 67410af985 | |||
| e531ce019d | |||
| b580d1798e | |||
| baed852ff4 | |||
| 25e46a9867 | |||
| ddc1caa065 | |||
| 52cbc21088 | |||
| d982efc866 | |||
| 6b58f37616 | |||
| eb5601ade3 | |||
| 613acfc998 | |||
| 96b49e71f4 | |||
| 75954a3a9c | |||
| 1cbc8da78c | |||
| 2fc8cf02d1 | |||
| a189c3904d | |||
| 531fccb22b | |||
| 015a3622d7 | |||
| 7b47403ae8 | |||
| 10398f83b6 | |||
| 7b75940258 | |||
| bb96f2a9e4 | |||
| a91ee6d956 | |||
| 2c9cc6241f | |||
| 15beca11c8 | |||
| ca21fe33f3 | |||
| 724dd272ca | |||
| 54cf9046e7 | |||
| cd7ca23f28 | |||
| 519ee13b32 | |||
| 2813167751 | |||
| 439857682b | |||
| 1d1c27bf40 | |||
| 53a180787b | |||
| 417783e64a | |||
| 4a8fc4904f | |||
| df25151fa5 | |||
| 6343f66ff7 | |||
| ccd7d0a562 | |||
| 9a58fa2b30 | |||
| 4575b6f342 | |||
| 210d7ab4a4 | |||
| e745208870 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -45,6 +45,11 @@ nbdist/
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
|
||||
######################################################################
|
||||
# AI Assistant Configuration
|
||||
.trae/
|
||||
.reasonix/skills/
|
||||
|
||||
######################################################################
|
||||
# Personal Scripts & Tables (not for commit)
|
||||
*.xlsx
|
||||
|
||||
81
docs/double-rack-ddl.sql
Normal file
81
docs/double-rack-ddl.sql
Normal file
@@ -0,0 +1,81 @@
|
||||
-- 双机架 (double-rack) 数据库 DDL
|
||||
-- 在 jdbc:mysql://140.143.206.120:13306/double-rack 上执行
|
||||
|
||||
-- 工艺方案主表
|
||||
CREATE TABLE IF NOT EXISTS `mill_process_recipe` (
|
||||
`recipe_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`recipe_no` VARCHAR(64) NOT NULL COMMENT '方案记录号(唯一)',
|
||||
`alloy_no` VARCHAR(32) NOT NULL COMMENT '合金号',
|
||||
`pass_count` INT NOT NULL DEFAULT 0 COMMENT '道次数量',
|
||||
`in_thick` DECIMAL(8,3) DEFAULT NULL COMMENT '原料厚度(mm)',
|
||||
`out_thick` DECIMAL(8,3) DEFAULT NULL COMMENT '成品厚度(mm)',
|
||||
`out_width` DECIMAL(8,1) DEFAULT NULL COMMENT '成品宽度(mm)',
|
||||
`status` CHAR(1) NOT NULL DEFAULT '0' COMMENT '状态: 0-正常 1-停用',
|
||||
`del_flag` CHAR(1) NOT NULL DEFAULT '0' COMMENT '删除标志: 0-存在 2-删除',
|
||||
`create_by` VARCHAR(64) DEFAULT NULL,
|
||||
`create_time` DATETIME DEFAULT NULL,
|
||||
`update_by` VARCHAR(64) DEFAULT NULL,
|
||||
`update_time` DATETIME DEFAULT NULL,
|
||||
`remark` VARCHAR(512) DEFAULT NULL,
|
||||
PRIMARY KEY (`recipe_id`),
|
||||
UNIQUE KEY `uk_recipe_no` (`recipe_no`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='双机架工艺方案主表';
|
||||
|
||||
-- 工艺方案道次表
|
||||
CREATE TABLE IF NOT EXISTS `mill_process_pass` (
|
||||
`pass_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`recipe_id` BIGINT NOT NULL COMMENT '关联方案ID',
|
||||
`pass_no` INT NOT NULL COMMENT '道次序号',
|
||||
`in_thick` DECIMAL(8,3) DEFAULT NULL COMMENT '入口厚度(mm)',
|
||||
`out_thick` DECIMAL(8,3) DEFAULT NULL COMMENT '出口厚度(mm)',
|
||||
`width` DECIMAL(8,1) DEFAULT NULL COMMENT '宽度(mm)',
|
||||
`roll_force` DECIMAL(10,2) DEFAULT NULL COMMENT '轧制力(kN)',
|
||||
`in_tension` DECIMAL(10,2) DEFAULT NULL COMMENT '入口张力(kN)',
|
||||
`out_tension` DECIMAL(10,2) DEFAULT NULL COMMENT '出口张力(kN)',
|
||||
`max_speed` DECIMAL(8,2) DEFAULT NULL COMMENT '最高速度(m/min)',
|
||||
`in_unit_tension` DECIMAL(10,4) DEFAULT NULL COMMENT '入口单位张力(N/mm²)',
|
||||
`out_unit_tension` DECIMAL(10,4) DEFAULT NULL COMMENT '出口单位张力(N/mm²)',
|
||||
`reduction` DECIMAL(8,3) DEFAULT NULL COMMENT '压下量(mm)',
|
||||
`total_reduction` DECIMAL(8,3) DEFAULT NULL COMMENT '总压下量(mm)',
|
||||
`del_flag` CHAR(1) NOT NULL DEFAULT '0' COMMENT '删除标志',
|
||||
`create_by` VARCHAR(64) DEFAULT NULL,
|
||||
`create_time` DATETIME DEFAULT NULL,
|
||||
`update_by` VARCHAR(64) DEFAULT NULL,
|
||||
`update_time` DATETIME DEFAULT NULL,
|
||||
`remark` VARCHAR(512) DEFAULT NULL,
|
||||
PRIMARY KEY (`pass_id`),
|
||||
KEY `idx_recipe_id` (`recipe_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='双机架工艺方案道次表';
|
||||
|
||||
-- 生产计划表(轧制队列)
|
||||
CREATE TABLE IF NOT EXISTS `mill_production_plan` (
|
||||
`plan_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`plan_no` VARCHAR(64) NOT NULL COMMENT '计划号',
|
||||
`plan_status` CHAR(1) NOT NULL DEFAULT '0' COMMENT '计划状态: 0-待生产 1-生产中 2-完成 3-撤销',
|
||||
`prod_status` VARCHAR(16) NOT NULL DEFAULT 'Idle' COMMENT '生产状态: Idle/Rolling/NextCoil/Done/Error',
|
||||
`sort_no` INT NOT NULL DEFAULT 0 COMMENT '队列序号',
|
||||
`in_mat_no` VARCHAR(64) DEFAULT NULL COMMENT '钢卷编号(入场钢卷号)',
|
||||
`sg_sign` VARCHAR(64) DEFAULT NULL COMMENT '合金牌号',
|
||||
`in_mat_thick` DECIMAL(8,3) DEFAULT NULL COMMENT '采料厚度(mm)',
|
||||
`in_mat_width` DECIMAL(8,1) DEFAULT NULL COMMENT '采料宽度(mm)',
|
||||
`in_mat_wt` DECIMAL(10,3) DEFAULT NULL COMMENT '采料重量(t)',
|
||||
`in_mat_len` DECIMAL(10,2) DEFAULT NULL COMMENT '采料长度(m)',
|
||||
`in_mat_in_dia` DECIMAL(8,1) DEFAULT NULL COMMENT '采料内径(mm)',
|
||||
`in_mat_dia` DECIMAL(8,1) DEFAULT NULL COMMENT '采料外径(mm)',
|
||||
`out_thick` DECIMAL(8,3) DEFAULT NULL COMMENT '成品厚度(mm)',
|
||||
`pass_count` INT NOT NULL DEFAULT 0 COMMENT '道次数',
|
||||
`recipe_id` BIGINT DEFAULT NULL COMMENT '关联工艺方案ID',
|
||||
`recipe_no` VARCHAR(64) DEFAULT NULL COMMENT '工艺方案号',
|
||||
`enter_coil_no` VARCHAR(64) DEFAULT NULL COMMENT '关联三级入场钢卷号',
|
||||
`current_coil_no` VARCHAR(64) DEFAULT NULL COMMENT '关联三级当前钢卷号',
|
||||
`del_flag` CHAR(1) NOT NULL DEFAULT '0' COMMENT '删除标志',
|
||||
`create_by` VARCHAR(64) DEFAULT NULL,
|
||||
`create_time` DATETIME DEFAULT NULL,
|
||||
`update_by` VARCHAR(64) DEFAULT NULL,
|
||||
`update_time` DATETIME DEFAULT NULL,
|
||||
`remark` VARCHAR(512) DEFAULT NULL,
|
||||
PRIMARY KEY (`plan_id`),
|
||||
KEY `idx_in_mat_no` (`in_mat_no`),
|
||||
KEY `idx_enter_coil_no` (`enter_coil_no`),
|
||||
KEY `idx_current_coil_no` (`current_coil_no`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='双机架生产计划表(轧制队列)';
|
||||
16
docs/spec-match-ddl.sql
Normal file
16
docs/spec-match-ddl.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- 规程版本新增匹配条件字段
|
||||
ALTER TABLE wms_process_spec_version
|
||||
ADD COLUMN match_entry_thick_min DECIMAL(8,3) NULL COMMENT '来料厚度下限(mm)',
|
||||
ADD COLUMN match_entry_thick_max DECIMAL(8,3) NULL COMMENT '来料厚度上限(mm)',
|
||||
ADD COLUMN match_exit_thick_min DECIMAL(8,3) NULL COMMENT '出口厚度下限(mm)',
|
||||
ADD COLUMN match_exit_thick_max DECIMAL(8,3) NULL COMMENT '出口厚度上限(mm)',
|
||||
ADD COLUMN match_entry_width_min DECIMAL(8,2) NULL COMMENT '来料宽度下限(mm)',
|
||||
ADD COLUMN match_entry_width_max DECIMAL(8,2) NULL COMMENT '来料宽度上限(mm)',
|
||||
ADD COLUMN match_exit_width_min DECIMAL(8,2) NULL COMMENT '出口宽度下限(mm)',
|
||||
ADD COLUMN match_exit_width_max DECIMAL(8,2) NULL COMMENT '出口宽度上限(mm)',
|
||||
ADD COLUMN match_steel_grade VARCHAR(100) NULL COMMENT '钢种关键字(模糊匹配)';
|
||||
|
||||
-- 钢卷主表新增规程绑定字段
|
||||
ALTER TABLE wms_material_coil
|
||||
ADD COLUMN spec_id BIGINT NULL COMMENT '绑定的规程ID',
|
||||
ADD COLUMN version_id BIGINT NULL COMMENT '绑定的规程版本ID';
|
||||
128
docs/spec-sample-data.sql
Normal file
128
docs/spec-sample-data.sql
Normal file
@@ -0,0 +1,128 @@
|
||||
-- ============================================================
|
||||
-- 规程匹配测试样本数据
|
||||
-- 执行前请确认:SELECT spec_id, spec_code FROM wms_process_spec;
|
||||
-- SELECT * FROM wms_production_line WHERE line_id = 1;
|
||||
-- ============================================================
|
||||
|
||||
-- 先查看现有规程,避免重复
|
||||
-- SELECT * FROM wms_process_spec WHERE line_id = 1;
|
||||
-- SELECT * FROM wms_process_spec_version WHERE is_active = 1;
|
||||
|
||||
-- ─────────────────────────────────────────────────
|
||||
-- 规程1:酸轧通用规程(宽范围覆盖大多数钢卷)
|
||||
-- ─────────────────────────────────────────────────
|
||||
INSERT INTO wms_process_spec (
|
||||
spec_code, spec_name, spec_type, line_id,
|
||||
product_type, is_enabled, del_flag,
|
||||
remark, create_by, create_time, update_by, update_time
|
||||
) VALUES (
|
||||
'ACL-STD-001', '酸轧通用规程', 'PROCESS', 1,
|
||||
'CR', 1, 0,
|
||||
'通用匹配规程,覆盖常规酸轧来料范围', 'admin', NOW(), 'admin', NOW()
|
||||
);
|
||||
|
||||
-- 获取刚插入的 spec_id
|
||||
SET @spec_id_std = LAST_INSERT_ID();
|
||||
|
||||
-- 版本V1(生效版本,宽范围)
|
||||
INSERT INTO wms_process_spec_version (
|
||||
spec_id, version_code, is_active, status, del_flag,
|
||||
match_entry_thick_min, match_entry_thick_max,
|
||||
match_exit_thick_min, match_exit_thick_max,
|
||||
match_entry_width_min, match_entry_width_max,
|
||||
match_exit_width_min, match_exit_width_max,
|
||||
match_steel_grade,
|
||||
remark, create_by, create_time, update_by, update_time
|
||||
) VALUES (
|
||||
@spec_id_std, 'V1.0', 1, 1, 0,
|
||||
1.500, 8.000, -- 来料厚度范围 mm(热卷厚度典型值 2~6mm,留余量)
|
||||
0.200, 4.000, -- 出口厚度范围 mm(冷轧成品典型值 0.3~2mm)
|
||||
700.00, 1700.00, -- 来料宽度范围 mm
|
||||
700.00, 1700.00, -- 出口宽度范围 mm
|
||||
NULL, -- 钢种为空 = 不限钢种
|
||||
'通用版本,宽范围覆盖', 'admin', NOW(), 'admin', NOW()
|
||||
);
|
||||
|
||||
-- ─────────────────────────────────────────────────
|
||||
-- 规程2:酸轧薄规格规程(出口厚度 ≤ 1.0mm)
|
||||
-- ─────────────────────────────────────────────────
|
||||
INSERT INTO wms_process_spec (
|
||||
spec_code, spec_name, spec_type, line_id,
|
||||
product_type, is_enabled, del_flag,
|
||||
remark, create_by, create_time, update_by, update_time
|
||||
) VALUES (
|
||||
'ACL-THIN-001', '酸轧薄规格规程', 'PROCESS', 1,
|
||||
'CR', 1, 0,
|
||||
'薄规格产品专用,出口厚度不超过1.0mm', 'admin', NOW(), 'admin', NOW()
|
||||
);
|
||||
|
||||
SET @spec_id_thin = LAST_INSERT_ID();
|
||||
|
||||
-- 版本V1(生效版本,出口厚度 ≤ 1.0mm)
|
||||
INSERT INTO wms_process_spec_version (
|
||||
spec_id, version_code, is_active, status, del_flag,
|
||||
match_entry_thick_min, match_entry_thick_max,
|
||||
match_exit_thick_min, match_exit_thick_max,
|
||||
match_entry_width_min, match_entry_width_max,
|
||||
match_exit_width_min, match_exit_width_max,
|
||||
match_steel_grade,
|
||||
remark, create_by, create_time, update_by, update_time
|
||||
) VALUES (
|
||||
@spec_id_thin, 'V1.0', 1, 1, 0,
|
||||
2.000, 5.000, -- 来料厚度
|
||||
0.200, 1.000, -- 出口厚度(薄规格)
|
||||
800.00, 1500.00, -- 来料宽度
|
||||
800.00, 1500.00, -- 出口宽度
|
||||
NULL, -- 不限钢种
|
||||
'薄规格专用版本', 'admin', NOW(), 'admin', NOW()
|
||||
);
|
||||
|
||||
-- ─────────────────────────────────────────────────
|
||||
-- 规程3:高强钢规程(含钢种匹配)
|
||||
-- ─────────────────────────────────────────────────
|
||||
INSERT INTO wms_process_spec (
|
||||
spec_code, spec_name, spec_type, line_id,
|
||||
product_type, is_enabled, del_flag,
|
||||
remark, create_by, create_time, update_by, update_time
|
||||
) VALUES (
|
||||
'ACL-HSS-001', '酸轧高强钢规程', 'PROCESS', 1,
|
||||
'CR', 1, 0,
|
||||
'高强度结构钢专用规程', 'admin', NOW(), 'admin', NOW()
|
||||
);
|
||||
|
||||
SET @spec_id_hss = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO wms_process_spec_version (
|
||||
spec_id, version_code, is_active, status, del_flag,
|
||||
match_entry_thick_min, match_entry_thick_max,
|
||||
match_exit_thick_min, match_exit_thick_max,
|
||||
match_entry_width_min, match_entry_width_max,
|
||||
match_exit_width_min, match_exit_width_max,
|
||||
match_steel_grade,
|
||||
remark, create_by, create_time, update_by, update_time
|
||||
) VALUES (
|
||||
@spec_id_hss, 'V1.0', 1, 1, 0,
|
||||
2.500, 7.000,
|
||||
0.500, 2.500,
|
||||
900.00, 1600.00,
|
||||
900.00, 1600.00,
|
||||
'Q', -- 匹配钢种含 "Q" 的(Q235、Q345、Q420 等)
|
||||
'高强钢版本,钢种含Q', 'admin', NOW(), 'admin', NOW()
|
||||
);
|
||||
|
||||
-- ─────────────────────────────────────────────────
|
||||
-- 验证查询
|
||||
-- ─────────────────────────────────────────────────
|
||||
SELECT
|
||||
s.spec_id, s.spec_code, s.spec_name, s.line_id,
|
||||
v.version_id, v.version_code, v.is_active,
|
||||
v.match_entry_thick_min, v.match_entry_thick_max,
|
||||
v.match_exit_thick_min, v.match_exit_thick_max,
|
||||
v.match_entry_width_min, v.match_entry_width_max,
|
||||
v.match_steel_grade
|
||||
FROM wms_process_spec s
|
||||
JOIN wms_process_spec_version v ON s.spec_id = v.spec_id
|
||||
WHERE s.line_id = 1
|
||||
AND s.del_flag = 0
|
||||
AND v.del_flag = 0
|
||||
ORDER BY s.spec_id, v.version_code;
|
||||
@@ -124,6 +124,11 @@
|
||||
<artifactId>klp-aps</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.klp</groupId>
|
||||
<artifactId>klp-cost</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -361,6 +361,68 @@ public class SqlServerApiClient {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public ExecuteSqlResponse queryExcoilByHotCoilId(String hotCoilId) {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"select * from JXPLTCM.PLTCM_PDO_EXCOIL where HOT_COILID = :hotCoilId",
|
||||
singletonParam("hotCoilId", hotCoilId)
|
||||
);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryPlanListByHotCoilIdLike(String hotCoilId, int page, int pageSize) {
|
||||
int endRow = page * pageSize;
|
||||
int startRow = endRow - pageSize;
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
params.put("startRow", startRow);
|
||||
params.put("endRow", endRow);
|
||||
params.put("hotCoilId", "%" + hotCoilId + "%");
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"select * from (select t.*, ROWNUM rn from (select * from JXPLTCM.PLTCM_PDI_PLAN where HOT_COILID LIKE :hotCoilId order by INSDATE desc) t where ROWNUM <= :endRow) where rn > :startRow",
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryPlanCountByHotCoilIdLike(String hotCoilId) {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"select count(*) as total from JXPLTCM.PLTCM_PDI_PLAN where HOT_COILID LIKE :hotCoilId",
|
||||
singletonParam("hotCoilId", "%" + hotCoilId + "%")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量按 EXCOILID 查询出口卷上线/下线时间(PLTCM_PDO_EXCOIL)
|
||||
*/
|
||||
public ExecuteSqlResponse queryExcoilTimesByCoilIds(List<String> coilIds) {
|
||||
if (coilIds == null || coilIds.isEmpty()) {
|
||||
return new ExecuteSqlResponse();
|
||||
}
|
||||
String inList = coilIds.stream()
|
||||
.filter(id -> id != null && !id.trim().isEmpty())
|
||||
.map(id -> "'" + id.replace("'", "''") + "'")
|
||||
.collect(java.util.stream.Collectors.joining(", "));
|
||||
if (inList.isEmpty()) return new ExecuteSqlResponse();
|
||||
String sql = "SELECT EXCOILID, START_DATE, END_DATE FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE EXCOILID IN (" + inList + ")";
|
||||
return executeSql("oracle", sql, emptyParams());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量按 HOT_COILID 查询计划数据(IN 子句,一次 Oracle 调用获取整页数据)
|
||||
*/
|
||||
public ExecuteSqlResponse queryPlanDimsByHotCoilIds(List<String> hotCoilIds) {
|
||||
if (hotCoilIds == null || hotCoilIds.isEmpty()) {
|
||||
return new ExecuteSqlResponse();
|
||||
}
|
||||
String inList = hotCoilIds.stream()
|
||||
.map(id -> "'" + id.replace("'", "''") + "'")
|
||||
.collect(java.util.stream.Collectors.joining(", "));
|
||||
String sql = "SELECT HOT_COILID, ENTRY_THICK, EXIT_THICK, ENTRY_WIDTH, EXIT_WIDTH, GRADE, PROCESS_CODE, COILID " +
|
||||
"FROM JXPLTCM.PLTCM_PDI_PLAN WHERE HOT_COILID IN (" + inList + ")";
|
||||
return executeSql("oracle", sql, emptyParams());
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryProSegByEncoilId(String encoilId) {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
@@ -413,25 +475,77 @@ public class SqlServerApiClient {
|
||||
return executeSql("oracle", sql.toString(), params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryExcoilList(int page, int pageSize) {
|
||||
public ExecuteSqlResponse queryExcoilByTimeRange(String startTime, String endTime) {
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1");
|
||||
if (startTime != null && !startTime.trim().isEmpty()) {
|
||||
sql.append(" AND END_DATE >= TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
params.put("startTime", startTime.trim());
|
||||
}
|
||||
if (endTime != null && !endTime.trim().isEmpty()) {
|
||||
sql.append(" AND END_DATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
params.put("endTime", endTime.trim());
|
||||
}
|
||||
sql.append(" ORDER BY END_DATE DESC");
|
||||
return executeSql("oracle", sql.toString(), params);
|
||||
}
|
||||
|
||||
// public ExecuteSqlResponse queryExcoilByInsdateRange(String startTime, String endTime) {
|
||||
// Map<String, Object> params = new java.util.HashMap<>();
|
||||
// StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1");
|
||||
// if (startTime != null && !startTime.trim().isEmpty()) {
|
||||
// sql.append(" AND INSDATE > TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
// params.put("startTime", startTime.trim());
|
||||
// }
|
||||
// if (endTime != null && !endTime.trim().isEmpty()) {
|
||||
// sql.append(" AND INSDATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
// params.put("endTime", endTime.trim());
|
||||
// }
|
||||
// sql.append(" ORDER BY INSDATE ASC");
|
||||
// return executeSql("oracle", sql.toString(), params);
|
||||
// }
|
||||
|
||||
public ExecuteSqlResponse queryExcoilList(int page, int pageSize, String coilId, String startDate, String endDate) {
|
||||
int endRow = page * pageSize;
|
||||
int startRow = endRow - pageSize;
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
params.put("startRow", startRow);
|
||||
params.put("endRow", endRow);
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"select * from (select t.*, ROWNUM rn from (select * from JXPLTCM.PLTCM_PDO_EXCOIL order by END_DATE desc) t where ROWNUM <= :endRow) where rn > :startRow",
|
||||
params
|
||||
);
|
||||
StringBuilder where = new StringBuilder();
|
||||
if (coilId != null && !coilId.trim().isEmpty()) {
|
||||
where.append(" AND UPPER(EXCOILID) LIKE '%' || UPPER(:coilId) || '%'");
|
||||
params.put("coilId", coilId.trim());
|
||||
}
|
||||
if (startDate != null && !startDate.trim().isEmpty()) {
|
||||
where.append(" AND END_DATE >= TO_DATE(:startDate, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
params.put("startDate", startDate.trim());
|
||||
}
|
||||
if (endDate != null && !endDate.trim().isEmpty()) {
|
||||
where.append(" AND END_DATE <= TO_DATE(:endDate, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
params.put("endDate", endDate.trim());
|
||||
}
|
||||
String sql = "select * from (select t.*, ROWNUM rn from (select * from JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1"
|
||||
+ where.toString() + " order by END_DATE desc) t where ROWNUM <= :endRow) where rn > :startRow";
|
||||
return executeSql("oracle", sql, params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryExcoilCount() {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"select count(*) as total from JXPLTCM.PLTCM_PDO_EXCOIL",
|
||||
emptyParams()
|
||||
);
|
||||
public ExecuteSqlResponse queryExcoilCount(String coilId, String startDate, String endDate) {
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder where = new StringBuilder();
|
||||
if (coilId != null && !coilId.trim().isEmpty()) {
|
||||
where.append(" AND UPPER(EXCOILID) LIKE '%' || UPPER(:coilId) || '%'");
|
||||
params.put("coilId", coilId.trim());
|
||||
}
|
||||
if (startDate != null && !startDate.trim().isEmpty()) {
|
||||
where.append(" AND END_DATE >= TO_DATE(:startDate, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
params.put("startDate", startDate.trim());
|
||||
}
|
||||
if (endDate != null && !endDate.trim().isEmpty()) {
|
||||
where.append(" AND END_DATE <= TO_DATE(:endDate, 'YYYY-MM-DD HH24:MI:SS')");
|
||||
params.put("endDate", endDate.trim());
|
||||
}
|
||||
String sql = "select count(*) as total from JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1" + where.toString();
|
||||
return executeSql("oracle", sql, params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryPresetSetupByCoilId(String coilId) {
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.klp.framework.controller;
|
||||
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.domain.bo.WmsMaterialCoilBo;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import com.klp.framework.service.SqlServerApiBusinessService;
|
||||
import com.klp.service.IWmsMaterialCoilService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/coil-comparison")
|
||||
public class CoilComparisonController {
|
||||
|
||||
private final SqlServerApiBusinessService sqlServerService;
|
||||
private final IWmsMaterialCoilService wmsMaterialCoilService;
|
||||
|
||||
/**
|
||||
* 获取钢卷状态信息接口
|
||||
* 根据时间范围、产线类型查询钢卷状态,并关联本地系统中的钢卷信息
|
||||
*
|
||||
* @param startTime 开始时间(可选)
|
||||
* @param endTime 结束时间(可选)
|
||||
* @param lineType 产线类型(可选)
|
||||
* @return 返回包含钢卷状态信息的列表,每个钢卷信息包含外系统和本系统的相关数据
|
||||
*/
|
||||
@GetMapping("/excoil-status")
|
||||
public R<List<Map<String, Object>>> getExcoilStatus(
|
||||
@RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime,
|
||||
@RequestParam(required = false) String lineType) {
|
||||
|
||||
// 默认时间为今天
|
||||
if (startTime == null || startTime.trim().isEmpty()) {
|
||||
startTime = LocalDate.now().toString() + " 00:00:00";
|
||||
}
|
||||
if (endTime == null || endTime.trim().isEmpty()) {
|
||||
endTime = LocalDate.now().toString() + " 23:59:59";
|
||||
}
|
||||
// 从SQL Server服务获取指定时间范围内的钢卷数据
|
||||
List<Map<String, Object>> excoilRows = sqlServerService.getExcoilByTimeRange(startTime, endTime);
|
||||
|
||||
// 构建查询条件,查询本地系统中的热轧卷板原料信息
|
||||
WmsMaterialCoilBo bo = new WmsMaterialCoilBo();
|
||||
bo.setItemType("raw_material");
|
||||
bo.setMaterialType("原料");
|
||||
bo.setItemName("热轧卷板");
|
||||
bo.setSelectType("raw_material");
|
||||
List<WmsMaterialCoilVo> localCoils = wmsMaterialCoilService.queryList(bo);
|
||||
|
||||
// 将本地钢卷数据以钢卷号为key存入Map,便于后续查找
|
||||
Map<String, WmsMaterialCoilVo> localMap = new HashMap<>();
|
||||
for (WmsMaterialCoilVo coil : localCoils) {
|
||||
if (coil.getEnterCoilNo() != null) {
|
||||
localMap.put(coil.getEnterCoilNo(), coil);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理结果集,将外系统和本地系统的钢卷信息合并
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Map<String, Object> excoil : excoilRows) {
|
||||
// 获取热轧卷ID
|
||||
String hotCoilId = excoil.get("hot_coilid") != null ? String.valueOf(excoil.get("hot_coilid")) : null;
|
||||
// 创建结果项
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
// 添加外系统基本信息
|
||||
item.put("excoilId", excoil.get("encoilid"));
|
||||
item.put("hotCoilId", hotCoilId);
|
||||
item.put("endDate", excoil.get("end_date"));
|
||||
item.put("startDate", excoil.get("start_date"));
|
||||
item.put("excoilid", excoil.get("excoilid"));
|
||||
item.put("grade", excoil.get("grade"));
|
||||
item.put("status", excoil.get("status"));
|
||||
item.put("shift", excoil.get("shift"));
|
||||
item.put("crew", excoil.get("crew"));
|
||||
item.put("entryThick", excoil.get("entry_thick"));
|
||||
item.put("entryWeight", excoil.get("entry_weight"));
|
||||
item.put("entryWidth", excoil.get("entry_width"));
|
||||
item.put("exitThick", excoil.get("exit_thick"));
|
||||
item.put("exitWidth", excoil.get("exit_width"));
|
||||
item.put("exitLength", excoil.get("exit_length"));
|
||||
item.put("exitNegDev", excoil.get("exit_neg_dev"));
|
||||
item.put("exitPosDev", excoil.get("exit_pos_dev"));
|
||||
item.put("calcExitWeight", excoil.get("calc_exit_weight"));
|
||||
item.put("measExitWeight", excoil.get("meas_exit_weight"));
|
||||
item.put("quality", excoil.get("quality"));
|
||||
item.put("shapeQuality", excoil.get("shape_quality"));
|
||||
item.put("orderQuality", excoil.get("order_quality"));
|
||||
item.put("productType", excoil.get("product_type"));
|
||||
item.put("parkType", excoil.get("park_type"));
|
||||
item.put("sideTrim", excoil.get("side_trim"));
|
||||
item.put("innerDiameter", excoil.get("inner_diameter"));
|
||||
item.put("outerDiameter", excoil.get("outer_diameter"));
|
||||
item.put("headpos", excoil.get("headpos"));
|
||||
item.put("tailpos", excoil.get("tailpos"));
|
||||
item.put("subid", excoil.get("subid"));
|
||||
item.put("rn", excoil.get("rn"));
|
||||
item.put("comments", excoil.get("comments"));
|
||||
item.put("reportFlag", excoil.get("report_flag"));
|
||||
item.put("usedEntryWeight", excoil.get("used_entry_weight"));
|
||||
item.put("onlineDate", excoil.get("online_date"));
|
||||
item.put("insdate", excoil.get("insdate"));
|
||||
item.put("weldedDate", excoil.get("welded_date"));
|
||||
|
||||
// 如果存在热轧卷ID,则尝试匹配本地系统数据
|
||||
if (hotCoilId != null) {
|
||||
WmsMaterialCoilVo matched = localMap.get(hotCoilId);
|
||||
if (matched != null) {
|
||||
// 匹配成功,添加本地系统数据
|
||||
item.put("enterCoilNo", matched.getEnterCoilNo());
|
||||
item.put("currentCoilNo", matched.getCurrentCoilNo());
|
||||
item.put("supplierCoilNo", matched.getSupplierCoilNo());
|
||||
item.put("dataType", matched.getDataType());
|
||||
item.put("itemName", matched.getItemName());
|
||||
item.put("itemCode", matched.getItemCode());
|
||||
item.put("specification", matched.getSpecification());
|
||||
item.put("material", matched.getMaterial());
|
||||
item.put("manufacturer", matched.getManufacturer());
|
||||
item.put("coilStatus", matched.getStatus());
|
||||
item.put("warehouseName", matched.getWarehouseName());
|
||||
// 根据数据类型设置匹配状态
|
||||
if (matched.getDataType() != null && matched.getDataType() == 0) {
|
||||
item.put("matchStatus", 0);
|
||||
item.put("matchStatusDesc", "已加工");
|
||||
} else {
|
||||
item.put("matchStatus", 1);
|
||||
item.put("matchStatusDesc", "未加工");
|
||||
}
|
||||
} else {
|
||||
// 未匹配到本地数据,设置为未入库状态
|
||||
item.put("enterCoilNo", null);
|
||||
item.put("currentCoilNo", null);
|
||||
item.put("supplierCoilNo", null);
|
||||
item.put("dataType", null);
|
||||
item.put("itemName", null);
|
||||
item.put("itemCode", null);
|
||||
item.put("specification", null);
|
||||
item.put("material", null);
|
||||
item.put("manufacturer", null);
|
||||
item.put("coilStatus", null);
|
||||
item.put("warehouseName", null);
|
||||
item.put("matchStatus", 2);
|
||||
item.put("matchStatusDesc", "未入库");
|
||||
}
|
||||
} else {
|
||||
// 热轧卷ID为空,设置为未入库状态
|
||||
item.put("enterCoilNo", null);
|
||||
item.put("currentCoilNo", null);
|
||||
item.put("supplierCoilNo", null);
|
||||
item.put("dataType", null);
|
||||
item.put("itemName", null);
|
||||
item.put("itemCode", null);
|
||||
item.put("specification", null);
|
||||
item.put("material", null);
|
||||
item.put("manufacturer", null);
|
||||
item.put("coilStatus", null);
|
||||
item.put("warehouseName", null);
|
||||
item.put("matchStatus", 2);
|
||||
item.put("matchStatusDesc", "未入库");
|
||||
}
|
||||
result.add(item);
|
||||
}
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,51 @@ public class SqlServerApiBusinessService {
|
||||
return PlanListView.fromExecuteSqlResponse(client.queryPlanListByStatus(status));
|
||||
}
|
||||
|
||||
public PlanListView getPlanListByHotCoilIdLike(String hotCoilId, int page, int pageSize) {
|
||||
return PlanListView.fromExecuteSqlResponse(client.queryPlanListByHotCoilIdLike(hotCoilId, page, pageSize));
|
||||
}
|
||||
|
||||
public long getPlanCountByHotCoilIdLike(String hotCoilId) {
|
||||
List<Map<String, Object>> rows = asRowList(client.queryPlanCountByHotCoilIdLike(hotCoilId));
|
||||
if (rows.isEmpty()) return 0L;
|
||||
Object total = rows.get(0).get("total");
|
||||
Number n = asNumber(total);
|
||||
return n == null ? 0L : n.longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取 L2 计划维度数据(来回料厚/宽、钢种),一次 Oracle 调用覆盖整页。
|
||||
* 返回 Map<hotCoilId, firstRow>,同一 HOT_COILID 只保留第一行。
|
||||
*/
|
||||
/**
|
||||
* 批量查询出口卷上线/下线时间,返回 Map<excoilId, {START_DATE, END_DATE}>
|
||||
*/
|
||||
public Map<String, Map<String, Object>> getExcoilTimesByCoilIds(List<String> coilIds) {
|
||||
if (coilIds == null || coilIds.isEmpty()) return Collections.emptyMap();
|
||||
List<Map<String, Object>> rows = asRowList(client.queryExcoilTimesByCoilIds(coilIds));
|
||||
Map<String, Map<String, Object>> result = new LinkedHashMap<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
Object id = row.getOrDefault("EXCOILID", row.get("excoilid"));
|
||||
if (id != null) result.putIfAbsent(id.toString().trim(), row);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, Map<String, Object>> getPlanDimsByHotCoilIds(List<String> hotCoilIds) {
|
||||
if (hotCoilIds == null || hotCoilIds.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<Map<String, Object>> rows = asRowList(client.queryPlanDimsByHotCoilIds(hotCoilIds));
|
||||
Map<String, Map<String, Object>> result = new LinkedHashMap<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
Object hcId = row.getOrDefault("HOT_COILID", row.get("hot_coilid"));
|
||||
if (hcId != null) {
|
||||
result.putIfAbsent(hcId.toString().trim(), row);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划详情:按成品卷号查询单条计划。
|
||||
*/
|
||||
@@ -77,7 +122,10 @@ public class SqlServerApiBusinessService {
|
||||
* 计划详情:按热卷号查询。
|
||||
*/
|
||||
public PlanDetailView getPlanByHotCoilId(String hotCoilId) {
|
||||
return PlanDetailView.fromExecuteSqlResponse(hotCoilId, client.queryPlanByHotCoilId(hotCoilId));
|
||||
SqlServerApiClient.ExecuteSqlResponse planResponse = client.queryPlanByHotCoilId(hotCoilId);
|
||||
SqlServerApiClient.ExecuteSqlResponse excoilResponse = null;
|
||||
excoilResponse = client.queryExcoilByHotCoilId(hotCoilId);
|
||||
return PlanDetailView.fromExecuteSqlResponse(hotCoilId, planResponse, excoilResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,18 +202,32 @@ public class SqlServerApiBusinessService {
|
||||
public List<Map<String, Object>> getExitTrace() { return exitTrace; }
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口卷实绩列表(按时间段),来自 PLTCM_PDO_EXCOIL。
|
||||
*/
|
||||
public List<Map<String, Object>> getExcoilByTimeRange(String startTime, String endTime) {
|
||||
return asRowList(client.queryExcoilByTimeRange(startTime, endTime));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 出口卷实绩列表(按数据写入时间),用于增量同步。
|
||||
// */
|
||||
// public List<Map<String, Object>> getExcoilByInsdateRange(String startTime, String endTime) {
|
||||
// return asRowList(client.queryExcoilByInsdateRange(startTime, endTime));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。
|
||||
*/
|
||||
public ExcoilPageView getExcoilList(int page, int pageSize) {
|
||||
return new ExcoilPageView(asRowList(client.queryExcoilList(page, pageSize)));
|
||||
public ExcoilPageView getExcoilList(int page, int pageSize, String coilId, String startDate, String endDate) {
|
||||
return new ExcoilPageView(asRowList(client.queryExcoilList(page, pageSize, coilId, startDate, endDate)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口卷实绩总数。
|
||||
* 出口卷实绩总数(支持钢卷号模糊搜索和时间范围过滤)。
|
||||
*/
|
||||
public long getExcoilCount() {
|
||||
List<Map<String, Object>> rows = asRowList(client.queryExcoilCount());
|
||||
public long getExcoilCount(String coilId, String startDate, String endDate) {
|
||||
List<Map<String, Object>> rows = asRowList(client.queryExcoilCount(coilId, startDate, endDate));
|
||||
if (rows.isEmpty()) return 0L;
|
||||
Number n = asNumber(rows.get(0).get("total"));
|
||||
return n == null ? 0L : n.longValue();
|
||||
@@ -190,6 +252,49 @@ public class SqlServerApiBusinessService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试用:统计 V_VBDA_GAUGE 中各 THICK 列的非空/非零数量,
|
||||
* 用于排查"末架出口厚度恒为 0"问题——确认实际数据落在哪一列。
|
||||
*/
|
||||
public Map<String, Object> getGaugeStats(String matId) {
|
||||
List<Map<String, Object>> rows = asRowList(client.queryGaugeByMatId(matId));
|
||||
String[] cols = {"THICK0", "THICK1", "THICK4", "THICK5",
|
||||
"THICK0REF", "THICK1REF", "THICK4REF", "THICK5REF"};
|
||||
Map<String, Object> stats = new LinkedHashMap<>();
|
||||
for (String col : cols) {
|
||||
long nonNull = 0, nonZero = 0;
|
||||
Double min = null, max = null;
|
||||
for (Map<String, Object> r : rows) {
|
||||
Object raw = r.get(col);
|
||||
if (raw == null) raw = r.get(col.toLowerCase());
|
||||
if (raw == null) continue;
|
||||
nonNull++;
|
||||
Number n = asNumber(raw);
|
||||
if (n == null) continue;
|
||||
double d = n.doubleValue();
|
||||
if (d != 0.0) nonZero++;
|
||||
if (min == null || d < min) min = d;
|
||||
if (max == null || d > max) max = d;
|
||||
}
|
||||
Map<String, Object> info = new LinkedHashMap<>();
|
||||
info.put("nonNullCount", nonNull);
|
||||
info.put("nonZeroCount", nonZero);
|
||||
info.put("min", min);
|
||||
info.put("max", max);
|
||||
stats.put(col, info);
|
||||
}
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("matId", matId);
|
||||
result.put("totalRows", rows.size());
|
||||
result.put("columnStats", stats);
|
||||
List<Map<String, Object>> samples = new ArrayList<>();
|
||||
if (!rows.isEmpty()) samples.add(rows.get(0));
|
||||
if (rows.size() > 1) samples.add(rows.get(rows.size() / 2));
|
||||
if (rows.size() > 2) samples.add(rows.get(rows.size() - 1));
|
||||
result.put("sampleRows", samples);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 轧辊数据:返回全部在辊/备辊数据。
|
||||
*/
|
||||
@@ -319,11 +424,13 @@ public class SqlServerApiBusinessService {
|
||||
private final String coilId;
|
||||
private final List<Map<String, Object>> rows;
|
||||
private final Map<String, Object> firstRow;
|
||||
private final List<Map<String, Object>> excoilRows;
|
||||
|
||||
public PlanDetailView(String coilId, List<Map<String, Object>> rows, Map<String, Object> firstRow) {
|
||||
public PlanDetailView(String coilId, List<Map<String, Object>> rows, Map<String, Object> firstRow, List<Map<String, Object>> excoilRows) {
|
||||
this.coilId = coilId;
|
||||
this.rows = rows;
|
||||
this.firstRow = firstRow;
|
||||
this.excoilRows = excoilRows;
|
||||
}
|
||||
|
||||
public String getCoilId() {
|
||||
@@ -338,10 +445,21 @@ public class SqlServerApiBusinessService {
|
||||
return firstRow;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getExcoilRows() {
|
||||
return excoilRows;
|
||||
}
|
||||
|
||||
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response) {
|
||||
List<Map<String, Object>> rows = asRowList(response);
|
||||
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
||||
return new PlanDetailView(coilId, rows, firstRow);
|
||||
return new PlanDetailView(coilId, rows, firstRow, Collections.<Map<String, Object>>emptyList());
|
||||
}
|
||||
|
||||
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response, SqlServerApiClient.ExecuteSqlResponse excoilResponse) {
|
||||
List<Map<String, Object>> rows = asRowList(response);
|
||||
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
||||
List<Map<String, Object>> excoilRows = asRowList(excoilResponse);
|
||||
return new PlanDetailView(coilId, rows, firstRow, excoilRows);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,15 @@ public class SqlServerApiController {
|
||||
return R.ok(businessService.getRealtimeData(matId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试用:V_VBDA_GAUGE 各 THICK 列非空/非零统计 + 样本行。
|
||||
* 用于定位"末架出口厚度恒为 0"问题。
|
||||
*/
|
||||
@GetMapping("/test/gauge-stats/{matId}")
|
||||
public R<Map<String, Object>> testGaugeStats(@PathVariable String matId) {
|
||||
return R.ok(businessService.getGaugeStats(matId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 轧辊数据:type / status 均可选,不传则返回全量。
|
||||
*/
|
||||
@@ -155,23 +164,52 @@ public class SqlServerApiController {
|
||||
return R.ok(businessService.getRollHistoryList(page, pageSize, rollId, standId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口卷实绩列表(按下线时间),来自 PLTCM_PDO_EXCOIL。
|
||||
* startTime / endTime 格式:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@GetMapping("/excoil/by-time")
|
||||
public R<List<Map<String, Object>>> excoilByTime(
|
||||
@RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime) {
|
||||
return R.ok(businessService.getExcoilByTimeRange(startTime, endTime));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 出口卷实绩列表(按数据写入时间),用于增量同步。
|
||||
// * startTime(exclusive)/ endTime(inclusive),格式:yyyy-MM-dd HH:mm:ss
|
||||
// */
|
||||
// @GetMapping("/excoil/by-insdate")
|
||||
// public R<List<Map<String, Object>>> excoilByInsdate(
|
||||
// @RequestParam(required = false) String startTime,
|
||||
// @RequestParam(required = false) String endTime) {
|
||||
// return R.ok(businessService.getExcoilByInsdateRange(startTime, endTime));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。
|
||||
* 支持 coilId 模糊搜索、startDate/endDate 时间范围过滤。
|
||||
*/
|
||||
@GetMapping("/excoil")
|
||||
public R<SqlServerApiBusinessService.ExcoilPageView> excoilList(
|
||||
@RequestParam(defaultValue = "1") int page,
|
||||
@RequestParam(defaultValue = "50") int pageSize) {
|
||||
return R.ok(businessService.getExcoilList(page, pageSize));
|
||||
@RequestParam(defaultValue = "50") int pageSize,
|
||||
@RequestParam(required = false) String coilId,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
return R.ok(businessService.getExcoilList(page, pageSize, coilId, startDate, endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口卷实绩总数。
|
||||
* 出口卷实绩总数(支持钢卷号模糊搜索和时间范围过滤)。
|
||||
*/
|
||||
@GetMapping("/excoil/count")
|
||||
public R<Map<String, Long>> excoilCount() {
|
||||
public R<Map<String, Long>> excoilCount(
|
||||
@RequestParam(required = false) String coilId,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
Map<String, Long> result = new HashMap<>();
|
||||
result.put("total", businessService.getExcoilCount());
|
||||
result.put("total", businessService.getExcoilCount(coilId, startDate, endDate));
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
||||
502
klp-admin/src/main/java/com/klp/wms/WmsSpecSyncController.java
Normal file
502
klp-admin/src/main/java/com/klp/wms/WmsSpecSyncController.java
Normal file
@@ -0,0 +1,502 @@
|
||||
package com.klp.wms;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.domain.WmsCoilPendingAction;
|
||||
import com.klp.domain.WmsProductionLine;
|
||||
import com.klp.domain.bo.WmsMaterialCoilBo;
|
||||
import com.klp.domain.vo.WmsCoilPendingActionVo;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import com.klp.domain.vo.WmsProcessSpecVersionVo;
|
||||
import com.klp.framework.service.SqlServerApiBusinessService;
|
||||
import com.klp.mapper.WmsCoilPendingActionMapper;
|
||||
import com.klp.mapper.WmsProductionLineMapper;
|
||||
import com.klp.service.IWmsMaterialCoilService;
|
||||
import com.klp.service.IWmsProcessSpecVersionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 规程同步接口(跨模块:同时依赖 klp-admin 的 L2 服务和 klp-wms 的规程/钢卷服务)
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/specSync")
|
||||
public class WmsSpecSyncController extends BaseController {
|
||||
|
||||
private final SqlServerApiBusinessService sqlServerApiBusinessService;
|
||||
private final IWmsProcessSpecVersionService specVersionService;
|
||||
private final IWmsMaterialCoilService materialCoilService;
|
||||
private final WmsProductionLineMapper productionLineMapper;
|
||||
private final WmsCoilPendingActionMapper pendingActionMapper;
|
||||
|
||||
/**
|
||||
* 根据热卷号匹配最佳规程版本(供 typing.vue 在 L2 填入后调用)
|
||||
*/
|
||||
@GetMapping("/matchBest")
|
||||
public R<WmsProcessSpecVersionVo> matchBest(@RequestParam String hotCoilId,
|
||||
@RequestParam(required = false) Long lineId) {
|
||||
SqlServerApiBusinessService.PlanDetailView plan =
|
||||
sqlServerApiBusinessService.getPlanByHotCoilId(hotCoilId);
|
||||
if (plan == null || plan.getFirstRow().isEmpty()) {
|
||||
return R.ok(null);
|
||||
}
|
||||
Map<String, Object> row = plan.getFirstRow();
|
||||
BigDecimal entryThick = toBigDecimal(row, "ENTRY_THICK", "entry_thick");
|
||||
BigDecimal exitThick = toBigDecimal(row, "EXIT_THICK", "exit_thick");
|
||||
BigDecimal entryWidth = toBigDecimal(row, "ENTRY_WIDTH", "entry_width");
|
||||
BigDecimal exitWidth = toBigDecimal(row, "EXIT_WIDTH", "exit_width");
|
||||
String grade = toStr(row, "GRADE", "grade");
|
||||
|
||||
WmsProcessSpecVersionVo best = specVersionService.matchBestVersion(
|
||||
entryThick, exitThick, entryWidth, exitWidth, grade, lineId);
|
||||
return R.ok(best);
|
||||
}
|
||||
|
||||
/**
|
||||
* 规程同步分页列表。
|
||||
* 以 L3(WMS MySQL)为主维度:只展示在 wms_coil_pending_action.processed_coil_ids
|
||||
* 中出现过的钢卷(即生产后处理过的),再按 enter_coil_no = HOT_COILID 从 L2(Oracle)
|
||||
* 批量富化计划维度(入口/出口厚宽、钢种等)及上线/下线时间。
|
||||
*/
|
||||
@GetMapping("/pageList")
|
||||
public R<Map<String, Object>> pageList(
|
||||
@RequestParam(defaultValue = "1") int pageNum,
|
||||
@RequestParam(defaultValue = "40") int pageSize,
|
||||
@RequestParam(required = false) String enterCoilNo,
|
||||
@RequestParam(required = false) String currentCoilNo,
|
||||
@RequestParam(required = false) String material,
|
||||
@RequestParam(required = false) String qualityStatus,
|
||||
@RequestParam(required = false) String specCode,
|
||||
@RequestParam(required = false) String syncStatus,
|
||||
@RequestParam(required = false) Long lineId) {
|
||||
|
||||
// ── 1. 预加载规程版本 ──────────────────────────────────────────────────
|
||||
// 活跃版本:仅用于推荐候选匹配
|
||||
List<WmsProcessSpecVersionVo> allActive = specVersionService.queryActiveVersionsEnriched(null);
|
||||
List<WmsProcessSpecVersionVo> globalCandidates = lineId != null
|
||||
? allActive.stream().filter(v -> lineId.equals(v.getLineId())).collect(Collectors.toList())
|
||||
: allActive;
|
||||
// 全部版本(含历史版本):用于展示已绑定规程名称,避免旧版本查不到
|
||||
Map<Long, WmsProcessSpecVersionVo> allVersionById = specVersionService.queryAllVersionsEnriched().stream()
|
||||
.collect(Collectors.toMap(WmsProcessSpecVersionVo::getVersionId, v -> v, (a, b) -> a));
|
||||
|
||||
// specCode 过滤 → specId 集合(后置内存过滤,从全部版本里搜)
|
||||
final Set<Long> filterSpecIds;
|
||||
if (StringUtils.hasText(specCode)) {
|
||||
final String kw = specCode.trim().toLowerCase();
|
||||
filterSpecIds = allVersionById.values().stream()
|
||||
.filter(v -> (v.getSpecCode() != null && v.getSpecCode().toLowerCase().contains(kw))
|
||||
|| (v.getSpecName() != null && v.getSpecName().toLowerCase().contains(kw)))
|
||||
.map(WmsProcessSpecVersionVo::getSpecId)
|
||||
.collect(Collectors.toSet());
|
||||
} else {
|
||||
filterSpecIds = null;
|
||||
}
|
||||
|
||||
// ── 2. 预加载产线表 → actionType(int) → Set<lineId> ───────────────────
|
||||
// 有效产线:wms_production_line.action_type IS NOT NULL(即配置了操作类型的产线)
|
||||
List<WmsProductionLine> allLines = productionLineMapper.selectList(
|
||||
Wrappers.<WmsProductionLine>lambdaQuery()
|
||||
.isNotNull(WmsProductionLine::getActionType));
|
||||
Map<Integer, Set<Long>> actionTypeToLineIds = new HashMap<>();
|
||||
for (WmsProductionLine pl : allLines) {
|
||||
if (!StringUtils.hasText(pl.getActionType())) continue;
|
||||
for (String part : pl.getActionType().split(",")) {
|
||||
try {
|
||||
int at = Integer.parseInt(part.trim());
|
||||
actionTypeToLineIds.computeIfAbsent(at, k -> new HashSet<>()).add(pl.getLineId());
|
||||
} catch (NumberFormatException ignore) { /* 跳过非数字 */ }
|
||||
}
|
||||
}
|
||||
|
||||
// ── 3. 展开已录入(action_status=2)待操作的 processed_coil_ids → 输出钢卷 ID ──
|
||||
Set<Integer> validActionTypes = actionTypeToLineIds.keySet();
|
||||
Set<Long> typedCoilIds = new LinkedHashSet<>();
|
||||
Map<Long, Integer> allCoilIdToActionType = new HashMap<>();
|
||||
|
||||
if (!validActionTypes.isEmpty()) {
|
||||
List<WmsCoilPendingAction> allPaList =
|
||||
pendingActionMapper.selectAllProcessedCoilIdsAndActionStatus();
|
||||
for (WmsCoilPendingAction pa : allPaList) {
|
||||
if (pa.getActionType() == null || !validActionTypes.contains(pa.getActionType())) continue;
|
||||
if (!StringUtils.hasText(pa.getProcessedCoilIds())) continue;
|
||||
for (String idStr : pa.getProcessedCoilIds().split(",")) {
|
||||
try {
|
||||
long pid = Long.parseLong(idStr.trim());
|
||||
typedCoilIds.add(pid);
|
||||
allCoilIdToActionType.putIfAbsent(pid, pa.getActionType());
|
||||
} catch (NumberFormatException ignore) { /* 跳过非数字 */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
final Map<Long, Integer> coilIdToActionType = allCoilIdToActionType;
|
||||
|
||||
// ── 4. 计数分页(仅已录入钢卷,按规程绑定状态过滤)────────────────────────
|
||||
final String effectiveSyncStatus;
|
||||
if ("synced".equals(syncStatus)) effectiveSyncStatus = "synced";
|
||||
else if ("unsynced".equals(syncStatus)) effectiveSyncStatus = "unsynced";
|
||||
else effectiveSyncStatus = null;
|
||||
|
||||
if (typedCoilIds.isEmpty()) {
|
||||
Map<String, Object> emptyResult = new LinkedHashMap<>();
|
||||
emptyResult.put("rows", Collections.emptyList());
|
||||
emptyResult.put("total", 0L);
|
||||
return R.ok(emptyResult);
|
||||
}
|
||||
|
||||
// ── 4a. 整体汇总统计(忽略 syncStatus 过滤,体现全量分布) ─────────────────
|
||||
Map<String, Long> overallStats = materialCoilService.getOverallSyncStats(
|
||||
typedCoilIds, enterCoilNo, currentCoilNo, material, qualityStatus, filterSpecIds);
|
||||
|
||||
int offset = (pageNum - 1) * pageSize;
|
||||
long total = materialCoilService.countByProcessedCoilIds(
|
||||
typedCoilIds, enterCoilNo, currentCoilNo, material, qualityStatus,
|
||||
effectiveSyncStatus, filterSpecIds);
|
||||
List<WmsMaterialCoilVo> l3Coils = materialCoilService.queryByProcessedCoilIds(
|
||||
typedCoilIds, enterCoilNo, currentCoilNo, material, qualityStatus,
|
||||
effectiveSyncStatus, filterSpecIds, offset, pageSize);
|
||||
|
||||
if (l3Coils.isEmpty()) {
|
||||
Map<String, Object> emptyResult = new LinkedHashMap<>();
|
||||
emptyResult.put("rows", Collections.emptyList());
|
||||
emptyResult.put("total", total);
|
||||
emptyResult.put("overallStats", overallStats);
|
||||
return R.ok(emptyResult);
|
||||
}
|
||||
|
||||
// ── 5. L2 富化:批量按 enter_coil_no(= HOT_COILID)查询计划维度 ──────────
|
||||
List<String> enterCoilNos = new ArrayList<>();
|
||||
Set<String> seenNos = new HashSet<>();
|
||||
for (WmsMaterialCoilVo c : l3Coils) {
|
||||
String primary = primaryEnterCoilNo(c.getEnterCoilNo());
|
||||
if (primary != null && seenNos.add(primary)) enterCoilNos.add(primary);
|
||||
}
|
||||
Map<String, Map<String, Object>> l2DimMap =
|
||||
sqlServerApiBusinessService.getPlanDimsByHotCoilIds(enterCoilNos);
|
||||
|
||||
// ── 6. 上线/下线时间:PLTCM_PDO_EXCOIL.EXCOILID = PLTCM_PDI_PLAN.COILID ──
|
||||
List<String> l2CoilIds = new ArrayList<>();
|
||||
for (Map<String, Object> dims : l2DimMap.values()) {
|
||||
String cid = toStr(dims, "COILID", "coilid");
|
||||
if (StringUtils.hasText(cid)) l2CoilIds.add(cid);
|
||||
}
|
||||
Map<String, Map<String, Object>> excoilTimeMap =
|
||||
sqlServerApiBusinessService.getExcoilTimesByCoilIds(l2CoilIds);
|
||||
|
||||
// ── 7. 组装行 ──────────────────────────────────────────────────────────────
|
||||
List<Map<String, Object>> rows = new ArrayList<>();
|
||||
for (WmsMaterialCoilVo coil : l3Coils) {
|
||||
Map<String, Object> row = new LinkedHashMap<>();
|
||||
String primaryNo = primaryEnterCoilNo(coil.getEnterCoilNo());
|
||||
|
||||
// ── L3 基础字段 ──
|
||||
row.put("wmsCoilId", coil.getCoilId());
|
||||
row.put("enterCoilNo", primaryNo);
|
||||
row.put("currentCoilNo", coil.getCurrentCoilNo());
|
||||
row.put("supplierCoilNo", coil.getSupplierCoilNo());
|
||||
row.put("netWeight", coil.getNetWeight());
|
||||
row.put("actualThickness", coil.getActualThickness());
|
||||
row.put("actualWidth", coil.getActualWidth());
|
||||
row.put("qualityStatus", coil.getQualityStatus());
|
||||
row.put("specification", coil.getSpecification());
|
||||
row.put("material", coil.getMaterial());
|
||||
|
||||
// 是否已流转(data_type=0)
|
||||
boolean movedOn = Integer.valueOf(0).equals(coil.getDataType());
|
||||
row.put("movedOn", movedOn);
|
||||
row.put("dataType", coil.getDataType());
|
||||
|
||||
// ── L2 数据有则富化,无则留空(不跳过,避免破坏分页偏移)──
|
||||
Map<String, Object> l2row = primaryNo != null ? l2DimMap.get(primaryNo) : null;
|
||||
BigDecimal entryThick = null, exitThick = null, entryWidth = null, exitWidth = null;
|
||||
String grade = null, l2CoilId = null;
|
||||
if (l2row != null) {
|
||||
entryThick = toBigDecimal(l2row, "ENTRY_THICK", "entry_thick");
|
||||
exitThick = toBigDecimal(l2row, "EXIT_THICK", "exit_thick");
|
||||
entryWidth = toBigDecimal(l2row, "ENTRY_WIDTH", "entry_width");
|
||||
exitWidth = toBigDecimal(l2row, "EXIT_WIDTH", "exit_width");
|
||||
grade = toStr(l2row, "GRADE", "grade");
|
||||
l2CoilId = toStr(l2row, "COILID", "coilid");
|
||||
row.put("entryThick", entryThick);
|
||||
row.put("exitThick", exitThick);
|
||||
row.put("entryWidth", entryWidth);
|
||||
row.put("exitWidth", exitWidth);
|
||||
row.put("grade", grade);
|
||||
row.put("processCode", toStr(l2row, "PROCESS_CODE", "process_code"));
|
||||
row.put("l2CoilId", l2CoilId);
|
||||
row.put("l2Found", true);
|
||||
}
|
||||
|
||||
// 上线/下线时间
|
||||
Map<String, Object> excoilTimes = StringUtils.hasText(l2CoilId)
|
||||
? excoilTimeMap.get(l2CoilId) : null;
|
||||
if (excoilTimes != null) {
|
||||
row.put("onlineTime", excoilTimes.getOrDefault("START_DATE", excoilTimes.get("start_date")));
|
||||
row.put("offlineTime", excoilTimes.getOrDefault("END_DATE", excoilTimes.get("end_date")));
|
||||
}
|
||||
|
||||
// ── 规程绑定状态 ──
|
||||
if (coil.getVersionId() != null) {
|
||||
WmsProcessSpecVersionVo bound = allVersionById.get(coil.getVersionId());
|
||||
if (bound != null) {
|
||||
row.put("specCode", bound.getSpecCode());
|
||||
row.put("specName", bound.getSpecName());
|
||||
row.put("versionCode", bound.getVersionCode());
|
||||
putMatchConds(row, bound);
|
||||
}
|
||||
row.put("syncStatus", "synced");
|
||||
} else {
|
||||
row.put("syncStatus", "unsynced");
|
||||
// 按产线限定候选规程(lineId=null 的规程不限定产线,始终纳入)
|
||||
Integer pendingAt = coilIdToActionType.get(coil.getCoilId());
|
||||
Set<Long> allowedLineIds = pendingAt != null
|
||||
? actionTypeToLineIds.getOrDefault(pendingAt, Collections.emptySet())
|
||||
: null;
|
||||
// 优先用同产线规程;若过滤后为空则兜底到全量活跃版本
|
||||
List<WmsProcessSpecVersionVo> candidates;
|
||||
if (allowedLineIds == null || allowedLineIds.isEmpty()) {
|
||||
candidates = globalCandidates;
|
||||
} else {
|
||||
candidates = globalCandidates.stream()
|
||||
.filter(v -> v.getLineId() == null || allowedLineIds.contains(v.getLineId()))
|
||||
.collect(Collectors.toList());
|
||||
if (candidates.isEmpty()) {
|
||||
candidates = globalCandidates; // 兜底:产线无匹配规程时展示全部
|
||||
}
|
||||
}
|
||||
WmsProcessSpecVersionVo best = null;
|
||||
int bestScore = -1;
|
||||
for (WmsProcessSpecVersionVo v : candidates) {
|
||||
int s = scoreVersion(v, entryThick, exitThick, entryWidth, exitWidth, grade);
|
||||
if (s > bestScore) { bestScore = s; best = v; }
|
||||
}
|
||||
// bestScore >= 0:只要存在候选规程就展示推荐(0 = 无维度条件匹配但仍有版本可绑)
|
||||
if (best != null && bestScore >= 0) {
|
||||
row.put("candidateSpecCode", best.getSpecCode());
|
||||
row.put("candidateSpecName", best.getSpecName());
|
||||
row.put("candidateVersionCode", best.getVersionCode());
|
||||
row.put("candidateVersionId", best.getVersionId());
|
||||
row.put("candidateSpecId", best.getSpecId());
|
||||
putMatchConds(row, best);
|
||||
}
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("rows", rows);
|
||||
result.put("total", total);
|
||||
result.put("overallStats", overallStats);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
// ── 私有工具方法 ─────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* enter_coil_no 字段可能存储了多个逗号分隔的热卷号(如 "26032550,26032550")。
|
||||
* 取第一个非空值作为主键,用于展示和 L2 关联查询。
|
||||
*/
|
||||
private String primaryEnterCoilNo(String raw) {
|
||||
if (!StringUtils.hasText(raw)) return null;
|
||||
String first = raw.split(",")[0].trim();
|
||||
return first.isEmpty() ? null : first;
|
||||
}
|
||||
|
||||
private int scoreVersion(WmsProcessSpecVersionVo v,
|
||||
BigDecimal entryThick, BigDecimal exitThick,
|
||||
BigDecimal entryWidth, BigDecimal exitWidth, String grade) {
|
||||
int score = 0;
|
||||
if (entryThick != null && v.getMatchEntryThickMin() != null && v.getMatchEntryThickMax() != null
|
||||
&& entryThick.compareTo(v.getMatchEntryThickMin()) >= 0
|
||||
&& entryThick.compareTo(v.getMatchEntryThickMax()) <= 0) score++;
|
||||
if (exitThick != null && v.getMatchExitThickMin() != null && v.getMatchExitThickMax() != null
|
||||
&& exitThick.compareTo(v.getMatchExitThickMin()) >= 0
|
||||
&& exitThick.compareTo(v.getMatchExitThickMax()) <= 0) score++;
|
||||
if (entryWidth != null && v.getMatchEntryWidthMin() != null && v.getMatchEntryWidthMax() != null
|
||||
&& entryWidth.compareTo(v.getMatchEntryWidthMin()) >= 0
|
||||
&& entryWidth.compareTo(v.getMatchEntryWidthMax()) <= 0) score++;
|
||||
if (exitWidth != null && v.getMatchExitWidthMin() != null && v.getMatchExitWidthMax() != null
|
||||
&& exitWidth.compareTo(v.getMatchExitWidthMin()) >= 0
|
||||
&& exitWidth.compareTo(v.getMatchExitWidthMax()) <= 0) score++;
|
||||
if (StringUtils.hasText(grade) && StringUtils.hasText(v.getMatchSteelGrade())
|
||||
&& grade.toLowerCase().contains(v.getMatchSteelGrade().toLowerCase())) score++;
|
||||
return score;
|
||||
}
|
||||
|
||||
private void putMatchConds(Map<String, Object> row, WmsProcessSpecVersionVo v) {
|
||||
row.put("matchEntryThickMin", v.getMatchEntryThickMin());
|
||||
row.put("matchEntryThickMax", v.getMatchEntryThickMax());
|
||||
row.put("matchExitThickMin", v.getMatchExitThickMin());
|
||||
row.put("matchExitThickMax", v.getMatchExitThickMax());
|
||||
row.put("matchEntryWidthMin", v.getMatchEntryWidthMin());
|
||||
row.put("matchEntryWidthMax", v.getMatchEntryWidthMax());
|
||||
row.put("matchExitWidthMin", v.getMatchExitWidthMin());
|
||||
row.put("matchExitWidthMax", v.getMatchExitWidthMax());
|
||||
row.put("matchSteelGrade", v.getMatchSteelGrade());
|
||||
}
|
||||
|
||||
/**
|
||||
* 待录入核查分页列表。
|
||||
* 数据源:wms_production_line 有效产线对应的待操作记录中 action_status != 2(尚未完成 typing)的条目。
|
||||
* 额外按入场卷号从 L2(Oracle)查询计划/实绩维度,供核查人员判断二级是否已有实绩。
|
||||
*/
|
||||
@GetMapping("/untypedPageList")
|
||||
public R<Map<String, Object>> untypedPageList(
|
||||
@RequestParam(defaultValue = "1") int pageNum,
|
||||
@RequestParam(defaultValue = "40") int pageSize,
|
||||
@RequestParam(required = false) String enterCoilNo,
|
||||
@RequestParam(required = false) String currentCoilNo,
|
||||
@RequestParam(required = false) String operatorName) {
|
||||
|
||||
// ── 1. 有效产线 actionType ──────────────────────────────────────────────
|
||||
List<WmsProductionLine> lines = productionLineMapper.selectList(
|
||||
Wrappers.<WmsProductionLine>lambdaQuery().isNotNull(WmsProductionLine::getActionType));
|
||||
Set<Integer> validAts = new HashSet<>();
|
||||
for (WmsProductionLine pl : lines) {
|
||||
if (!StringUtils.hasText(pl.getActionType())) continue;
|
||||
for (String part : pl.getActionType().split(",")) {
|
||||
try { validAts.add(Integer.parseInt(part.trim())); } catch (NumberFormatException ignore) {}
|
||||
}
|
||||
}
|
||||
if (validAts.isEmpty()) {
|
||||
Map<String, Object> empty = new LinkedHashMap<>();
|
||||
empty.put("rows", Collections.emptyList());
|
||||
empty.put("total", 0L);
|
||||
return R.ok(empty);
|
||||
}
|
||||
|
||||
// ── 2. 分页查询未录入待操作 ────────────────────────────────────────────────
|
||||
// 条件1:action_status IN (0,1) —— 0=待处理/1=进行中,2=已完成/3=已取消均排除
|
||||
// 条件2:processed_coil_ids 为空 —— 只有未写入产出卷 ID 的记录才是尚未录入的
|
||||
QueryWrapper<WmsCoilPendingAction> qw = new QueryWrapper<>();
|
||||
qw.eq("wcpa.del_flag", 0);
|
||||
qw.in("wcpa.action_type", validAts);
|
||||
qw.in("wcpa.action_status", java.util.Arrays.asList(0, 1));
|
||||
qw.and(w -> w.isNull("wcpa.processed_coil_ids")
|
||||
.or().eq("wcpa.processed_coil_ids", ""));
|
||||
if (StringUtils.hasText(enterCoilNo)) qw.like("wmc.enter_coil_no", enterCoilNo);
|
||||
if (StringUtils.hasText(currentCoilNo)) qw.like("wcpa.current_coil_no", currentCoilNo);
|
||||
if (StringUtils.hasText(operatorName)) qw.like("wcpa.operator_name", operatorName);
|
||||
qw.orderByDesc("wcpa.scan_time");
|
||||
|
||||
Page<WmsCoilPendingActionVo> voPage =
|
||||
pendingActionMapper.selectVoPagePlus(Page.of(pageNum, pageSize), qw);
|
||||
List<WmsCoilPendingActionVo> paList = voPage.getRecords();
|
||||
|
||||
if (paList.isEmpty()) {
|
||||
Map<String, Object> empty = new LinkedHashMap<>();
|
||||
empty.put("rows", Collections.emptyList());
|
||||
empty.put("total", voPage.getTotal());
|
||||
return R.ok(empty);
|
||||
}
|
||||
|
||||
// ── 3. L2 富化 ─────────────────────────────────────────────────────────
|
||||
List<String> nos = new ArrayList<>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
for (WmsCoilPendingActionVo pa : paList) {
|
||||
String primary = primaryEnterCoilNo(pa.getEnterCoilNo());
|
||||
if (primary != null && seen.add(primary)) nos.add(primary);
|
||||
}
|
||||
Map<String, Map<String, Object>> l2DimMap = nos.isEmpty()
|
||||
? Collections.emptyMap()
|
||||
: sqlServerApiBusinessService.getPlanDimsByHotCoilIds(nos);
|
||||
|
||||
// ── 4. 组装行 ──────────────────────────────────────────────────────────
|
||||
List<Map<String, Object>> rows = new ArrayList<>();
|
||||
for (WmsCoilPendingActionVo pa : paList) {
|
||||
String primaryNo = primaryEnterCoilNo(pa.getEnterCoilNo());
|
||||
Map<String, Object> l2row = primaryNo != null ? l2DimMap.get(primaryNo) : null;
|
||||
Map<String, Object> row = new LinkedHashMap<>();
|
||||
row.put("actionId", pa.getActionId());
|
||||
row.put("coilId", pa.getCoilId());
|
||||
row.put("actionType", pa.getActionType());
|
||||
row.put("actionStatus", pa.getActionStatus());
|
||||
row.put("scanTime", pa.getScanTime());
|
||||
row.put("createTime", pa.getCreateTime());
|
||||
row.put("operatorName", pa.getOperatorName());
|
||||
row.put("warehouseName", pa.getWarehouseName());
|
||||
row.put("enterCoilNo", primaryNo);
|
||||
row.put("currentCoilNo", pa.getCurrentCoilNo());
|
||||
row.put("supplierCoilNo", pa.getSupplierCoilNo());
|
||||
row.put("material", pa.getMaterial());
|
||||
row.put("specification", pa.getSpecification());
|
||||
row.put("itemName", pa.getItemName());
|
||||
if (l2row != null) {
|
||||
row.put("entryThick", toBigDecimal(l2row, "ENTRY_THICK", "entry_thick"));
|
||||
row.put("exitThick", toBigDecimal(l2row, "EXIT_THICK", "exit_thick"));
|
||||
row.put("entryWidth", toBigDecimal(l2row, "ENTRY_WIDTH", "entry_width"));
|
||||
row.put("exitWidth", toBigDecimal(l2row, "EXIT_WIDTH", "exit_width"));
|
||||
row.put("grade", toStr(l2row, "GRADE", "grade"));
|
||||
row.put("processCode", toStr(l2row, "PROCESS_CODE", "process_code"));
|
||||
row.put("l2Found", true);
|
||||
} else {
|
||||
row.put("l2Found", false);
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("rows", rows);
|
||||
result.put("total", voPage.getTotal());
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量同步规程绑定。
|
||||
* 请求体:{ "bindings": [{ "coilId": 123, "specId": 456, "versionId": 789 }, ...] }
|
||||
* 前端已完成匹配计算,直接写入指定的 specId/versionId,不重新跑匹配算法。
|
||||
*/
|
||||
@PostMapping("/syncSpec")
|
||||
@SuppressWarnings("unchecked")
|
||||
public R<Void> syncSpec(@RequestBody Map<String, Object> body) {
|
||||
List<Map<String, Object>> bindings = (List<Map<String, Object>>) body.get("bindings");
|
||||
if (bindings == null || bindings.isEmpty()) {
|
||||
return R.fail("bindings 不能为空");
|
||||
}
|
||||
for (Map<String, Object> b : bindings) {
|
||||
try {
|
||||
Long coilId = toLong(b, "coilId");
|
||||
Long specId = toLong(b, "specId");
|
||||
Long versionId = toLong(b, "versionId");
|
||||
if (coilId == 0L || specId == 0L || versionId == 0L) continue;
|
||||
WmsMaterialCoilBo bo = new WmsMaterialCoilBo();
|
||||
bo.setCoilId(coilId);
|
||||
bo.setSpecId(specId);
|
||||
bo.setVersionId(versionId);
|
||||
materialCoilService.updateSimple(bo);
|
||||
} catch (Exception e) {
|
||||
log.warn("规程同步失败 binding={}", b, e);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private BigDecimal toBigDecimal(Map<String, Object> row, String upperKey, String lowerKey) {
|
||||
Object val = row.getOrDefault(upperKey, row.get(lowerKey));
|
||||
if (val == null) return null;
|
||||
try { return new BigDecimal(val.toString()); } catch (NumberFormatException e) { return null; }
|
||||
}
|
||||
|
||||
private String toStr(Map<String, Object> row, String upperKey, String lowerKey) {
|
||||
Object val = row.getOrDefault(upperKey, row.get(lowerKey));
|
||||
return val == null ? null : val.toString().trim();
|
||||
}
|
||||
|
||||
private long toLong(Map<String, Object> row, String key) {
|
||||
if (row == null) return 0L;
|
||||
Object v = row.get(key);
|
||||
if (v == null) return 0L;
|
||||
try { return Long.parseLong(v.toString()); } catch (NumberFormatException e) { return 0L; }
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,14 @@ spring:
|
||||
url: jdbc:mysql://140.143.206.120:3306/cgldb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
username: klp
|
||||
password: KeLunPu123@
|
||||
# 双机架数据源
|
||||
double-rack:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://140.143.206.120:13306/double-rack?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
username: klp
|
||||
password: KeLunPu@123
|
||||
# Oracle 数据源
|
||||
acid-l2:
|
||||
lazy: true
|
||||
@@ -167,7 +175,7 @@ redisson:
|
||||
# 客户端名称
|
||||
clientName: ${klp.name}
|
||||
# 最小空闲连接数
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionMinimumIdleSize: 4
|
||||
# 连接池大小
|
||||
connectionPoolSize: 32
|
||||
# 连接空闲超时,单位:毫秒
|
||||
|
||||
@@ -103,6 +103,15 @@ spring:
|
||||
password: root
|
||||
hikari:
|
||||
connectionTestQuery: SELECT 1 FROM DUAL
|
||||
|
||||
# 双机架数据源
|
||||
double-rack:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://140.143.206.120:13306/double-rack?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
username: klp
|
||||
password: KeLunPu@123
|
||||
# postgres:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: org.postgresql.Driver
|
||||
@@ -117,7 +126,7 @@ spring:
|
||||
# password: root
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
maxPoolSize: 100
|
||||
# 最小空闲线程数量
|
||||
minIdle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
@@ -163,7 +172,7 @@ redisson:
|
||||
# 最小空闲连接数
|
||||
connectionMinimumIdleSize: 4
|
||||
# 连接池大小
|
||||
connectionPoolSize: 64
|
||||
connectionPoolSize: 128
|
||||
# 连接空闲超时,单位:毫秒
|
||||
idleConnectionTimeout: 100000
|
||||
# 命令等待超时,单位:毫秒
|
||||
|
||||
@@ -76,6 +76,16 @@ public class ApsPlanDetailController extends BaseController {
|
||||
return toAjax(iApsPlanDetailService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增排产单明细
|
||||
*/
|
||||
@Log(title = "排产单明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/batch")
|
||||
public R<Void> batchAdd(@Validated(AddGroup.class) @RequestBody List<ApsPlanDetailBo> boList) {
|
||||
return toAjax(iApsPlanDetailService.insertBatchByBo(boList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排产单明细
|
||||
*/
|
||||
|
||||
@@ -226,5 +226,9 @@ public class ApsPlanDetailBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排产日期(字符串格式,例如 '2025-12-29')
|
||||
*/
|
||||
private String detailDate;
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ public class ApsPlanSheetBo extends BaseEntity {
|
||||
*/
|
||||
private String planType;
|
||||
|
||||
/**
|
||||
* 排产文件
|
||||
*/
|
||||
private String apsUrl;
|
||||
|
||||
/**
|
||||
* 排产人
|
||||
*/
|
||||
|
||||
@@ -184,6 +184,10 @@ public class ApsPlanDetail extends BaseEntity {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 排产日期(字符串格式,例如 '2025-12-29')
|
||||
*/
|
||||
private String detailDate;
|
||||
/**
|
||||
* 删除标记(0正常 1删除)
|
||||
*/
|
||||
|
||||
@@ -49,6 +49,10 @@ public class ApsPlanSheet extends BaseEntity {
|
||||
* 排产类型
|
||||
*/
|
||||
private String planType;
|
||||
/**
|
||||
* 排产文件
|
||||
*/
|
||||
private String apsUrl;
|
||||
/**
|
||||
* 排产人
|
||||
*/
|
||||
|
||||
@@ -261,6 +261,12 @@ public class ApsPlanDetailVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排产日期(字符串格式,例如 '2025-12-29')
|
||||
*/
|
||||
@ExcelProperty(value = "排产日期")
|
||||
private String detailDate;
|
||||
|
||||
/**
|
||||
* 技术附件
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,12 @@ public class ApsPlanSheetVo {
|
||||
@ExcelProperty(value = "排产类型")
|
||||
private String planType;
|
||||
|
||||
/**
|
||||
* 排产文件
|
||||
*/
|
||||
@ExcelProperty(value = "排产文件")
|
||||
private String apsUrl;
|
||||
|
||||
/**
|
||||
* 排产人
|
||||
*/
|
||||
|
||||
@@ -43,6 +43,11 @@ public interface IApsPlanDetailService {
|
||||
*/
|
||||
Boolean insertByBo(ApsPlanDetailBo bo);
|
||||
|
||||
/**
|
||||
* 批量新增排产单明细
|
||||
*/
|
||||
Boolean insertBatchByBo(List<ApsPlanDetailBo> boList);
|
||||
|
||||
/**
|
||||
* 修改排产单明细
|
||||
*/
|
||||
|
||||
@@ -101,6 +101,7 @@ public class ApsPlanDetailServiceImpl implements IApsPlanDetailService {
|
||||
qw.eq(StringUtils.isNotBlank(bo.getSampleReq()), "d.sample_req", bo.getSampleReq());
|
||||
qw.eq(bo.getStartTime() != null, "d.start_time", bo.getStartTime());
|
||||
qw.eq(bo.getEndTime() != null, "d.end_time", bo.getEndTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getDetailDate()), "d.detail_date", bo.getDetailDate());
|
||||
//根据创建时间倒叙
|
||||
qw.orderByDesc("d.create_time");
|
||||
return qw;
|
||||
@@ -168,6 +169,7 @@ public class ApsPlanDetailServiceImpl implements IApsPlanDetailService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSampleReq()), ApsPlanDetail::getSampleReq, bo.getSampleReq());
|
||||
lqw.eq(bo.getStartTime() != null, ApsPlanDetail::getStartTime, bo.getStartTime());
|
||||
lqw.eq(bo.getEndTime() != null, ApsPlanDetail::getEndTime, bo.getEndTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDetailDate()), ApsPlanDetail::getDetailDate, bo.getDetailDate());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -185,6 +187,16 @@ public class ApsPlanDetailServiceImpl implements IApsPlanDetailService {
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增排产单明细
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertBatchByBo(List<ApsPlanDetailBo> boList) {
|
||||
List<ApsPlanDetail> list = BeanUtil.copyToList(boList, ApsPlanDetail.class);
|
||||
list.forEach(this::validEntityBeforeSave);
|
||||
return baseMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排产单明细
|
||||
*/
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="endTime" column="end_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="detailDate" column="detail_date"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<result property="lineName" column="line_name"/>
|
||||
<result property="planCode" column="plan_code"/>
|
||||
<result property="planType" column="plan_type"/>
|
||||
<result property="apsUrl" column="aps_url"/>
|
||||
<result property="scheduler" column="scheduler"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
@@ -27,6 +28,7 @@
|
||||
s.line_name AS lineName,
|
||||
s.plan_code AS planCode,
|
||||
s.plan_type AS planType,
|
||||
s.aps_url AS apsUrl,
|
||||
s.scheduler AS scheduler,
|
||||
s.remark AS masterRemark,
|
||||
d.remark AS detailRemark,
|
||||
|
||||
@@ -26,9 +26,15 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Excel相关处理
|
||||
@@ -149,6 +155,33 @@ public class ExcelUtil {
|
||||
builder.doWrite(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel(仅导出指定列)
|
||||
*
|
||||
* @param list 导出数据集合
|
||||
* @param sheetName 工作表的名称
|
||||
* @param clazz 实体类
|
||||
* @param includeColumnFieldNames 需要导出的字段名集合(Java字段名,非Excel列名)
|
||||
* @param response 响应体
|
||||
*/
|
||||
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz,
|
||||
Set<String> includeColumnFieldNames,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
resetResponse(sheetName, response);
|
||||
ServletOutputStream os = response.getOutputStream();
|
||||
EasyExcel.write(os, clazz)
|
||||
.autoCloseStream(false)
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
.registerConverter(new ExcelBigNumberConvert())
|
||||
.includeColumnFieldNames(includeColumnFieldNames)
|
||||
.sheet(sheetName)
|
||||
.doWrite(list);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("导出Excel异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单表多数据模板导出 模板格式为 {.属性}
|
||||
*
|
||||
@@ -325,4 +358,67 @@ public class ExcelUtil {
|
||||
return IdUtil.fastSimpleUUID() + "_" + filename + ".xlsx";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel(按指定顺序的列导出,使用动态表头)
|
||||
*
|
||||
* @param list 导出数据集合
|
||||
* @param sheetName 工作表的名称
|
||||
* @param orderedFields 按导出顺序排列的Java字段名列表
|
||||
* @param fieldLabelMap Java字段名 -> Excel列头中文名 映射
|
||||
* @param response 响应体
|
||||
*/
|
||||
public static <T> void exportExcelOrdered(List<T> list, String sheetName,
|
||||
List<String> orderedFields,
|
||||
Map<String, String> fieldLabelMap,
|
||||
HttpServletResponse response) {
|
||||
if (orderedFields == null || orderedFields.isEmpty()) {
|
||||
throw new IllegalArgumentException("导出列不能为空");
|
||||
}
|
||||
// 构建动态表头
|
||||
List<List<String>> heads = orderedFields.stream()
|
||||
.map(f -> Collections.singletonList(fieldLabelMap.getOrDefault(f, f)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建数据行
|
||||
List<List<Object>> data = new ArrayList<>(list.size());
|
||||
if (!list.isEmpty()) {
|
||||
Map<String, Field> fieldCache = new HashMap<>();
|
||||
Class<?> clazz = list.get(0).getClass();
|
||||
for (T vo : list) {
|
||||
List<Object> row = new ArrayList<>(orderedFields.size());
|
||||
for (String fieldName : orderedFields) {
|
||||
Field field = fieldCache.computeIfAbsent(fieldName, k -> {
|
||||
try {
|
||||
Field f = clazz.getDeclaredField(k);
|
||||
f.setAccessible(true);
|
||||
return f;
|
||||
} catch (NoSuchFieldException e) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
try {
|
||||
row.add(field != null ? field.get(vo) : null);
|
||||
} catch (IllegalAccessException e) {
|
||||
row.add(null);
|
||||
}
|
||||
}
|
||||
data.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
resetResponse(sheetName, response);
|
||||
ServletOutputStream os = response.getOutputStream();
|
||||
EasyExcel.write(os)
|
||||
.head(heads)
|
||||
.autoCloseStream(false)
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
.registerConverter(new ExcelBigNumberConvert())
|
||||
.sheet(sheetName)
|
||||
.doWrite(data);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("导出Excel异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
20
klp-cost/pom.xml
Normal file
20
klp-cost/pom.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.klp</groupId>
|
||||
<artifactId>klp-oa</artifactId>
|
||||
<version>0.8.3</version>
|
||||
</parent>
|
||||
<artifactId>klp-cost</artifactId>
|
||||
<name>Archetype - klp-cost</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.klp</groupId>
|
||||
<artifactId>klp-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.cost.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.cost.domain.vo.CostItemVo;
|
||||
import com.klp.cost.domain.bo.CostItemBo;
|
||||
import com.klp.cost.service.ICostItemService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 成本项目配置
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cost/item")
|
||||
public class CostItemController extends BaseController {
|
||||
|
||||
private final ICostItemService iCostItemService;
|
||||
|
||||
/**
|
||||
* 查询成本项目配置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CostItemVo> list(CostItemBo bo, PageQuery pageQuery) {
|
||||
return iCostItemService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出成本项目配置列表
|
||||
*/
|
||||
@Log(title = "成本项目配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CostItemBo bo, HttpServletResponse response) {
|
||||
List<CostItemVo> list = iCostItemService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "成本项目配置", CostItemVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取成本项目配置详细信息
|
||||
*
|
||||
* @param itemId 主键
|
||||
*/
|
||||
@GetMapping("/{itemId}")
|
||||
public R<CostItemVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long itemId) {
|
||||
return R.ok(iCostItemService.queryById(itemId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成本项目配置
|
||||
*/
|
||||
@Log(title = "成本项目配置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CostItemBo bo) {
|
||||
return toAjax(iCostItemService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成本项目配置
|
||||
*/
|
||||
@Log(title = "成本项目配置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostItemBo bo) {
|
||||
return toAjax(iCostItemService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除成本项目配置
|
||||
*
|
||||
* @param itemIds 主键串
|
||||
*/
|
||||
@Log(title = "成本项目配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{itemIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] itemIds) {
|
||||
return toAjax(iCostItemService.deleteWithValidByIds(Arrays.asList(itemIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.klp.cost.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.cost.domain.vo.CostPriceVo;
|
||||
import com.klp.cost.domain.bo.CostPriceBo;
|
||||
import com.klp.cost.service.ICostPriceService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 成本单价历史
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cost/price")
|
||||
public class CostPriceController extends BaseController {
|
||||
|
||||
private final ICostPriceService iCostPriceService;
|
||||
|
||||
/**
|
||||
* 查询成本单价历史列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CostPriceVo> list(CostPriceBo bo, PageQuery pageQuery) {
|
||||
return iCostPriceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出成本单价历史列表
|
||||
*/
|
||||
@Log(title = "成本单价历史", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CostPriceBo bo, HttpServletResponse response) {
|
||||
List<CostPriceVo> list = iCostPriceService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "成本单价历史", CostPriceVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取成本单价历史详细信息
|
||||
*
|
||||
* @param priceId 主键
|
||||
*/
|
||||
@GetMapping("/{priceId}")
|
||||
public R<CostPriceVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long priceId) {
|
||||
return R.ok(iCostPriceService.queryById(priceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成本单价历史
|
||||
*/
|
||||
@Log(title = "成本单价历史", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CostPriceBo bo) {
|
||||
return toAjax(iCostPriceService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成本单价历史
|
||||
*/
|
||||
@Log(title = "成本单价历史", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostPriceBo bo) {
|
||||
return toAjax(iCostPriceService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除成本单价历史
|
||||
*
|
||||
* @param priceIds 主键串
|
||||
*/
|
||||
@Log(title = "成本单价历史", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{priceIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] priceIds) {
|
||||
return toAjax(iCostPriceService.deleteWithValidByIds(Arrays.asList(priceIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.klp.cost.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.cost.domain.vo.CostProdDetailVo;
|
||||
import com.klp.cost.domain.bo.CostProdDetailBo;
|
||||
import com.klp.cost.service.ICostProdDetailService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产成本明细
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cost/prodDetail")
|
||||
public class CostProdDetailController extends BaseController {
|
||||
|
||||
private final ICostProdDetailService iCostProdDetailService;
|
||||
|
||||
/**
|
||||
* 查询生产成本明细列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CostProdDetailVo> list(CostProdDetailBo bo, PageQuery pageQuery) {
|
||||
return iCostProdDetailService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产成本明细列表
|
||||
*/
|
||||
@Log(title = "生产成本明细", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CostProdDetailBo bo, HttpServletResponse response) {
|
||||
List<CostProdDetailVo> list = iCostProdDetailService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "生产成本明细", CostProdDetailVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产成本明细详细信息
|
||||
*
|
||||
* @param detailId 主键
|
||||
*/
|
||||
@GetMapping("/{detailId}")
|
||||
public R<CostProdDetailVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long detailId) {
|
||||
return R.ok(iCostProdDetailService.queryById(detailId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产成本明细
|
||||
*/
|
||||
@Log(title = "生产成本明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Long> add(@Validated(AddGroup.class) @RequestBody CostProdDetailBo bo) {
|
||||
return R.ok(iCostProdDetailService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存生产成本明细(先删除再插入)
|
||||
*/
|
||||
@Log(title = "生产成本明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/batch")
|
||||
public R<Void> batchSave(@RequestBody CostProdDetailBo bo) {
|
||||
return toAjax(iCostProdDetailService.batchSaveWithDelete(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产成本明细
|
||||
*/
|
||||
@Log(title = "生产成本明细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostProdDetailBo bo) {
|
||||
return toAjax(iCostProdDetailService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产成本明细
|
||||
*
|
||||
* @param detailIds 主键串
|
||||
*/
|
||||
@Log(title = "生产成本明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{detailIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] detailIds) {
|
||||
return toAjax(iCostProdDetailService.deleteWithValidByIds(Arrays.asList(detailIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.cost.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.cost.domain.vo.CostProdMetricVo;
|
||||
import com.klp.cost.domain.bo.CostProdMetricBo;
|
||||
import com.klp.cost.service.ICostProdMetricService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产指标明细
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cost/prodMetric")
|
||||
public class CostProdMetricController extends BaseController {
|
||||
|
||||
private final ICostProdMetricService iCostProdMetricService;
|
||||
|
||||
/**
|
||||
* 查询生产指标明细列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CostProdMetricVo> list(CostProdMetricBo bo, PageQuery pageQuery) {
|
||||
return iCostProdMetricService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产指标明细列表
|
||||
*/
|
||||
@Log(title = "生产指标明细", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CostProdMetricBo bo, HttpServletResponse response) {
|
||||
List<CostProdMetricVo> list = iCostProdMetricService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "生产指标明细", CostProdMetricVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产指标明细详细信息
|
||||
*
|
||||
* @param metricId 主键
|
||||
*/
|
||||
@GetMapping("/{metricId}")
|
||||
public R<CostProdMetricVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long metricId) {
|
||||
return R.ok(iCostProdMetricService.queryById(metricId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产指标明细
|
||||
*/
|
||||
@Log(title = "生产指标明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CostProdMetricBo bo) {
|
||||
return toAjax(iCostProdMetricService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产指标明细
|
||||
*/
|
||||
@Log(title = "生产指标明细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostProdMetricBo bo) {
|
||||
return toAjax(iCostProdMetricService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产指标明细
|
||||
*
|
||||
* @param metricIds 主键串
|
||||
*/
|
||||
@Log(title = "生产指标明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{metricIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] metricIds) {
|
||||
return toAjax(iCostProdMetricService.deleteWithValidByIds(Arrays.asList(metricIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.klp.cost.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.cost.domain.vo.CostProdReportVo;
|
||||
import com.klp.cost.domain.bo.CostProdReportBo;
|
||||
import com.klp.cost.service.ICostProdReportService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产月报
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cost/prodReport")
|
||||
public class CostProdReportController extends BaseController {
|
||||
|
||||
private final ICostProdReportService iCostProdReportService;
|
||||
|
||||
/**
|
||||
* 查询生产月报列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CostProdReportVo> list(CostProdReportBo bo, PageQuery pageQuery) {
|
||||
return iCostProdReportService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产月报列表
|
||||
*/
|
||||
@Log(title = "生产月报", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CostProdReportBo bo, HttpServletResponse response) {
|
||||
List<CostProdReportVo> list = iCostProdReportService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "生产月报", CostProdReportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产月报详细信息
|
||||
*
|
||||
* @param reportId 主键
|
||||
*/
|
||||
@GetMapping("/{reportId}")
|
||||
public R<CostProdReportVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long reportId) {
|
||||
return R.ok(iCostProdReportService.queryById(reportId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产月报
|
||||
*/
|
||||
@Log(title = "生产月报", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CostProdReportBo bo) {
|
||||
return toAjax(iCostProdReportService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产月报
|
||||
*/
|
||||
@Log(title = "生产月报", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostProdReportBo bo) {
|
||||
return toAjax(iCostProdReportService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产月报
|
||||
*
|
||||
* @param reportIds 主键串
|
||||
*/
|
||||
@Log(title = "生产月报", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reportIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] reportIds) {
|
||||
return toAjax(iCostProdReportService.deleteWithValidByIds(Arrays.asList(reportIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制生产月报
|
||||
* 明细列原样保留,指标列重新插入并更新config中的id引用
|
||||
*/
|
||||
@Log(title = "生产月报", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/copy/{sourceId}")
|
||||
public R<CostProdReportVo> copy(@NotNull(message = "源报表ID不能为空") @PathVariable Long sourceId,
|
||||
@RequestBody CostProdReportBo bo) {
|
||||
return R.ok(iCostProdReportService.copyReport(sourceId, bo));
|
||||
}
|
||||
}
|
||||
57
klp-cost/src/main/java/com/klp/cost/domain/CostItem.java
Normal file
57
klp-cost/src/main/java/com/klp/cost/domain/CostItem.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.klp.cost.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 成本项目配置对象 cost_item
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cost_item")
|
||||
public class CostItem extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "item_id")
|
||||
private Long itemId;
|
||||
/**
|
||||
* 成本项目编码
|
||||
*/
|
||||
private String itemCode;
|
||||
/**
|
||||
* 成本项目名称
|
||||
*/
|
||||
private String itemName;
|
||||
/**
|
||||
* 成本分类 原料/能耗/辅料/设备/人工
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 查询条件(JSON格式)
|
||||
*/
|
||||
private String queryCondition;
|
||||
/**
|
||||
* 删除标识 0=正常 2=删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
55
klp-cost/src/main/java/com/klp/cost/domain/CostPrice.java
Normal file
55
klp-cost/src/main/java/com/klp/cost/domain/CostPrice.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.klp.cost.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 成本单价历史对象 cost_price
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cost_price")
|
||||
public class CostPrice extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "price_id")
|
||||
private Long priceId;
|
||||
/**
|
||||
* 成本项目ID
|
||||
*/
|
||||
private Long itemId;
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date effectiveDate;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0=正常 2=删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.klp.cost.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 生产成本明细对象 cost_prod_detail
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cost_prod_detail")
|
||||
public class CostProdDetail extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "detail_id")
|
||||
private Long detailId;
|
||||
/**
|
||||
* 生产月报ID
|
||||
*/
|
||||
private Long reportId;
|
||||
/**
|
||||
* 班次 1=甲班 2=乙班
|
||||
*/
|
||||
private String shift;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date detailDate;
|
||||
/**
|
||||
* 成本项目ID
|
||||
*/
|
||||
private Long itemId;
|
||||
/**
|
||||
* 消耗用量
|
||||
*/
|
||||
private BigDecimal quantity;
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0=正常 2=删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.klp.cost.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 生产指标明细对象 cost_prod_metric
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cost_prod_metric")
|
||||
public class CostProdMetric extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "metric_id")
|
||||
private Long metricId;
|
||||
/**
|
||||
* 生产日报ID
|
||||
*/
|
||||
private Long reportId;
|
||||
/**
|
||||
* 指标编码
|
||||
*/
|
||||
private String metricCode;
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
private String metricName;
|
||||
/**
|
||||
* 指标计算公式(如:output_weight/input_weight*100)
|
||||
*/
|
||||
private String metricFormula;
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal metricValue;
|
||||
/**
|
||||
* 是否使用单价 0=否 1=是
|
||||
*/
|
||||
private Integer usePrice;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0=正常 2=删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.klp.cost.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 生产月报对象 cost_prod_report
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cost_prod_report")
|
||||
public class CostProdReport extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "report_id")
|
||||
private Long reportId;
|
||||
/**
|
||||
* 报表标题
|
||||
*/
|
||||
private String reportTitle;
|
||||
/**
|
||||
* 报表日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date reportDate;
|
||||
/**
|
||||
* 产线类型 acid=酸轧 galvanized=镀锌
|
||||
*/
|
||||
private String lineType;
|
||||
/**
|
||||
* 投入量 单位:吨
|
||||
*/
|
||||
private BigDecimal inputWeight;
|
||||
/**
|
||||
* 产出量 单位:吨
|
||||
*/
|
||||
private BigDecimal outputWeight;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 列配置JSON
|
||||
*/
|
||||
private String colConfig;
|
||||
/**
|
||||
* 删除标识 0=正常 2=删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.klp.cost.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 成本项目配置业务对象 cost_item
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CostItemBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 成本项目编码
|
||||
*/
|
||||
private String itemCode;
|
||||
|
||||
/**
|
||||
* 成本项目名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 成本分类 原料/能耗/辅料/设备/人工
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 查询条件(JSON格式)
|
||||
*/
|
||||
private String queryCondition;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.klp.cost.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 成本单价历史业务对象 cost_price
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CostPriceBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long priceId;
|
||||
|
||||
/**
|
||||
* 成本项目ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date effectiveDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.klp.cost.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 生产成本明细业务对象 cost_prod_detail
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CostProdDetailBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long detailId;
|
||||
|
||||
/**
|
||||
* 生产月报ID
|
||||
*/
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 班次 1=甲班 2=乙班
|
||||
*/
|
||||
private String shift;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date detailDate;
|
||||
|
||||
/**
|
||||
* 成本项目ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 消耗用量
|
||||
*/
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 要删除的主键ID集合
|
||||
*/
|
||||
private List<Long> detailIds;
|
||||
|
||||
/**
|
||||
* 要批量插入的数据集合
|
||||
*/
|
||||
private List<CostProdDetailBo> prodDetailList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.klp.cost.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 生产指标明细业务对象 cost_prod_metric
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CostProdMetricBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long metricId;
|
||||
|
||||
/**
|
||||
* 生产日报ID
|
||||
*/
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 指标编码
|
||||
*/
|
||||
private String metricCode;
|
||||
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
private String metricName;
|
||||
|
||||
/**
|
||||
* 指标计算公式(如:output_weight/input_weight*100)
|
||||
*/
|
||||
private String metricFormula;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal metricValue;
|
||||
|
||||
/**
|
||||
* 是否使用单价 0=否 1=是
|
||||
*/
|
||||
private Integer usePrice;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.klp.cost.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 生产月报业务对象 cost_prod_report
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CostProdReportBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 报表标题
|
||||
*/
|
||||
private String reportTitle;
|
||||
|
||||
/**
|
||||
* 报表日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date reportDate;
|
||||
|
||||
/**
|
||||
* 产线类型 acid=酸轧 galvanized=镀锌
|
||||
*/
|
||||
private String lineType;
|
||||
|
||||
/**
|
||||
* 投入量 单位:吨
|
||||
*/
|
||||
private BigDecimal inputWeight;
|
||||
|
||||
/**
|
||||
* 产出量 单位:吨
|
||||
*/
|
||||
private BigDecimal outputWeight;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 列配置JSON
|
||||
*/
|
||||
private String colConfig;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.klp.cost.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 成本项目配置视图对象 cost_item
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CostItemVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 成本项目编码
|
||||
*/
|
||||
@ExcelProperty(value = "成本项目编码")
|
||||
private String itemCode;
|
||||
|
||||
/**
|
||||
* 成本项目名称
|
||||
*/
|
||||
@ExcelProperty(value = "成本项目名称")
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 成本分类 原料/能耗/辅料/设备/人工
|
||||
*/
|
||||
@ExcelProperty(value = "成本分类 原料/能耗/辅料/设备/人工")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@ExcelProperty(value = "计量单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 查询条件(JSON格式)
|
||||
*/
|
||||
@ExcelProperty(value = "查询条件(JSON格式)")
|
||||
private String queryCondition;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.klp.cost.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 成本单价历史视图对象 cost_price
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CostPriceVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long priceId;
|
||||
|
||||
/**
|
||||
* 成本项目ID
|
||||
*/
|
||||
@ExcelProperty(value = "成本项目ID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@ExcelProperty(value = "单价")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
@ExcelProperty(value = "生效日期")
|
||||
private Date effectiveDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.klp.cost.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 生产成本明细视图对象 cost_prod_detail
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CostProdDetailVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long detailId;
|
||||
|
||||
/**
|
||||
* 生产月报ID
|
||||
*/
|
||||
@ExcelProperty(value = "生产月报ID")
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 班次 1=甲班 2=乙班
|
||||
*/
|
||||
@ExcelProperty(value = "班次 1=甲班 2=乙班")
|
||||
private String shift;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@ExcelProperty(value = "日期")
|
||||
private Date detailDate;
|
||||
|
||||
/**
|
||||
* 成本项目ID
|
||||
*/
|
||||
@ExcelProperty(value = "成本项目ID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 消耗用量
|
||||
*/
|
||||
@ExcelProperty(value = "消耗用量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@ExcelProperty(value = "单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
@ExcelProperty(value = "总金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.klp.cost.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 生产指标明细视图对象 cost_prod_metric
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CostProdMetricVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long metricId;
|
||||
|
||||
/**
|
||||
* 生产日报ID
|
||||
*/
|
||||
@ExcelProperty(value = "生产日报ID")
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 指标编码
|
||||
*/
|
||||
@ExcelProperty(value = "指标编码")
|
||||
private String metricCode;
|
||||
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
@ExcelProperty(value = "指标名称")
|
||||
private String metricName;
|
||||
|
||||
/**
|
||||
* 指标计算公式(如:output_weight/input_weight*100)
|
||||
*/
|
||||
@ExcelProperty(value = "指标计算公式", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=:output_weight/input_weight*100")
|
||||
private String metricFormula;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@ExcelProperty(value = "单价")
|
||||
private BigDecimal metricValue;
|
||||
|
||||
/**
|
||||
* 是否使用单价 0=否 1=是
|
||||
*/
|
||||
@ExcelProperty(value = "是否使用单价")
|
||||
private Integer usePrice;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.klp.cost.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 生产月报视图对象 cost_prod_report
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CostProdReportVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 报表标题
|
||||
*/
|
||||
@ExcelProperty(value = "报表标题")
|
||||
private String reportTitle;
|
||||
|
||||
/**
|
||||
* 报表日期
|
||||
*/
|
||||
@ExcelProperty(value = "报表日期")
|
||||
private Date reportDate;
|
||||
|
||||
/**
|
||||
* 产线类型 acid=酸轧 galvanized=镀锌
|
||||
*/
|
||||
@ExcelProperty(value = "产线类型 acid=酸轧 galvanized=镀锌")
|
||||
private String lineType;
|
||||
|
||||
/**
|
||||
* 投入量 单位:吨
|
||||
*/
|
||||
@ExcelProperty(value = "投入量 单位:吨")
|
||||
private BigDecimal inputWeight;
|
||||
|
||||
/**
|
||||
* 产出量 单位:吨
|
||||
*/
|
||||
@ExcelProperty(value = "产出量 单位:吨")
|
||||
private BigDecimal outputWeight;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 列配置JSON
|
||||
*/
|
||||
private String colConfig;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.cost.mapper;
|
||||
|
||||
import com.klp.cost.domain.CostItem;
|
||||
import com.klp.cost.domain.vo.CostItemVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 成本项目配置Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface CostItemMapper extends BaseMapperPlus<CostItemMapper, CostItem, CostItemVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.cost.mapper;
|
||||
|
||||
import com.klp.cost.domain.CostPrice;
|
||||
import com.klp.cost.domain.vo.CostPriceVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 成本单价历史Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface CostPriceMapper extends BaseMapperPlus<CostPriceMapper, CostPrice, CostPriceVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.cost.mapper;
|
||||
|
||||
import com.klp.cost.domain.CostProdDetail;
|
||||
import com.klp.cost.domain.vo.CostProdDetailVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 生产成本明细Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface CostProdDetailMapper extends BaseMapperPlus<CostProdDetailMapper, CostProdDetail, CostProdDetailVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.cost.mapper;
|
||||
|
||||
import com.klp.cost.domain.CostProdMetric;
|
||||
import com.klp.cost.domain.vo.CostProdMetricVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 生产指标明细Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface CostProdMetricMapper extends BaseMapperPlus<CostProdMetricMapper, CostProdMetric, CostProdMetricVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.cost.mapper;
|
||||
|
||||
import com.klp.cost.domain.CostProdReport;
|
||||
import com.klp.cost.domain.vo.CostProdReportVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 生产月报Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface CostProdReportMapper extends BaseMapperPlus<CostProdReportMapper, CostProdReport, CostProdReportVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.cost.service;
|
||||
|
||||
import com.klp.cost.domain.CostItem;
|
||||
import com.klp.cost.domain.vo.CostItemVo;
|
||||
import com.klp.cost.domain.bo.CostItemBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 成本项目配置Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface ICostItemService {
|
||||
|
||||
/**
|
||||
* 查询成本项目配置
|
||||
*/
|
||||
CostItemVo queryById(Long itemId);
|
||||
|
||||
/**
|
||||
* 查询成本项目配置列表
|
||||
*/
|
||||
TableDataInfo<CostItemVo> queryPageList(CostItemBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询成本项目配置列表
|
||||
*/
|
||||
List<CostItemVo> queryList(CostItemBo bo);
|
||||
|
||||
/**
|
||||
* 新增成本项目配置
|
||||
*/
|
||||
Boolean insertByBo(CostItemBo bo);
|
||||
|
||||
/**
|
||||
* 修改成本项目配置
|
||||
*/
|
||||
Boolean updateByBo(CostItemBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除成本项目配置信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.cost.service;
|
||||
|
||||
import com.klp.cost.domain.CostPrice;
|
||||
import com.klp.cost.domain.vo.CostPriceVo;
|
||||
import com.klp.cost.domain.bo.CostPriceBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 成本单价历史Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface ICostPriceService {
|
||||
|
||||
/**
|
||||
* 查询成本单价历史
|
||||
*/
|
||||
CostPriceVo queryById(Long priceId);
|
||||
|
||||
/**
|
||||
* 查询成本单价历史列表
|
||||
*/
|
||||
TableDataInfo<CostPriceVo> queryPageList(CostPriceBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询成本单价历史列表
|
||||
*/
|
||||
List<CostPriceVo> queryList(CostPriceBo bo);
|
||||
|
||||
/**
|
||||
* 新增成本单价历史
|
||||
*/
|
||||
Boolean insertByBo(CostPriceBo bo);
|
||||
|
||||
/**
|
||||
* 修改成本单价历史
|
||||
*/
|
||||
Boolean updateByBo(CostPriceBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除成本单价历史信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.klp.cost.service;
|
||||
|
||||
import com.klp.cost.domain.CostProdDetail;
|
||||
import com.klp.cost.domain.vo.CostProdDetailVo;
|
||||
import com.klp.cost.domain.bo.CostProdDetailBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产成本明细Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface ICostProdDetailService {
|
||||
|
||||
/**
|
||||
* 查询生产成本明细
|
||||
*/
|
||||
CostProdDetailVo queryById(Long detailId);
|
||||
|
||||
/**
|
||||
* 查询生产成本明细列表
|
||||
*/
|
||||
TableDataInfo<CostProdDetailVo> queryPageList(CostProdDetailBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询生产成本明细列表
|
||||
*/
|
||||
List<CostProdDetailVo> queryList(CostProdDetailBo bo);
|
||||
|
||||
/**
|
||||
* 新增生产成本明细
|
||||
*/
|
||||
Long insertByBo(CostProdDetailBo bo);
|
||||
|
||||
/**
|
||||
* 修改生产成本明细
|
||||
*/
|
||||
Boolean updateByBo(CostProdDetailBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产成本明细信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量保存(先删除再插入)
|
||||
*/
|
||||
Boolean batchSaveWithDelete(CostProdDetailBo bo);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.cost.service;
|
||||
|
||||
import com.klp.cost.domain.CostProdMetric;
|
||||
import com.klp.cost.domain.vo.CostProdMetricVo;
|
||||
import com.klp.cost.domain.bo.CostProdMetricBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产指标明细Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface ICostProdMetricService {
|
||||
|
||||
/**
|
||||
* 查询生产指标明细
|
||||
*/
|
||||
CostProdMetricVo queryById(Long metricId);
|
||||
|
||||
/**
|
||||
* 查询生产指标明细列表
|
||||
*/
|
||||
TableDataInfo<CostProdMetricVo> queryPageList(CostProdMetricBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询生产指标明细列表
|
||||
*/
|
||||
List<CostProdMetricVo> queryList(CostProdMetricBo bo);
|
||||
|
||||
/**
|
||||
* 新增生产指标明细
|
||||
*/
|
||||
Boolean insertByBo(CostProdMetricBo bo);
|
||||
|
||||
/**
|
||||
* 修改生产指标明细
|
||||
*/
|
||||
Boolean updateByBo(CostProdMetricBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产指标明细信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.klp.cost.service;
|
||||
|
||||
import com.klp.cost.domain.CostProdReport;
|
||||
import com.klp.cost.domain.vo.CostProdReportVo;
|
||||
import com.klp.cost.domain.bo.CostProdReportBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产月报Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface ICostProdReportService {
|
||||
|
||||
/**
|
||||
* 查询生产月报
|
||||
*/
|
||||
CostProdReportVo queryById(Long reportId);
|
||||
|
||||
/**
|
||||
* 查询生产月报列表
|
||||
*/
|
||||
TableDataInfo<CostProdReportVo> queryPageList(CostProdReportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询生产月报列表
|
||||
*/
|
||||
List<CostProdReportVo> queryList(CostProdReportBo bo);
|
||||
|
||||
/**
|
||||
* 新增生产月报
|
||||
*/
|
||||
Boolean insertByBo(CostProdReportBo bo);
|
||||
|
||||
/**
|
||||
* 修改生产月报
|
||||
*/
|
||||
Boolean updateByBo(CostProdReportBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产月报信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 复制生产月报(明细列原样保留,指标列重新插入并更新config中的id引用)
|
||||
*/
|
||||
CostProdReportVo copyReport(Long sourceId, CostProdReportBo bo);
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.klp.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.cost.domain.bo.CostItemBo;
|
||||
import com.klp.cost.domain.vo.CostItemVo;
|
||||
import com.klp.cost.domain.CostItem;
|
||||
import com.klp.cost.mapper.CostItemMapper;
|
||||
import com.klp.cost.service.ICostItemService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 成本项目配置Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CostItemServiceImpl implements ICostItemService {
|
||||
|
||||
private final CostItemMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询成本项目配置
|
||||
*/
|
||||
@Override
|
||||
public CostItemVo queryById(Long itemId){
|
||||
return baseMapper.selectVoById(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询成本项目配置列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CostItemVo> queryPageList(CostItemBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CostItem> lqw = buildQueryWrapper(bo);
|
||||
Page<CostItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询成本项目配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<CostItemVo> queryList(CostItemBo bo) {
|
||||
LambdaQueryWrapper<CostItem> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CostItem> buildQueryWrapper(CostItemBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<CostItem> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getItemCode()), CostItem::getItemCode, bo.getItemCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getItemName()), CostItem::getItemName, bo.getItemName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCategory()), CostItem::getCategory, bo.getCategory());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), CostItem::getUnit, bo.getUnit());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQueryCondition()), CostItem::getQueryCondition, bo.getQueryCondition());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成本项目配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(CostItemBo bo) {
|
||||
CostItem add = BeanUtil.toBean(bo, CostItem.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setItemId(add.getItemId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成本项目配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CostItemBo bo) {
|
||||
CostItem update = BeanUtil.toBean(bo, CostItem.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CostItem entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除成本项目配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.klp.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.cost.domain.bo.CostPriceBo;
|
||||
import com.klp.cost.domain.vo.CostPriceVo;
|
||||
import com.klp.cost.domain.CostPrice;
|
||||
import com.klp.cost.mapper.CostPriceMapper;
|
||||
import com.klp.cost.service.ICostPriceService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 成本单价历史Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CostPriceServiceImpl implements ICostPriceService {
|
||||
|
||||
private final CostPriceMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询成本单价历史
|
||||
*/
|
||||
@Override
|
||||
public CostPriceVo queryById(Long priceId){
|
||||
return baseMapper.selectVoById(priceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询成本单价历史列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CostPriceVo> queryPageList(CostPriceBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CostPrice> lqw = buildQueryWrapper(bo);
|
||||
Page<CostPriceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询成本单价历史列表
|
||||
*/
|
||||
@Override
|
||||
public List<CostPriceVo> queryList(CostPriceBo bo) {
|
||||
LambdaQueryWrapper<CostPrice> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CostPrice> buildQueryWrapper(CostPriceBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<CostPrice> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getItemId() != null, CostPrice::getItemId, bo.getItemId());
|
||||
lqw.eq(bo.getPrice() != null, CostPrice::getPrice, bo.getPrice());
|
||||
lqw.eq(bo.getEffectiveDate() != null, CostPrice::getEffectiveDate, bo.getEffectiveDate());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成本单价历史
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(CostPriceBo bo) {
|
||||
CostPrice add = BeanUtil.toBean(bo, CostPrice.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setPriceId(add.getPriceId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成本单价历史
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CostPriceBo bo) {
|
||||
CostPrice update = BeanUtil.toBean(bo, CostPrice.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CostPrice entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除成本单价历史
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.klp.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.klp.cost.domain.bo.CostProdDetailBo;
|
||||
import com.klp.cost.domain.vo.CostProdDetailVo;
|
||||
import com.klp.cost.domain.CostProdDetail;
|
||||
import com.klp.cost.mapper.CostProdDetailMapper;
|
||||
import com.klp.cost.service.ICostProdDetailService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 生产成本明细Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CostProdDetailServiceImpl implements ICostProdDetailService {
|
||||
|
||||
private final CostProdDetailMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询生产成本明细
|
||||
*/
|
||||
@Override
|
||||
public CostProdDetailVo queryById(Long detailId){
|
||||
return baseMapper.selectVoById(detailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产成本明细列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CostProdDetailVo> queryPageList(CostProdDetailBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CostProdDetail> lqw = buildQueryWrapper(bo);
|
||||
Page<CostProdDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产成本明细列表
|
||||
*/
|
||||
@Override
|
||||
public List<CostProdDetailVo> queryList(CostProdDetailBo bo) {
|
||||
LambdaQueryWrapper<CostProdDetail> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CostProdDetail> buildQueryWrapper(CostProdDetailBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<CostProdDetail> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getReportId() != null, CostProdDetail::getReportId, bo.getReportId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShift()), CostProdDetail::getShift, bo.getShift());
|
||||
lqw.eq(bo.getDetailDate() != null, CostProdDetail::getDetailDate, bo.getDetailDate());
|
||||
lqw.eq(bo.getItemId() != null, CostProdDetail::getItemId, bo.getItemId());
|
||||
lqw.eq(bo.getQuantity() != null, CostProdDetail::getQuantity, bo.getQuantity());
|
||||
lqw.eq(bo.getUnitPrice() != null, CostProdDetail::getUnitPrice, bo.getUnitPrice());
|
||||
lqw.eq(bo.getAmount() != null, CostProdDetail::getAmount, bo.getAmount());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产成本明细
|
||||
*/
|
||||
@Override
|
||||
public Long insertByBo(CostProdDetailBo bo) {
|
||||
CostProdDetail add = BeanUtil.toBean(bo, CostProdDetail.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setDetailId(add.getDetailId());
|
||||
}
|
||||
return add.getDetailId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产成本明细
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CostProdDetailBo bo) {
|
||||
CostProdDetail update = BeanUtil.toBean(bo, CostProdDetail.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CostProdDetail entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除生产成本明细
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存(先删除再插入)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchSaveWithDelete(CostProdDetailBo bo) {
|
||||
if (CollUtil.isNotEmpty(bo.getProdDetailList())) {
|
||||
if (CollUtil.isNotEmpty(bo.getDetailIds())) {
|
||||
baseMapper.deleteBatchIds(bo.getDetailIds());
|
||||
}
|
||||
List<CostProdDetail> list = bo.getProdDetailList().stream()
|
||||
.map(item -> BeanUtil.toBean(item, CostProdDetail.class))
|
||||
.collect(Collectors.toList());
|
||||
return baseMapper.insertBatch(list);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.klp.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.cost.domain.bo.CostProdMetricBo;
|
||||
import com.klp.cost.domain.vo.CostProdMetricVo;
|
||||
import com.klp.cost.domain.CostProdMetric;
|
||||
import com.klp.cost.mapper.CostProdMetricMapper;
|
||||
import com.klp.cost.service.ICostProdMetricService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 生产指标明细Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CostProdMetricServiceImpl implements ICostProdMetricService {
|
||||
|
||||
private final CostProdMetricMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询生产指标明细
|
||||
*/
|
||||
@Override
|
||||
public CostProdMetricVo queryById(Long metricId){
|
||||
return baseMapper.selectVoById(metricId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产指标明细列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CostProdMetricVo> queryPageList(CostProdMetricBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CostProdMetric> lqw = buildQueryWrapper(bo);
|
||||
Page<CostProdMetricVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产指标明细列表
|
||||
*/
|
||||
@Override
|
||||
public List<CostProdMetricVo> queryList(CostProdMetricBo bo) {
|
||||
LambdaQueryWrapper<CostProdMetric> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CostProdMetric> buildQueryWrapper(CostProdMetricBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<CostProdMetric> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getReportId() != null, CostProdMetric::getReportId, bo.getReportId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMetricCode()), CostProdMetric::getMetricCode, bo.getMetricCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getMetricName()), CostProdMetric::getMetricName, bo.getMetricName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMetricFormula()), CostProdMetric::getMetricFormula, bo.getMetricFormula());
|
||||
lqw.eq(bo.getMetricValue() != null, CostProdMetric::getMetricValue, bo.getMetricValue());
|
||||
lqw.eq(bo.getUsePrice() != null, CostProdMetric::getUsePrice, bo.getUsePrice());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产指标明细
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(CostProdMetricBo bo) {
|
||||
CostProdMetric add = BeanUtil.toBean(bo, CostProdMetric.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setMetricId(add.getMetricId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产指标明细
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CostProdMetricBo bo) {
|
||||
CostProdMetric update = BeanUtil.toBean(bo, CostProdMetric.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CostProdMetric entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除生产指标明细
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.klp.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.cost.domain.bo.CostProdReportBo;
|
||||
import com.klp.cost.domain.vo.CostProdReportVo;
|
||||
import com.klp.cost.domain.CostProdReport;
|
||||
import com.klp.cost.domain.CostProdMetric;
|
||||
import com.klp.cost.mapper.CostProdReportMapper;
|
||||
import com.klp.cost.mapper.CostProdMetricMapper;
|
||||
import com.klp.cost.service.ICostProdReportService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 生产月报Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CostProdReportServiceImpl implements ICostProdReportService {
|
||||
|
||||
private final CostProdReportMapper baseMapper;
|
||||
private final CostProdMetricMapper metricMapper;
|
||||
|
||||
/**
|
||||
* 查询生产月报
|
||||
*/
|
||||
@Override
|
||||
public CostProdReportVo queryById(Long reportId){
|
||||
return baseMapper.selectVoById(reportId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产月报列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CostProdReportVo> queryPageList(CostProdReportBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CostProdReport> lqw = buildQueryWrapper(bo);
|
||||
Page<CostProdReportVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产月报列表
|
||||
*/
|
||||
@Override
|
||||
public List<CostProdReportVo> queryList(CostProdReportBo bo) {
|
||||
LambdaQueryWrapper<CostProdReport> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CostProdReport> buildQueryWrapper(CostProdReportBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<CostProdReport> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReportTitle()), CostProdReport::getReportTitle, bo.getReportTitle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLineType()), CostProdReport::getLineType, bo.getLineType());
|
||||
lqw.eq(bo.getInputWeight() != null, CostProdReport::getInputWeight, bo.getInputWeight());
|
||||
lqw.eq(bo.getOutputWeight() != null, CostProdReport::getOutputWeight, bo.getOutputWeight());
|
||||
lqw.apply(bo.getReportDate() != null, "DATE_FORMAT(report_date, '%Y-%m') = {0}", bo.getReportDate());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产月报
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(CostProdReportBo bo) {
|
||||
CostProdReport add = BeanUtil.toBean(bo, CostProdReport.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setReportId(add.getReportId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产月报
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CostProdReportBo bo) {
|
||||
CostProdReport update = BeanUtil.toBean(bo, CostProdReport.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CostProdReport entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除生产月报
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制生产月报
|
||||
* 明细列原样保留(itemId不变),指标列重新插入并更新config中的id引用
|
||||
*/
|
||||
@Override
|
||||
public CostProdReportVo copyReport(Long sourceId, CostProdReportBo bo) {
|
||||
CostProdReport source = baseMapper.selectById(sourceId);
|
||||
if (source == null) {
|
||||
throw new RuntimeException("源报表不存在");
|
||||
}
|
||||
|
||||
// 创建新报表,先插入以获取ID
|
||||
CostProdReport newRp = new CostProdReport();
|
||||
BeanUtil.copyProperties(source, newRp, "reportId", "colConfig");
|
||||
newRp.setReportTitle(bo.getReportTitle() != null ? bo.getReportTitle() : source.getReportTitle() + "-副本");
|
||||
if (bo.getReportDate() != null) newRp.setReportDate(bo.getReportDate());
|
||||
if (bo.getLineType() != null) newRp.setLineType(bo.getLineType());
|
||||
if (bo.getInputWeight() != null) newRp.setInputWeight(bo.getInputWeight());
|
||||
if (bo.getOutputWeight() != null) newRp.setOutputWeight(bo.getOutputWeight());
|
||||
if (bo.getRemark() != null) newRp.setRemark(bo.getRemark());
|
||||
baseMapper.insert(newRp);
|
||||
Long newRid = newRp.getReportId();
|
||||
|
||||
// 处理colConfig:为每个指标列重新插入metric记录,更新id引用
|
||||
String colConfig = source.getColConfig();
|
||||
if (StringUtils.isNotBlank(colConfig)) {
|
||||
JSONObject cfg = JSONUtil.parseObj(colConfig);
|
||||
JSONArray columns = cfg.getJSONArray("columns");
|
||||
if (columns != null && columns.size() > 0) {
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
JSONObject col = columns.getJSONObject(i);
|
||||
if ("m".equals(col.getStr("t"))) {
|
||||
String idStr = col.getStr("id");
|
||||
Long oldMetricId = idStr != null ? Long.parseLong(idStr) : null;
|
||||
if (oldMetricId != null) {
|
||||
CostProdMetric srcMetric = metricMapper.selectById(oldMetricId);
|
||||
if (srcMetric != null) {
|
||||
CostProdMetric newMetric = new CostProdMetric();
|
||||
BeanUtil.copyProperties(srcMetric, newMetric, "metricId", "reportId");
|
||||
newMetric.setReportId(newRid);
|
||||
metricMapper.insert(newMetric);
|
||||
col.set("id", String.valueOf(newMetric.getMetricId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newRp.setColConfig(cfg.toString());
|
||||
}
|
||||
baseMapper.updateById(newRp);
|
||||
}
|
||||
|
||||
return baseMapper.selectVoById(newRid);
|
||||
}
|
||||
}
|
||||
23
klp-cost/src/main/resources/mapper/cost/CostItemMapper.xml
Normal file
23
klp-cost/src/main/resources/mapper/cost/CostItemMapper.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.cost.mapper.CostItemMapper">
|
||||
|
||||
<resultMap type="com.klp.cost.domain.CostItem" id="CostItemResult">
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="itemCode" column="item_code"/>
|
||||
<result property="itemName" column="item_name"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="queryCondition" column="query_condition"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
21
klp-cost/src/main/resources/mapper/cost/CostPriceMapper.xml
Normal file
21
klp-cost/src/main/resources/mapper/cost/CostPriceMapper.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.cost.mapper.CostPriceMapper">
|
||||
|
||||
<resultMap type="com.klp.cost.domain.CostPrice" id="CostPriceResult">
|
||||
<result property="priceId" column="price_id"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="effectiveDate" column="effective_date"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.cost.mapper.CostProdDetailMapper">
|
||||
|
||||
<resultMap type="com.klp.cost.domain.CostProdDetail" id="CostProdDetailResult">
|
||||
<result property="detailId" column="detail_id"/>
|
||||
<result property="reportId" column="report_id"/>
|
||||
<result property="shift" column="shift"/>
|
||||
<result property="detailDate" column="detail_date"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="quantity" column="quantity"/>
|
||||
<result property="unitPrice" column="unit_price"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.cost.mapper.CostProdMetricMapper">
|
||||
|
||||
<resultMap type="com.klp.cost.domain.CostProdMetric" id="CostProdMetricResult">
|
||||
<result property="metricId" column="metric_id"/>
|
||||
<result property="reportId" column="report_id"/>
|
||||
<result property="metricCode" column="metric_code"/>
|
||||
<result property="metricName" column="metric_name"/>
|
||||
<result property="metricFormula" column="metric_formula"/>
|
||||
<result property="metricValue" column="metric_value"/>
|
||||
<result property="usePrice" column="use_price"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.cost.mapper.CostProdReportMapper">
|
||||
|
||||
<resultMap type="com.klp.cost.domain.CostProdReport" id="CostProdReportResult">
|
||||
<result property="reportId" column="report_id"/>
|
||||
<result property="reportTitle" column="report_title"/>
|
||||
<result property="reportDate" column="report_date"/>
|
||||
<result property="lineType" column="line_type"/>
|
||||
<result property="inputWeight" column="input_weight"/>
|
||||
<result property="outputWeight" column="output_weight"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="colConfig" column="col_config"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -85,6 +85,15 @@ public class CrmSalesReportController extends BaseController {
|
||||
return R.ok(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询省份统计数据
|
||||
*/
|
||||
@GetMapping("/provinceStats")
|
||||
public R<List<CrmSalesReportVo.ProvinceStat>> getProvinceStats(CrmSalesReportBo bo) {
|
||||
List<CrmSalesReportVo.ProvinceStat> stats = iCrmSalesReportService.queryProvinceStats(bo);
|
||||
return R.ok(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售报表订单明细
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.klp.crm.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
@@ -173,6 +175,65 @@ public class CrmOrderItemVo {
|
||||
@ExcelProperty(value = "用途")
|
||||
private String purpose;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
private Long delFlag;
|
||||
|
||||
/**
|
||||
* 合同号(联表查询直接映射)
|
||||
*/
|
||||
@ExcelProperty(value = "合同号")
|
||||
private String contractCode;
|
||||
|
||||
/**
|
||||
* 供方(联表查询直接映射)
|
||||
*/
|
||||
@ExcelProperty(value = "供方")
|
||||
private String supplier;
|
||||
|
||||
/**
|
||||
* 需方(联表查询直接映射)
|
||||
*/
|
||||
@ExcelProperty(value = "需方")
|
||||
private String customer;
|
||||
|
||||
/**
|
||||
* 签订时间(联表查询直接映射)
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ExcelProperty(value = "签订时间")
|
||||
private Date signTime;
|
||||
|
||||
/**
|
||||
* 交货日期(联表查询直接映射)
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ExcelProperty(value = "交货日期")
|
||||
private Date deliveryDate;
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
*/
|
||||
|
||||
@@ -290,4 +290,35 @@ public class CrmSalesReportVo {
|
||||
@ExcelProperty(value = "销售金额")
|
||||
private BigDecimal salesAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 省份统计内部类
|
||||
*/
|
||||
@Data
|
||||
public static class ProvinceStat {
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@ExcelProperty(value = "省份")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 客户数量
|
||||
*/
|
||||
@ExcelProperty(value = "客户数量")
|
||||
private Integer customerCount;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
@ExcelProperty(value = "订单数量")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 销售金额
|
||||
*/
|
||||
@ExcelProperty(value = "销售金额")
|
||||
private BigDecimal salesAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,9 @@ import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface CrmCustomerMapper extends BaseMapperPlus<CrmCustomerMapper, CrmCustomer, CrmCustomerVo> {
|
||||
|
||||
/**
|
||||
* 查询当前最大的customer_code,用于自动生成新编码
|
||||
*/
|
||||
String selectMaxCustomerCode();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.klp.crm.mapper;
|
||||
|
||||
import com.klp.crm.domain.CrmOrderItem;
|
||||
import com.klp.crm.domain.bo.CrmOrderItemBo;
|
||||
import com.klp.crm.domain.vo.CrmOrderItemVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -22,4 +24,14 @@ public interface CrmOrderItemMapper extends BaseMapperPlus<CrmOrderItemMapper, C
|
||||
* @return 订单明细列表
|
||||
*/
|
||||
List<CrmOrderItem> selectOrderItemsByOrderIds(@Param("orderIds") List<Long> orderIds);
|
||||
|
||||
/**
|
||||
* 联表查询订单明细(支持排序和分页)
|
||||
* 排序规则:deliveryDate DESC -> orderId ASC -> createTime DESC
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param bo 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<CrmOrderItemVo> selectVoListWithOrder(Page<CrmOrderItemVo> page, @Param("bo") CrmOrderItemBo bo);
|
||||
}
|
||||
|
||||
@@ -54,4 +54,12 @@ public interface CrmSalesReportMapper {
|
||||
* @return 行业统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.IndustryStat> selectIndustryStats(@Param("bo") CrmSalesReportBo bo);
|
||||
|
||||
/**
|
||||
* 查询省份统计数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 省份统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.ProvinceStat> selectProvinceStats(@Param("bo") CrmSalesReportBo bo);
|
||||
}
|
||||
@@ -72,4 +72,12 @@ public interface ICrmSalesReportService {
|
||||
* @return 行业统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.IndustryStat> queryIndustryStats(CrmSalesReportBo bo);
|
||||
|
||||
/**
|
||||
* 查询省份统计数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 省份统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.ProvinceStat> queryProvinceStats(CrmSalesReportBo bo);
|
||||
}
|
||||
@@ -91,6 +91,25 @@ public class CrmCustomerServiceImpl implements ICrmCustomerService {
|
||||
@Override
|
||||
public Boolean insertByBo(CrmCustomerBo bo) {
|
||||
CrmCustomer add = BeanUtil.toBean(bo, CrmCustomer.class);
|
||||
// 自动生成customer_code:查询最大编码并加1
|
||||
if (StringUtils.isBlank(add.getCustomerCode())) {
|
||||
String maxCode = baseMapper.selectMaxCustomerCode();
|
||||
if (StringUtils.isBlank(maxCode)) {
|
||||
add.setCustomerCode("00001");
|
||||
} else {
|
||||
// 提取末尾数字后缀并递增,支持纯数字("00001")和带前缀("KH00001")两种格式
|
||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("^(.*?)(\\d+)$");
|
||||
java.util.regex.Matcher matcher = pattern.matcher(maxCode);
|
||||
if (matcher.matches()) {
|
||||
String prefix = matcher.group(1);
|
||||
String numStr = matcher.group(2);
|
||||
long num = Long.parseLong(numStr) + 1;
|
||||
add.setCustomerCode(prefix + String.format("%0" + numStr.length() + "d", num));
|
||||
} else {
|
||||
add.setCustomerCode(maxCode + "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
|
||||
@@ -69,23 +69,31 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
|
||||
|
||||
/**
|
||||
* 查询正式订单明细列表
|
||||
* 实现逻辑:SQL联表查询 → 数据库层排序(交货日期倒序→订单ID升序→创建时间倒序)→ 物理分页
|
||||
* 排序跨页生效,同一合同明细连续排列,避免内存排序大数据量问题
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CrmOrderItemVo> queryPageList(CrmOrderItemBo bo, PageQuery pageQuery) {
|
||||
List<Long> orderIdScope = resolveOrderIdScope(bo);
|
||||
if (orderIdScope != null && orderIdScope.isEmpty()) {
|
||||
Page<CrmOrderItemVo> emptyPage = new Page<>(ObjectUtil.defaultIfNull(pageQuery.getPageNum(), 1),
|
||||
ObjectUtil.defaultIfNull(pageQuery.getPageSize(), 10), 0);
|
||||
emptyPage.setRecords(Collections.emptyList());
|
||||
return TableDataInfo.build(emptyPage);
|
||||
}
|
||||
LambdaQueryWrapper<CrmOrderItem> lqw = buildQueryWrapper(bo);
|
||||
if (orderIdScope != null) {
|
||||
lqw.in(CrmOrderItem::getOrderId, orderIdScope);
|
||||
}
|
||||
Page<CrmOrderItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
fillOrderInfoOnItems(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
// 使用MyBatis-Plus分页插件,SQL层完成联表查询、排序和分页
|
||||
Page<CrmOrderItemVo> page = new Page<>(
|
||||
ObjectUtil.defaultIfNull(pageQuery.getPageNum(), 1),
|
||||
ObjectUtil.defaultIfNull(pageQuery.getPageSize(), 10)
|
||||
);
|
||||
// 联表查询:在SQL层完成排序,避免内存排序
|
||||
Page<CrmOrderItemVo> resultPage = baseMapper.selectVoListWithOrder(page, bo);
|
||||
return TableDataInfo.build(resultPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较两个日期,null 值排在末尾
|
||||
* @param desc true=倒序,false=升序
|
||||
*/
|
||||
private int compareDate(Date a, Date b, boolean desc) {
|
||||
if (a == null && b == null) return 0;
|
||||
if (a == null) return 1; // null 排在后面
|
||||
if (b == null) return -1;
|
||||
int cmp = a.compareTo(b);
|
||||
return desc ? -cmp : cmp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -250,11 +250,9 @@ public class CrmOrderServiceImpl implements ICrmOrderService {
|
||||
qw.eq("co.del_flag", 0);
|
||||
//排序规则:
|
||||
// 1. 置顶优先 (is_top=1 排在前面)
|
||||
// 2. 状态为1(已生效)的排在前面
|
||||
// 3. 创建时间倒序
|
||||
// 2. 合同号倒序(KLPY+年月日+序号,降序最新在前)
|
||||
qw.orderByDesc("co.is_top")
|
||||
.orderByDesc("CASE WHEN co.status = 1 THEN 1 ELSE 0 END")
|
||||
.orderByDesc("co.create_time");
|
||||
.orderByDesc("co.contract_code");
|
||||
return qw;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,4 +136,12 @@ public class CrmSalesReportServiceImpl implements ICrmSalesReportService {
|
||||
public List<CrmSalesReportVo.IndustryStat> queryIndustryStats(CrmSalesReportBo bo) {
|
||||
return baseMapper.selectIndustryStats(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询省份统计数据
|
||||
*/
|
||||
@Override
|
||||
public List<CrmSalesReportVo.ProvinceStat> queryProvinceStats(CrmSalesReportBo bo) {
|
||||
return baseMapper.selectProvinceStats(bo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,5 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMaxCustomerCode" resultType="String">
|
||||
SELECT customer_code FROM crm_customer WHERE del_flag = 0 ORDER BY LENGTH(customer_code) DESC, customer_code DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.crm.mapper.CrmOrderItemMapper">
|
||||
|
||||
<resultMap type="com.klp.crm.domain.CrmOrderItem" id="CrmOrderItemResult">
|
||||
@@ -36,6 +36,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
<!-- 联表查询结果映射 -->
|
||||
<resultMap type="com.klp.crm.domain.vo.CrmOrderItemVo" id="CrmOrderItemVoResult">
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="productType" column="product_type"/>
|
||||
<result property="rawMaterialSpec" column="raw_material_spec"/>
|
||||
<result property="productNum" column="product_num"/>
|
||||
<result property="specialRequire" column="special_require"/>
|
||||
<result property="itemAmount" column="item_amount"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="finishedProductSpec" column="finished_product_spec"/>
|
||||
<result property="material" column="material"/>
|
||||
<result property="grade" column="grade"/>
|
||||
<result property="weight" column="weight"/>
|
||||
<result property="widthTolerance" column="width_tolerance"/>
|
||||
<result property="thicknessTolerance" column="thickness_tolerance"/>
|
||||
<result property="contractPrice" column="contract_price"/>
|
||||
<result property="customizer" column="customizer"/>
|
||||
<result property="shipper" column="shipper"/>
|
||||
<result property="productionBatch" column="production_batch"/>
|
||||
<result property="surfaceTreatment" column="surface_treatment"/>
|
||||
<result property="surfaceQuality" column="surface_quality"/>
|
||||
<result property="edgeCuttingReq" column="edge_cutting_req"/>
|
||||
<result property="packagingReq" column="packaging_req"/>
|
||||
<result property="width" column="width"/>
|
||||
<result property="thickness" column="thickness"/>
|
||||
<result property="purpose" column="purpose"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<!-- 合同信息字段 -->
|
||||
<result property="contractCode" column="contract_code"/>
|
||||
<result property="supplier" column="supplier"/>
|
||||
<result property="customer" column="customer"/>
|
||||
<result property="signTime" column="sign_time"/>
|
||||
<result property="deliveryDate" column="delivery_date"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据订单ID列表查询订单明细 -->
|
||||
<select id="selectOrderItemsByOrderIds" resultMap="CrmOrderItemResult">
|
||||
SELECT
|
||||
@@ -78,5 +118,132 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY item_id ASC
|
||||
</select>
|
||||
|
||||
<!-- 联表查询订单明细(支持排序和分页) -->
|
||||
<select id="selectVoListWithOrder" resultMap="CrmOrderItemVoResult">
|
||||
SELECT
|
||||
i.item_id,
|
||||
i.order_id,
|
||||
i.product_type,
|
||||
i.raw_material_spec,
|
||||
i.product_num,
|
||||
i.special_require,
|
||||
i.item_amount,
|
||||
i.remark,
|
||||
i.finished_product_spec,
|
||||
i.material,
|
||||
i.grade,
|
||||
i.weight,
|
||||
i.width_tolerance,
|
||||
i.thickness_tolerance,
|
||||
i.contract_price,
|
||||
i.customizer,
|
||||
i.shipper,
|
||||
i.production_batch,
|
||||
i.surface_treatment,
|
||||
i.surface_quality,
|
||||
i.edge_cutting_req,
|
||||
i.packaging_req,
|
||||
i.width,
|
||||
i.thickness,
|
||||
i.purpose,
|
||||
i.create_by,
|
||||
i.create_time,
|
||||
i.update_by,
|
||||
i.update_time,
|
||||
i.del_flag,
|
||||
o.contract_code,
|
||||
o.supplier,
|
||||
o.customer,
|
||||
o.sign_time,
|
||||
o.delivery_date
|
||||
FROM crm_order_item i
|
||||
LEFT JOIN crm_order o ON i.order_id = o.order_id AND o.del_flag = 0
|
||||
<where>
|
||||
i.del_flag = 0
|
||||
<if test="bo.itemId != null">
|
||||
AND i.item_id = #{bo.itemId}
|
||||
</if>
|
||||
<if test="bo.orderId != null">
|
||||
AND i.order_id = #{bo.orderId}
|
||||
</if>
|
||||
<if test="bo.productType != null and bo.productType != ''">
|
||||
AND i.product_type = #{bo.productType}
|
||||
</if>
|
||||
<if test="bo.rawMaterialSpec != null and bo.rawMaterialSpec != ''">
|
||||
AND i.raw_material_spec = #{bo.rawMaterialSpec}
|
||||
</if>
|
||||
<if test="bo.productNum != null">
|
||||
AND i.product_num = #{bo.productNum}
|
||||
</if>
|
||||
<if test="bo.specialRequire != null and bo.specialRequire != ''">
|
||||
AND i.special_require = #{bo.specialRequire}
|
||||
</if>
|
||||
<if test="bo.finishedProductSpec != null and bo.finishedProductSpec != ''">
|
||||
AND i.finished_product_spec = #{bo.finishedProductSpec}
|
||||
</if>
|
||||
<if test="bo.material != null and bo.material != ''">
|
||||
AND i.material LIKE CONCAT('%', #{bo.material}, '%')
|
||||
</if>
|
||||
<if test="bo.grade != null and bo.grade != ''">
|
||||
AND i.grade = #{bo.grade}
|
||||
</if>
|
||||
<if test="bo.weight != null">
|
||||
AND i.weight = #{bo.weight}
|
||||
</if>
|
||||
<if test="bo.contractPrice != null">
|
||||
AND i.contract_price = #{bo.contractPrice}
|
||||
</if>
|
||||
<if test="bo.customizer != null and bo.customizer != ''">
|
||||
AND i.customizer = #{bo.customizer}
|
||||
</if>
|
||||
<if test="bo.shipper != null and bo.shipper != ''">
|
||||
AND i.shipper = #{bo.shipper}
|
||||
</if>
|
||||
<if test="bo.productionBatch != null and bo.productionBatch != ''">
|
||||
AND i.production_batch = #{bo.productionBatch}
|
||||
</if>
|
||||
<if test="bo.surfaceTreatment != null and bo.surfaceTreatment != ''">
|
||||
AND i.surface_treatment = #{bo.surfaceTreatment}
|
||||
</if>
|
||||
<if test="bo.surfaceQuality != null and bo.surfaceQuality != ''">
|
||||
AND i.surface_quality = #{bo.surfaceQuality}
|
||||
</if>
|
||||
<if test="bo.edgeCuttingReq != null and bo.edgeCuttingReq != ''">
|
||||
AND i.edge_cutting_req = #{bo.edgeCuttingReq}
|
||||
</if>
|
||||
<if test="bo.packagingReq != null and bo.packagingReq != ''">
|
||||
AND i.packaging_req = #{bo.packagingReq}
|
||||
</if>
|
||||
<if test="bo.width != null and bo.width != ''">
|
||||
AND i.width = #{bo.width}
|
||||
</if>
|
||||
<if test="bo.thickness != null and bo.thickness != ''">
|
||||
AND i.thickness = #{bo.thickness}
|
||||
</if>
|
||||
<if test="bo.purpose != null and bo.purpose != ''">
|
||||
AND i.purpose = #{bo.purpose}
|
||||
</if>
|
||||
<!-- 合同表筛选条件 -->
|
||||
<if test="bo.contractCode != null and bo.contractCode != ''">
|
||||
AND o.contract_code LIKE CONCAT('%', #{bo.contractCode}, '%')
|
||||
</if>
|
||||
<if test="bo.customer != null and bo.customer != ''">
|
||||
AND o.customer LIKE CONCAT('%', #{bo.customer}, '%')
|
||||
</if>
|
||||
<if test="bo.signDateStart != null">
|
||||
AND o.sign_time >= #{bo.signDateStart}
|
||||
</if>
|
||||
<if test="bo.signDateEnd != null">
|
||||
AND o.sign_time < DATE_ADD(#{bo.signDateEnd}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
<if test="bo.deliveryDateStart != null">
|
||||
AND o.delivery_date >= #{bo.deliveryDateStart}
|
||||
</if>
|
||||
<if test="bo.deliveryDateEnd != null">
|
||||
AND o.delivery_date < DATE_ADD(#{bo.deliveryDateEnd}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY o.delivery_date DESC, i.order_id ASC, i.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -268,4 +268,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY salesAmount DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询省份统计数据 -->
|
||||
<select id="selectProvinceStats" resultType="com.klp.crm.domain.vo.CrmSalesReportVo$ProvinceStat">
|
||||
SELECT
|
||||
COALESCE(c.province, '其他') as province,
|
||||
COUNT(DISTINCT c.customer_id) as customerCount,
|
||||
COUNT(o.order_id) as orderCount,
|
||||
COALESCE(SUM(o.order_amount), 0) as salesAmount
|
||||
FROM crm_order o
|
||||
LEFT JOIN crm_customer c ON o.customer_id = c.customer_id
|
||||
<include refid="selectCondition"/>
|
||||
GROUP BY c.province
|
||||
ORDER BY salesAmount DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.mes.eqp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentChecklistBo;
|
||||
import com.klp.mes.eqp.service.IEqpEquipmentChecklistService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备检验清单
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/eqp/equipmentChecklist")
|
||||
public class EqpEquipmentChecklistController extends BaseController {
|
||||
|
||||
private final IEqpEquipmentChecklistService iEqpEquipmentChecklistService;
|
||||
|
||||
/**
|
||||
* 查询设备检验清单列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqpEquipmentChecklistVo> list(EqpEquipmentChecklistBo bo, PageQuery pageQuery) {
|
||||
return iEqpEquipmentChecklistService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备检验清单列表
|
||||
*/
|
||||
@Log(title = "设备检验清单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EqpEquipmentChecklistBo bo, HttpServletResponse response) {
|
||||
List<EqpEquipmentChecklistVo> list = iEqpEquipmentChecklistService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备检验清单", EqpEquipmentChecklistVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备检验清单详细信息
|
||||
*
|
||||
* @param checkId 主键
|
||||
*/
|
||||
@GetMapping("/{checkId}")
|
||||
public R<EqpEquipmentChecklistVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long checkId) {
|
||||
return R.ok(iEqpEquipmentChecklistService.queryById(checkId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备检验清单
|
||||
*/
|
||||
@Log(title = "设备检验清单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqpEquipmentChecklistBo bo) {
|
||||
return toAjax(iEqpEquipmentChecklistService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备检验清单
|
||||
*/
|
||||
@Log(title = "设备检验清单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentChecklistBo bo) {
|
||||
return toAjax(iEqpEquipmentChecklistService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备检验清单
|
||||
*
|
||||
* @param checkIds 主键串
|
||||
*/
|
||||
@Log(title = "设备检验清单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{checkIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] checkIds) {
|
||||
return toAjax(iEqpEquipmentChecklistService.deleteWithValidByIds(Arrays.asList(checkIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.mes.eqp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionApprovalVo;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentInspectionApprovalBo;
|
||||
import com.klp.mes.eqp.service.IEqpEquipmentInspectionApprovalService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备巡检审批(按产线+时间范围审批)
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-29
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/eqp/equipmentInspectionApproval")
|
||||
public class EqpEquipmentInspectionApprovalController extends BaseController {
|
||||
|
||||
private final IEqpEquipmentInspectionApprovalService iEqpEquipmentInspectionApprovalService;
|
||||
|
||||
/**
|
||||
* 查询设备巡检审批(按产线+时间范围审批)列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqpEquipmentInspectionApprovalVo> list(EqpEquipmentInspectionApprovalBo bo, PageQuery pageQuery) {
|
||||
return iEqpEquipmentInspectionApprovalService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备巡检审批(按产线+时间范围审批)列表
|
||||
*/
|
||||
@Log(title = "设备巡检审批(按产线+时间范围审批)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EqpEquipmentInspectionApprovalBo bo, HttpServletResponse response) {
|
||||
List<EqpEquipmentInspectionApprovalVo> list = iEqpEquipmentInspectionApprovalService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备巡检审批(按产线+时间范围审批)", EqpEquipmentInspectionApprovalVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备巡检审批(按产线+时间范围审批)详细信息
|
||||
*
|
||||
* @param approvalId 主键
|
||||
*/
|
||||
@GetMapping("/{approvalId}")
|
||||
public R<EqpEquipmentInspectionApprovalVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long approvalId) {
|
||||
return R.ok(iEqpEquipmentInspectionApprovalService.queryById(approvalId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备巡检审批(按产线+时间范围审批)
|
||||
*/
|
||||
@Log(title = "设备巡检审批(按产线+时间范围审批)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqpEquipmentInspectionApprovalBo bo) {
|
||||
return toAjax(iEqpEquipmentInspectionApprovalService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备巡检审批(按产线+时间范围审批)
|
||||
*/
|
||||
@Log(title = "设备巡检审批(按产线+时间范围审批)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentInspectionApprovalBo bo) {
|
||||
return toAjax(iEqpEquipmentInspectionApprovalService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备巡检审批(按产线+时间范围审批)
|
||||
*
|
||||
* @param approvalIds 主键串
|
||||
*/
|
||||
@Log(title = "设备巡检审批(按产线+时间范围审批)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{approvalIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] approvalIds) {
|
||||
return toAjax(iEqpEquipmentInspectionApprovalService.deleteWithValidByIds(Arrays.asList(approvalIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.mes.eqp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentInspectionRecordBo;
|
||||
import com.klp.mes.eqp.service.IEqpEquipmentInspectionRecordService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备巡检记录
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/eqp/equipmentInspectionRecord")
|
||||
public class EqpEquipmentInspectionRecordController extends BaseController {
|
||||
|
||||
private final IEqpEquipmentInspectionRecordService iEqpEquipmentInspectionRecordService;
|
||||
|
||||
/**
|
||||
* 查询设备巡检记录列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqpEquipmentInspectionRecordVo> list(EqpEquipmentInspectionRecordBo bo, PageQuery pageQuery) {
|
||||
return iEqpEquipmentInspectionRecordService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备巡检记录列表
|
||||
*/
|
||||
@Log(title = "设备巡检记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EqpEquipmentInspectionRecordBo bo, HttpServletResponse response) {
|
||||
List<EqpEquipmentInspectionRecordVo> list = iEqpEquipmentInspectionRecordService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备巡检记录", EqpEquipmentInspectionRecordVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备巡检记录详细信息
|
||||
*
|
||||
* @param recordId 主键
|
||||
*/
|
||||
@GetMapping("/{recordId}")
|
||||
public R<EqpEquipmentInspectionRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long recordId) {
|
||||
return R.ok(iEqpEquipmentInspectionRecordService.queryById(recordId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备巡检记录
|
||||
*/
|
||||
@Log(title = "设备巡检记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqpEquipmentInspectionRecordBo bo) {
|
||||
return toAjax(iEqpEquipmentInspectionRecordService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备巡检记录
|
||||
*/
|
||||
@Log(title = "设备巡检记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentInspectionRecordBo bo) {
|
||||
return toAjax(iEqpEquipmentInspectionRecordService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备巡检记录
|
||||
*
|
||||
* @param recordIds 主键串
|
||||
*/
|
||||
@Log(title = "设备巡检记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{recordIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] recordIds) {
|
||||
return toAjax(iEqpEquipmentInspectionRecordService.deleteWithValidByIds(Arrays.asList(recordIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.klp.mes.eqp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentPartVo;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentPartBo;
|
||||
import com.klp.mes.eqp.service.IEqpEquipmentPartService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 检验部位
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/eqp/equipmentPart")
|
||||
public class EqpEquipmentPartController extends BaseController {
|
||||
|
||||
private final IEqpEquipmentPartService iEqpEquipmentPartService;
|
||||
|
||||
/**
|
||||
* 查询检验部位列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqpEquipmentPartVo> list(EqpEquipmentPartBo bo, PageQuery pageQuery) {
|
||||
return iEqpEquipmentPartService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出检验部位列表
|
||||
*/
|
||||
@Log(title = "检验部位", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EqpEquipmentPartBo bo, HttpServletResponse response) {
|
||||
List<EqpEquipmentPartVo> list = iEqpEquipmentPartService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "检验部位", EqpEquipmentPartVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检验部位详细信息
|
||||
*
|
||||
* @param partId 主键
|
||||
*/
|
||||
@GetMapping("/{partId}")
|
||||
public R<EqpEquipmentPartVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long partId) {
|
||||
return R.ok(iEqpEquipmentPartService.queryById(partId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增检验部位
|
||||
*/
|
||||
@Log(title = "检验部位", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqpEquipmentPartBo bo) {
|
||||
return toAjax(iEqpEquipmentPartService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改检验部位
|
||||
*/
|
||||
@Log(title = "检验部位", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentPartBo bo) {
|
||||
return toAjax(iEqpEquipmentPartService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除检验部位
|
||||
*
|
||||
* @param partIds 主键串
|
||||
*/
|
||||
@Log(title = "检验部位", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{partIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] partIds) {
|
||||
return toAjax(iEqpEquipmentPartService.deleteWithValidByIds(Arrays.asList(partIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增检验部位及检验清单
|
||||
*/
|
||||
@Log(title = "检验部位", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/batch")
|
||||
public R<Void> addBatch(@RequestBody EqpEquipmentPartBo bo) {
|
||||
return toAjax(iEqpEquipmentPartService.insertBatchByBo(bo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.klp.mes.eqp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 设备检验清单对象 eqp_equipment_checklist
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("eqp_equipment_checklist")
|
||||
public class EqpEquipmentChecklist extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 检验清单ID
|
||||
*/
|
||||
@TableId(value = "check_id")
|
||||
private Long checkId;
|
||||
/**
|
||||
* 检验编号
|
||||
*/
|
||||
private String checkNo;
|
||||
/**
|
||||
* 检验部位表
|
||||
*/
|
||||
private Long partId;
|
||||
/**
|
||||
* 设备部件名称
|
||||
*/
|
||||
private String partName;
|
||||
/**
|
||||
* 检验内容
|
||||
*/
|
||||
private String checkContent;
|
||||
/**
|
||||
* 设备状态 运行/停止
|
||||
*/
|
||||
private String equipmentState;
|
||||
/**
|
||||
* 检验标准
|
||||
*/
|
||||
private String checkStandard;
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
private String responsiblePerson;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.klp.mes.eqp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 设备巡检审批(按产线+时间范围审批)对象 eqp_equipment_inspection_approval
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("eqp_equipment_inspection_approval")
|
||||
public class EqpEquipmentInspectionApproval extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 审批ID 主键
|
||||
*/
|
||||
@TableId(value = "approval_id")
|
||||
private Long approvalId;
|
||||
/**
|
||||
* 产线ID(对应你刚改的bigint类型)
|
||||
*/
|
||||
private Long productionLine;
|
||||
/**
|
||||
* 巡检开始时间
|
||||
*/
|
||||
private Date insStartTime;
|
||||
/**
|
||||
* 巡检结束时间
|
||||
*/
|
||||
private Date insEndTime;
|
||||
/**
|
||||
* 申请人
|
||||
*/
|
||||
private String applyUser;
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
private Date applyTime;
|
||||
/**
|
||||
* 审批状态 1=待审批 2=已通过 3=已驳回 4=已撤销
|
||||
*/
|
||||
private Integer approvalStatus;
|
||||
/**
|
||||
* 审批人
|
||||
*/
|
||||
private String approvalUser;
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
private Date approvalTime;
|
||||
/**
|
||||
* 审批意见
|
||||
*/
|
||||
private String approvalOpinion;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.klp.mes.eqp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 设备巡检记录对象 eqp_equipment_inspection_record
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("eqp_equipment_inspection_record")
|
||||
public class EqpEquipmentInspectionRecord extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 巡检记录ID
|
||||
*/
|
||||
@TableId(value = "record_id")
|
||||
private Long recordId;
|
||||
/**
|
||||
* 检验清单ID
|
||||
*/
|
||||
private Long checkId;
|
||||
/**
|
||||
* 班次 1白班 2夜班
|
||||
*/
|
||||
private Integer shift;
|
||||
/**
|
||||
* 巡检时间
|
||||
*/
|
||||
private Date inspectTime;
|
||||
/**
|
||||
* 运行状态 1正常 2故障
|
||||
*/
|
||||
private Integer runStatus;
|
||||
/**
|
||||
* 巡检人
|
||||
*/
|
||||
private String inspector;
|
||||
/**
|
||||
* 异常描述
|
||||
*/
|
||||
private String abnormalDesc;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 巡检照片URL,多个用英文逗号分隔
|
||||
*/
|
||||
private String photo;
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.klp.mes.eqp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 检验部位对象 eqp_equipment_part
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("eqp_equipment_part")
|
||||
public class EqpEquipmentPart extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 巡检记录ID
|
||||
*/
|
||||
@TableId(value = "part_id")
|
||||
private Long partId;
|
||||
/**
|
||||
* 巡检部位
|
||||
*/
|
||||
private String inspectPart;
|
||||
/**
|
||||
* 产线
|
||||
*/
|
||||
private Long productionLine;
|
||||
/**
|
||||
* 产线段
|
||||
*/
|
||||
private String lineSection;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String responsiblePerson;
|
||||
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.klp.mes.eqp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 设备检验清单业务对象 eqp_equipment_checklist
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EqpEquipmentChecklistBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 检验清单ID
|
||||
*/
|
||||
private Long checkId;
|
||||
|
||||
/**
|
||||
* 检验编号
|
||||
*/
|
||||
private String checkNo;
|
||||
|
||||
/**
|
||||
* 检验部位表
|
||||
*/
|
||||
private Long partId;
|
||||
|
||||
/**
|
||||
* 设备部件名称
|
||||
*/
|
||||
private String partName;
|
||||
|
||||
/**
|
||||
* 检验内容
|
||||
*/
|
||||
private String checkContent;
|
||||
|
||||
/**
|
||||
* 设备状态 运行/停止
|
||||
*/
|
||||
private String equipmentState;
|
||||
|
||||
/**
|
||||
* 检验标准
|
||||
*/
|
||||
private String checkStandard;
|
||||
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
private String responsiblePerson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private List<Long> partIds;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.klp.mes.eqp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 设备巡检审批(按产线+时间范围审批)业务对象 eqp_equipment_inspection_approval
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-29
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EqpEquipmentInspectionApprovalBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 审批ID 主键
|
||||
*/
|
||||
private Long approvalId;
|
||||
|
||||
/**
|
||||
* 产线ID(对应你刚改的bigint类型)
|
||||
*/
|
||||
private Long productionLine;
|
||||
|
||||
/**
|
||||
* 巡检开始时间
|
||||
*/
|
||||
private Date insStartTime;
|
||||
|
||||
/**
|
||||
* 巡检结束时间
|
||||
*/
|
||||
private Date insEndTime;
|
||||
|
||||
/**
|
||||
* 申请人
|
||||
*/
|
||||
private String applyUser;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
private Date applyTime;
|
||||
|
||||
/**
|
||||
* 审批状态 1=待审批 2=已通过 3=已驳回 4=已撤销
|
||||
*/
|
||||
private Integer approvalStatus;
|
||||
|
||||
/**
|
||||
* 审批人
|
||||
*/
|
||||
private String approvalUser;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
private Date approvalTime;
|
||||
|
||||
/**
|
||||
* 审批意见
|
||||
*/
|
||||
private String approvalOpinion;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.klp.mes.eqp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 设备巡检记录业务对象 eqp_equipment_inspection_record
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EqpEquipmentInspectionRecordBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 巡检记录ID
|
||||
*/
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 检验清单ID
|
||||
*/
|
||||
private Long checkId;
|
||||
|
||||
/**
|
||||
* 班次 1白班 2夜班
|
||||
*/
|
||||
private Integer shift;
|
||||
|
||||
/**
|
||||
* 巡检时间
|
||||
*/
|
||||
private Date inspectTime;
|
||||
|
||||
/**
|
||||
* 运行状态 1正常 2故障
|
||||
*/
|
||||
private Integer runStatus;
|
||||
|
||||
/**
|
||||
* 巡检人
|
||||
*/
|
||||
private String inspector;
|
||||
|
||||
/**
|
||||
* 异常描述
|
||||
*/
|
||||
private String abnormalDesc;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 巡检照片URL,多个用英文逗号分隔
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
/**
|
||||
* 产线
|
||||
*/
|
||||
private Long productionLine;
|
||||
|
||||
/**
|
||||
* 巡检时间开始
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startInspectTime;
|
||||
|
||||
/**
|
||||
* 巡检时间结束
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endInspectTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.klp.mes.eqp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 检验部位业务对象 eqp_equipment_part
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EqpEquipmentPartBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 巡检记录ID
|
||||
*/
|
||||
private Long partId;
|
||||
|
||||
/**
|
||||
* 巡检部位
|
||||
*/
|
||||
private String inspectPart;
|
||||
|
||||
/**
|
||||
* 产线
|
||||
*/
|
||||
private Long productionLine;
|
||||
|
||||
/**
|
||||
* 产线段
|
||||
*/
|
||||
private String lineSection;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String responsiblePerson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 检验清单列表
|
||||
*/
|
||||
private List<EqpEquipmentChecklistBo> checklistList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.klp.mes.eqp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 设备检验清单视图对象 eqp_equipment_checklist
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqpEquipmentChecklistVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 检验清单ID
|
||||
*/
|
||||
@ExcelProperty(value = "检验清单ID")
|
||||
private Long checkId;
|
||||
|
||||
/**
|
||||
* 检验编号
|
||||
*/
|
||||
@ExcelProperty(value = "检验编号")
|
||||
private String checkNo;
|
||||
|
||||
/**
|
||||
* 检验部位表
|
||||
*/
|
||||
@ExcelProperty(value = "检验部位表")
|
||||
private Long partId;
|
||||
|
||||
/**
|
||||
* 设备部件名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备部件名称")
|
||||
private String partName;
|
||||
|
||||
/**
|
||||
* 检验内容
|
||||
*/
|
||||
@ExcelProperty(value = "检验内容")
|
||||
private String checkContent;
|
||||
|
||||
/**
|
||||
* 设备状态 运行/停止
|
||||
*/
|
||||
@ExcelProperty(value = "设备状态 运行/停止")
|
||||
private String equipmentState;
|
||||
|
||||
/**
|
||||
* 检验标准
|
||||
*/
|
||||
@ExcelProperty(value = "检验标准")
|
||||
private String checkStandard;
|
||||
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
@ExcelProperty(value = "责任人")
|
||||
private String responsiblePerson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.klp.mes.eqp.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 设备巡检审批(按产线+时间范围审批)视图对象 eqp_equipment_inspection_approval
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-29
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqpEquipmentInspectionApprovalVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 审批ID 主键
|
||||
*/
|
||||
@ExcelProperty(value = "审批ID 主键")
|
||||
private Long approvalId;
|
||||
|
||||
/**
|
||||
* 产线ID(对应你刚改的bigint类型)
|
||||
*/
|
||||
@ExcelProperty(value = "产线ID", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "对=应你刚改的bigint类型")
|
||||
private Long productionLine;
|
||||
|
||||
/**
|
||||
* 巡检开始时间
|
||||
*/
|
||||
@ExcelProperty(value = "巡检开始时间")
|
||||
private Date insStartTime;
|
||||
|
||||
/**
|
||||
* 巡检结束时间
|
||||
*/
|
||||
@ExcelProperty(value = "巡检结束时间")
|
||||
private Date insEndTime;
|
||||
|
||||
/**
|
||||
* 申请人
|
||||
*/
|
||||
@ExcelProperty(value = "申请人")
|
||||
private String applyUser;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
@ExcelProperty(value = "申请时间")
|
||||
private Date applyTime;
|
||||
|
||||
/**
|
||||
* 审批状态 1=待审批 2=已通过 3=已驳回 4=已撤销
|
||||
*/
|
||||
@ExcelProperty(value = "审批状态 1=待审批 2=已通过 3=已驳回 4=已撤销")
|
||||
private Integer approvalStatus;
|
||||
|
||||
/**
|
||||
* 审批人
|
||||
*/
|
||||
@ExcelProperty(value = "审批人")
|
||||
private String approvalUser;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
@ExcelProperty(value = "审批时间")
|
||||
private Date approvalTime;
|
||||
|
||||
/**
|
||||
* 审批意见
|
||||
*/
|
||||
@ExcelProperty(value = "审批意见")
|
||||
private String approvalOpinion;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.klp.mes.eqp.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 设备巡检记录视图对象 eqp_equipment_inspection_record
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqpEquipmentInspectionRecordVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 巡检记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "巡检记录ID")
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 检验清单ID
|
||||
*/
|
||||
@ExcelProperty(value = "检验清单ID")
|
||||
private Long checkId;
|
||||
|
||||
/**
|
||||
* 班次 1白班 2夜班
|
||||
*/
|
||||
@ExcelProperty(value = "班次 1白班 2夜班")
|
||||
private Integer shift;
|
||||
|
||||
/**
|
||||
* 巡检时间
|
||||
*/
|
||||
@ExcelProperty(value = "巡检时间")
|
||||
private Date inspectTime;
|
||||
|
||||
/**
|
||||
* 运行状态 1正常 2故障
|
||||
*/
|
||||
@ExcelProperty(value = "运行状态 1正常 2故障")
|
||||
private Integer runStatus;
|
||||
|
||||
/**
|
||||
* 巡检人
|
||||
*/
|
||||
@ExcelProperty(value = "巡检人")
|
||||
private String inspector;
|
||||
|
||||
/**
|
||||
* 异常描述
|
||||
*/
|
||||
@ExcelProperty(value = "异常描述")
|
||||
private String abnormalDesc;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 巡检照片URL,多个用英文逗号分隔
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
/**
|
||||
* 检验内容
|
||||
*/
|
||||
private String checkContent;
|
||||
|
||||
/**
|
||||
* 检验标准
|
||||
*/
|
||||
private String checkStandard;
|
||||
|
||||
/**
|
||||
* 巡检部位
|
||||
*/
|
||||
private String inspectPart;
|
||||
|
||||
/**
|
||||
* 产线
|
||||
*/
|
||||
private String productionLine;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.klp.mes.eqp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 检验部位视图对象 eqp_equipment_part
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqpEquipmentPartVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 巡检记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "巡检记录ID")
|
||||
private Long partId;
|
||||
|
||||
/**
|
||||
* 巡检部位
|
||||
*/
|
||||
@ExcelProperty(value = "巡检部位")
|
||||
private String inspectPart;
|
||||
|
||||
/**
|
||||
* 产线
|
||||
*/
|
||||
@ExcelProperty(value = "产线")
|
||||
private Long productionLine;
|
||||
|
||||
/**
|
||||
* 产线段
|
||||
*/
|
||||
@ExcelProperty(value = "产线段")
|
||||
private String lineSection;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ExcelProperty(value = "负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 检验清单列表
|
||||
*/
|
||||
private List<EqpEquipmentChecklistVo> checklistList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentChecklist;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备检验清单Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
public interface EqpEquipmentChecklistMapper extends BaseMapperPlus<EqpEquipmentChecklistMapper, EqpEquipmentChecklist, EqpEquipmentChecklistVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentInspectionApproval;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionApprovalVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备巡检审批(按产线+时间范围审批)Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-29
|
||||
*/
|
||||
public interface EqpEquipmentInspectionApprovalMapper extends BaseMapperPlus<EqpEquipmentInspectionApprovalMapper, EqpEquipmentInspectionApproval, EqpEquipmentInspectionApprovalVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentInspectionRecord;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 设备巡检记录Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
public interface EqpEquipmentInspectionRecordMapper extends BaseMapperPlus<EqpEquipmentInspectionRecordMapper, EqpEquipmentInspectionRecord, EqpEquipmentInspectionRecordVo> {
|
||||
|
||||
Page<EqpEquipmentInspectionRecordVo> selectVoPagePlus(Page<Object> build, @Param("ew") QueryWrapper<EqpEquipmentInspectionRecord> lqw);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentPart;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentPartVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 检验部位Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
public interface EqpEquipmentPartMapper extends BaseMapperPlus<EqpEquipmentPartMapper, EqpEquipmentPart, EqpEquipmentPartVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.mes.eqp.service;
|
||||
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentChecklist;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentChecklistBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备检验清单Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-21
|
||||
*/
|
||||
public interface IEqpEquipmentChecklistService {
|
||||
|
||||
/**
|
||||
* 查询设备检验清单
|
||||
*/
|
||||
EqpEquipmentChecklistVo queryById(Long checkId);
|
||||
|
||||
/**
|
||||
* 查询设备检验清单列表
|
||||
*/
|
||||
TableDataInfo<EqpEquipmentChecklistVo> queryPageList(EqpEquipmentChecklistBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询设备检验清单列表
|
||||
*/
|
||||
List<EqpEquipmentChecklistVo> queryList(EqpEquipmentChecklistBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备检验清单
|
||||
*/
|
||||
Boolean insertByBo(EqpEquipmentChecklistBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备检验清单
|
||||
*/
|
||||
Boolean updateByBo(EqpEquipmentChecklistBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备检验清单信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user