Compare commits
12 Commits
6733f5f641
...
SCADA系统测试
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ca5287e2 | ||
|
|
50b74f484f | ||
|
|
a102ed46f2 | ||
|
|
2ed796c1a1 | ||
| 4a4bcb3fab | |||
| a1181e49fc | |||
|
|
c11f3104cb | ||
| 5800b6b61c | |||
|
|
878961649d | ||
|
|
9461ba39e0 | ||
| 36015f26d9 | |||
| a22a573c0d |
@@ -32,19 +32,19 @@ VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslPro
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
|
||||
79
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
Normal file
79
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
-- MES 停机主类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_downtime_main_type:*
|
||||
-- 父菜单:MES基础资料 / MES资料;修改租户改 SET @mes_tenant_id
|
||||
-- 新环境也可依赖 Flyway:V3.9.2_64__mes_xsl_downtime_main_type.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机主类型是否启用', 'xslmes_downtime_main_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_main_type_status' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '停用', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000119', @mes_base_pid, '停机主类型', '/xslmes/mesXslDowntimeMainType', 'xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList', NULL, 1, NULL, '1', 18, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000121', '1860000000000000119', '编辑', 2, 'mes:mes_xsl_downtime_main_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000122', '1860000000000000119', '删除', 2, 'mes:mes_xsl_downtime_main_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000123', '1860000000000000119', '批量删除', 2, 'mes:mes_xsl_downtime_main_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000124', '1860000000000000119', '导出', 2, 'mes:mes_xsl_downtime_main_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000125', '1860000000000000119', '导入', 2, 'mes:mes_xsl_downtime_main_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000119',
|
||||
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123',
|
||||
'1860000000000000124', '1860000000000000125'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
22
jeecg-boot/db/mes-xsl-downtime-main-type.sql
Normal file
22
jeecg-boot/db/mes-xsl-downtime-main-type.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 仅建表 mes_xsl_downtime_main_type。完整初始化请执行 mes-xsl-downtime-main-type-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||
87
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
Normal file
87
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
Normal file
@@ -0,0 +1,87 @@
|
||||
-- MES 停机类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_downtime_type:*
|
||||
-- 依赖:mes_xsl_process_operation、mes_xsl_downtime_main_type;父菜单 MES基础资料
|
||||
-- Flyway:V3.9.2_65__mes_xsl_downtime_type.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 责任区分、故障等级为手填,不初始化字典;已上线库请执行 mes-xsl-downtime-type-remove-unused-dict.sql
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机类型是否启用', 'xslmes_downtime_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_type_status' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '停用', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||
`downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
`responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||
`fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdt_process` (`process_operation_id`),
|
||||
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000126', @mes_base_pid, '停机类型', '/xslmes/mesXslDowntimeType', 'xslmes/mesXslDowntimeType/MesXslDowntimeTypeList', NULL, 1, NULL, '1', 19, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000128', '1860000000000000126', '编辑', 2, 'mes:mes_xsl_downtime_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000129', '1860000000000000126', '删除', 2, 'mes:mes_xsl_downtime_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000130', '1860000000000000126', '批量删除', 2, 'mes:mes_xsl_downtime_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000131', '1860000000000000126', '导出', 2, 'mes:mes_xsl_downtime_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000132', '1860000000000000126', '导入', 2, 'mes:mes_xsl_downtime_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000126',
|
||||
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130',
|
||||
'1860000000000000131', '1860000000000000132'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
11
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
Normal file
11
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- 删除停机类型模块中已废弃的字典(责任区分、故障等级已改为手填,不再使用下拉字典)
|
||||
-- 保留:xslmes_downtime_type_status(是否启用)、xslmes_downtime_main_type_status(停机主类型是否启用)
|
||||
-- 执行后请在系统管理刷新字典缓存,或重新登录
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DELETE i FROM `sys_dict_item` i
|
||||
INNER JOIN `sys_dict` d ON i.`dict_id` = d.`id`
|
||||
WHERE d.`dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||
|
||||
DELETE FROM `sys_dict`
|
||||
WHERE `dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||
28
jeecg-boot/db/mes-xsl-downtime-type.sql
Normal file
28
jeecg-boot/db/mes-xsl-downtime-type.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- 仅建表 mes_xsl_downtime_type。完整初始化请执行 mes-xsl-downtime-type-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||
`downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
`responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||
`fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdt_process` (`process_operation_id`),
|
||||
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||
@@ -67,19 +67,19 @@ VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEqu
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
|
||||
69
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
Normal file
69
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
Normal file
@@ -0,0 +1,69 @@
|
||||
-- 设备类型菜单/按钮补全并挂到 MES基础资料(解决仅 UPDATE 时 id 077 不存在、菜单与权限均不显示)
|
||||
-- 可重复执行;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` p
|
||||
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||
SET p.`parent_id` = x.`pid`,
|
||||
p.`is_leaf` = 0,
|
||||
p.`url` = '/xslmes/mesXslEquipmentType',
|
||||
p.`component` = 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList',
|
||||
p.`hidden` = 0,
|
||||
p.`del_flag` = 0,
|
||||
p.`status` = '1',
|
||||
p.`update_time` = NOW()
|
||||
WHERE p.`menu_type` = 1
|
||||
AND p.`url` = '/xslmes/mesXslEquipmentType'
|
||||
AND p.`id` <> '1860000000000000077';
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -31,14 +31,14 @@ WHERE d.`dict_code` = 'xslmes_manufacturer_valid' AND NOT EXISTS (SELECT 1 FROM
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`manufacturer_category` varchar(32) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||
`manufacturer_name` varchar(128) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
`manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||
`manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -3,14 +3,14 @@ SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`manufacturer_category` varchar(32) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||
`manufacturer_name` varchar(128) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
`manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||
`manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
-- 工序管理、设备类别、设备类型:挂到「MES基础资料」下,并修复权限树(is_leaf)与租户 admin 授权
|
||||
-- 适用:菜单曾在 MES XSL 根下或 is_leaf=1 导致角色授权页不显示按钮权限
|
||||
-- 修改租户:改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||
'1860000000000000074', '1860000000000000075', '1860000000000000076',
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
79
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
Normal file
79
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
-- 工序管理(060)、设备类别(070):补全菜单/按钮、挂 MES基础资料、修复 is_leaf、租户 admin 授权
|
||||
-- 可重复执行;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
-- 工序管理
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||
|
||||
-- 设备类别
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||
'1860000000000000074', '1860000000000000075', '1860000000000000076'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
66
jeecg-boot/db/mes-xsl-raw-material-inspect-record-menu.sql
Normal file
66
jeecg-boot/db/mes-xsl-raw-material-inspect-record-menu.sql
Normal file
@@ -0,0 +1,66 @@
|
||||
-- 原材料送检记录菜单与权限(挂到 MES管理)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_parent_id = (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE url = '/mes' AND menu_type = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_parent_id = IFNULL(@mes_parent_id, '1860000000000000001');
|
||||
|
||||
-- 二级菜单:原材料送检记录
|
||||
INSERT INTO sys_permission(
|
||||
id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no,
|
||||
is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time
|
||||
)
|
||||
VALUES (
|
||||
'1860000000000099111', @mes_parent_id, '原材料送检记录',
|
||||
'/xslmes/mesXslRawMaterialInspectRecordList',
|
||||
'xslmes/mesXslRawMaterialInspectRecord/MesXslRawMaterialInspectRecordList',
|
||||
'MesXslRawMaterialInspectRecordList', 1, NULL, '1', 22,
|
||||
1, 1, 0, '1', 0, 1, 0, 'admin', NOW()
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
url = VALUES(url),
|
||||
component = VALUES(component),
|
||||
component_name = VALUES(component_name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
sort_no = VALUES(sort_no),
|
||||
is_route = VALUES(is_route),
|
||||
is_leaf = VALUES(is_leaf),
|
||||
hidden = VALUES(hidden),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag),
|
||||
keep_alive = VALUES(keep_alive),
|
||||
internal_or_external = VALUES(internal_or_external);
|
||||
|
||||
-- 按钮权限
|
||||
INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time) VALUES
|
||||
('1860000000000099112', '1860000000000099111', '编辑', 2, 'xslmes:mes_xsl_raw_material_inspect_record:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099113', '1860000000000099111', '导出', 2, 'xslmes:mes_xsl_raw_material_inspect_record:exportXls', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag);
|
||||
|
||||
-- admin 角色授权
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
|
||||
FROM sys_permission p
|
||||
WHERE p.id IN ('1860000000000099111', '1860000000000099112', '1860000000000099113')
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission rp
|
||||
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND rp.permission_id = p.id
|
||||
);
|
||||
36
jeecg-boot/db/mes-xsl-raw-material-inspect-record-reset.sql
Normal file
36
jeecg-boot/db/mes-xsl-raw-material-inspect-record-reset.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- 原材料送检记录测试数据重置脚本(稳妥版)
|
||||
-- 作用:
|
||||
-- 1) 将存在送检记录关联的原材料卡片检测结果重置为「未检(0)」
|
||||
-- 2) 清空原材料送检记录主表/子表数据
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
-- 执行前计数(便于确认是否命中数据)
|
||||
SELECT COUNT(1) AS before_record_count FROM mes_xsl_raw_material_inspect_record;
|
||||
SELECT COUNT(1) AS before_record_line_count FROM mes_xsl_raw_material_inspect_record_line;
|
||||
|
||||
-- 回写原材料卡片检测结果为未检(0):只重置存在送检记录关联的卡片
|
||||
UPDATE mes_xsl_raw_material_card c
|
||||
JOIN (
|
||||
SELECT DISTINCT r.raw_material_card_id AS card_id
|
||||
FROM mes_xsl_raw_material_inspect_record r
|
||||
WHERE r.raw_material_card_id IS NOT NULL
|
||||
AND r.raw_material_card_id <> ''
|
||||
) t ON t.card_id = c.id
|
||||
SET c.test_result = '0',
|
||||
c.update_time = NOW();
|
||||
|
||||
-- 先删子表,再删主表
|
||||
DELETE FROM mes_xsl_raw_material_inspect_record_line
|
||||
WHERE record_id IN (
|
||||
SELECT id FROM mes_xsl_raw_material_inspect_record
|
||||
);
|
||||
|
||||
DELETE FROM mes_xsl_raw_material_inspect_record;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- 执行后计数
|
||||
SELECT COUNT(1) AS remaining_record_count FROM mes_xsl_raw_material_inspect_record;
|
||||
SELECT COUNT(1) AS remaining_record_line_count FROM mes_xsl_raw_material_inspect_record_line;
|
||||
80
jeecg-boot/db/mes-xsl-raw-material-inspect-record.sql
Normal file
80
jeecg-boot/db/mes-xsl-raw-material-inspect-record.sql
Normal file
@@ -0,0 +1,80 @@
|
||||
-- 原材料送检记录(主表 + 子表)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_raw_material_inspect_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`raw_material_card_id` varchar(32) DEFAULT NULL COMMENT '原材料卡片ID',
|
||||
`barcode` varchar(128) DEFAULT NULL COMMENT '条码',
|
||||
`batch_no` varchar(128) DEFAULT NULL COMMENT '批次号',
|
||||
`material_id` varchar(32) DEFAULT NULL COMMENT '物料ID',
|
||||
`material_name` varchar(200) DEFAULT NULL COMMENT '物料名称',
|
||||
`inspect_status` varchar(10) DEFAULT '0' COMMENT '检验状态(字典 xslmes_inspect_status:0待检 1合格 2不合格)',
|
||||
`inspect_time` datetime DEFAULT NULL COMMENT '送检时间',
|
||||
`result_time` datetime DEFAULT NULL COMMENT '判定时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_xsl_rm_ir_card` (`raw_material_card_id`),
|
||||
KEY `idx_xsl_rm_ir_status` (`inspect_status`),
|
||||
KEY `idx_xsl_rm_ir_time` (`inspect_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='原材料送检记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_raw_material_inspect_record_line` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`record_id` varchar(32) NOT NULL COMMENT '送检记录主表ID',
|
||||
`inspect_std_id` varchar(32) DEFAULT NULL COMMENT '检验标准ID',
|
||||
`inspect_item_id` varchar(32) DEFAULT NULL COMMENT '检验项目ID',
|
||||
`inspect_item_name` varchar(200) DEFAULT NULL COMMENT '检验项目名称',
|
||||
`allow_min` decimal(24,6) DEFAULT NULL COMMENT '容许最小值',
|
||||
`include_min_flag` int NOT NULL DEFAULT '0' COMMENT '包含最小值:1是 0否',
|
||||
`allow_max` decimal(24,6) DEFAULT NULL COMMENT '容许最大值',
|
||||
`include_max_flag` int NOT NULL DEFAULT '0' COMMENT '包含最大值:1是 0否',
|
||||
`inspect_value` decimal(24,6) DEFAULT NULL COMMENT '检验值',
|
||||
`pass_flag` varchar(10) DEFAULT '0' COMMENT '判定状态(字典 xslmes_inspect_status:0待检 1合格 2不合格)',
|
||||
`sort_no` int DEFAULT NULL COMMENT '排序',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_xsl_rm_irl_record` (`record_id`),
|
||||
KEY `idx_xsl_rm_irl_item` (`inspect_item_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='原材料送检记录-检验明细';
|
||||
|
||||
-- 字典:送检状态
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`)
|
||||
SELECT REPLACE(UUID(), '-', ''), '送检状态', 'xslmes_inspect_status', '原材料送检状态:待检/合格/不合格', 0, 'admin', NOW(), 0
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_inspect_status' AND `del_flag` = 0
|
||||
);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '待检', '0', '待检', 1, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_inspect_status'
|
||||
AND d.`del_flag` = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict_item` i WHERE i.dict_id = d.id AND i.item_value = '0'
|
||||
);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '合格', '1', '合格', 2, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_inspect_status'
|
||||
AND d.`del_flag` = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict_item` i WHERE i.dict_id = d.id AND i.item_value = '1'
|
||||
);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '不合格', '2', '不合格', 3, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_inspect_status'
|
||||
AND d.`del_flag` = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict_item` i WHERE i.dict_id = d.id AND i.item_value = '2'
|
||||
);
|
||||
@@ -43,6 +43,7 @@ import org.jeecg.modules.xslmes.service.MesXslStompNotifyService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRawMaterialCardBriefVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -405,12 +406,7 @@ public class MesXslDesktopAnonController {
|
||||
if (oConvertUtils.isEmpty(mesXslWeightRecord.getPlateNumber())) {
|
||||
return Result.error("车牌号不能为空");
|
||||
}
|
||||
// 净重自动计算
|
||||
if (mesXslWeightRecord.getGrossWeight() != null && mesXslWeightRecord.getTareWeight() != null) {
|
||||
mesXslWeightRecord.setNetWeight(
|
||||
mesXslWeightRecord.getGrossWeight().subtract(mesXslWeightRecord.getTareWeight()));
|
||||
}
|
||||
applyWeightBillType(mesXslWeightRecord);
|
||||
applyWeightNetAndBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
weightRecordService.save(mesXslWeightRecord);
|
||||
stompNotify.publishWeightRecordChanged("add", mesXslWeightRecord.getId());
|
||||
@@ -423,12 +419,7 @@ public class MesXslDesktopAnonController {
|
||||
if (oConvertUtils.isEmpty(mesXslWeightRecord.getId())) {
|
||||
return Result.error("主键不能为空");
|
||||
}
|
||||
// 净重自动计算
|
||||
if (mesXslWeightRecord.getGrossWeight() != null && mesXslWeightRecord.getTareWeight() != null) {
|
||||
mesXslWeightRecord.setNetWeight(
|
||||
mesXslWeightRecord.getGrossWeight().subtract(mesXslWeightRecord.getTareWeight()));
|
||||
}
|
||||
applyWeightBillType(mesXslWeightRecord);
|
||||
applyWeightNetAndBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
boolean ok = weightRecordService.updateById(mesXslWeightRecord);
|
||||
if (!ok) {
|
||||
@@ -839,18 +830,47 @@ public class MesXslDesktopAnonController {
|
||||
|
||||
// ─────────────────────────── 车辆私有辅助 ────────────────────────────
|
||||
|
||||
private void applyWeightNetAndBillType(MesXslWeightRecord record) {
|
||||
sanitizeNonPositiveWeightsToNull(record);
|
||||
if (isEffectiveWeight(record.getGrossWeight()) && isEffectiveWeight(record.getTareWeight())) {
|
||||
BigDecimal net = record.getGrossWeight().subtract(record.getTareWeight());
|
||||
record.setNetWeight(net.compareTo(BigDecimal.ZERO) >= 0 ? net : BigDecimal.ZERO);
|
||||
} else {
|
||||
record.setNetWeight(null);
|
||||
}
|
||||
applyWeightBillType(record);
|
||||
}
|
||||
|
||||
/** 将 ≤0 的重量视为未录入,避免 JSON/Numeric 占位 0 被当成已称皮重、误判称重完成 */
|
||||
private static void sanitizeNonPositiveWeightsToNull(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getGrossWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setGrossWeight(null);
|
||||
}
|
||||
if (record.getTareWeight() != null && record.getTareWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setTareWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEffectiveWeight(BigDecimal w) {
|
||||
return w != null && w.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
private void applyWeightBillType(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getTareWeight() != null) {
|
||||
boolean g = isEffectiveWeight(record.getGrossWeight());
|
||||
boolean t = isEffectiveWeight(record.getTareWeight());
|
||||
if (g && t) {
|
||||
record.setBillType("2");
|
||||
return;
|
||||
}
|
||||
if (record.getGrossWeight() != null) {
|
||||
if (g) {
|
||||
record.setBillType("1");
|
||||
return;
|
||||
}
|
||||
if (record.getTareWeight() != null) {
|
||||
if (t) {
|
||||
record.setBillType("3");
|
||||
return;
|
||||
}
|
||||
record.setBillType(null);
|
||||
}
|
||||
|
||||
private void applyMaterialTypeDefault(MesXslWeightRecord record) {
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 停机主类型
|
||||
*/
|
||||
@Tag(name = "MES停机主类型")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslDowntimeMainType")
|
||||
@Slf4j
|
||||
public class MesXslDowntimeMainTypeController extends JeecgController<MesXslDowntimeMainType, IMesXslDowntimeMainTypeService> {
|
||||
|
||||
private static final Set<String> STATUS_VALUES = Set.of("0", "1");
|
||||
private static final Pattern COLOR_HEX = Pattern.compile("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$");
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Operation(summary = "MES停机主类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslDowntimeMainType>> queryPageList(
|
||||
MesXslDowntimeMainType model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslDowntimeMainType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型列表默认按显示顺序升序-----------
|
||||
queryWrapper.orderByAsc("display_order").orderByDesc("create_time");
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型列表默认按显示顺序升序-----------
|
||||
Page<MesXslDowntimeMainType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslDowntimeMainType> pageList = mesXslDowntimeMainTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-添加")
|
||||
@Operation(summary = "MES停机主类型-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslDowntimeMainType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
mesXslDowntimeMainTypeService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-编辑")
|
||||
@Operation(summary = "MES停机主类型-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslDowntimeMainType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
mesXslDowntimeMainTypeService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-删除")
|
||||
@Operation(summary = "MES停机主类型-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslDowntimeMainTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-批量删除")
|
||||
@Operation(summary = "MES停机主类型-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslDowntimeMainTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES停机主类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslDowntimeMainType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslDowntimeMainType entity = mesXslDowntimeMainTypeService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验停机类型是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkDowntimeType")
|
||||
public Result<String> checkDowntimeType(
|
||||
@RequestParam(name = "downtimeType", required = true) String downtimeType,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(downtimeType) || downtimeType.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslDowntimeMainType ctx = new MesXslDowntimeMainType();
|
||||
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(downtimeType.trim(), dataId, ctx)) {
|
||||
return Result.error("停机类型不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeMainType model) {
|
||||
return super.exportXls(request, model, MesXslDowntimeMainType.class, "MES停机主类型");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型导入:类型唯一、工序编码解析、颜色与启用状态校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslDowntimeMainType> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslDowntimeMainType.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> typesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslDowntimeMainType row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String dt = row.getDowntimeType();
|
||||
if (dt != null) {
|
||||
dt = dt.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dt)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条停机类型不能为空");
|
||||
}
|
||||
row.setDowntimeType(dt);
|
||||
if (!typesInFile.add(dt)) {
|
||||
return Result.error("文件导入失败:停机类型【" + dt + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(dt, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条停机类型【" + dt + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
String opCode = row.getImportOperationCode();
|
||||
if (opCode != null) {
|
||||
opCode = opCode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(opCode)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码不能为空");
|
||||
}
|
||||
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||
if (op == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在");
|
||||
}
|
||||
row.setProcessOperationId(op.getId());
|
||||
row.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (row.getDisplayOrder() == null) {
|
||||
row.setDisplayOrder(0);
|
||||
}
|
||||
String colorErr = normalizeColor(row);
|
||||
if (colorErr != null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条" + colorErr);
|
||||
}
|
||||
String st = row.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
row.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条是否启用无效(须为 0 启用或 1 停用)");
|
||||
}
|
||||
row.setStatus(st);
|
||||
}
|
||||
row.setImportOperationCode(null);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslDowntimeMainTypeService.saveBatch(list);
|
||||
log.info("停机主类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(停机类型不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型导入:类型唯一、工序编码解析、颜色与启用状态校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验与工序名称回填-----------
|
||||
private String validateForSave(MesXslDowntimeMainType model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeType()) || model.getDowntimeType().trim().isEmpty()) {
|
||||
return "停机类型不能为空";
|
||||
}
|
||||
String dt = model.getDowntimeType().trim();
|
||||
model.setDowntimeType(dt);
|
||||
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(dt, excludeId, model)) {
|
||||
return "停机类型不能重复";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||
return "请选择所属工序";
|
||||
}
|
||||
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||
if (op == null) {
|
||||
return "所属工序不存在";
|
||||
}
|
||||
model.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (model.getDisplayOrder() == null) {
|
||||
model.setDisplayOrder(0);
|
||||
}
|
||||
|
||||
String colorErr = normalizeColor(model);
|
||||
if (colorErr != null) {
|
||||
return colorErr;
|
||||
}
|
||||
|
||||
String st = model.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
model.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return "是否启用取值无效";
|
||||
}
|
||||
model.setStatus(st);
|
||||
}
|
||||
model.setImportOperationCode(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String normalizeColor(MesXslDowntimeMainType model) {
|
||||
String color = model.getDistinguishColor();
|
||||
if (oConvertUtils.isEmpty(color)) {
|
||||
model.setDistinguishColor(null);
|
||||
return null;
|
||||
}
|
||||
color = color.trim();
|
||||
if (!color.startsWith("#")) {
|
||||
color = "#" + color;
|
||||
}
|
||||
if (!COLOR_HEX.matcher(color).matches()) {
|
||||
return "区分颜色格式无效(须为十六进制色值,如 #1890ff)";
|
||||
}
|
||||
model.setDistinguishColor(color.toLowerCase());
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslDowntimeMainType context) {
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||
if (found == null || found.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return found.get(0);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验与工序名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 停机类型
|
||||
*/
|
||||
@Tag(name = "MES停机类型")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslDowntimeType")
|
||||
@Slf4j
|
||||
public class MesXslDowntimeTypeController extends JeecgController<MesXslDowntimeType, IMesXslDowntimeTypeService> {
|
||||
|
||||
private static final Set<String> STATUS_VALUES = Set.of("0", "1");
|
||||
private static final Set<String> YN_VALUES = Set.of("0", "1");
|
||||
private static final Pattern COLOR_HEX = Pattern.compile("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$");
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeTypeService mesXslDowntimeTypeService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
|
||||
|
||||
@Operation(summary = "MES停机类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslDowntimeType>> queryPageList(
|
||||
MesXslDowntimeType model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslDowntimeType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型列表默认按显示顺序升序-----------
|
||||
queryWrapper.orderByAsc("display_order").orderByDesc("create_time");
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型列表默认按显示顺序升序-----------
|
||||
Page<MesXslDowntimeType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslDowntimeType> pageList = mesXslDowntimeTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-添加")
|
||||
@Operation(summary = "MES停机类型-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslDowntimeType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
mesXslDowntimeTypeService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-编辑")
|
||||
@Operation(summary = "MES停机类型-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslDowntimeType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
mesXslDowntimeTypeService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-删除")
|
||||
@Operation(summary = "MES停机类型-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslDowntimeTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-批量删除")
|
||||
@Operation(summary = "MES停机类型-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslDowntimeTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES停机类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslDowntimeType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslDowntimeType entity = mesXslDowntimeTypeService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验停机类型是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkDowntimeType")
|
||||
public Result<String> checkDowntimeType(
|
||||
@RequestParam(name = "downtimeType", required = true) String downtimeType,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(downtimeType) || downtimeType.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslDowntimeType ctx = new MesXslDowntimeType();
|
||||
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(downtimeType.trim(), dataId, ctx)) {
|
||||
return Result.error("停机类型不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeType model) {
|
||||
return super.exportXls(request, model, MesXslDowntimeType.class, "MES停机类型");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型导入:必填校验、类型唯一、工序与主类型解析-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslDowntimeType> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslDowntimeType.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> typesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslDowntimeType row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String err = validateImportRow(row, rowNo, typesInFile);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslDowntimeTypeService.saveBatch(list);
|
||||
log.info("停机类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(停机类型不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型导入:必填校验、类型唯一、工序与主类型解析-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验、关联工序与主类型回填-----------
|
||||
private String validateForSave(MesXslDowntimeType model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||
return "请选择所属工序";
|
||||
}
|
||||
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||
if (op == null) {
|
||||
return "所属工序不存在";
|
||||
}
|
||||
model.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeMainTypeId())) {
|
||||
return "请选择所属主类型";
|
||||
}
|
||||
String mainErr = fillAndValidateMainType(model);
|
||||
if (mainErr != null) {
|
||||
return mainErr;
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeType()) || model.getDowntimeType().trim().isEmpty()) {
|
||||
return "停机类型不能为空";
|
||||
}
|
||||
String dt = model.getDowntimeType().trim();
|
||||
model.setDowntimeType(dt);
|
||||
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(dt, excludeId, model)) {
|
||||
return "停机类型不能重复";
|
||||
}
|
||||
|
||||
if (model.getDisplayOrder() == null) {
|
||||
return "显示顺序不能为空";
|
||||
}
|
||||
|
||||
String colorErr = normalizeColor(model);
|
||||
if (colorErr != null) {
|
||||
return colorErr;
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】责任区分、故障等级改为手填文本,仅 trim-----------
|
||||
model.setResponsibilityDistinct(trimToNull(model.getResponsibilityDistinct()));
|
||||
model.setFaultLevel(trimToNull(model.getFaultLevel()));
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】责任区分、故障等级改为手填文本,仅 trim-----------
|
||||
|
||||
String dm = model.getDowntimeMaintenance();
|
||||
if (oConvertUtils.isEmpty(dm)) {
|
||||
model.setDowntimeMaintenance("0");
|
||||
} else {
|
||||
dm = dm.trim();
|
||||
if (!YN_VALUES.contains(dm)) {
|
||||
return "是否停机维修取值无效";
|
||||
}
|
||||
model.setDowntimeMaintenance(dm);
|
||||
}
|
||||
|
||||
String st = model.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
model.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return "是否启用取值无效";
|
||||
}
|
||||
model.setStatus(st);
|
||||
}
|
||||
model.setImportOperationCode(null);
|
||||
model.setImportMainTypeName(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private String fillAndValidateMainType(MesXslDowntimeType model) {
|
||||
MesXslDowntimeMainType main = mesXslDowntimeMainTypeService.getById(model.getDowntimeMainTypeId());
|
||||
if (main == null) {
|
||||
return "所属主类型不存在";
|
||||
}
|
||||
if (!model.getProcessOperationId().equals(main.getProcessOperationId())) {
|
||||
return "所属主类型与所选工序不匹配";
|
||||
}
|
||||
model.setDowntimeMainTypeName(main.getDowntimeType());
|
||||
return null;
|
||||
}
|
||||
|
||||
private String validateImportRow(MesXslDowntimeType row, int rowNo, Set<String> typesInFile) {
|
||||
String opCode = row.getImportOperationCode();
|
||||
if (opCode != null) {
|
||||
opCode = opCode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(opCode)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条工序编码不能为空";
|
||||
}
|
||||
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||
if (op == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在";
|
||||
}
|
||||
row.setProcessOperationId(op.getId());
|
||||
row.setProcessOperationName(op.getOperationName());
|
||||
|
||||
String mainName = row.getImportMainTypeName();
|
||||
if (mainName != null) {
|
||||
mainName = mainName.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(mainName)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条主类型名称不能为空";
|
||||
}
|
||||
MesXslDowntimeMainType main = findMainTypeByNameAndProcess(mainName, op.getId(), row);
|
||||
if (main == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条主类型【" + mainName + "】在所选工序下不存在";
|
||||
}
|
||||
row.setDowntimeMainTypeId(main.getId());
|
||||
row.setDowntimeMainTypeName(main.getDowntimeType());
|
||||
|
||||
String dt = row.getDowntimeType();
|
||||
if (dt != null) {
|
||||
dt = dt.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dt)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条停机类型不能为空";
|
||||
}
|
||||
row.setDowntimeType(dt);
|
||||
if (!typesInFile.add(dt)) {
|
||||
return "文件导入失败:停机类型【" + dt + "】在导入文件中重复";
|
||||
}
|
||||
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(dt, null, row)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条停机类型【" + dt + "】不能重复(同租户未删除数据中已存在)";
|
||||
}
|
||||
if (row.getDisplayOrder() == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条显示顺序不能为空";
|
||||
}
|
||||
|
||||
String colorErr = normalizeColor(row);
|
||||
if (colorErr != null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条" + colorErr;
|
||||
}
|
||||
|
||||
row.setResponsibilityDistinct(trimToNull(row.getResponsibilityDistinct()));
|
||||
row.setFaultLevel(trimToNull(row.getFaultLevel()));
|
||||
|
||||
String dm = row.getDowntimeMaintenance();
|
||||
if (oConvertUtils.isEmpty(dm)) {
|
||||
row.setDowntimeMaintenance("0");
|
||||
} else {
|
||||
dm = dm.trim();
|
||||
if (!YN_VALUES.contains(dm)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条是否停机维修无效";
|
||||
}
|
||||
row.setDowntimeMaintenance(dm);
|
||||
}
|
||||
|
||||
String st = row.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
row.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条是否启用无效";
|
||||
}
|
||||
row.setStatus(st);
|
||||
}
|
||||
row.setImportOperationCode(null);
|
||||
row.setImportMainTypeName(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslDowntimeMainType findMainTypeByNameAndProcess(
|
||||
String mainTypeName, String processOperationId, MesXslDowntimeType context) {
|
||||
LambdaQueryWrapper<MesXslDowntimeMainType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslDowntimeMainType::getDowntimeType, mainTypeName.trim());
|
||||
w.eq(MesXslDowntimeMainType::getProcessOperationId, processOperationId);
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslDowntimeMainType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslDowntimeMainType::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslDowntimeMainType::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return mesXslDowntimeMainTypeService.getOne(w, false);
|
||||
}
|
||||
|
||||
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslDowntimeType context) {
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||
if (found == null || found.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return found.get(0);
|
||||
}
|
||||
|
||||
private static String trimToNull(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String v = value.trim();
|
||||
return v.isEmpty() ? null : v;
|
||||
}
|
||||
|
||||
private static String normalizeColor(MesXslDowntimeType model) {
|
||||
String color = model.getDistinguishColor();
|
||||
if (oConvertUtils.isEmpty(color)) {
|
||||
model.setDistinguishColor(null);
|
||||
return null;
|
||||
}
|
||||
color = color.trim();
|
||||
if (!color.startsWith("#")) {
|
||||
color = "#" + color;
|
||||
}
|
||||
if (!COLOR_HEX.matcher(color).matches()) {
|
||||
return "区分颜色格式无效(须为十六进制色值,如 #1890ff)";
|
||||
}
|
||||
model.setDistinguishColor(color.toLowerCase());
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验、关联工序与主类型回填-----------
|
||||
}
|
||||
@@ -12,8 +12,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
@@ -32,6 +36,8 @@ import org.jeecg.modules.print.support.PrintServerPdfJobService;
|
||||
import org.jeecg.modules.print.util.PrintBizDataMappingUtil;
|
||||
import org.jeecg.modules.xslmes.constant.MesXslPrintConstants;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialInspectRecordMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
|
||||
import org.jeecg.modules.xslmes.service.MesXslStompNotifyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -72,6 +78,8 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
private IPrintTemplateService printTemplateService;
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
@Autowired
|
||||
private MesXslRawMaterialInspectRecordMapper inspectRecordMapper;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@@ -82,8 +90,11 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
if (mesXslRawMaterialCard == null) {
|
||||
mesXslRawMaterialCard = new MesXslRawMaterialCard();
|
||||
}
|
||||
// 库区条件:去掉实体上的值避免 QueryGenerator 再拼一班;用 TRIM 与看板聚合一致(避免首尾空格导致「有汇总无明细」)
|
||||
String rawWarehouseArea = mesXslRawMaterialCard != null ? mesXslRawMaterialCard.getWarehouseArea() : null;
|
||||
String rawWarehouseArea = mesXslRawMaterialCard.getWarehouseArea();
|
||||
String areaEq = oConvertUtils.isNotEmpty(rawWarehouseArea) ? rawWarehouseArea.trim() : "";
|
||||
boolean filterByWarehouseArea = !areaEq.isEmpty();
|
||||
if (filterByWarehouseArea) {
|
||||
@@ -114,9 +125,34 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
}
|
||||
Page<MesXslRawMaterialCard> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRawMaterialCard> pageList = mesXslRawMaterialCardService.page(page, queryWrapper);
|
||||
fillPendingInspectFlag(pageList.getRecords());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
private void fillPendingInspectFlag(List<MesXslRawMaterialCard> cards) {
|
||||
if (cards == null || cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> cardIds = cards.stream()
|
||||
.map(MesXslRawMaterialCard::getId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
if (cardIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<MesXslRawMaterialInspectRecord> pendingList = inspectRecordMapper.selectList(
|
||||
new QueryWrapper<MesXslRawMaterialInspectRecord>()
|
||||
.select("raw_material_card_id")
|
||||
.in("raw_material_card_id", cardIds)
|
||||
.eq("inspect_status", "0")
|
||||
.groupBy("raw_material_card_id"));
|
||||
Set<String> pendingCardIds = pendingList == null ? Collections.emptySet() : pendingList.stream()
|
||||
.map(MesXslRawMaterialInspectRecord::getRawMaterialCardId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
cards.forEach(card -> card.setHasPendingInspect(pendingCardIds.contains(card.getId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialInspectRecordService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectRecordPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Tag(name = "原材料送检记录")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRawMaterialInspectRecord")
|
||||
public class MesXslRawMaterialInspectRecordController
|
||||
extends JeecgController<MesXslRawMaterialInspectRecord, IMesXslRawMaterialInspectRecordService> {
|
||||
|
||||
@Autowired private IMesXslRawMaterialInspectRecordService inspectRecordService;
|
||||
|
||||
@Operation(summary = "原材料送检记录-分页列表查询")
|
||||
@GetMapping("/list")
|
||||
public Result<IPage<MesXslRawMaterialInspectRecord>> queryPageList(
|
||||
MesXslRawMaterialInspectRecord query,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRawMaterialInspectRecord> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(query, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("inspect_time");
|
||||
IPage<MesXslRawMaterialInspectRecord> pageList =
|
||||
inspectRecordService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "原材料送检记录-送检")
|
||||
@Operation(summary = "原材料送检记录-送检(由原材料卡片生成)")
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:edit")
|
||||
@PostMapping("/createByCard")
|
||||
public Result<MesXslRawMaterialInspectRecord> createByCard(@RequestBody Map<String, Object> body) {
|
||||
String rawMaterialCardId =
|
||||
body.get("rawMaterialCardId") == null ? "" : body.get("rawMaterialCardId").toString();
|
||||
if (StringUtils.isBlank(rawMaterialCardId)) {
|
||||
return Result.error("rawMaterialCardId不能为空");
|
||||
}
|
||||
MesXslRawMaterialInspectRecord record =
|
||||
inspectRecordService.createByRawMaterialCardId(rawMaterialCardId.trim());
|
||||
return Result.OK("送检成功", record);
|
||||
}
|
||||
|
||||
@Operation(summary = "原材料送检记录-通过id查询")
|
||||
@GetMapping("/queryById")
|
||||
public Result<MesXslRawMaterialInspectRecord> queryById(@RequestParam(name = "id") String id) {
|
||||
MesXslRawMaterialInspectRecord db = inspectRecordService.getById(id);
|
||||
if (db == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(db);
|
||||
}
|
||||
|
||||
@Operation(summary = "原材料送检记录-按主表查询子表")
|
||||
@GetMapping("/queryLineListByRecordId")
|
||||
public Result<List<MesXslRawMaterialInspectRecordLine>> queryLineListByRecordId(
|
||||
@RequestParam(name = "id") String id) {
|
||||
return Result.OK(inspectRecordService.selectLinesByRecordId(id));
|
||||
}
|
||||
|
||||
@AutoLog(value = "原材料送检记录-录入检验结果前加载明细")
|
||||
@Operation(summary = "原材料送检记录-录入检验结果前加载明细")
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_inspect_record:edit")
|
||||
@PostMapping("/prepareResultEntry")
|
||||
public Result<List<MesXslRawMaterialInspectRecordLine>> prepareResultEntry(
|
||||
@RequestBody Map<String, Object> body) {
|
||||
String id = body.get("id") == null ? "" : body.get("id").toString();
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return Result.error("id不能为空");
|
||||
}
|
||||
return Result.OK(inspectRecordService.prepareResultEntryLines(id.trim()));
|
||||
}
|
||||
|
||||
@AutoLog(value = "原材料送检记录-保存检验结果")
|
||||
@Operation(summary = "原材料送检记录-保存检验结果")
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_inspect_record:edit")
|
||||
@PostMapping("/saveInspectResult")
|
||||
public Result<String> saveInspectResult(@RequestBody MesXslRawMaterialInspectRecordPage page) {
|
||||
if (StringUtils.isBlank(page.getId())) {
|
||||
return Result.error("id不能为空");
|
||||
}
|
||||
inspectRecordService.saveInspectResult(page.getId(), page.getLineList());
|
||||
return Result.OK("保存成功");
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_inspect_record:exportXls")
|
||||
@RequestMapping("/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRawMaterialInspectRecord query) {
|
||||
return super.exportXls(request, query, MesXslRawMaterialInspectRecord.class, "原材料送检记录");
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,8 @@ public class MesXslRawMaterialSummaryController {
|
||||
.append("AND (w.del_flag = 0 OR w.del_flag IS NULL) ")
|
||||
.append("LEFT JOIN mes_mixer_material m ON m.id = i.material_id ")
|
||||
.append("AND (m.del_flag = 0 OR m.del_flag IS NULL) ")
|
||||
.append("WHERE (i.del_flag = 0 OR i.del_flag IS NULL) ");
|
||||
// mes_xsl_raw_material_inventory 表当前无 del_flag 字段,这里使用恒真条件避免 SQL 报错
|
||||
.append("WHERE 1=1 ");
|
||||
|
||||
if (query != null && StringUtils.isNotBlank(query.getWarehouseName())) {
|
||||
sql.append("AND ").append(warehouseExpr).append(" LIKE ? ");
|
||||
|
||||
@@ -72,9 +72,9 @@ public class MesXslWeightRecordController extends JeecgController<MesXslWeightRe
|
||||
String seq = String.format("%03d", new Random().nextInt(1000));
|
||||
mesXslWeightRecord.setBillNo("BDH-" + dateStr + seq);
|
||||
}
|
||||
computeBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
computeNetWeight(mesXslWeightRecord);
|
||||
computeBillType(mesXslWeightRecord);
|
||||
mesXslWeightRecordService.save(mesXslWeightRecord);
|
||||
stompNotifyService.publishWeightRecordChanged("add", mesXslWeightRecord.getId());
|
||||
return Result.OK("添加成功!");
|
||||
@@ -85,9 +85,9 @@ public class MesXslWeightRecordController extends JeecgController<MesXslWeightRe
|
||||
@RequiresPermissions("xslmes:mes_xsl_weight_record:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslWeightRecord mesXslWeightRecord) {
|
||||
computeBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
computeNetWeight(mesXslWeightRecord);
|
||||
computeBillType(mesXslWeightRecord);
|
||||
mesXslWeightRecordService.updateById(mesXslWeightRecord);
|
||||
stompNotifyService.publishWeightRecordChanged("edit", mesXslWeightRecord.getId());
|
||||
return Result.OK("编辑成功!");
|
||||
@@ -137,26 +137,47 @@ public class MesXslWeightRecordController extends JeecgController<MesXslWeightRe
|
||||
}
|
||||
|
||||
private void computeNetWeight(MesXslWeightRecord record) {
|
||||
sanitizeNonPositiveWeightsToNull(record);
|
||||
BigDecimal gross = record.getGrossWeight();
|
||||
BigDecimal tare = record.getTareWeight();
|
||||
if (gross != null && tare != null) {
|
||||
if (isEffectiveWeight(gross) && isEffectiveWeight(tare)) {
|
||||
BigDecimal net = gross.subtract(tare);
|
||||
record.setNetWeight(net.compareTo(BigDecimal.ZERO) >= 0 ? net : BigDecimal.ZERO);
|
||||
} else {
|
||||
record.setNetWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void computeBillType(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getTareWeight() != null) {
|
||||
boolean g = isEffectiveWeight(record.getGrossWeight());
|
||||
boolean t = isEffectiveWeight(record.getTareWeight());
|
||||
if (g && t) {
|
||||
record.setBillType("2");
|
||||
return;
|
||||
}
|
||||
if (record.getGrossWeight() != null) {
|
||||
if (g) {
|
||||
record.setBillType("1");
|
||||
return;
|
||||
}
|
||||
if (record.getTareWeight() != null) {
|
||||
if (t) {
|
||||
record.setBillType("3");
|
||||
return;
|
||||
}
|
||||
record.setBillType(null);
|
||||
}
|
||||
|
||||
/** 将 ≤0 的重量视为未录入,避免占位 0 误判称重完成 */
|
||||
private static void sanitizeNonPositiveWeightsToNull(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getGrossWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setGrossWeight(null);
|
||||
}
|
||||
if (record.getTareWeight() != null && record.getTareWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setTareWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEffectiveWeight(BigDecimal w) {
|
||||
return w != null && w.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
private void applyMaterialTypeDefault(MesXslWeightRecord record) {
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 停机主类型(表 mes_xsl_downtime_main_type)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_downtime_main_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES停机主类型")
|
||||
public class MesXslDowntimeMainType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属工序主键")
|
||||
private String processOperationId;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称冗余")
|
||||
private String processOperationName;
|
||||
|
||||
@Excel(name = "停机类型", width = 24)
|
||||
@Schema(description = "停机类型(同租户未删除数据中唯一)")
|
||||
private String downtimeType;
|
||||
|
||||
@Excel(name = "显示顺序", width = 12)
|
||||
@Schema(description = "显示顺序(升序)")
|
||||
private Integer displayOrder;
|
||||
|
||||
@Excel(name = "区分颜色", width = 16)
|
||||
@Schema(description = "区分颜色(十六进制色值)")
|
||||
private String distinguishColor;
|
||||
|
||||
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_downtime_main_type_status")
|
||||
@Dict(dicCode = "xslmes_downtime_main_type_status")
|
||||
@Schema(description = "是否启用(字典 xslmes_downtime_main_type_status:0启用1停用)")
|
||||
private String status;
|
||||
|
||||
/** Excel 导入用:工序编码,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "工序编码", width = 18)
|
||||
@Schema(description = "导入用工序编码")
|
||||
private String importOperationCode;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 停机类型(表 mes_xsl_downtime_type)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_downtime_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES停机类型")
|
||||
public class MesXslDowntimeType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属工序主键")
|
||||
private String processOperationId;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称冗余")
|
||||
private String processOperationName;
|
||||
|
||||
@Schema(description = "所属停机主类型主键")
|
||||
private String downtimeMainTypeId;
|
||||
|
||||
@Excel(name = "所属主类型", width = 24)
|
||||
@Schema(description = "主类型名称冗余")
|
||||
private String downtimeMainTypeName;
|
||||
|
||||
@Excel(name = "停机类型", width = 24)
|
||||
@Schema(description = "停机类型(同租户未删除数据中唯一)")
|
||||
private String downtimeType;
|
||||
|
||||
@Excel(name = "显示顺序", width = 12)
|
||||
@Schema(description = "显示顺序(升序,必填)")
|
||||
private Integer displayOrder;
|
||||
|
||||
@Excel(name = "区分颜色", width = 16)
|
||||
@Schema(description = "区分颜色(十六进制色值)")
|
||||
private String distinguishColor;
|
||||
|
||||
@Excel(name = "责任区分", width = 20)
|
||||
@Schema(description = "责任区分(手填)")
|
||||
private String responsibilityDistinct;
|
||||
|
||||
@Excel(name = "故障等级", width = 16)
|
||||
@Schema(description = "故障等级(手填)")
|
||||
private String faultLevel;
|
||||
|
||||
@Excel(name = "是否停机维修", width = 14, dicCode = "yn")
|
||||
@Dict(dicCode = "yn")
|
||||
@Schema(description = "是否停机维修(字典 yn:1是0否)")
|
||||
private String downtimeMaintenance;
|
||||
|
||||
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_downtime_type_status")
|
||||
@Dict(dicCode = "xslmes_downtime_type_status")
|
||||
@Schema(description = "是否启用(字典 xslmes_downtime_type_status:0启用1停用)")
|
||||
private String status;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "工序编码", width = 18)
|
||||
@Schema(description = "导入用工序编码")
|
||||
private String importOperationCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "主类型名称", width = 24)
|
||||
@Schema(description = "导入用停机主类型名称")
|
||||
private String importMainTypeName;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -138,4 +139,8 @@ public class MesXslRawMaterialCard implements Serializable {
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "是否存在待检送检记录(前端控制送检按钮显隐)")
|
||||
private Boolean hasPendingInspect;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Data
|
||||
@TableName("mes_xsl_raw_material_inspect_record")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "原材料送检记录")
|
||||
public class MesXslRawMaterialInspectRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "原材料卡片ID")
|
||||
private String rawMaterialCardId;
|
||||
|
||||
@Excel(name = "条码", width = 20)
|
||||
@Schema(description = "条码")
|
||||
private String barcode;
|
||||
|
||||
@Excel(name = "批次号", width = 20)
|
||||
@Schema(description = "批次号")
|
||||
private String batchNo;
|
||||
|
||||
@Schema(description = "物料ID")
|
||||
private String materialId;
|
||||
|
||||
@Excel(name = "物料名称", width = 20)
|
||||
@Schema(description = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Excel(name = "检验状态", width = 12, dicCode = "xslmes_inspect_status")
|
||||
@Dict(dicCode = "xslmes_inspect_status")
|
||||
@Schema(description = "检验状态(xslmes_inspect_status:0待检 1合格 2不合格)")
|
||||
private String inspectStatus;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "送检时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "送检时间")
|
||||
private Date inspectTime;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "判定时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "判定时间")
|
||||
private Date resultTime;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "送检明细")
|
||||
private List<MesXslRawMaterialInspectRecordLine> lineList;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Data
|
||||
@TableName("mes_xsl_raw_material_inspect_record_line")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "原材料送检记录-检验明细")
|
||||
public class MesXslRawMaterialInspectRecordLine implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "送检记录主表ID")
|
||||
private String recordId;
|
||||
|
||||
@Schema(description = "检验标准ID")
|
||||
private String inspectStdId;
|
||||
|
||||
@Schema(description = "检验项目ID")
|
||||
private String inspectItemId;
|
||||
|
||||
@Schema(description = "检验项目名称")
|
||||
private String inspectItemName;
|
||||
|
||||
@Schema(description = "容许最小值")
|
||||
private BigDecimal allowMin;
|
||||
|
||||
@Schema(description = "包含最小值 1是 0否")
|
||||
private Integer includeMinFlag;
|
||||
|
||||
@Schema(description = "容许最大值")
|
||||
private BigDecimal allowMax;
|
||||
|
||||
@Schema(description = "包含最大值 1是 0否")
|
||||
private Integer includeMaxFlag;
|
||||
|
||||
@Schema(description = "检验值")
|
||||
private BigDecimal inspectValue;
|
||||
|
||||
@Dict(dicCode = "xslmes_inspect_status")
|
||||
@Schema(description = "明细判定状态(xslmes_inspect_status:0待检 1合格 2不合格)")
|
||||
private String passFlag;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sortNo;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
|
||||
/**
|
||||
* MES 停机主类型
|
||||
*/
|
||||
public interface MesXslDowntimeMainTypeMapper extends BaseMapper<MesXslDowntimeMainType> {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
|
||||
/**
|
||||
* MES 停机类型
|
||||
*/
|
||||
public interface MesXslDowntimeTypeMapper extends BaseMapper<MesXslDowntimeType> {}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
|
||||
public interface MesXslRawMaterialInspectRecordLineMapper
|
||||
extends BaseMapper<MesXslRawMaterialInspectRecordLine> {}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
|
||||
public interface MesXslRawMaterialInspectRecordMapper
|
||||
extends BaseMapper<MesXslRawMaterialInspectRecord> {}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* MES XSL 业务模块(Maven 工程名:jeecg-module-xslmes)。
|
||||
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、备品件类别({@link org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory})、备品件信息({@link org.jeecg.modules.xslmes.entity.MesXslSparePart})、厂家信息({@link org.jeecg.modules.xslmes.entity.MesXslManufacturer})等。
|
||||
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、备品件类别({@link org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory})、备品件信息({@link org.jeecg.modules.xslmes.entity.MesXslSparePart})、厂家信息({@link org.jeecg.modules.xslmes.entity.MesXslManufacturer})、停机主类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType})、停机类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeType})等。
|
||||
*/
|
||||
package org.jeecg.modules.xslmes;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
|
||||
public interface IMesXslDowntimeMainTypeService extends IService<MesXslDowntimeMainType> {
|
||||
|
||||
/**
|
||||
* 停机类型是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||
*
|
||||
* @param downtimeType 停机类型(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeMainType context);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
|
||||
public interface IMesXslDowntimeTypeService extends IService<MesXslDowntimeType> {
|
||||
|
||||
/**
|
||||
* 停机类型名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||
*/
|
||||
boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeType context);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
|
||||
public interface IMesXslRawMaterialInspectRecordService
|
||||
extends IService<MesXslRawMaterialInspectRecord> {
|
||||
|
||||
MesXslRawMaterialInspectRecord createByRawMaterialCardId(String rawMaterialCardId);
|
||||
|
||||
List<MesXslRawMaterialInspectRecordLine> selectLinesByRecordId(String recordId);
|
||||
|
||||
List<MesXslRawMaterialInspectRecordLine> prepareResultEntryLines(String recordId);
|
||||
|
||||
void saveInspectResult(String recordId, List<MesXslRawMaterialInspectRecordLine> lineList);
|
||||
|
||||
String evaluatePassFlag(
|
||||
BigDecimal inspectValue,
|
||||
BigDecimal allowMin,
|
||||
Integer includeMinFlag,
|
||||
BigDecimal allowMax,
|
||||
Integer includeMaxFlag);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeMainTypeMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslDowntimeMainTypeServiceImpl extends ServiceImpl<MesXslDowntimeMainTypeMapper, MesXslDowntimeMainType>
|
||||
implements IMesXslDowntimeMainTypeService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeMainType context) {
|
||||
if (oConvertUtils.isEmpty(downtimeType)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslDowntimeMainType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslDowntimeMainType::getDowntimeType, downtimeType.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslDowntimeMainType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslDowntimeMainType::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslDowntimeMainType::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslDowntimeMainType::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslDowntimeMainType context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeTypeMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslDowntimeTypeServiceImpl extends ServiceImpl<MesXslDowntimeTypeMapper, MesXslDowntimeType>
|
||||
implements IMesXslDowntimeTypeService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeType context) {
|
||||
if (oConvertUtils.isEmpty(downtimeType)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslDowntimeType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslDowntimeType::getDowntimeType, downtimeType.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslDowntimeType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslDowntimeType::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslDowntimeType::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslDowntimeType::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslDowntimeType context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.entity.MesMixerMaterial;
|
||||
import org.jeecg.modules.mes.material.entity.MesRawMaterialInspectStd;
|
||||
import org.jeecg.modules.mes.material.entity.MesRawMaterialInspectStdLine;
|
||||
import org.jeecg.modules.mes.material.mapper.MesMaterialMapper;
|
||||
import org.jeecg.modules.mes.material.mapper.MesMixerMaterialMapper;
|
||||
import org.jeecg.modules.mes.material.mapper.MesRawMaterialInspectStdLineMapper;
|
||||
import org.jeecg.modules.mes.material.mapper.MesRawMaterialInspectStdMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialInspectRecordLineMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialInspectRecordMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialInspectRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MesXslRawMaterialInspectRecordServiceImpl
|
||||
extends ServiceImpl<MesXslRawMaterialInspectRecordMapper, MesXslRawMaterialInspectRecord>
|
||||
implements IMesXslRawMaterialInspectRecordService {
|
||||
|
||||
private static final String CARD_TEST_RESULT_UNTESTED = "0";
|
||||
private static final String CARD_TEST_RESULT_PASS = "1";
|
||||
private static final String CARD_TEST_RESULT_FAIL = "2";
|
||||
private static final String STATUS_PENDING = "0";
|
||||
private static final String STATUS_PASS = "1";
|
||||
private static final String STATUS_FAIL = "2";
|
||||
|
||||
@Autowired private IMesXslRawMaterialCardService rawMaterialCardService;
|
||||
@Autowired private MesXslRawMaterialInspectRecordLineMapper recordLineMapper;
|
||||
@Autowired private MesMaterialMapper mesMaterialMapper;
|
||||
@Autowired private MesMixerMaterialMapper mesMixerMaterialMapper;
|
||||
@Autowired private MesRawMaterialInspectStdMapper inspectStdMapper;
|
||||
@Autowired private MesRawMaterialInspectStdLineMapper inspectStdLineMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MesXslRawMaterialInspectRecord createByRawMaterialCardId(String rawMaterialCardId) {
|
||||
MesXslRawMaterialCard card = rawMaterialCardService.getById(rawMaterialCardId);
|
||||
if (card == null) {
|
||||
throw new JeecgBootException("未找到原材料卡片");
|
||||
}
|
||||
long pendingCount =
|
||||
this.lambdaQuery()
|
||||
.eq(MesXslRawMaterialInspectRecord::getRawMaterialCardId, rawMaterialCardId)
|
||||
.eq(MesXslRawMaterialInspectRecord::getInspectStatus, STATUS_PENDING)
|
||||
.count();
|
||||
if (pendingCount > 0) {
|
||||
throw new JeecgBootException("该原材料卡片已存在待检送检记录,不能重复送检");
|
||||
}
|
||||
String cardTestResult = normalize(card.getTestResult());
|
||||
if (StringUtils.isNotBlank(cardTestResult) && !CARD_TEST_RESULT_UNTESTED.equals(cardTestResult)) {
|
||||
throw new JeecgBootException("仅未检状态的原材料卡片允许送检");
|
||||
}
|
||||
MesXslRawMaterialInspectRecord entity = new MesXslRawMaterialInspectRecord();
|
||||
entity.setRawMaterialCardId(card.getId());
|
||||
entity.setBarcode(card.getBarcode());
|
||||
entity.setBatchNo(card.getBatchNo());
|
||||
entity.setMaterialId(card.getMaterialId());
|
||||
entity.setMaterialName(card.getMaterialName());
|
||||
entity.setInspectStatus(STATUS_PENDING);
|
||||
entity.setInspectTime(new Date());
|
||||
this.save(entity);
|
||||
// 送检后将卡片检测结果置为待检
|
||||
MesXslRawMaterialCard updateCard = new MesXslRawMaterialCard();
|
||||
updateCard.setId(card.getId());
|
||||
updateCard.setTestResult(CARD_TEST_RESULT_UNTESTED);
|
||||
rawMaterialCardService.updateById(updateCard);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MesXslRawMaterialInspectRecordLine> selectLinesByRecordId(String recordId) {
|
||||
return recordLineMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslRawMaterialInspectRecordLine>()
|
||||
.eq(MesXslRawMaterialInspectRecordLine::getRecordId, recordId)
|
||||
.orderByAsc(MesXslRawMaterialInspectRecordLine::getSortNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<MesXslRawMaterialInspectRecordLine> prepareResultEntryLines(String recordId) {
|
||||
MesXslRawMaterialInspectRecord record = this.getById(recordId);
|
||||
if (record == null) {
|
||||
throw new JeecgBootException("送检记录不存在");
|
||||
}
|
||||
List<MesXslRawMaterialInspectRecordLine> current = selectLinesByRecordId(recordId);
|
||||
if (!current.isEmpty()) {
|
||||
return current;
|
||||
}
|
||||
|
||||
MesRawMaterialInspectStd std = resolveEnableInspectStd(record.getMaterialId(), record.getMaterialName());
|
||||
if (std == null) {
|
||||
throw new JeecgBootException("未找到已启用的原材料检验标准,请先维护并启用检验标准");
|
||||
}
|
||||
List<MesRawMaterialInspectStdLine> stdLines =
|
||||
inspectStdLineMapper.selectList(
|
||||
new LambdaQueryWrapper<MesRawMaterialInspectStdLine>()
|
||||
.eq(MesRawMaterialInspectStdLine::getStdId, std.getId())
|
||||
.orderByAsc(MesRawMaterialInspectStdLine::getSortNo));
|
||||
if (stdLines.isEmpty()) {
|
||||
throw new JeecgBootException("当前检验标准未配置明细检验项目");
|
||||
}
|
||||
|
||||
int sortNo = 0;
|
||||
List<MesXslRawMaterialInspectRecordLine> out = new ArrayList<>(stdLines.size());
|
||||
for (MesRawMaterialInspectStdLine stdLine : stdLines) {
|
||||
MesXslRawMaterialInspectRecordLine line = new MesXslRawMaterialInspectRecordLine();
|
||||
line.setRecordId(recordId);
|
||||
line.setInspectStdId(std.getId());
|
||||
line.setInspectItemId(stdLine.getInspectItemId());
|
||||
line.setInspectItemName(stdLine.getInspectItemName());
|
||||
line.setAllowMin(stdLine.getAllowMin());
|
||||
line.setIncludeMinFlag(stdLine.getIncludeMinFlag() == null ? 0 : stdLine.getIncludeMinFlag());
|
||||
line.setAllowMax(stdLine.getAllowMax());
|
||||
line.setIncludeMaxFlag(stdLine.getIncludeMaxFlag() == null ? 0 : stdLine.getIncludeMaxFlag());
|
||||
line.setPassFlag(STATUS_PENDING);
|
||||
line.setSortNo(sortNo++);
|
||||
recordLineMapper.insert(line);
|
||||
out.add(line);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveInspectResult(String recordId, List<MesXslRawMaterialInspectRecordLine> lineList) {
|
||||
MesXslRawMaterialInspectRecord record = this.getById(recordId);
|
||||
if (record == null) {
|
||||
throw new JeecgBootException("送检记录不存在");
|
||||
}
|
||||
if (lineList == null || lineList.isEmpty()) {
|
||||
throw new JeecgBootException("请至少录入一条检验结果");
|
||||
}
|
||||
|
||||
boolean allPass = true;
|
||||
for (MesXslRawMaterialInspectRecordLine line : lineList) {
|
||||
if (StringUtils.isBlank(line.getId())) {
|
||||
throw new JeecgBootException("明细ID不能为空,请刷新后重试");
|
||||
}
|
||||
MesXslRawMaterialInspectRecordLine dbLine = recordLineMapper.selectById(line.getId());
|
||||
if (dbLine == null || !recordId.equals(dbLine.getRecordId())) {
|
||||
throw new JeecgBootException("明细不存在或不属于当前送检记录");
|
||||
}
|
||||
String passFlag =
|
||||
evaluatePassFlag(
|
||||
line.getInspectValue(),
|
||||
dbLine.getAllowMin(),
|
||||
dbLine.getIncludeMinFlag(),
|
||||
dbLine.getAllowMax(),
|
||||
dbLine.getIncludeMaxFlag());
|
||||
dbLine.setInspectValue(line.getInspectValue());
|
||||
dbLine.setPassFlag(passFlag);
|
||||
recordLineMapper.updateById(dbLine);
|
||||
if (!STATUS_PASS.equals(passFlag)) {
|
||||
allPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
record.setInspectStatus(allPass ? STATUS_PASS : STATUS_FAIL);
|
||||
record.setResultTime(new Date());
|
||||
this.updateById(record);
|
||||
// 判定完成后回写原材料卡片检测结果
|
||||
if (StringUtils.isNotBlank(record.getRawMaterialCardId())) {
|
||||
MesXslRawMaterialCard card = new MesXslRawMaterialCard();
|
||||
card.setId(record.getRawMaterialCardId());
|
||||
card.setTestResult(allPass ? CARD_TEST_RESULT_PASS : CARD_TEST_RESULT_FAIL);
|
||||
rawMaterialCardService.updateById(card);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String evaluatePassFlag(
|
||||
BigDecimal inspectValue,
|
||||
BigDecimal allowMin,
|
||||
Integer includeMinFlag,
|
||||
BigDecimal allowMax,
|
||||
Integer includeMaxFlag) {
|
||||
if (inspectValue == null) {
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
if (allowMin != null) {
|
||||
int cmpMin = inspectValue.compareTo(allowMin);
|
||||
boolean includeMin = includeMinFlag != null && includeMinFlag == 1;
|
||||
if (includeMin ? cmpMin < 0 : cmpMin <= 0) {
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
if (allowMax != null) {
|
||||
int cmpMax = inspectValue.compareTo(allowMax);
|
||||
boolean includeMax = includeMaxFlag != null && includeMaxFlag == 1;
|
||||
if (includeMax ? cmpMax > 0 : cmpMax >= 0) {
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
return STATUS_PASS;
|
||||
}
|
||||
|
||||
private MesRawMaterialInspectStd resolveEnableInspectStd(String materialId, String materialName) {
|
||||
String normalizedMaterialId = normalize(materialId);
|
||||
if (StringUtils.isBlank(normalizedMaterialId)) {
|
||||
log.warn("送检标准匹配失败:送检记录物料ID为空,materialName={}", materialName);
|
||||
return null;
|
||||
}
|
||||
List<MesRawMaterialInspectStd> allStds =
|
||||
inspectStdMapper.selectList(
|
||||
new LambdaQueryWrapper<MesRawMaterialInspectStd>()
|
||||
.and(
|
||||
w ->
|
||||
w.eq(MesRawMaterialInspectStd::getDelFlag, 0)
|
||||
.or()
|
||||
.isNull(MesRawMaterialInspectStd::getDelFlag))
|
||||
.orderByDesc(MesRawMaterialInspectStd::getEnableFlag)
|
||||
.orderByDesc(MesRawMaterialInspectStd::getEffectiveDate)
|
||||
.orderByDesc(MesRawMaterialInspectStd::getCreateTime));
|
||||
if (allStds.isEmpty()) {
|
||||
log.warn("送检标准匹配失败:没有可用检验标准,materialId={}", materialId);
|
||||
return null;
|
||||
}
|
||||
|
||||
String mappedMixerMaterialId = mapMaterialIdToMixerMaterialId(normalizedMaterialId);
|
||||
|
||||
// 第一优先级:仅在启用标准中匹配
|
||||
MesRawMaterialInspectStd matchedEnabled = matchByMaterialId(allStds, normalizedMaterialId, mappedMixerMaterialId, true);
|
||||
if (matchedEnabled != null) {
|
||||
return matchedEnabled;
|
||||
}
|
||||
|
||||
// 第二优先级:若未启用标准,则回退到同物料最新标准(避免业务无法录入)
|
||||
MesRawMaterialInspectStd matchedAny = matchByMaterialId(allStds, normalizedMaterialId, mappedMixerMaterialId, false);
|
||||
if (matchedAny != null) {
|
||||
log.warn(
|
||||
"送检标准未找到启用版本,已回退到未启用标准 stdId={}, materialId={}, mappedMixerMaterialId={}, enableFlag={}",
|
||||
matchedAny.getId(),
|
||||
materialId,
|
||||
mappedMixerMaterialId,
|
||||
matchedAny.getEnableFlag());
|
||||
return matchedAny;
|
||||
}
|
||||
|
||||
log.warn(
|
||||
"送检标准匹配失败(仅物料ID匹配),materialId={}, mappedMixerMaterialId={}, materialName={}, stdCount={}",
|
||||
materialId,
|
||||
mappedMixerMaterialId,
|
||||
materialName,
|
||||
allStds.size());
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesRawMaterialInspectStd matchByMaterialId(
|
||||
List<MesRawMaterialInspectStd> standards,
|
||||
String normalizedMaterialId,
|
||||
String mappedMixerMaterialId,
|
||||
boolean onlyEnabled) {
|
||||
for (MesRawMaterialInspectStd std : standards) {
|
||||
if (onlyEnabled && !Objects.equals(std.getEnableFlag(), 1)) {
|
||||
continue;
|
||||
}
|
||||
String stdMaterialId = normalize(std.getMixerMaterialId());
|
||||
if (Objects.equals(normalizedMaterialId, stdMaterialId)) {
|
||||
return std;
|
||||
}
|
||||
if (StringUtils.isNotBlank(mappedMixerMaterialId) && Objects.equals(mappedMixerMaterialId, stdMaterialId)) {
|
||||
return std;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String mapMaterialIdToMixerMaterialId(String materialId) {
|
||||
MesMaterial material = mesMaterialMapper.selectById(materialId);
|
||||
if (material == null || StringUtils.isBlank(material.getMaterialCode())) {
|
||||
return null;
|
||||
}
|
||||
MesMixerMaterial mixerMaterial =
|
||||
mesMixerMaterialMapper.selectOne(
|
||||
new LambdaQueryWrapper<MesMixerMaterial>()
|
||||
.eq(MesMixerMaterial::getMaterialCode, StringUtils.trimToEmpty(material.getMaterialCode()))
|
||||
.last("LIMIT 1"));
|
||||
return mixerMaterial == null ? null : normalize(mixerMaterial.getId());
|
||||
}
|
||||
|
||||
private String normalize(String value) {
|
||||
return StringUtils.trimToEmpty(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
|
||||
/** 原材料送检记录主子表保存页。 */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MesXslRawMaterialInspectRecordPage extends MesXslRawMaterialInspectRecord {}
|
||||
@@ -195,3 +195,61 @@ jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturerList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/components/MesXslManufacturerModal.vue
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机主类型(所属工序、停机类型唯一、显示顺序、区分颜色、是否启用) ---
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_64__mes_xsl_downtime_main_type.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeMainType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeMainTypeMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeMainTypeService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeMainTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeMainTypeController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/components/MesXslDowntimeMainTypeModal.vue
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机类型(工序+主类型+停机类型、责任区分、故障等级、停机维修、色卡) ---
|
||||
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-type.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_65__mes_xsl_downtime_type.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeTypeMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeTypeService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/components/MesXslDowntimeTypeModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/components/MesXslDowntimeMainTypeSelectModal.vue
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机类型责任区分、故障等级改为手填(非字典) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_66__mes_xsl_downtime_type_text_fields.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||
jeecg-boot/db/mes-xsl-downtime-type.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机主类型/停机类型/厂家信息业务字符字段统一 varchar(500) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_67__mes_xsl_varchar500_biz_fields.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-manufacturer.sql
|
||||
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】删除停机类型废弃字典(责任区分、故障等级改手填后) ---
|
||||
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_68__mes_xsl_downtime_remove_unused_dict.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别/设备类型菜单挂 MES基础资料并修复权限树与租户授权 ---
|
||||
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_69__mes_xsl_move_process_equipment_menus_to_mes_base.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】设备类型菜单补全 INSERT(077 未建时仅 UPDATE 无效)---
|
||||
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_70__mes_xsl_equipment_type_menu_ensure.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别菜单与按钮权限补全及租户授权 ---
|
||||
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_71__mes_xsl_process_and_category_menu_ensure.sql
|
||||
jeecg-boot/db/mes-process-operation-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8080
|
||||
port: 8888
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
-- MES 停机主类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(与 jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql 一致)
|
||||
-- 权限前缀:mes:mes_xsl_downtime_main_type:*;父菜单 MES基础资料 / MES资料
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机主类型是否启用', 'xslmes_downtime_main_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_main_type_status' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '停用', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_type` varchar(128) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||
`distinguish_color` varchar(32) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000119', @mes_base_pid, '停机主类型', '/xslmes/mesXslDowntimeMainType', 'xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList', NULL, 1, NULL, '1', 18, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000121', '1860000000000000119', '编辑', 2, 'mes:mes_xsl_downtime_main_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000122', '1860000000000000119', '删除', 2, 'mes:mes_xsl_downtime_main_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000123', '1860000000000000119', '批量删除', 2, 'mes:mes_xsl_downtime_main_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000124', '1860000000000000119', '导出', 2, 'mes:mes_xsl_downtime_main_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000125', '1860000000000000119', '导入', 2, 'mes:mes_xsl_downtime_main_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000119',
|
||||
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123',
|
||||
'1860000000000000124', '1860000000000000125'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -0,0 +1,114 @@
|
||||
-- MES 停机类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_downtime_type:*;父菜单 MES基础资料 / MES资料
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机责任区分', 'xslmes_downtime_responsibility', '生产、设备、质量、其他', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_responsibility' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '生产', 'production', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'production');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '设备', 'equipment', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'equipment');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '质量', 'quality', 3, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'quality');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '其他', 'other', 4, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'other');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机故障等级', 'xslmes_downtime_fault_level', '一级、二级、三级', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_fault_level' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '一级', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_fault_level' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '二级', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_fault_level' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '三级', '3', 3, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_fault_level' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '3');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机类型是否启用', 'xslmes_downtime_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_type_status' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '停用', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||
`downtime_main_type_name` varchar(128) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||
`downtime_type` varchar(128) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||
`distinguish_color` varchar(32) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
`responsibility_distinct` varchar(32) DEFAULT NULL COMMENT '责任区分(字典xslmes_downtime_responsibility)',
|
||||
`fault_level` varchar(10) DEFAULT NULL COMMENT '故障等级(字典xslmes_downtime_fault_level:1一级2二级3三级)',
|
||||
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdt_process` (`process_operation_id`),
|
||||
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000126', @mes_base_pid, '停机类型', '/xslmes/mesXslDowntimeType', 'xslmes/mesXslDowntimeType/MesXslDowntimeTypeList', NULL, 1, NULL, '1', 19, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000128', '1860000000000000126', '编辑', 2, 'mes:mes_xsl_downtime_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000129', '1860000000000000126', '删除', 2, 'mes:mes_xsl_downtime_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000130', '1860000000000000126', '批量删除', 2, 'mes:mes_xsl_downtime_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000131', '1860000000000000126', '导出', 2, 'mes:mes_xsl_downtime_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000132', '1860000000000000126', '导入', 2, 'mes:mes_xsl_downtime_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000126',
|
||||
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130',
|
||||
'1860000000000000131', '1860000000000000132'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -0,0 +1,4 @@
|
||||
-- 停机类型:责任区分、故障等级改为手填,放宽字段长度
|
||||
ALTER TABLE `mes_xsl_downtime_type`
|
||||
MODIFY COLUMN `responsibility_distinct` varchar(128) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||
MODIFY COLUMN `fault_level` varchar(64) DEFAULT NULL COMMENT '故障等级(手填)';
|
||||
@@ -0,0 +1,26 @@
|
||||
-- MES:业务字符字段统一 varchar(500)(MySQL;状态/字典码仍 varchar(1),主键及外键仍 varchar(32))
|
||||
ALTER TABLE `mes_xsl_downtime_main_type`
|
||||
MODIFY COLUMN `process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
MODIFY COLUMN `downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
MODIFY COLUMN `distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
MODIFY COLUMN `sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
MODIFY COLUMN `create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
MODIFY COLUMN `update_by` varchar(500) DEFAULT NULL COMMENT '更新人';
|
||||
|
||||
ALTER TABLE `mes_xsl_downtime_type`
|
||||
MODIFY COLUMN `process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
MODIFY COLUMN `downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余',
|
||||
MODIFY COLUMN `downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
MODIFY COLUMN `distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
MODIFY COLUMN `responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||
MODIFY COLUMN `fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||
MODIFY COLUMN `sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
MODIFY COLUMN `create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
MODIFY COLUMN `update_by` varchar(500) DEFAULT NULL COMMENT '更新人';
|
||||
|
||||
ALTER TABLE `mes_xsl_manufacturer`
|
||||
MODIFY COLUMN `manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category)',
|
||||
MODIFY COLUMN `manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
MODIFY COLUMN `sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
MODIFY COLUMN `create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
MODIFY COLUMN `update_by` varchar(500) DEFAULT NULL COMMENT '更新人';
|
||||
@@ -0,0 +1,9 @@
|
||||
-- 停机类型:删除未使用的字典(责任区分、故障等级已改为手填)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DELETE i FROM `sys_dict_item` i
|
||||
INNER JOIN `sys_dict` d ON i.`dict_id` = d.`id`
|
||||
WHERE d.`dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||
|
||||
DELETE FROM `sys_dict`
|
||||
WHERE `dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||
@@ -0,0 +1,74 @@
|
||||
-- 工序管理、设备类别、设备类型:挂 MES基础资料 + 权限树 is_leaf + 租户 admin 授权(与 db/mes-xsl-move-process-equipment-menus-to-mes-base.sql 一致)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
UPDATE `sys_permission` p
|
||||
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||
SET p.`parent_id` = x.`pid`,
|
||||
p.`is_leaf` = 0,
|
||||
p.`url` = '/xslmes/mesXslProcessOperation',
|
||||
p.`component` = 'xslmes/mesXslProcessOperation/MesXslProcessOperationList',
|
||||
p.`component_name` = NULL,
|
||||
p.`perms_type` = '1',
|
||||
p.`update_by` = 'admin',
|
||||
p.`update_time` = NOW()
|
||||
WHERE p.`id` = '1860000000000000060';
|
||||
|
||||
UPDATE `sys_permission` p
|
||||
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||
SET p.`parent_id` = x.`pid`,
|
||||
p.`is_leaf` = 0,
|
||||
p.`url` = '/xslmes/mesXslEquipmentCategory',
|
||||
p.`component` = 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList',
|
||||
p.`component_name` = NULL,
|
||||
p.`perms_type` = '1',
|
||||
p.`update_by` = 'admin',
|
||||
p.`update_time` = NOW()
|
||||
WHERE p.`id` = '1860000000000000070';
|
||||
|
||||
UPDATE `sys_permission` p
|
||||
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||
SET p.`parent_id` = x.`pid`,
|
||||
p.`is_leaf` = 0,
|
||||
p.`url` = '/xslmes/mesXslEquipmentType',
|
||||
p.`component` = 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList',
|
||||
p.`component_name` = NULL,
|
||||
p.`perms_type` = '1',
|
||||
p.`update_by` = 'admin',
|
||||
p.`update_time` = NOW()
|
||||
WHERE p.`id` = '1860000000000000077';
|
||||
|
||||
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||
'1860000000000000074', '1860000000000000075', '1860000000000000076',
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -0,0 +1,54 @@
|
||||
-- 设备类型:补全菜单与按钮(id 077 可能从未插入),挂 MES基础资料,修复权限树 is_leaf
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -0,0 +1,72 @@
|
||||
-- 工序管理、设备类别:补全菜单/按钮与租户 admin 授权(与 db/mes-xsl-process-and-category-menu-fix.sql 一致)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||
'1860000000000000074', '1860000000000000075', '1860000000000000076'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -7,10 +7,10 @@ VITE_PUBLIC_PATH = /
|
||||
|
||||
# 跨域代理:前缀须与 VITE_GLOB_API_URL 一致,且 rewrite 后路径需包含后端 context-path(/jeecg-boot)
|
||||
# 详见 build/vite/proxy.ts
|
||||
VITE_PROXY = [["/jeecg-boot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
|
||||
VITE_PROXY = [["/jeecg-boot","http://localhost:8888/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
|
||||
|
||||
#后台接口全路径地址(必填)
|
||||
VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot
|
||||
VITE_GLOB_DOMAIN_URL=http://localhost:8888/jeecg-boot
|
||||
|
||||
#后台接口父地址(必填),与 server.servlet.context-path 一致,避免仅去掉别名前缀后缺少 /jeecg-boot
|
||||
VITE_GLOB_API_URL=/jeecg-boot
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 64 KiB |
@@ -30,7 +30,12 @@
|
||||
}
|
||||
|
||||
.aui-image {
|
||||
padding: 180px 80px;
|
||||
/* 左侧蓝色区:flex 垂直水平居中展示宣传图(替代大块 padding 顶在上方) */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 32px 40px;
|
||||
flex-basis: 60%;
|
||||
-webkit-flex-basis: 60%;
|
||||
background-color: #0198cd;
|
||||
@@ -39,9 +44,21 @@
|
||||
}
|
||||
|
||||
.aui-image-text {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 相对原图约 331×118 放大 30% → 430×153;资源为 2× 导出,浏览器缩放回该尺寸更清晰 */
|
||||
.aui-image-text img {
|
||||
width: 430px;
|
||||
max-width: min(430px, 100%);
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.aui-formBox {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslDowntimeMainType/list',
|
||||
checkDowntimeType = '/xslmes/mesXslDowntimeMainType/checkDowntimeType',
|
||||
save = '/xslmes/mesXslDowntimeMainType/add',
|
||||
edit = '/xslmes/mesXslDowntimeMainType/edit',
|
||||
deleteOne = '/xslmes/mesXslDowntimeMainType/delete',
|
||||
deleteBatch = '/xslmes/mesXslDowntimeMainType/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslDowntimeMainType/importExcel',
|
||||
exportXls = '/xslmes/mesXslDowntimeMainType/exportXls',
|
||||
queryById = '/xslmes/mesXslDowntimeMainType/queryById',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const checkDowntimeType = (params: { downtimeType: string; dataId?: string }) =>
|
||||
defHttp.get(
|
||||
{ url: Api.checkDowntimeType, params },
|
||||
{
|
||||
successMessageMode: 'none',
|
||||
errorMessageMode: 'none',
|
||||
},
|
||||
);
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params });
|
||||
};
|
||||
@@ -0,0 +1,113 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { h } from 'vue';
|
||||
import { checkDowntimeType } from './MesXslDowntimeMainType.api';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '工序名称', align: 'center', dataIndex: 'processOperationName', width: 160 },
|
||||
{ title: '停机类型', align: 'center', dataIndex: 'downtimeType', width: 160 },
|
||||
{ title: '显示顺序', align: 'center', dataIndex: 'displayOrder', width: 90 },
|
||||
{
|
||||
title: '区分颜色',
|
||||
align: 'center',
|
||||
dataIndex: 'distinguishColor',
|
||||
width: 120,
|
||||
customRender: ({ text }) => {
|
||||
const c = text ? String(text) : '';
|
||||
if (!c) {
|
||||
return '';
|
||||
}
|
||||
return h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '6px' } }, [
|
||||
h('span', {
|
||||
style: {
|
||||
display: 'inline-block',
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
borderRadius: '2px',
|
||||
backgroundColor: c,
|
||||
border: '1px solid #d9d9d9',
|
||||
},
|
||||
}),
|
||||
h('span', c),
|
||||
]);
|
||||
},
|
||||
},
|
||||
{ title: '是否启用', align: 'center', dataIndex: 'status_dictText', width: 100 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
{ title: '租户ID', align: 'center', dataIndex: 'tenantId', width: 90, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_downtime_main_type_status' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择所属工序' }] },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
},
|
||||
{
|
||||
label: '停机类型',
|
||||
field: 'downtimeType',
|
||||
component: 'Input',
|
||||
componentProps: { placeholder: '同租户内未删除数据中不可重复' },
|
||||
dynamicRules: ({ model }) => [
|
||||
{ required: true, message: '请输入停机类型' },
|
||||
{
|
||||
validator: async (_rule, value) => {
|
||||
const v = value == null ? '' : String(value).trim();
|
||||
if (!v) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
try {
|
||||
await checkDowntimeType({ downtimeType: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
const msg = e?.response?.data?.message || e?.message || '停机类型不能重复';
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '显示顺序',
|
||||
field: 'displayOrder',
|
||||
component: 'InputNumber',
|
||||
defaultValue: 0,
|
||||
componentProps: { min: 0, precision: 0, style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '区分颜色',
|
||||
field: 'distinguishColor',
|
||||
component: 'Input',
|
||||
slot: 'distinguishColorPicker',
|
||||
},
|
||||
{
|
||||
label: '是否启用',
|
||||
field: 'status',
|
||||
required: true,
|
||||
defaultValue: '0',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_downtime_main_type_status', placeholder: '请选择' },
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_main_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_main_type:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_main_type:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'mes:mes_xsl_downtime_main_type:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_downtime_main_type:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeMainTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslDowntimeMainType" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslDowntimeMainTypeModal from './components/MesXslDowntimeMainTypeModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeMainType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeMainType.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '停机主类型',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '停机主类型',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
selectedRowKeys.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_downtime_main_type:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="680" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #processOperationPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择工序" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openProcessSelect">选择工序</a-button>
|
||||
<a-button v-if="model.processOperationId && !isDetail" @click="clearProcess">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #distinguishColorPicker="{ model, field }">
|
||||
<div style="display: flex; align-items: center; gap: 12px; width: 100%">
|
||||
<input
|
||||
type="color"
|
||||
:value="normalizeColorValue(model[field])"
|
||||
:disabled="isDetail"
|
||||
style="width: 48px; height: 32px; padding: 0; border: 1px solid #d9d9d9; cursor: pointer"
|
||||
@input="(e) => onColorInput(model, field, e)"
|
||||
/>
|
||||
<a-input v-model:value="model[field]" :disabled="isDetail" placeholder="如 #1890ff" allow-clear style="flex: 1" />
|
||||
</div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslDowntimeMainType.data';
|
||||
import { saveOrUpdate } from '../MesXslDowntimeMainType.api';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) await setFieldsValue({ ...data.record });
|
||||
else await setFieldsValue({ status: '0', displayOrder: 0 });
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增停机主类型' : unref(isDetail) ? '停机主类型详情' : '编辑停机主类型',
|
||||
);
|
||||
|
||||
function normalizeColorValue(val: unknown) {
|
||||
const s = val == null ? '' : String(val).trim();
|
||||
if (!s) {
|
||||
return '#1890ff';
|
||||
}
|
||||
return s.startsWith('#') ? s : `#${s}`;
|
||||
}
|
||||
|
||||
function onColorInput(model: Recordable, field: string, e: Event) {
|
||||
const v = (e.target as HTMLInputElement).value;
|
||||
model[field] = v;
|
||||
}
|
||||
|
||||
function openProcessSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openProcessModal(true, { processOperationId: vals.processOperationId });
|
||||
}
|
||||
|
||||
function clearProcess() {
|
||||
setFieldsValue({ processOperationId: '', processOperationName: '' });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: { processOperationId?: string; processOperationName?: string }) {
|
||||
setFieldsValue({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,58 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslDowntimeType/list',
|
||||
checkDowntimeType = '/xslmes/mesXslDowntimeType/checkDowntimeType',
|
||||
save = '/xslmes/mesXslDowntimeType/add',
|
||||
edit = '/xslmes/mesXslDowntimeType/edit',
|
||||
deleteOne = '/xslmes/mesXslDowntimeType/delete',
|
||||
deleteBatch = '/xslmes/mesXslDowntimeType/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslDowntimeType/importExcel',
|
||||
exportXls = '/xslmes/mesXslDowntimeType/exportXls',
|
||||
queryById = '/xslmes/mesXslDowntimeType/queryById',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const checkDowntimeType = (params: { downtimeType: string; dataId?: string }) =>
|
||||
defHttp.get(
|
||||
{ url: Api.checkDowntimeType, params },
|
||||
{
|
||||
successMessageMode: 'none',
|
||||
errorMessageMode: 'none',
|
||||
},
|
||||
);
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params });
|
||||
};
|
||||
@@ -0,0 +1,144 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { h } from 'vue';
|
||||
import { checkDowntimeType } from './MesXslDowntimeType.api';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '工序名称', align: 'center', dataIndex: 'processOperationName', width: 140 },
|
||||
{ title: '所属主类型', align: 'center', dataIndex: 'downtimeMainTypeName', width: 140 },
|
||||
{ title: '停机类型', align: 'center', dataIndex: 'downtimeType', width: 140 },
|
||||
{ title: '显示顺序', align: 'center', dataIndex: 'displayOrder', width: 90 },
|
||||
{
|
||||
title: '区分颜色',
|
||||
align: 'center',
|
||||
dataIndex: 'distinguishColor',
|
||||
width: 120,
|
||||
customRender: ({ text }) => {
|
||||
const c = text ? String(text) : '';
|
||||
if (!c) {
|
||||
return '';
|
||||
}
|
||||
return h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '6px' } }, [
|
||||
h('span', {
|
||||
style: {
|
||||
display: 'inline-block',
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
borderRadius: '2px',
|
||||
backgroundColor: c,
|
||||
border: '1px solid #d9d9d9',
|
||||
},
|
||||
}),
|
||||
h('span', c),
|
||||
]);
|
||||
},
|
||||
},
|
||||
{ title: '责任区分', align: 'center', dataIndex: 'responsibilityDistinct', width: 120 },
|
||||
{ title: '故障等级', align: 'center', dataIndex: 'faultLevel', width: 100 },
|
||||
{ title: '是否停机维修', align: 'center', dataIndex: 'downtimeMaintenance_dictText', width: 110 },
|
||||
{ title: '是否启用', align: 'center', dataIndex: 'status_dictText', width: 90 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '主类型', field: 'downtimeMainTypeName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_downtime_type_status' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择所属工序' }] },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
},
|
||||
{ label: '', field: 'downtimeMainTypeId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择所属主类型' }] },
|
||||
{
|
||||
label: '所属主类型',
|
||||
field: 'downtimeMainTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeMainTypePicker',
|
||||
},
|
||||
{
|
||||
label: '停机类型',
|
||||
field: 'downtimeType',
|
||||
component: 'Input',
|
||||
componentProps: { placeholder: '同租户内未删除数据中不可重复' },
|
||||
dynamicRules: ({ model }) => [
|
||||
{ required: true, message: '请输入停机类型' },
|
||||
{
|
||||
validator: async (_rule, value) => {
|
||||
const v = value == null ? '' : String(value).trim();
|
||||
if (!v) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
try {
|
||||
await checkDowntimeType({ downtimeType: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
const msg = e?.response?.data?.message || e?.message || '停机类型不能重复';
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '显示顺序',
|
||||
field: 'displayOrder',
|
||||
required: true,
|
||||
component: 'InputNumber',
|
||||
defaultValue: 0,
|
||||
componentProps: { min: 0, precision: 0, style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '区分颜色',
|
||||
field: 'distinguishColor',
|
||||
component: 'Input',
|
||||
slot: 'distinguishColorPicker',
|
||||
},
|
||||
{
|
||||
label: '责任区分',
|
||||
field: 'responsibilityDistinct',
|
||||
component: 'Input',
|
||||
componentProps: { placeholder: '手填' },
|
||||
},
|
||||
{
|
||||
label: '故障等级',
|
||||
field: 'faultLevel',
|
||||
component: 'Input',
|
||||
componentProps: { placeholder: '手填' },
|
||||
},
|
||||
{
|
||||
label: '是否停机维修',
|
||||
field: 'downtimeMaintenance',
|
||||
defaultValue: '0',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'yn', placeholder: '请选择' },
|
||||
},
|
||||
{
|
||||
label: '是否启用',
|
||||
field: 'status',
|
||||
required: true,
|
||||
defaultValue: '0',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_downtime_type_status', placeholder: '请选择' },
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_type:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_type:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'mes:mes_xsl_downtime_type:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_downtime_type:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslDowntimeType" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslDowntimeTypeModal from './components/MesXslDowntimeTypeModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeType.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '停机类型',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '停机类型',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
selectedRowKeys.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_downtime_type:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="选择停机主类型" :width="960" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list, queryById } from '/@/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const selectedRow = ref<Recordable | null>(null);
|
||||
const processOperationIdRef = ref<string>('');
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRow.value = rows?.[0] ?? null;
|
||||
}
|
||||
|
||||
const [registerTable, { reload, setProps, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] =
|
||||
useTable({
|
||||
api: (params) => {
|
||||
const p = { ...params };
|
||||
if (processOperationIdRef.value) {
|
||||
p.processOperationId = processOperationIdRef.value;
|
||||
}
|
||||
return list(p);
|
||||
},
|
||||
columns: [
|
||||
{ title: '工序名称', dataIndex: 'processOperationName', width: 160 },
|
||||
{ title: '停机类型', dataIndex: 'downtimeType', width: 200 },
|
||||
{ title: '显示顺序', dataIndex: 'displayOrder', width: 90 },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 10 } }],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: false,
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
selectedRow.value = null;
|
||||
processOperationIdRef.value = (data?.processOperationId as string) || '';
|
||||
clearSelectedRowKeys?.();
|
||||
setProps({
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
setModalProps({ confirmLoading: false });
|
||||
const mid = data?.downtimeMainTypeId as string | undefined;
|
||||
if (mid) {
|
||||
setSelectedRowKeys?.([mid]);
|
||||
try {
|
||||
const raw = await queryById({ id: mid });
|
||||
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
if (row) {
|
||||
selectedRow.value = row;
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||
if (!row && keys.length) {
|
||||
try {
|
||||
const raw = await queryById({ id: keys[0] });
|
||||
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (!row?.id) {
|
||||
emit('select', { downtimeMainTypeId: '', downtimeMainTypeName: '' });
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
emit('select', {
|
||||
downtimeMainTypeId: row.id,
|
||||
downtimeMainTypeName: row.downtimeType || '',
|
||||
});
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="720" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #processOperationPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择工序" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openProcessSelect">选择工序</a-button>
|
||||
<a-button v-if="model.processOperationId && !isDetail" @click="clearProcess">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #downtimeMainTypePicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请先选工序,再选主类型" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail || !model.processOperationId" @click="openMainTypeSelect">
|
||||
选择主类型
|
||||
</a-button>
|
||||
<a-button v-if="model.downtimeMainTypeId && !isDetail" @click="clearMainType">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #distinguishColorPicker="{ model, field }">
|
||||
<div style="display: flex; align-items: center; gap: 12px; width: 100%">
|
||||
<input
|
||||
type="color"
|
||||
:value="normalizeColorValue(model[field])"
|
||||
:disabled="isDetail"
|
||||
style="width: 48px; height: 32px; padding: 0; border: 1px solid #d9d9d9; cursor: pointer"
|
||||
@input="(e) => onColorInput(model, field, e)"
|
||||
/>
|
||||
<a-input v-model:value="model[field]" :disabled="isDetail" placeholder="如 #1890ff" allow-clear style="flex: 1" />
|
||||
</div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
<MesXslDowntimeMainTypeSelectModal @register="registerMainTypeModal" @select="onMainTypeSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslDowntimeType.data';
|
||||
import { saveOrUpdate } from '../MesXslDowntimeType.api';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import MesXslDowntimeMainTypeSelectModal from './MesXslDowntimeMainTypeSelectModal.vue';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
const [registerMainTypeModal, { openModal: openMainTypeModal }] = useModal();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) await setFieldsValue({ ...data.record });
|
||||
else await setFieldsValue({ status: '0', downtimeMaintenance: '0', displayOrder: 0 });
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增停机类型' : unref(isDetail) ? '停机类型详情' : '编辑停机类型',
|
||||
);
|
||||
|
||||
function normalizeColorValue(val: unknown) {
|
||||
const s = val == null ? '' : String(val).trim();
|
||||
if (!s) {
|
||||
return '#1890ff';
|
||||
}
|
||||
return s.startsWith('#') ? s : `#${s}`;
|
||||
}
|
||||
|
||||
function onColorInput(model: Recordable, field: string, e: Event) {
|
||||
model[field] = (e.target as HTMLInputElement).value;
|
||||
}
|
||||
|
||||
function openProcessSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openProcessModal(true, { processOperationId: vals.processOperationId });
|
||||
}
|
||||
|
||||
function clearProcess() {
|
||||
setFieldsValue({
|
||||
processOperationId: '',
|
||||
processOperationName: '',
|
||||
downtimeMainTypeId: '',
|
||||
downtimeMainTypeName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: { processOperationId?: string; processOperationName?: string }) {
|
||||
const vals = getFieldsValue();
|
||||
const pid = payload.processOperationId || '';
|
||||
if (vals.downtimeMainTypeId && vals.processOperationId && vals.processOperationId !== pid) {
|
||||
setFieldsValue({
|
||||
processOperationId: pid,
|
||||
processOperationName: payload.processOperationName || '',
|
||||
downtimeMainTypeId: '',
|
||||
downtimeMainTypeName: '',
|
||||
});
|
||||
} else {
|
||||
setFieldsValue({
|
||||
processOperationId: pid,
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openMainTypeSelect() {
|
||||
const vals = getFieldsValue();
|
||||
if (!vals.processOperationId) {
|
||||
createMessage.warning('请先选择所属工序');
|
||||
return;
|
||||
}
|
||||
openMainTypeModal(true, {
|
||||
processOperationId: vals.processOperationId,
|
||||
downtimeMainTypeId: vals.downtimeMainTypeId,
|
||||
});
|
||||
}
|
||||
|
||||
function clearMainType() {
|
||||
setFieldsValue({ downtimeMainTypeId: '', downtimeMainTypeName: '' });
|
||||
}
|
||||
|
||||
function onMainTypeSelect(payload: { downtimeMainTypeId?: string; downtimeMainTypeName?: string }) {
|
||||
setFieldsValue({
|
||||
downtimeMainTypeId: payload.downtimeMainTypeId || '',
|
||||
downtimeMainTypeName: payload.downtimeMainTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -16,6 +16,7 @@ enum Api {
|
||||
queryPrinters = '/xslmes/mesXslRawMaterialCard/queryPrinters',
|
||||
prepareNativePrint = '/xslmes/mesXslRawMaterialCard/prepareNativePrint',
|
||||
printPdf = '/xslmes/mesXslRawMaterialCard/printPdf',
|
||||
createInspectRecordByCard = '/xslmes/mesXslRawMaterialInspectRecord/createByCard',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -63,3 +64,6 @@ export const prepareNativePrint = (id: string) =>
|
||||
/** id + 前端生成的 pdfBase64;printerName 空则用默认队列 */
|
||||
export const printPdf = (data: { id: string; printerName?: string; pdfBase64: string; fileName?: string }) =>
|
||||
defHttp.post({ url: Api.printPdf, data, timeout: 3 * 60 * 1000 });
|
||||
|
||||
export const createInspectRecordByCard = (rawMaterialCardId: string) =>
|
||||
defHttp.post({ url: Api.createInspectRecordByCard, params: { rawMaterialCardId } });
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
getExportUrl,
|
||||
updatePriority,
|
||||
prepareNativePrint,
|
||||
createInspectRecordByCard,
|
||||
} from './MesXslRawMaterialCard.api';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import {
|
||||
@@ -431,6 +432,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSendInspect(record: Recordable) {
|
||||
await createInspectRecordByCard(record.id as string);
|
||||
record.testResult = '0';
|
||||
record.hasPendingInspect = true;
|
||||
createMessage.success('已生成送检记录');
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
@@ -452,6 +461,12 @@
|
||||
onClick: handlePrintRow.bind(null, record),
|
||||
auth: 'xslmes:mes_xsl_raw_material_card:edit',
|
||||
},
|
||||
{
|
||||
label: '送检',
|
||||
onClick: handleSendInspect.bind(null, record),
|
||||
auth: 'xslmes:mes_xsl_raw_material_card:edit',
|
||||
ifShow: () => (!record.testResult || record.testResult === '0') && !record.hasPendingInspect,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslRawMaterialInspectRecord/list',
|
||||
queryById = '/xslmes/mesXslRawMaterialInspectRecord/queryById',
|
||||
queryLineListByRecordId = '/xslmes/mesXslRawMaterialInspectRecord/queryLineListByRecordId',
|
||||
prepareResultEntry = '/xslmes/mesXslRawMaterialInspectRecord/prepareResultEntry',
|
||||
saveInspectResult = '/xslmes/mesXslRawMaterialInspectRecord/saveInspectResult',
|
||||
exportXls = '/xslmes/mesXslRawMaterialInspectRecord/exportXls',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
export const queryLineListByRecordId = (params) => defHttp.get({ url: Api.queryLineListByRecordId, params });
|
||||
export const prepareResultEntry = (id: string) => defHttp.post({ url: Api.prepareResultEntry, params: { id } });
|
||||
export const saveInspectResult = (params) => defHttp.post({ url: Api.saveInspectResult, params });
|
||||
@@ -0,0 +1,80 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '条码', align: 'center', dataIndex: 'barcode', width: 180 },
|
||||
{ title: '批次号', align: 'center', dataIndex: 'batchNo', width: 160 },
|
||||
{ title: '物料名称', align: 'center', dataIndex: 'materialName', width: 180 },
|
||||
{ title: '检验状态', align: 'center', dataIndex: 'inspectStatus_dictText', width: 120 },
|
||||
{ title: '送检时间', align: 'center', dataIndex: 'inspectTime', width: 170 },
|
||||
{ title: '判定时间', align: 'center', dataIndex: 'resultTime', width: 170 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '条码', field: 'barcode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '批次号', field: 'batchNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '物料名称', field: 'materialName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '检验状态',
|
||||
field: 'inspectStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_inspect_status' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const lineJVxeColumns: JVxeColumn[] = [
|
||||
{
|
||||
title: '检验项目',
|
||||
key: 'inspectItemName',
|
||||
type: JVxeTypes.input,
|
||||
width: 220,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '容许最小值',
|
||||
key: 'allowMin',
|
||||
type: JVxeTypes.inputNumber,
|
||||
width: 120,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '包含最小值',
|
||||
key: 'includeMinFlag',
|
||||
type: JVxeTypes.checkbox,
|
||||
width: 110,
|
||||
align: 'center',
|
||||
customValue: [1, 0],
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '容许最大值',
|
||||
key: 'allowMax',
|
||||
type: JVxeTypes.inputNumber,
|
||||
width: 120,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '包含最大值',
|
||||
key: 'includeMaxFlag',
|
||||
type: JVxeTypes.checkbox,
|
||||
width: 110,
|
||||
align: 'center',
|
||||
customValue: [1, 0],
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '检验值',
|
||||
key: 'inspectValue',
|
||||
type: JVxeTypes.inputNumber,
|
||||
width: 120,
|
||||
validateRules: [{ required: true, message: '${title}必填' }],
|
||||
},
|
||||
{
|
||||
title: '判定',
|
||||
key: 'passFlag_dictText',
|
||||
type: JVxeTypes.input,
|
||||
width: 100,
|
||||
disabled: true,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_raw_material_inspect_record:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslRawMaterialInspectRecordResultModal @register="registerResultModal" @success="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRawMaterialInspectRecord" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { columns, searchFormSchema } from './MesXslRawMaterialInspectRecord.data';
|
||||
import { getExportUrl, list } from './MesXslRawMaterialInspectRecord.api';
|
||||
import MesXslRawMaterialInspectRecordResultModal from './modules/MesXslRawMaterialInspectRecordResultModal.vue';
|
||||
|
||||
const [registerResultModal, { openModal: openResultModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '原材料送检记录',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
|
||||
actionColumn: { width: 180, fixed: 'right' },
|
||||
},
|
||||
exportConfig: {
|
||||
name: '原材料送检记录',
|
||||
url: getExportUrl,
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload }] = tableContext;
|
||||
|
||||
function handleEntryResult(record: Recordable) {
|
||||
openResultModal(true, { record, editable: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openResultModal(true, { record, editable: false });
|
||||
}
|
||||
|
||||
function getTableAction(record: Recordable) {
|
||||
return [
|
||||
{
|
||||
label: '录入检验结果',
|
||||
onClick: handleEntryResult.bind(null, record),
|
||||
auth: 'xslmes:mes_xsl_raw_material_inspect_record:edit',
|
||||
ifShow: () => record.inspectStatus === '0',
|
||||
},
|
||||
{
|
||||
label: '查看',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
destroyOnClose
|
||||
:title="title"
|
||||
width="1100px"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<a-descriptions bordered :column="2" size="small">
|
||||
<a-descriptions-item label="条码">{{ mainRecord.barcode || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="批次号">{{ mainRecord.batchNo || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="物料名称">{{ mainRecord.materialName || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="检验状态">{{ mainRecord.inspectStatus_dictText || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="送检时间">{{ mainRecord.inspectTime || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="判定时间">{{ mainRecord.resultTime || '-' }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<a-divider orientation="left">检验明细</a-divider>
|
||||
<JVxeTable
|
||||
v-if="tableReady"
|
||||
ref="lineTableRef"
|
||||
row-number
|
||||
keep-source
|
||||
:max-height="400"
|
||||
:loading="lineLoading"
|
||||
:columns="tableColumns"
|
||||
:dataSource="lineDataSource"
|
||||
:disabled="!editable"
|
||||
/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { lineJVxeColumns } from '../MesXslRawMaterialInspectRecord.data';
|
||||
import { prepareResultEntry, queryById, queryLineListByRecordId, saveInspectResult } from '../MesXslRawMaterialInspectRecord.api';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
const editable = ref(false);
|
||||
const tableReady = ref(false);
|
||||
const lineLoading = ref(false);
|
||||
const lineDataSource = ref<Recordable[]>([]);
|
||||
const lineTableRef = ref<JVxeTableInstance>();
|
||||
const recordId = ref('');
|
||||
const mainRecord = ref<Recordable>({});
|
||||
|
||||
const tableColumns = computed(() => {
|
||||
if (editable.value) {
|
||||
return lineJVxeColumns;
|
||||
}
|
||||
return lineJVxeColumns.map((c) => {
|
||||
if (c.key === 'inspectValue') {
|
||||
return { ...c, disabled: true };
|
||||
}
|
||||
return c;
|
||||
});
|
||||
});
|
||||
|
||||
function mapPassFlagText(list: Recordable[]) {
|
||||
return (list || []).map((row) => {
|
||||
const passFlag = String(row?.passFlag ?? '');
|
||||
let passText = '';
|
||||
if (passFlag === '0') passText = '待检';
|
||||
else if (passFlag === '1') passText = '合格';
|
||||
else if (passFlag === '2') passText = '不合格';
|
||||
return { ...row, passFlag_dictText: passText };
|
||||
});
|
||||
}
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
tableReady.value = false;
|
||||
lineDataSource.value = [];
|
||||
editable.value = !!data?.editable;
|
||||
recordId.value = data?.record?.id || '';
|
||||
setModalProps({
|
||||
confirmLoading: false,
|
||||
showCancelBtn: true,
|
||||
showOkBtn: editable.value,
|
||||
okText: '保存',
|
||||
});
|
||||
if (!recordId.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
lineLoading.value = true;
|
||||
try {
|
||||
const mainRaw = await queryById({ id: recordId.value });
|
||||
mainRecord.value = (mainRaw as any)?.id != null ? (mainRaw as Recordable) : ((mainRaw as any)?.result ?? {});
|
||||
if (editable.value) {
|
||||
const linesRaw = await prepareResultEntry(recordId.value);
|
||||
const list = Array.isArray(linesRaw) ? linesRaw : ((linesRaw as any)?.result ?? []);
|
||||
lineDataSource.value = mapPassFlagText(list || []);
|
||||
} else {
|
||||
const linesRaw = await queryLineListByRecordId({ id: recordId.value });
|
||||
const list = Array.isArray(linesRaw) ? linesRaw : ((linesRaw as any)?.result ?? []);
|
||||
lineDataSource.value = mapPassFlagText(list || []);
|
||||
}
|
||||
} finally {
|
||||
lineLoading.value = false;
|
||||
tableReady.value = true;
|
||||
}
|
||||
});
|
||||
|
||||
const title = computed(() => (editable.value ? '录入检验结果' : '送检记录详情'));
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!editable.value) {
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const lineRef = lineTableRef.value as any;
|
||||
if (lineRef?.validateTable) {
|
||||
const err = await lineRef.validateTable();
|
||||
if (err) {
|
||||
createMessage.warning('请完善检验值');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const tableData = (lineRef?.getTableData?.() || []) as Recordable[];
|
||||
const lineList = tableData.map((item) => ({
|
||||
id: item.id,
|
||||
inspectValue: item.inspectValue,
|
||||
}));
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveInspectResult({
|
||||
id: recordId.value,
|
||||
lineList,
|
||||
});
|
||||
createMessage.success('保存成功');
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -21,7 +21,7 @@ public interface IRawMaterialEntryService
|
||||
Task<bool> DeleteAsync(string id, CancellationToken ct = default);
|
||||
Task<bool> DeleteBatchAsync(string ids, CancellationToken ct = default);
|
||||
|
||||
/// <summary>调用后端接口生成条码/批次号(格式:QH+物料编码+yyMMdd+序号)</summary>
|
||||
/// <summary>生成条码/批次号(优先后端,离线回退本地;格式:QH+物料编码+yyMMdd+序号)</summary>
|
||||
Task<string?> GenerateBarcodeAsync(string materialCode, CancellationToken ct = default);
|
||||
|
||||
/// <summary>按业务打印绑定准备模板 JSON 与 printData(与后端 prepareNativePrint 一致,免密 anon)。</summary>
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace YY.Admin.Core.Services;
|
||||
|
||||
public interface IWarehouseService
|
||||
{
|
||||
/// <summary>获取全部仓库列表(在线时拉取远端并刷新缓存,离线时返回本地缓存)</summary>
|
||||
/// <summary>获取全部仓库列表(优先内存/磁盘缓存;仅缓存为空且在线时拉取远端)</summary>
|
||||
Task<List<MesXslWarehouse>> GetAllAsync(CancellationToken ct = default);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,12 @@ public partial class SysMenu : EntityBase
|
||||
[SugarColumn(ColumnDescription = "是否固定")]
|
||||
public bool IsAffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 桌面端登录后默认打开的首页(全库仅一项建议为 true,保存时由服务层互斥)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "桌面端默认首页")]
|
||||
public bool IsDefaultDesktopHome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
|
||||
return new[]
|
||||
{
|
||||
new SysMenu{ Id=1300100000101, Pid=0, Title="工作台", Path="", Name="dashboard", Component="Layout", Icon="", Type=MenuTypeEnum.Dir, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=0 },
|
||||
new SysMenu{ Id=1300100010101, Pid=1300100000101, Title="仪表盘", Path="DashboardView", Name="home", Component="/home/index", IsAffix=true, Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||
new SysMenu{ Id=1300100010101, Pid=1300100000101, Title="仪表盘", Path="DashboardView", Name="home", Component="/home/index", IsAffix=true, IsDefaultDesktopHome=true, Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||
new SysMenu{ Id=1300100010201, Pid=1300100000101, Title="站内信", Path="/dashboard/notice", Name="notice", Component="/home/notice/index", Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=101 },
|
||||
|
||||
// 建议此处Id范围之间放置具体业务应用菜单
|
||||
|
||||
@@ -163,9 +163,11 @@ namespace YY.Admin.Core.SqlSugar
|
||||
config.ConnectionString = CryptogramUtil.Decrypt(config.ConnectionString);
|
||||
}
|
||||
|
||||
// SQLite 相对路径默认依赖进程工作目录;快捷方式/从不同目录启动会在别处生成空库,表现为发布后菜单全空
|
||||
// SQLite 相对路径会解析到 LocalApplicationData\Data(见 ResolveSqliteConnectionToAbsolutePath)
|
||||
if (config.DbType == DbType.Sqlite && !string.IsNullOrWhiteSpace(config.ConnectionString))
|
||||
{
|
||||
// 安装包随带的 Admin.NET.db / Slave.db 在安装目录;运行时代码只读写可写目录。首启若无用户库则从安装目录复制模板。
|
||||
TrySeedSqliteFromInstallDirectory(config.ConnectionString);
|
||||
config.ConnectionString = ResolveSqliteConnectionToAbsolutePath(config.ConnectionString);
|
||||
}
|
||||
|
||||
@@ -251,6 +253,8 @@ namespace YY.Admin.Core.SqlSugar
|
||||
|
||||
// 兼容旧库:曾关闭表初始化或升级前库无 Jeecg 盐列时补齐,避免脱网按 Jeecg 规则验密时读列失败
|
||||
EnsureSysUserJeecgPasswordSaltColumn(dbProvider, config);
|
||||
// 兼容旧库:菜单表增加「桌面默认首页」标记列
|
||||
EnsureSysMenuDefaultDesktopHomeColumn(dbProvider, config);
|
||||
// 兜底:确保 Jeecg 用户同构表存在(登录页“同步 Jeecg 用户”写入此表)
|
||||
EnsureJeecgSysUserMirrorTable(dbProvider, config);
|
||||
// 兜底:确保 Jeecg 数据字典同构表存在(数据字典页面“同步数据字典”写入此表)
|
||||
@@ -264,7 +268,41 @@ namespace YY.Admin.Core.SqlSugar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将 SQLite 连接串中的相对 DataSource 解析为基于应用程序基目录的绝对路径。
|
||||
/// 首次启动时:若用户数据目录中尚无该 SQLite 文件,且安装目录(exe 旁)存在同名库,则复制一份作为初始模板。
|
||||
/// 否则安装包内随带的菜单/配置永远不会被用到(实际始终读写 %LocalAppData%\YY.Admin\Data\)。
|
||||
/// </summary>
|
||||
private static void TrySeedSqliteFromInstallDirectory(string connectionString)
|
||||
{
|
||||
try
|
||||
{
|
||||
var builder = new SqliteConnectionStringBuilder(connectionString);
|
||||
var ds = builder.DataSource;
|
||||
if (string.IsNullOrWhiteSpace(ds) || Path.IsPathFullyQualified(ds))
|
||||
return;
|
||||
|
||||
var fileName = Path.GetFileName(ds.TrimStart('.', '/', '\\'));
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
fileName = "Admin.NET.db";
|
||||
|
||||
var dataDir = AppWritablePaths.EnsureDirectoryExists(AppWritablePaths.DataDirectory);
|
||||
var targetPath = Path.Combine(dataDir, fileName);
|
||||
if (File.Exists(targetPath))
|
||||
return;
|
||||
|
||||
var bundledPath = Path.Combine(AppContext.BaseDirectory, fileName);
|
||||
if (!File.Exists(bundledPath))
|
||||
return;
|
||||
|
||||
File.Copy(bundledPath, targetPath, overwrite: false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 忽略:后续仍可按空库走建表/基准种子
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将 SQLite 连接串中的相对 DataSource 解析为 %LocalAppData%\YY.Admin\Data\ 下绝对路径(适配 Program Files 只读安装)。
|
||||
/// </summary>
|
||||
private static string ResolveSqliteConnectionToAbsolutePath(string connectionString)
|
||||
{
|
||||
@@ -282,7 +320,7 @@ namespace YY.Admin.Core.SqlSugar
|
||||
return connectionString;
|
||||
}
|
||||
|
||||
// Program Files 等安装目录对普通用户只读;SQLite 库放到 LocalApplicationData
|
||||
// Program Files 等安装目录对普通用户只读;运行期 SQLite 放到 LocalApplicationData(首启可由 TrySeedSqliteFromInstallDirectory 从安装目录拷贝模板)
|
||||
var dataDir = AppWritablePaths.EnsureDirectoryExists(AppWritablePaths.DataDirectory);
|
||||
var fileName = Path.GetFileName(ds.TrimStart('.', '/', '\\'));
|
||||
if (string.IsNullOrWhiteSpace(fileName))
|
||||
@@ -352,8 +390,57 @@ namespace YY.Admin.Core.SqlSugar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 若 sys_user 缺少 jeecg_password_salt,则执行 ALTER 补列(与实体 SysUser.JeecgPasswordSalt 一致)
|
||||
/// 若 sys_menu 缺少桌面默认首页标记列,则 ALTER 补齐(与实体 SysMenu.IsDefaultDesktopHome 一致)
|
||||
/// </summary>
|
||||
private static void EnsureSysMenuDefaultDesktopHomeColumn(SqlSugarScopeProvider dbProvider, DbConnectionConfig config)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entityInfo = dbProvider.EntityMaintenance.GetEntityInfo(typeof(SysMenu));
|
||||
var tableName = entityInfo.DbTableName;
|
||||
if (!dbProvider.DbMaintenance.IsAnyTable(tableName, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var col = entityInfo.Columns.FirstOrDefault(c => c.PropertyName == nameof(SysMenu.IsDefaultDesktopHome));
|
||||
if (col == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var columns = dbProvider.DbMaintenance.GetColumnInfosByTableName(tableName, false);
|
||||
if (columns != null &&
|
||||
columns.Any(c => string.Equals(c.DbColumnName, col.DbColumnName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var cName = col.DbColumnName;
|
||||
var sql = config.DbType switch
|
||||
{
|
||||
DbType.Sqlite => $"ALTER TABLE {tableName} ADD COLUMN {cName} INTEGER NOT NULL DEFAULT 0;",
|
||||
DbType.MySql => $"ALTER TABLE `{tableName}` ADD COLUMN `{cName}` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '桌面端默认首页';",
|
||||
DbType.PostgreSQL => $"ALTER TABLE \"{tableName}\" ADD COLUMN IF NOT EXISTS {cName} BOOLEAN NOT NULL DEFAULT FALSE;",
|
||||
DbType.SqlServer => $"ALTER TABLE [{tableName}] ADD [{cName}] BIT NOT NULL DEFAULT 0;",
|
||||
DbType.Kdbndp => $"ALTER TABLE \"{tableName}\" ADD COLUMN IF NOT EXISTS {cName} BOOLEAN NOT NULL DEFAULT FALSE;",
|
||||
DbType.Dm => $"ALTER TABLE {tableName} ADD {cName} NUMBER(1) DEFAULT 0 NOT NULL;",
|
||||
_ => (string?)null
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(sql))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Retry(() => dbProvider.Ado.ExecuteCommand(sql), maxRetry: 3, retryIntervalMs: 1000);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 无权限、从库只读等场景不阻断启动
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureSysUserJeecgPasswordSaltColumn(SqlSugarScopeProvider dbProvider, DbConnectionConfig config)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -121,6 +121,11 @@ namespace YY.Admin.Services
|
||||
/// 是否固定
|
||||
/// </summary>
|
||||
public bool IsAffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 桌面端登录后作为默认首页打开的菜单
|
||||
/// </summary>
|
||||
public bool IsDefaultDesktopHome { get; set; }
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 菜单子项
|
||||
|
||||
@@ -157,6 +157,9 @@ namespace YY.Admin.Services.Service.Menu
|
||||
if (n <= 0)
|
||||
return (false, "保存失败", 0);
|
||||
|
||||
if (input.IsDefaultDesktopHome)
|
||||
await ClearDefaultDesktopHomeExceptAsync(input.Id);
|
||||
|
||||
await TryLinkCurrentTenantMenuAsync(id);
|
||||
return (true, "保存成功", id);
|
||||
}
|
||||
@@ -180,6 +183,9 @@ namespace YY.Admin.Services.Service.Menu
|
||||
if (NewParentIsInsideMenuSubtree(input.Id, input.Pid, all))
|
||||
return (false, "不能将父级设为当前菜单或其子菜单");
|
||||
|
||||
if (input.IsDefaultDesktopHome)
|
||||
await ClearDefaultDesktopHomeExceptAsync(input.Id);
|
||||
|
||||
existing.Pid = input.Pid;
|
||||
existing.Type = input.Type;
|
||||
existing.Name = input.Name;
|
||||
@@ -194,13 +200,17 @@ namespace YY.Admin.Services.Service.Menu
|
||||
existing.IsHide = input.IsHide;
|
||||
existing.IsKeepAlive = input.IsKeepAlive;
|
||||
existing.IsAffix = input.IsAffix;
|
||||
existing.IsDefaultDesktopHome = input.IsDefaultDesktopHome;
|
||||
existing.OrderNo = input.OrderNo;
|
||||
existing.Status = input.Status;
|
||||
existing.Remark = input.Remark;
|
||||
existing.UpdateTime = DateTime.Now;
|
||||
|
||||
var n = await _dbContext.Updateable(existing).ExecuteCommandAsync();
|
||||
return n > 0 ? (true, "保存成功") : (false, "更新失败");
|
||||
if (n <= 0)
|
||||
return (false, "更新失败");
|
||||
await TryLinkCurrentTenantMenuAsync(input.Id);
|
||||
return (true, "保存成功");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -219,6 +229,17 @@ namespace YY.Admin.Services.Service.Menu
|
||||
return n > 0 ? (true, "已删除") : (false, "删除失败");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保证全表仅一条菜单为桌面默认首页(当前保留项除外全部置 false)
|
||||
/// </summary>
|
||||
private async Task ClearDefaultDesktopHomeExceptAsync(long keepMenuId)
|
||||
{
|
||||
await _dbContext.Updateable<SysMenu>()
|
||||
.SetColumns(m => new SysMenu { IsDefaultDesktopHome = false })
|
||||
.Where(m => m.Id != keepMenuId && m.IsDefaultDesktopHome)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
private async Task TryLinkCurrentTenantMenuAsync(long menuId)
|
||||
{
|
||||
var tenantId = AppSession.CurrentUser?.TenantId;
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Globalization;
|
||||
using System.Web;
|
||||
using Prism.Events;
|
||||
using YY.Admin.Core;
|
||||
@@ -151,6 +152,7 @@ public class RawMaterialEntryService : IRawMaterialEntryService, ISingletonDepen
|
||||
if (!entry.TenantId.HasValue || entry.TenantId.Value <= 0) entry.TenantId = DefaultTenantId;
|
||||
var local = Clone(entry);
|
||||
if (string.IsNullOrWhiteSpace(local.Id)) local.Id = $"local-{Guid.NewGuid():N}";
|
||||
EnsureBarcodeAndBatchNo(local);
|
||||
|
||||
if (_networkMonitor.IsOnline)
|
||||
{
|
||||
@@ -228,6 +230,11 @@ public class RawMaterialEntryService : IRawMaterialEntryService, ISingletonDepen
|
||||
|
||||
public async Task<string?> GenerateBarcodeAsync(string materialCode, CancellationToken ct = default)
|
||||
{
|
||||
if (!_networkMonitor.IsOnline)
|
||||
{
|
||||
return GenerateLocalBarcode(materialCode);
|
||||
}
|
||||
|
||||
var url = $"{BaseUrl}/xslmes/mesXslRawMaterialEntry/anon/generateBarcode?materialCode={Uri.EscapeDataString(materialCode ?? "")}";
|
||||
try
|
||||
{
|
||||
@@ -243,7 +250,46 @@ public class RawMaterialEntryService : IRawMaterialEntryService, ISingletonDepen
|
||||
{
|
||||
_logger.Warning($"[原料入场] 生成条码失败: {ex.Message}");
|
||||
}
|
||||
return null;
|
||||
return GenerateLocalBarcode(materialCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 桌面端离线兜底产号:保持与服务端一致的格式 QH + 物料编码 + yyMMdd + 3位流水。
|
||||
/// 流水号口径与服务端一致:按当前前缀匹配条码计数 + 1(非 max+1)。
|
||||
/// </summary>
|
||||
private string GenerateLocalBarcode(string materialCode)
|
||||
{
|
||||
var normalizedCode = (materialCode ?? string.Empty).Trim();
|
||||
var dateStr = DateTime.Now.ToString("yyMMdd", CultureInfo.InvariantCulture);
|
||||
var prefix = $"QH{normalizedCode}{dateStr}";
|
||||
|
||||
int sequence;
|
||||
lock (_cacheLock)
|
||||
{
|
||||
var snapshot = ApplyPendingOpsSnapshotUnsafe(_localCache.Select(Clone).ToList());
|
||||
var count = snapshot.Count(x =>
|
||||
!string.IsNullOrWhiteSpace(x.Barcode) &&
|
||||
x.Barcode!.StartsWith(prefix, StringComparison.OrdinalIgnoreCase));
|
||||
sequence = count + 1;
|
||||
}
|
||||
return $"{prefix}{sequence:000}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增入场记录时保证条码和批次号本地可用:
|
||||
/// 条码为空时本地生成,批次号为空时回填为条码。
|
||||
/// </summary>
|
||||
private void EnsureBarcodeAndBatchNo(MesXslRawMaterialEntry entry)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entry.Barcode))
|
||||
{
|
||||
entry.Barcode = GenerateLocalBarcode(entry.MaterialCode ?? string.Empty);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(entry.BatchNo))
|
||||
{
|
||||
entry.BatchNo = entry.Barcode;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<(string templateJson, string printDataJson, string? errorMessage)> PrepareNativePrintAsync(string id, CancellationToken ct = default)
|
||||
|
||||
@@ -10,8 +10,7 @@ using YY.Admin.Core.Services;
|
||||
namespace YY.Admin.Services.Service.Warehouse;
|
||||
|
||||
/// <summary>
|
||||
/// 仓库数据只读服务:启动时从后端拉取全量列表并缓存到磁盘,断网时回退本地缓存。
|
||||
/// 仅供其他模块的下拉筛选使用,不提供 CRUD。
|
||||
/// 仓库数据只读服务:启动与重连时后台刷新远端写入缓存;GetAllAsync 优先读缓存,避免库区等业务每次打开都全量拉仓库。
|
||||
/// </summary>
|
||||
public class WarehouseService : IWarehouseService, ISingletonDependency
|
||||
{
|
||||
@@ -20,6 +19,7 @@ public class WarehouseService : IWarehouseService, ISingletonDependency
|
||||
private readonly INetworkMonitor _networkMonitor;
|
||||
private readonly ILoggerService _logger;
|
||||
private readonly object _cacheLock = new();
|
||||
private readonly SemaphoreSlim _emptyLoadGate = new(1, 1);
|
||||
private readonly string _cacheFilePath;
|
||||
private List<MesXslWarehouse> _localCache = new();
|
||||
|
||||
@@ -64,19 +64,44 @@ public class WarehouseService : IWarehouseService, ISingletonDependency
|
||||
|
||||
public async Task<List<MesXslWarehouse>> GetAllAsync(CancellationToken ct = default)
|
||||
{
|
||||
if (_networkMonitor.IsOnline)
|
||||
lock (_cacheLock)
|
||||
{
|
||||
if (_localCache.Count > 0 || !_networkMonitor.IsOnline)
|
||||
return _localCache.ToList();
|
||||
}
|
||||
|
||||
// 缓存为空且在线:仅此时阻塞拉远端(首次安装或清缓存后)
|
||||
await _emptyLoadGate.WaitAsync(ct).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
lock (_cacheLock)
|
||||
{
|
||||
if (_localCache.Count > 0)
|
||||
return _localCache.ToList();
|
||||
}
|
||||
|
||||
if (!_networkMonitor.IsOnline)
|
||||
{
|
||||
lock (_cacheLock)
|
||||
return _localCache.ToList();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await RefreshFromRemoteAsync(ct).ConfigureAwait(false);
|
||||
}
|
||||
catch { }
|
||||
catch
|
||||
{
|
||||
/* 登录前拉取失败等场景,仍返回当前缓存(可能仍为空) */
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_emptyLoadGate.Release();
|
||||
}
|
||||
|
||||
lock (_cacheLock)
|
||||
{
|
||||
return _localCache.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RefreshFromRemoteAsync(CancellationToken ct)
|
||||
|
||||
@@ -197,12 +197,12 @@ public class WeightRecordService : IWeightRecordService, ISingletonDependency
|
||||
|
||||
public async Task<bool> AddAsync(MesXslWeightRecord entity, CancellationToken ct = default)
|
||||
{
|
||||
SanitizeWeightsBeforePersist(entity);
|
||||
if (!entity.TenantId.HasValue || entity.TenantId.Value <= 0)
|
||||
entity.TenantId = DefaultTenantId;
|
||||
if (string.IsNullOrWhiteSpace(entity.BillNo))
|
||||
entity.BillNo = GenerateBillNo();
|
||||
if (string.IsNullOrWhiteSpace(entity.BillType))
|
||||
entity.BillType = ResolveBillType(entity);
|
||||
entity.BillType = ResolveBillType(entity);
|
||||
|
||||
var local = Clone(entity);
|
||||
if (string.IsNullOrWhiteSpace(local.Id))
|
||||
@@ -246,21 +246,41 @@ public class WeightRecordService : IWeightRecordService, ISingletonDependency
|
||||
|
||||
/// <summary>
|
||||
/// 根据称重数据推导单据类型:仅毛重=已称毛重;仅皮重=已称皮重;毛重+皮重=称重完成。
|
||||
/// 注意:皮重/毛重为 0 时按「未称」处理(避免 NumericUpDown/JSON 占位 0 误判为称重完成)。
|
||||
/// </summary>
|
||||
private static string? ResolveBillType(MesXslWeightRecord entity)
|
||||
{
|
||||
if (entity.GrossWeight.HasValue && entity.TareWeight.HasValue) return "2";
|
||||
if (entity.GrossWeight.HasValue) return "1";
|
||||
if (entity.TareWeight.HasValue) return "3";
|
||||
var g = HasEffectiveWeighKg(entity.GrossWeight);
|
||||
var t = HasEffectiveWeighKg(entity.TareWeight);
|
||||
if (g && t) return "2";
|
||||
if (g) return "1";
|
||||
if (t) return "3";
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool HasEffectiveWeighKg(double? kg) => kg.HasValue && kg.Value > 0;
|
||||
|
||||
/// <summary>
|
||||
/// 将 ≤0 的重量视为未录入并清空净重,防止上传 payload 带 0 误判。
|
||||
/// </summary>
|
||||
private static void SanitizeWeightsBeforePersist(MesXslWeightRecord entity)
|
||||
{
|
||||
if (entity.GrossWeight.HasValue && entity.GrossWeight.Value <= 0)
|
||||
entity.GrossWeight = null;
|
||||
if (entity.TareWeight.HasValue && entity.TareWeight.Value <= 0)
|
||||
entity.TareWeight = null;
|
||||
if (HasEffectiveWeighKg(entity.GrossWeight) && HasEffectiveWeighKg(entity.TareWeight))
|
||||
entity.NetWeight = Math.Round(entity.GrossWeight!.Value - entity.TareWeight!.Value, 2);
|
||||
else
|
||||
entity.NetWeight = null;
|
||||
}
|
||||
|
||||
public async Task<bool> EditAsync(MesXslWeightRecord entity, CancellationToken ct = default)
|
||||
{
|
||||
SanitizeWeightsBeforePersist(entity);
|
||||
if (!entity.TenantId.HasValue || entity.TenantId.Value <= 0)
|
||||
entity.TenantId = DefaultTenantId;
|
||||
if (string.IsNullOrWhiteSpace(entity.BillType))
|
||||
entity.BillType = ResolveBillType(entity);
|
||||
entity.BillType = ResolveBillType(entity);
|
||||
|
||||
var local = Clone(entity);
|
||||
if (IsLocalTempId(local.Id))
|
||||
|
||||
@@ -3,6 +3,7 @@ using FluentValidation;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NewLife;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -73,6 +74,46 @@ namespace YY.Admin
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入用户级 AppSettings(user.config)。若文件损坏(如缺少 configSections),删除后重试一次。
|
||||
/// </summary>
|
||||
private static void PersistSkinTypeUserSettingSafe()
|
||||
{
|
||||
for (var attempt = 0; attempt < 2; attempt++)
|
||||
{
|
||||
try
|
||||
{
|
||||
AppSettings.Default.SkinType = AppSettingsViewModel.GetSkinType().ToInt();
|
||||
AppSettings.Default.Save();
|
||||
return;
|
||||
}
|
||||
catch (ConfigurationErrorsException ex)
|
||||
{
|
||||
if (attempt == 0)
|
||||
{
|
||||
var path = ex.Filename;
|
||||
if (string.IsNullOrWhiteSpace(path) && ex.InnerException is ConfigurationErrorsException inner)
|
||||
path = inner.Filename;
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(path) && File.Exists(path))
|
||||
File.Delete(path);
|
||||
AppSettings.Default.Reload();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 删除/Reload 失败则向上抛出原异常
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override Window CreateShell()
|
||||
{
|
||||
return Container.Resolve<LoginWindow>();
|
||||
@@ -178,9 +219,8 @@ namespace YY.Admin
|
||||
_logger = Container.Resolve<ILoggerService>();
|
||||
// 初始化全局异常处理(通过解析触发构造函数注册)
|
||||
Container.Resolve<GlobalExceptionHandler>();
|
||||
// 保存默认主题
|
||||
AppSettings.Default.SkinType = AppSettingsViewModel.GetSkinType().ToInt();
|
||||
AppSettings.Default.Save();
|
||||
// 保存默认主题(用户级 user.config;损坏时自动删文件并重载)
|
||||
PersistSkinTypeUserSettingSafe();
|
||||
|
||||
_logger.Information("应用程序已启动");
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ namespace YY.Admin.ViewModels.Control
|
||||
public MenuItem? Parent { get; set; } // 父节点引用
|
||||
public ObservableCollection<MenuItem> Children { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 是否为桌面端配置的默认首页
|
||||
/// </summary>
|
||||
public bool IsDefaultDesktopHome { get; set; }
|
||||
|
||||
|
||||
private bool _isExpanded;
|
||||
|
||||
@@ -300,6 +305,7 @@ namespace YY.Admin.ViewModels.Control
|
||||
target.Icon = ConvertHtmlEntityToUnicode(source?.Icon ?? "");
|
||||
target.ViewName = ResolveViewName(source); // 将菜单路由映射到已注册的WPF视图
|
||||
target.Parent = parent; // 设置父节点
|
||||
target.IsDefaultDesktopHome = source?.IsDefaultDesktopHome == true;
|
||||
|
||||
// 添加子菜单(如果有)
|
||||
if (source.Children != null && source.Children.Any())
|
||||
@@ -389,8 +395,9 @@ namespace YY.Admin.ViewModels.Control
|
||||
{
|
||||
try
|
||||
{
|
||||
// 默认菜单
|
||||
var defaultMenuItem = GetFirstLeaf(MenuItems.FirstOrDefault());
|
||||
// 优先使用菜单管理中勾选的「默认首页」,否则取排序后的第一个叶子菜单
|
||||
var defaultMenuItem = FindDefaultHomeLeaf(MenuItems)
|
||||
?? GetFirstLeaf(MenuItems.FirstOrDefault());
|
||||
if (defaultMenuItem != null)
|
||||
{
|
||||
// Tab不允许关闭
|
||||
@@ -419,6 +426,31 @@ namespace YY.Admin.ViewModels.Control
|
||||
return GetFirstLeaf(menu.Children.FirstOrDefault());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按先序遍历查找第一个标记为默认首页的叶子节点(与左侧树展示顺序一致)
|
||||
/// </summary>
|
||||
private static MenuItem? FindDefaultHomeLeaf(IEnumerable<MenuItem>? nodes)
|
||||
{
|
||||
if (nodes == null)
|
||||
return null;
|
||||
|
||||
foreach (var m in nodes)
|
||||
{
|
||||
if (m.Children is not { Count: > 0 })
|
||||
{
|
||||
if (m.IsDefaultDesktopHome)
|
||||
return m;
|
||||
continue;
|
||||
}
|
||||
|
||||
var sub = FindDefaultHomeLeaf(m.Children);
|
||||
if (sub != null)
|
||||
return sub;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ToggleParents(MenuItem? item, bool IsExpanded)
|
||||
{
|
||||
if (item == null)
|
||||
|
||||
@@ -306,16 +306,7 @@ namespace YY.Admin.ViewModels
|
||||
ViewName = "MenuTreeView",
|
||||
Command = new DelegateCommand<NavItem>(it => _ = NavigateToViewAsync(CommonConst.MenuRegion, it.ViewName))
|
||||
},
|
||||
new NavItem {
|
||||
Icon = "GamepadVariantOutline",
|
||||
Name = "菜单区域",
|
||||
Command = new DelegateCommand<NavItem>(it => _ = NavigateToViewAsync(CommonConst.MenuRegion, it.ViewName))
|
||||
},
|
||||
new NavItem {
|
||||
Icon = "FoodAppleOutline",
|
||||
Name = "Tab区域",
|
||||
Command = new DelegateCommand<NavItem>(OnOpenOrActivateTab)
|
||||
},
|
||||
// 已隐藏开发调试用「菜单区域」「Tab区域」,日常仅保留「功能菜单」
|
||||
(_menuTreeToggleNavItem = new NavItem {
|
||||
Icon = "ChevronDoubleLeft",
|
||||
Name = "折叠菜单",
|
||||
|
||||
@@ -688,6 +688,11 @@ public class RawMaterialEntryOperationViewModel : RawMaterialEntryEditDialogView
|
||||
return;
|
||||
}
|
||||
|
||||
if (!await EnsureEntryBarcodeAndBatchNoAsync())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 库位必填仅校验本批待生成行;行号取在原集合的真实索引,避免编号偏移误导
|
||||
foreach (var row in pendingRows)
|
||||
{
|
||||
@@ -865,6 +870,42 @@ public class RawMaterialEntryOperationViewModel : RawMaterialEntryEditDialogView
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成原材料卡片前确保入场记录已有条码/批次号。
|
||||
/// 规则:条码优先沿用现有值;为空时调用入场服务生成(在线优先,离线本地兜底);
|
||||
/// 批次号为空则回填为条码。
|
||||
/// </summary>
|
||||
private async Task<bool> EnsureEntryBarcodeAndBatchNoAsync()
|
||||
{
|
||||
if (Entry == null) return false;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Entry.Barcode))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Entry.MaterialCode))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("当前记录缺少物料编码,无法生成原材料卡片条码。");
|
||||
return false;
|
||||
}
|
||||
|
||||
var code = await EntryService.GenerateBarcodeAsync(Entry.MaterialCode);
|
||||
if (string.IsNullOrWhiteSpace(code))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("未能生成入场条码,请检查网络或稍后重试。");
|
||||
return false;
|
||||
}
|
||||
|
||||
Entry.Barcode = code.Trim();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Entry.BatchNo))
|
||||
{
|
||||
Entry.BatchNo = Entry.Barcode;
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(Entry));
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<RawMaterialCardGeneratePlanItem> BuildPlannedRawMaterialCards(
|
||||
MesXslRawMaterialEntry entry,
|
||||
IReadOnlyList<RawMaterialSplitDetailItem> pendingRows,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
@@ -11,21 +12,28 @@ using YY.Admin.Services.Service.Menu;
|
||||
namespace YY.Admin.ViewModels.SysManage;
|
||||
|
||||
/// <summary>
|
||||
/// 左侧列表一行(树形扁平展示)
|
||||
/// 左侧列表一行(树形扁平展示,可见行受折叠状态控制)
|
||||
/// </summary>
|
||||
public sealed class MenuFlatRow
|
||||
{
|
||||
public SysMenu Menu { get; }
|
||||
public int Depth { get; }
|
||||
public string IndentTitle { get; }
|
||||
/// <summary>是否存在子节点(用于显示展开按钮)</summary>
|
||||
public bool HasChildren { get; }
|
||||
/// <summary>子节点当前是否展开</summary>
|
||||
public bool IsExpanded { get; }
|
||||
public Thickness LeadingMargin => new(Depth * 14, 0, 0, 0);
|
||||
public string TitleText { get; }
|
||||
|
||||
public MenuFlatRow(SysMenu menu, int depth)
|
||||
public MenuFlatRow(SysMenu menu, int depth, bool hasChildren, bool isExpanded)
|
||||
{
|
||||
Menu = menu;
|
||||
Depth = depth;
|
||||
var pad = new string(' ', depth);
|
||||
HasChildren = hasChildren;
|
||||
IsExpanded = isExpanded;
|
||||
var tag = menu.Type == MenuTypeEnum.Dir ? "[目录] " : menu.Type == MenuTypeEnum.Btn ? "[按钮] " : "[菜单] ";
|
||||
IndentTitle = pad + tag + menu.Title;
|
||||
var homeMark = menu.IsDefaultDesktopHome ? "[默认首页] " : "";
|
||||
TitleText = tag + homeMark + menu.Title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,13 +57,25 @@ public class MenuEditorModel : BindableBase
|
||||
private bool _isHide;
|
||||
private bool _isKeepAlive = true;
|
||||
private bool _isAffix;
|
||||
private bool _isDefaultDesktopHome;
|
||||
private int _orderNo = 100;
|
||||
private StatusEnum _status = StatusEnum.Enable;
|
||||
private string? _remark;
|
||||
|
||||
public long Id { get => _id; set => SetProperty(ref _id, value); }
|
||||
public long Pid { get => _pid; set => SetProperty(ref _pid, value); }
|
||||
public MenuTypeEnum Type { get => _type; set => SetProperty(ref _type, value); }
|
||||
public MenuTypeEnum Type
|
||||
{
|
||||
get => _type;
|
||||
set
|
||||
{
|
||||
if (!SetProperty(ref _type, value))
|
||||
return;
|
||||
RaisePropertyChanged(nameof(CanSetDefaultDesktopHome));
|
||||
if (value != MenuTypeEnum.Menu)
|
||||
IsDefaultDesktopHome = false;
|
||||
}
|
||||
}
|
||||
public string? Name { get => _name; set => SetProperty(ref _name, value); }
|
||||
public string? Path { get => _path; set => SetProperty(ref _path, value); }
|
||||
public string? Component { get => _component; set => SetProperty(ref _component, value); }
|
||||
@@ -68,12 +88,20 @@ public class MenuEditorModel : BindableBase
|
||||
public bool IsHide { get => _isHide; set => SetProperty(ref _isHide, value); }
|
||||
public bool IsKeepAlive { get => _isKeepAlive; set => SetProperty(ref _isKeepAlive, value); }
|
||||
public bool IsAffix { get => _isAffix; set => SetProperty(ref _isAffix, value); }
|
||||
public bool IsDefaultDesktopHome
|
||||
{
|
||||
get => _isDefaultDesktopHome;
|
||||
set => SetProperty(ref _isDefaultDesktopHome, value);
|
||||
}
|
||||
public int OrderNo { get => _orderNo; set => SetProperty(ref _orderNo, value); }
|
||||
public StatusEnum Status { get => _status; set => SetProperty(ref _status, value); }
|
||||
public string? Remark { get => _remark; set => SetProperty(ref _remark, value); }
|
||||
|
||||
public bool IsNew => Id == 0;
|
||||
|
||||
/// <summary>仅「菜单」类型可设为桌面默认首页</summary>
|
||||
public bool CanSetDefaultDesktopHome => Type == MenuTypeEnum.Menu;
|
||||
|
||||
public void LoadFrom(SysMenu m)
|
||||
{
|
||||
Id = m.Id;
|
||||
@@ -91,6 +119,7 @@ public class MenuEditorModel : BindableBase
|
||||
IsHide = m.IsHide;
|
||||
IsKeepAlive = m.IsKeepAlive;
|
||||
IsAffix = m.IsAffix;
|
||||
IsDefaultDesktopHome = m.Type == MenuTypeEnum.Menu && m.IsDefaultDesktopHome;
|
||||
OrderNo = m.OrderNo;
|
||||
Status = m.Status;
|
||||
Remark = m.Remark;
|
||||
@@ -115,6 +144,7 @@ public class MenuEditorModel : BindableBase
|
||||
IsHide = IsHide,
|
||||
IsKeepAlive = IsKeepAlive,
|
||||
IsAffix = IsAffix,
|
||||
IsDefaultDesktopHome = Type == MenuTypeEnum.Menu && IsDefaultDesktopHome,
|
||||
OrderNo = OrderNo,
|
||||
Status = Status,
|
||||
Remark = Remark
|
||||
@@ -138,6 +168,7 @@ public class MenuEditorModel : BindableBase
|
||||
IsHide = false;
|
||||
IsKeepAlive = true;
|
||||
IsAffix = false;
|
||||
IsDefaultDesktopHome = false;
|
||||
OrderNo = 100;
|
||||
Status = StatusEnum.Enable;
|
||||
Remark = null;
|
||||
@@ -147,6 +178,10 @@ public class MenuEditorModel : BindableBase
|
||||
public class MenuManagementViewModel : BaseViewModel
|
||||
{
|
||||
private readonly ISysMenuService _menuService;
|
||||
/// <summary>最近一次加载的全量菜单(折叠切换时仅重算列表,不重复读库)</summary>
|
||||
private List<SysMenu> _allMenusCache = new();
|
||||
/// <summary>已折叠节点 Id(其子级不在扁平列表中展示)</summary>
|
||||
private readonly HashSet<long> _collapsedMenuIds = new();
|
||||
|
||||
public ObservableCollection<MenuFlatRow> FlatRows { get; } = new();
|
||||
public ObservableCollection<KeyValuePair<long, string>> ParentOptions { get; } = new();
|
||||
@@ -208,6 +243,9 @@ public class MenuManagementViewModel : BaseViewModel
|
||||
public DelegateCommand AddChildCommand { get; }
|
||||
public DelegateCommand SaveCommand { get; }
|
||||
public DelegateCommand DeleteCommand { get; }
|
||||
public DelegateCommand<MenuFlatRow?> ToggleExpandCommand { get; }
|
||||
public DelegateCommand ExpandAllCommand { get; }
|
||||
public DelegateCommand CollapseAllCommand { get; }
|
||||
|
||||
public MenuManagementViewModel(
|
||||
ISysMenuService menuService,
|
||||
@@ -224,6 +262,9 @@ public class MenuManagementViewModel : BaseViewModel
|
||||
.ObservesProperty(() => Editor);
|
||||
DeleteCommand = new DelegateCommand(async () => await DeleteAsync(), () => SelectedRow != null && SelectedRow.Menu.Id != 0)
|
||||
.ObservesProperty(() => SelectedRow);
|
||||
ToggleExpandCommand = new DelegateCommand<MenuFlatRow?>(OnToggleExpand);
|
||||
ExpandAllCommand = new DelegateCommand(OnExpandAll);
|
||||
CollapseAllCommand = new DelegateCommand(OnCollapseAll);
|
||||
|
||||
_ = RefreshAsync();
|
||||
}
|
||||
@@ -234,8 +275,11 @@ public class MenuManagementViewModel : BaseViewModel
|
||||
{
|
||||
IsLoading = true;
|
||||
var all = await _menuService.GetAllMenusForManageAsync();
|
||||
PruneCollapsedState(all);
|
||||
_allMenusCache = all;
|
||||
RebuildFlat(all);
|
||||
RebuildParentOptions(all);
|
||||
ResyncSelectionAfterRebuild();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -250,18 +294,90 @@ public class MenuManagementViewModel : BaseViewModel
|
||||
private void RebuildFlat(List<SysMenu> all)
|
||||
{
|
||||
FlatRows.Clear();
|
||||
bool HasChild(long id) => all.Any(x => x.Pid == id);
|
||||
|
||||
void Walk(long pid, int depth)
|
||||
{
|
||||
foreach (var m in all.Where(x => x.Pid == pid).OrderBy(x => x.OrderNo).ThenBy(x => x.Id))
|
||||
{
|
||||
FlatRows.Add(new MenuFlatRow(m, depth));
|
||||
Walk(m.Id, depth + 1);
|
||||
var hasCh = HasChild(m.Id);
|
||||
var expanded = !_collapsedMenuIds.Contains(m.Id);
|
||||
FlatRows.Add(new MenuFlatRow(m, depth, hasCh, expanded));
|
||||
if (hasCh && expanded)
|
||||
Walk(m.Id, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Walk(0, 0);
|
||||
}
|
||||
|
||||
/// <summary>删除已不存在的菜单 Id,并去掉已无子级的折叠记录</summary>
|
||||
private void PruneCollapsedState(List<SysMenu> all)
|
||||
{
|
||||
var validIds = new HashSet<long>(all.Select(m => m.Id));
|
||||
foreach (var id in _collapsedMenuIds.ToList())
|
||||
{
|
||||
if (!validIds.Contains(id) || !all.Any(x => x.Pid == id))
|
||||
_collapsedMenuIds.Remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToggleExpand(MenuFlatRow? row)
|
||||
{
|
||||
if (row?.HasChildren != true)
|
||||
return;
|
||||
|
||||
var id = row.Menu.Id;
|
||||
if (_collapsedMenuIds.Contains(id))
|
||||
_collapsedMenuIds.Remove(id);
|
||||
else
|
||||
_collapsedMenuIds.Add(id);
|
||||
|
||||
RebuildFlat(_allMenusCache);
|
||||
ResyncSelectionAfterRebuild();
|
||||
}
|
||||
|
||||
private void OnExpandAll()
|
||||
{
|
||||
_collapsedMenuIds.Clear();
|
||||
RebuildFlat(_allMenusCache);
|
||||
ResyncSelectionAfterRebuild();
|
||||
}
|
||||
|
||||
private void OnCollapseAll()
|
||||
{
|
||||
_collapsedMenuIds.Clear();
|
||||
foreach (var m in _allMenusCache.Where(m => _allMenusCache.Any(c => c.Pid == m.Id)))
|
||||
_collapsedMenuIds.Add(m.Id);
|
||||
|
||||
RebuildFlat(_allMenusCache);
|
||||
ResyncSelectionAfterRebuild();
|
||||
}
|
||||
|
||||
/// <summary>重建列表后,按 Id 恢复选中;若当前项被折叠隐藏则选中其可见祖先</summary>
|
||||
private void ResyncSelectionAfterRebuild()
|
||||
{
|
||||
if (_selectedRow == null)
|
||||
return;
|
||||
|
||||
var id = _selectedRow.Menu.Id;
|
||||
MenuFlatRow? row = FlatRows.FirstOrDefault(r => r.Menu.Id == id);
|
||||
var curId = id;
|
||||
while (row == null && curId != 0)
|
||||
{
|
||||
var m = _allMenusCache.FirstOrDefault(x => x.Id == curId);
|
||||
if (m == null)
|
||||
break;
|
||||
curId = m.Pid;
|
||||
if (curId == 0)
|
||||
break;
|
||||
row = FlatRows.FirstOrDefault(r => r.Menu.Id == curId);
|
||||
}
|
||||
|
||||
if (row != null)
|
||||
SelectedRow = row;
|
||||
}
|
||||
|
||||
private void RebuildParentOptions(List<SysMenu> all)
|
||||
{
|
||||
ParentOptions.Clear();
|
||||
|
||||
@@ -168,9 +168,12 @@ public class WeightRecordEditDialogViewModel : BaseViewModel, IDialogResultable<
|
||||
return;
|
||||
}
|
||||
|
||||
// 净重自动计算
|
||||
if (Record.GrossWeight.HasValue && Record.TareWeight.HasValue)
|
||||
// 净重自动计算(0 视为未称,不计算净重)
|
||||
if (Record.GrossWeight.HasValue && Record.GrossWeight.Value > 0
|
||||
&& Record.TareWeight.HasValue && Record.TareWeight.Value > 0)
|
||||
Record.NetWeight = Math.Round(Record.GrossWeight.Value - Record.TareWeight.Value, 2);
|
||||
else
|
||||
Record.NetWeight = null;
|
||||
|
||||
// 写入密炼物料
|
||||
Record.MixerMaterialIds = _mixerMaterialIds;
|
||||
|
||||
@@ -98,6 +98,21 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
private bool _tareWeightCaptured;
|
||||
public bool TareWeightCaptured { get => _tareWeightCaptured; set => SetProperty(ref _tareWeightCaptured, value); }
|
||||
|
||||
/// <summary>
|
||||
/// 手动输入毛重/皮重(仅用于测试联调,正式过磅请关闭)。
|
||||
/// </summary>
|
||||
private bool _isManualWeightEntry;
|
||||
public bool IsManualWeightEntry
|
||||
{
|
||||
get => _isManualWeightEntry;
|
||||
set
|
||||
{
|
||||
if (!SetProperty(ref _isManualWeightEntry, value)) return;
|
||||
CaptureGrossWeightCommand.RaiseCanExecuteChanged();
|
||||
CaptureTareWeightCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 表单绑定属性 ───
|
||||
|
||||
private DateTime _weighDate = DateTime.Today;
|
||||
@@ -234,14 +249,27 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
public double? GrossWeight
|
||||
{
|
||||
get => _grossWeight;
|
||||
set { SetProperty(ref _grossWeight, value); RecalcNetWeight(); }
|
||||
set
|
||||
{
|
||||
if (!SetProperty(ref _grossWeight, value)) return;
|
||||
// 测试用手动录入:有有效数值即视为已填写(用于「已采集」提示与保存)
|
||||
if (IsManualWeightEntry)
|
||||
GrossWeightCaptured = value.HasValue && value.Value > 0;
|
||||
RecalcNetWeight();
|
||||
}
|
||||
}
|
||||
|
||||
private double? _tareWeight;
|
||||
public double? TareWeight
|
||||
{
|
||||
get => _tareWeight;
|
||||
set { SetProperty(ref _tareWeight, value); RecalcNetWeight(); }
|
||||
set
|
||||
{
|
||||
if (!SetProperty(ref _tareWeight, value)) return;
|
||||
if (IsManualWeightEntry)
|
||||
TareWeightCaptured = value.HasValue && value.Value > 0;
|
||||
RecalcNetWeight();
|
||||
}
|
||||
}
|
||||
|
||||
private double? _netWeight;
|
||||
@@ -312,10 +340,12 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
|
||||
CaptureGrossWeightCommand = new DelegateCommand(CaptureGrossWeight, CanCaptureGrossWeight)
|
||||
.ObservesProperty(() => IsWeightStable)
|
||||
.ObservesProperty(() => IsManualWeightEntry)
|
||||
.ObservesProperty(() => GrossWeightCaptured)
|
||||
.ObservesProperty(() => TareWeightCaptured);
|
||||
CaptureTareWeightCommand = new DelegateCommand(CaptureTareWeight, CanCaptureTareWeight)
|
||||
.ObservesProperty(() => IsWeightStable)
|
||||
.ObservesProperty(() => IsManualWeightEntry)
|
||||
.ObservesProperty(() => GrossWeightCaptured)
|
||||
.ObservesProperty(() => TareWeightCaptured);
|
||||
SaveCommand = new DelegateCommand(async () => await SaveAsync());
|
||||
@@ -386,7 +416,8 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
{
|
||||
_vehiclePresent = true;
|
||||
_stableCountdown = 0;
|
||||
_baseWeight = _rnd.Next(18000, 65000); // 18~65吨随机
|
||||
// 同一张单第二次上磅:模拟重量与已采值协调(先毛后皮 → 皮重小于毛重;先皮后毛 → 毛重大于皮重)
|
||||
PickBaseWeightForCurrentWeighingScenario();
|
||||
AddLog("检测到车辆入场");
|
||||
|
||||
// 模拟摄像头识别车牌(2秒后回传)
|
||||
@@ -411,6 +442,40 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
leaveTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按当前单据已填毛重/皮重生成模拟磅台基准重量,保证净重合理。
|
||||
/// </summary>
|
||||
private void PickBaseWeightForCurrentWeighingScenario()
|
||||
{
|
||||
if (HasEffectiveWeighValue(GrossWeight) && !HasEffectiveWeighValue(TareWeight))
|
||||
{
|
||||
var g = GrossWeight!.Value;
|
||||
// 皮重需明显小于毛重,留出净重空间
|
||||
var maxTare = Math.Max(0, g - 30);
|
||||
var minTare = Math.Min(maxTare * 0.22, maxTare - 80);
|
||||
minTare = Math.Max(0, minTare);
|
||||
if (maxTare - minTare < 25)
|
||||
minTare = Math.Max(0, maxTare * 0.45);
|
||||
if (maxTare - minTare < 1)
|
||||
maxTare = Math.Max(minTare + 1, g - 5);
|
||||
_baseWeight = minTare + _rnd.NextDouble() * Math.Max(1e-6, maxTare - minTare);
|
||||
}
|
||||
else if (HasEffectiveWeighValue(TareWeight) && !HasEffectiveWeighValue(GrossWeight))
|
||||
{
|
||||
var t = TareWeight!.Value;
|
||||
var lower = t + Math.Max(100, t * 0.05);
|
||||
var span = 8000 + _rnd.NextDouble() * 12000;
|
||||
var upper = Math.Min(65000, lower + span);
|
||||
if (upper - lower < 500)
|
||||
upper = lower + 500;
|
||||
_baseWeight = lower + _rnd.NextDouble() * (upper - lower);
|
||||
}
|
||||
else
|
||||
{
|
||||
_baseWeight = _rnd.Next(18000, 65000); // 18~65 吨随机(首次过磅或两称已齐)
|
||||
}
|
||||
}
|
||||
|
||||
private void SimulateVehicleLeave()
|
||||
{
|
||||
_vehiclePresent = false;
|
||||
@@ -446,19 +511,25 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
|
||||
private bool CanCaptureGrossWeight()
|
||||
{
|
||||
return IsWeightStable && !GrossWeightCaptured;
|
||||
if (GrossWeightCaptured) return false;
|
||||
// 手动测试模式:无需等稳定即可点采集
|
||||
if (IsManualWeightEntry) return true;
|
||||
return IsWeightStable;
|
||||
}
|
||||
|
||||
private bool CanCaptureTareWeight()
|
||||
{
|
||||
return IsWeightStable && !TareWeightCaptured;
|
||||
if (TareWeightCaptured) return false;
|
||||
if (IsManualWeightEntry) return true;
|
||||
return IsWeightStable;
|
||||
}
|
||||
|
||||
private void RecalcNetWeight()
|
||||
{
|
||||
if (GrossWeight.HasValue && TareWeight.HasValue)
|
||||
// 与后端一致:0 或占位视为“未称”,避免仅毛重时 net=tare(0) 即毛重、单据误判完成
|
||||
if (HasEffectiveWeighValue(GrossWeight) && HasEffectiveWeighValue(TareWeight))
|
||||
{
|
||||
NetWeight = Math.Round(GrossWeight.Value - TareWeight.Value, 2);
|
||||
NetWeight = Math.Round(GrossWeight!.Value - TareWeight!.Value, 2);
|
||||
RaisePropertyChanged(nameof(NetWeightDisplay));
|
||||
}
|
||||
else
|
||||
@@ -468,6 +539,8 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private static bool HasEffectiveWeighValue(double? kg) => kg.HasValue && kg.Value > 0;
|
||||
|
||||
private async Task SaveAsync()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(PlateNumber))
|
||||
@@ -481,12 +554,12 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
var isOutbound = string.Equals(InoutDirection, "2", StringComparison.Ordinal);
|
||||
if (!isCompleteSelectedRecord)
|
||||
{
|
||||
if (isOutbound && !TareWeight.HasValue)
|
||||
if (isOutbound && !HasEffectiveWeighValue(TareWeight))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("出厂流程请先采集皮重!");
|
||||
return;
|
||||
}
|
||||
if (!isOutbound && !GrossWeight.HasValue)
|
||||
if (!isOutbound && !HasEffectiveWeighValue(GrossWeight))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("进厂流程请先采集毛重!");
|
||||
return;
|
||||
@@ -494,7 +567,7 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
var needSecondWeightCaptured = isOutbound ? GrossWeight.HasValue : TareWeight.HasValue;
|
||||
var needSecondWeightCaptured = isOutbound ? HasEffectiveWeighValue(GrossWeight) : HasEffectiveWeighValue(TareWeight);
|
||||
if (!needSecondWeightCaptured)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning(isOutbound
|
||||
@@ -558,6 +631,7 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
ClearCustomerSelection();
|
||||
ClearMixerMaterialSelection();
|
||||
ClearVehicleMatch();
|
||||
IsManualWeightEntry = false;
|
||||
// 保存后立即按当前方向回填缓存,避免必须重进页面才显示
|
||||
TryApplyCachedUnitByDirection(InoutDirection);
|
||||
RaisePropertyChanged(nameof(NetWeightDisplay));
|
||||
@@ -592,8 +666,9 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
IsPlateNumberLocked = false;
|
||||
ClearSupplierSelection();
|
||||
ClearCustomerSelection();
|
||||
ClearMixerMaterialSelection();
|
||||
ClearMixerMaterialSelection();
|
||||
ClearVehicleMatch();
|
||||
IsManualWeightEntry = false;
|
||||
RaisePropertyChanged(nameof(NetWeightDisplay));
|
||||
AddLog("表单已清空");
|
||||
}
|
||||
@@ -845,15 +920,16 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
// 按进出方向查询当天待补称单据:进厂=已称毛重,出厂=已称皮重。
|
||||
var page = await _weightRecordService.PageAsync(1, 100, filterPlateNumber: plate);
|
||||
var today = DateTime.Today;
|
||||
var isOutbound = string.Equals(InoutDirection, "2", StringComparison.Ordinal);
|
||||
var candidates = page.Records
|
||||
.Where(r =>
|
||||
string.Equals((r.PlateNumber ?? string.Empty).Trim(), plate, StringComparison.OrdinalIgnoreCase) &&
|
||||
r.WeighDate.HasValue &&
|
||||
r.WeighDate.Value.Date == today &&
|
||||
(isOutbound
|
||||
? (r.TareWeight.HasValue && !r.GrossWeight.HasValue)
|
||||
: (r.GrossWeight.HasValue && !r.TareWeight.HasValue)))
|
||||
var isOutbound = string.Equals(InoutDirection, "2", StringComparison.Ordinal);
|
||||
bool effT(double? w) => w.HasValue && w.Value > 0;
|
||||
var candidates = page.Records
|
||||
.Where(r =>
|
||||
string.Equals((r.PlateNumber ?? string.Empty).Trim(), plate, StringComparison.OrdinalIgnoreCase) &&
|
||||
r.WeighDate.HasValue &&
|
||||
r.WeighDate.Value.Date == today &&
|
||||
(isOutbound
|
||||
? (effT(r.TareWeight) && !effT(r.GrossWeight))
|
||||
: (effT(r.GrossWeight) && !effT(r.TareWeight))))
|
||||
.OrderByDescending(r => r.CreateTime ?? DateTime.MinValue)
|
||||
.ToList();
|
||||
|
||||
@@ -865,8 +941,8 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
BillNo = record.BillNo ?? "-",
|
||||
PlateNumber = record.PlateNumber ?? "-",
|
||||
FirstWeightDisplay = isOutbound
|
||||
? (record.TareWeight.HasValue ? $"{record.TareWeight.Value:N2}" : "-")
|
||||
: (record.GrossWeight.HasValue ? $"{record.GrossWeight.Value:N2}" : "-")
|
||||
? (HasEffectiveWeighValue(record.TareWeight) ? $"{record.TareWeight!.Value:N2}" : "-")
|
||||
: (HasEffectiveWeighValue(record.GrossWeight) ? $"{record.GrossWeight!.Value:N2}" : "-")
|
||||
});
|
||||
}
|
||||
|
||||
@@ -914,14 +990,14 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
if (isOutbound)
|
||||
{
|
||||
TareWeight = selected.Source.TareWeight;
|
||||
TareWeightCaptured = TareWeight.HasValue;
|
||||
TareWeightCaptured = HasEffectiveWeighValue(TareWeight);
|
||||
GrossWeight = null;
|
||||
GrossWeightCaptured = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
GrossWeight = selected.Source.GrossWeight;
|
||||
GrossWeightCaptured = GrossWeight.HasValue;
|
||||
GrossWeightCaptured = HasEffectiveWeighValue(GrossWeight);
|
||||
TareWeight = null;
|
||||
TareWeightCaptured = false;
|
||||
}
|
||||
@@ -953,6 +1029,7 @@ public class WeightRecordOperationViewModel : BaseViewModel
|
||||
ClearCustomerSelection();
|
||||
ClearMixerMaterialSelection();
|
||||
ClearVehicleMatch();
|
||||
IsManualWeightEntry = false;
|
||||
RaisePropertyChanged(nameof(NetWeightDisplay));
|
||||
AddLog("已切换进出方向,当前表单数据已清空");
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:consts="clr-namespace:YY.Admin.Core.Const;assembly=YY.Admin.Core"
|
||||
xmlns:ctls="clr-namespace:YY.Admin.Core.Controls;assembly=YY.Admin.Core"
|
||||
xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Icon="/Resources/Icon/logo.ico"
|
||||
Title="{Binding Title}"
|
||||
@@ -17,6 +18,28 @@
|
||||
KeyDown="Window_KeyDown"
|
||||
FontSize="{StaticResource FontSize }">
|
||||
|
||||
<hc:Window.NonClientAreaContent>
|
||||
<!-- 与最小化/关闭同一标题栏行,靠右紧贴系统按钮左侧 -->
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
<Button
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,2,0"
|
||||
Width="34"
|
||||
Height="26"
|
||||
Padding="0"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Hand"
|
||||
Focusable="False"
|
||||
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
||||
Command="{Binding OpenServerSettingsCommand}"
|
||||
ToolTip="服务器设置">
|
||||
<ctls:FontAwesomeIcon Icon="" IconFamily="Solid" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</hc:Window.NonClientAreaContent>
|
||||
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -38,16 +61,6 @@
|
||||
|
||||
<Border Grid.Column="1">
|
||||
<Grid>
|
||||
<Button
|
||||
Command="{Binding OpenServerSettingsCommand}"
|
||||
Width="34"
|
||||
Height="34"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,8,8,0"
|
||||
ToolTip="服务器设置">
|
||||
<ctls:FontAwesomeIcon Icon="" IconFamily="Solid"/>
|
||||
</Button>
|
||||
<StackPanel Margin="20 0 20 20">
|
||||
<!-- Logo和标题 -->
|
||||
<StackPanel HorizontalAlignment="Center" Margin="0,20,0,40">
|
||||
|
||||
@@ -61,11 +61,53 @@
|
||||
|
||||
<Border Grid.Column="0" CornerRadius="4" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="4">
|
||||
<DockPanel LastChildFill="True">
|
||||
<TextBlock DockPanel.Dock="Top" Margin="4,0,4,8" Text="菜单树(点击选中后在右侧编辑)" TextWrapping="Wrap" Opacity="0.85"/>
|
||||
<StackPanel DockPanel.Dock="Top" Margin="4,0,4,8">
|
||||
<TextBlock Text="菜单树(点击选中后在右侧编辑,有子节点时可点箭头折叠/展开)" TextWrapping="Wrap" Opacity="0.85"/>
|
||||
<hc:UniformSpacingPanel Spacing="6" Margin="0,6,0,0">
|
||||
<Button Content="全部展开" Padding="8,2" Style="{StaticResource ButtonInfo}"
|
||||
Command="{Binding ExpandAllCommand}"/>
|
||||
<Button Content="全部折叠" Padding="8,2" Style="{StaticResource ButtonInfo}"
|
||||
Command="{Binding CollapseAllCommand}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
<ListBox ItemsSource="{Binding FlatRows}"
|
||||
SelectedItem="{Binding SelectedRow, Mode=TwoWay}"
|
||||
DisplayMemberPath="IndentTitle"
|
||||
VirtualizingStackPanel.IsVirtualizing="True"/>
|
||||
VirtualizingStackPanel.IsVirtualizing="True">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="{Binding LeadingMargin}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0"
|
||||
Width="20" Height="20" Padding="0"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Center"
|
||||
Cursor="Hand"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Command="{Binding DataContext.ToggleExpandCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
|
||||
CommandParameter="{Binding}"
|
||||
Visibility="{Binding HasChildren, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||
<md:PackIcon Width="16" Height="16" VerticalAlignment="Center">
|
||||
<md:PackIcon.Style>
|
||||
<Style TargetType="md:PackIcon">
|
||||
<Setter Property="Kind" Value="ChevronRight"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsExpanded}" Value="True">
|
||||
<Setter Property="Kind" Value="ChevronDown"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</md:PackIcon.Style>
|
||||
</md:PackIcon>
|
||||
</Button>
|
||||
<TextBlock Grid.Column="1" Text="{Binding TitleText}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
@@ -199,6 +241,12 @@
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=12, Md=4, Lg=4, Xl=4}">
|
||||
<CheckBox Content="固定页签" IsChecked="{Binding IsAffix}" Margin="0,6,0,0"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=12, Md=8, Lg=8, Xl=8}">
|
||||
<CheckBox Content="默认首页(桌面登录后自动打开此菜单)"
|
||||
IsChecked="{Binding IsDefaultDesktopHome}"
|
||||
IsEnabled="{Binding CanSetDefaultDesktopHome}"
|
||||
Margin="0,6,0,0"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=12, Md=4, Lg=4, Xl=4}">
|
||||
<CheckBox Content="缓存页面" IsChecked="{Binding IsKeepAlive}" Margin="0,6,0,0"/>
|
||||
</hc:Col>
|
||||
|
||||
@@ -540,9 +540,14 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,4">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,4" VerticalAlignment="Center">
|
||||
<Border Width="4" Height="18" CornerRadius="2" Background="{StaticResource SectionBorderBrush}"/>
|
||||
<TextBlock Text="重量信息" Style="{StaticResource SectionTitleStyle}"/>
|
||||
<CheckBox Margin="16,0,0,0" VerticalAlignment="Center"
|
||||
Content="手动输入重量"
|
||||
IsChecked="{Binding IsManualWeightEntry, Mode=TwoWay}"/>
|
||||
<TextBlock Margin="8,0,0,0" VerticalAlignment="Center"
|
||||
FontSize="11" Foreground="#ff9800" Text="(仅限测试)"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 毛重 / 皮重并排 -->
|
||||
@@ -568,20 +573,44 @@
|
||||
<TextBlock Text="毛 重(KG)" FontSize="12" Foreground="{DynamicResource SecondaryTextBrush}"
|
||||
Margin="0,0,0,4" HorizontalAlignment="Center"/>
|
||||
<Border CornerRadius="8" Padding="10,10" Background="{DynamicResource RegionBrush}">
|
||||
<TextBlock Text="{Binding GrossWeight, StringFormat=N2, FallbackValue=—, TargetNullValue=—}"
|
||||
HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"
|
||||
FontFamily="Consolas">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding GrossWeightCaptured}" Value="True">
|
||||
<Setter Property="Foreground" Value="#4caf50"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<Grid MinHeight="40">
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"
|
||||
FontFamily="Consolas" VerticalAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<Binding Path="GrossWeight" StringFormat="N2" TargetNullValue="—"/>
|
||||
</TextBlock.Text>
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding GrossWeightCaptured}" Value="True">
|
||||
<Setter Property="Foreground" Value="#4caf50"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsManualWeightEntry}" Value="True">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<hc:NumericUpDown Value="{Binding GrossWeight, Mode=TwoWay}"
|
||||
Minimum="0"
|
||||
DecimalPlaces="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center">
|
||||
<hc:NumericUpDown.Style>
|
||||
<Style TargetType="hc:NumericUpDown" BasedOn="{StaticResource NumericUpDownPlus}">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsManualWeightEntry}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</hc:NumericUpDown.Style>
|
||||
</hc:NumericUpDown>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Margin="0,6,0,0" Height="32" CornerRadius="6">
|
||||
<Border.Style>
|
||||
@@ -632,12 +661,44 @@
|
||||
<TextBlock Text="皮 重(KG)" FontSize="12" Foreground="{DynamicResource SecondaryTextBrush}"
|
||||
Margin="0,0,0,4" HorizontalAlignment="Center"/>
|
||||
<Border CornerRadius="8" Padding="10,10" Background="{DynamicResource RegionBrush}">
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"
|
||||
FontFamily="Consolas" Foreground="{DynamicResource SecondaryTextBrush}">
|
||||
<TextBlock.Text>
|
||||
<Binding Path="TareWeight" StringFormat="N2" FallbackValue="—" TargetNullValue="—"/>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<Grid MinHeight="40">
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"
|
||||
FontFamily="Consolas" VerticalAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<Binding Path="TareWeight" StringFormat="N2" TargetNullValue="—"/>
|
||||
</TextBlock.Text>
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding TareWeightCaptured}" Value="True">
|
||||
<Setter Property="Foreground" Value="#4caf50"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsManualWeightEntry}" Value="True">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<hc:NumericUpDown Value="{Binding TareWeight, Mode=TwoWay}"
|
||||
Minimum="0"
|
||||
DecimalPlaces="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center">
|
||||
<hc:NumericUpDown.Style>
|
||||
<Style TargetType="hc:NumericUpDown" BasedOn="{StaticResource NumericUpDownPlus}">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsManualWeightEntry}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</hc:NumericUpDown.Style>
|
||||
</hc:NumericUpDown>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Margin="0,6,0,0" Height="32" CornerRadius="6">
|
||||
<Border.Style>
|
||||
|
||||
@@ -68,6 +68,16 @@ if errorlevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM <20>˵<EFBFBD><CBB5><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLite<74><65><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>³<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>һ<EFBFBD>ݣ<EFBFBD>dotnet publish Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if exist "Admin.NET.db" (
|
||||
copy /Y "Admin.NET.db" "publish\" >nul
|
||||
echo <20>Ѹ<EFBFBD><D1B8><EFBFBD> Admin.NET.db<64><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>һ<EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
|
||||
)
|
||||
if exist "Slave.db" (
|
||||
copy /Y "Slave.db" "publish\" >nul
|
||||
echo <20>Ѹ<EFBFBD><D1B8><EFBFBD> Slave.db
|
||||
)
|
||||
|
||||
REM <20><><EFBFBD><EFBFBD> Updates Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD>ư汾<C6B0>ļ<EFBFBD>
|
||||
echo [3/4] <20><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>...
|
||||
if not exist "publish\Updates" mkdir "publish\Updates"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
418
yy-admin-master/installer/ChineseSimplified.isl
Normal file
418
yy-admin-master/installer/ChineseSimplified.isl
Normal file
@@ -0,0 +1,418 @@
|
||||
; *** Inno Setup version 6.5.0+ Chinese Simplified messages ***
|
||||
;
|
||||
; To download user-contributed translations of this file, go to:
|
||||
; https://jrsoftware.org/files/istrans/
|
||||
;
|
||||
; Note: When translating this text, do not add periods (.) to the end of
|
||||
; messages that didn't have them already, because on those messages Inno
|
||||
; Setup adds the periods automatically (appending a period would result in
|
||||
; two periods being displayed).
|
||||
;
|
||||
; Maintained by Zhenghan Yang
|
||||
; Email: 847320916@QQ.com
|
||||
; Translation based on network resource
|
||||
; The latest Translation is on https://github.com/kira-96/Inno-Setup-Chinese-Simplified-Translation
|
||||
;
|
||||
|
||||
[LangOptions]
|
||||
; The following three entries are very important. Be sure to read and
|
||||
; understand the '[LangOptions] section' topic in the help file.
|
||||
LanguageName=简体中文
|
||||
; If Language Name display incorrect, uncomment next line
|
||||
; LanguageName=<7B80><4F53><4E2D><6587>
|
||||
; About LanguageID, to reference link:
|
||||
; https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
|
||||
LanguageID=$0804
|
||||
; About CodePage, to reference link:
|
||||
; https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
|
||||
LanguageCodePage=936
|
||||
; If the language you are translating to requires special font faces or
|
||||
; sizes, uncomment any of the following entries and change them accordingly.
|
||||
;DialogFontName=
|
||||
;DialogFontSize=9
|
||||
;DialogFontBaseScaleWidth=7
|
||||
;DialogFontBaseScaleHeight=15
|
||||
;WelcomeFontName=Segoe UI
|
||||
;WelcomeFontSize=14
|
||||
|
||||
[Messages]
|
||||
|
||||
; *** 应用程序标题
|
||||
SetupAppTitle=安装
|
||||
SetupWindowTitle=安装 - %1
|
||||
UninstallAppTitle=卸载
|
||||
UninstallAppFullTitle=%1 卸载
|
||||
|
||||
; *** Misc. common
|
||||
InformationTitle=信息
|
||||
ConfirmTitle=确认
|
||||
ErrorTitle=错误
|
||||
|
||||
; *** SetupLdr messages
|
||||
SetupLdrStartupMessage=现在将安装 %1。您想要继续吗?
|
||||
LdrCannotCreateTemp=无法创建临时文件。安装程序已中止
|
||||
LdrCannotExecTemp=无法执行临时目录中的文件。安装程序已中止
|
||||
HelpTextNote=
|
||||
|
||||
; *** 启动错误消息
|
||||
LastErrorMessage=%1。%n%n错误 %2: %3
|
||||
SetupFileMissing=安装目录中缺少文件 %1。请修正这个问题或者获取程序的新副本。
|
||||
SetupFileCorrupt=安装文件已损坏。请获取程序的新副本。
|
||||
SetupFileCorruptOrWrongVer=安装文件已损坏,或是与这个安装程序的版本不兼容。请修正这个问题或获取新的程序副本。
|
||||
InvalidParameter=无效的命令行参数:%n%n%1
|
||||
SetupAlreadyRunning=安装程序正在运行。
|
||||
WindowsVersionNotSupported=此程序不支持当前计算机运行的 Windows 版本。
|
||||
WindowsServicePackRequired=此程序需要 %1 服务包 %2 或更高版本。
|
||||
NotOnThisPlatform=此程序不能在 %1 上运行。
|
||||
OnlyOnThisPlatform=此程序只能在 %1 上运行。
|
||||
OnlyOnTheseArchitectures=此程序只能安装到为下列处理器架构设计的 Windows 版本中:%n%n%1
|
||||
WinVersionTooLowError=此程序需要 %1 版本 %2 或更高。
|
||||
WinVersionTooHighError=此程序不能安装于 %1 版本 %2 或更高。
|
||||
AdminPrivilegesRequired=在安装此程序时您必须以管理员身份登录。
|
||||
PowerUserPrivilegesRequired=在安装此程序时您必须以管理员身份或有权限的用户组身份登录。
|
||||
SetupAppRunningError=安装程序发现 %1 当前正在运行。%n%n请先关闭正在运行的程序,然后点击“确定”继续,或点击“取消”退出。
|
||||
UninstallAppRunningError=卸载程序发现 %1 当前正在运行。%n%n请先关闭正在运行的程序,然后点击“确定”继续,或点击“取消”退出。
|
||||
|
||||
; *** 启动问题
|
||||
PrivilegesRequiredOverrideTitle=选择安装程序模式
|
||||
PrivilegesRequiredOverrideInstruction=选择安装模式
|
||||
PrivilegesRequiredOverrideText1=%1 可以为所有用户安装(需要管理员权限),或仅为您安装。
|
||||
PrivilegesRequiredOverrideText2=%1 可以仅为您安装,或为所有用户安装(需要管理员权限)。
|
||||
PrivilegesRequiredOverrideAllUsers=为所有用户安装(&A)
|
||||
PrivilegesRequiredOverrideAllUsersRecommended=为所有用户安装(&A) (建议选项)
|
||||
PrivilegesRequiredOverrideCurrentUser=仅为我安装(&M)
|
||||
PrivilegesRequiredOverrideCurrentUserRecommended=仅为我安装(&M) (建议选项)
|
||||
|
||||
; *** 其他错误
|
||||
ErrorCreatingDir=安装程序无法创建目录“%1”
|
||||
ErrorTooManyFilesInDir=无法在目录“%1”中创建文件,因为里面包含太多文件
|
||||
|
||||
; *** 安装程序公共消息
|
||||
ExitSetupTitle=退出安装程序
|
||||
ExitSetupMessage=安装程序尚未完成。如果现在退出,将不会安装该程序。%n%n您之后可以再次运行安装程序完成安装。%n%n现在退出安装程序吗?
|
||||
AboutSetupMenuItem=关于安装程序(&A)...
|
||||
AboutSetupTitle=关于安装程序
|
||||
AboutSetupMessage=%1 版本 %2%n%3%n%n%1 主页:%n%4
|
||||
AboutSetupNote=
|
||||
TranslatorNote=简体中文翻译由Kira(847320916@qq.com)维护。项目地址:https://github.com/kira-96/Inno-Setup-Chinese-Simplified-Translation
|
||||
|
||||
; *** 按钮
|
||||
ButtonBack=< 上一步(&B)
|
||||
ButtonNext=下一步(&N) >
|
||||
ButtonInstall=安装(&I)
|
||||
ButtonOK=确定
|
||||
ButtonCancel=取消
|
||||
ButtonYes=是(&Y)
|
||||
ButtonYesToAll=全是(&A)
|
||||
ButtonNo=否(&N)
|
||||
ButtonNoToAll=全否(&O)
|
||||
ButtonFinish=完成(&F)
|
||||
ButtonBrowse=浏览(&B)...
|
||||
ButtonWizardBrowse=浏览(&R)...
|
||||
ButtonNewFolder=新建文件夹(&M)
|
||||
|
||||
; *** “选择语言”对话框消息
|
||||
SelectLanguageTitle=选择安装语言
|
||||
SelectLanguageLabel=选择安装时使用的语言。
|
||||
|
||||
; *** 公共向导文字
|
||||
ClickNext=点击“下一步”继续,或点击“取消”退出安装程序。
|
||||
BeveledLabel=
|
||||
BrowseDialogTitle=浏览文件夹
|
||||
BrowseDialogLabel=在下面的列表中选择一个文件夹,然后点击“确定”。
|
||||
NewFolderName=新建文件夹
|
||||
|
||||
; *** “欢迎”向导页
|
||||
WelcomeLabel1=欢迎使用 [name] 安装向导
|
||||
WelcomeLabel2=现在将安装 [name/ver] 到您的电脑中。%n%n建议您在继续安装前关闭所有其他应用程序。
|
||||
|
||||
; *** “密码”向导页
|
||||
WizardPassword=密码
|
||||
PasswordLabel1=这个安装程序有密码保护。
|
||||
PasswordLabel3=请输入密码,然后点击“下一步”继续。密码区分大小写。
|
||||
PasswordEditLabel=密码(&P):
|
||||
IncorrectPassword=您输入的密码不正确,请重新输入。
|
||||
|
||||
; *** “许可协议”向导页
|
||||
WizardLicense=许可协议
|
||||
LicenseLabel=请在继续安装前阅读以下重要信息。
|
||||
LicenseLabel3=请仔细阅读下列许可协议。在继续安装前您必须同意这些协议条款。
|
||||
LicenseAccepted=我同意此协议(&A)
|
||||
LicenseNotAccepted=我不同意此协议(&D)
|
||||
|
||||
; *** “信息”向导页
|
||||
WizardInfoBefore=信息
|
||||
InfoBeforeLabel=请在继续安装前阅读以下重要信息。
|
||||
InfoBeforeClickLabel=准备好继续安装后,点击“下一步”。
|
||||
WizardInfoAfter=信息
|
||||
InfoAfterLabel=请在继续安装前阅读以下重要信息。
|
||||
InfoAfterClickLabel=准备好继续安装后,点击“下一步”。
|
||||
|
||||
; *** “用户信息”向导页
|
||||
WizardUserInfo=用户信息
|
||||
UserInfoDesc=请输入您的信息。
|
||||
UserInfoName=用户名(&U):
|
||||
UserInfoOrg=组织(&O):
|
||||
UserInfoSerial=序列号(&S):
|
||||
UserInfoNameRequired=您必须输入用户名。
|
||||
|
||||
; *** “选择目标目录”向导页
|
||||
WizardSelectDir=选择目标位置
|
||||
SelectDirDesc=您想将 [name] 安装在哪里?
|
||||
SelectDirLabel3=安装程序将安装 [name] 到下面的文件夹中。
|
||||
SelectDirBrowseLabel=点击“下一步”继续。如果您想选择其他文件夹,点击“浏览”。
|
||||
DiskSpaceGBLabel=至少需要有 [gb] GB 的可用磁盘空间。
|
||||
DiskSpaceMBLabel=至少需要有 [mb] MB 的可用磁盘空间。
|
||||
CannotInstallToNetworkDrive=安装程序无法安装到一个网络驱动器。
|
||||
CannotInstallToUNCPath=安装程序无法安装到一个 UNC 路径。
|
||||
InvalidPath=您必须输入一个带驱动器卷标的完整路径,例如:%n%nC:\APP%n%n或UNC路径:%n%n\\server\share
|
||||
InvalidDrive=您选定的驱动器或 UNC 共享不存在或不能访问。请选择其他位置。
|
||||
DiskSpaceWarningTitle=磁盘空间不足
|
||||
DiskSpaceWarning=安装程序至少需要 %1 KB 的可用空间才能安装,但选定驱动器只有 %2 KB 的可用空间。%n%n您一定要继续吗?
|
||||
DirNameTooLong=文件夹名称或路径太长。
|
||||
InvalidDirName=文件夹名称无效。
|
||||
BadDirName32=文件夹名称不能包含下列任何字符:%n%n%1
|
||||
DirExistsTitle=文件夹已存在
|
||||
DirExists=文件夹:%n%n%1%n%n已经存在。您一定要安装到这个文件夹中吗?
|
||||
DirDoesntExistTitle=文件夹不存在
|
||||
DirDoesntExist=文件夹:%n%n%1%n%n不存在。您想要创建此文件夹吗?
|
||||
|
||||
; *** “选择组件”向导页
|
||||
WizardSelectComponents=选择组件
|
||||
SelectComponentsDesc=您想安装哪些程序组件?
|
||||
SelectComponentsLabel2=选中您想安装的组件;取消您不想安装的组件。然后点击“下一步”继续。
|
||||
FullInstallation=完全安装
|
||||
; if possible don't translate 'Compact' as 'Minimal' (I mean 'Minimal' in your language)
|
||||
CompactInstallation=简洁安装
|
||||
CustomInstallation=自定义安装
|
||||
NoUninstallWarningTitle=组件已存在
|
||||
NoUninstallWarning=安装程序检测到下列组件已安装在您的电脑中:%n%n%1%n%n取消选中这些组件不会卸载它们。%n%n确定要继续吗?
|
||||
ComponentSize1=%1 KB
|
||||
ComponentSize2=%1 MB
|
||||
ComponentsDiskSpaceGBLabel=当前选择的组件需要至少 [gb] GB 的磁盘空间。
|
||||
ComponentsDiskSpaceMBLabel=当前选择的组件需要至少 [mb] MB 的磁盘空间。
|
||||
|
||||
; *** “选择附加任务”向导页
|
||||
WizardSelectTasks=选择附加任务
|
||||
SelectTasksDesc=您想要安装程序执行哪些附加任务?
|
||||
SelectTasksLabel2=选择您想要安装程序在安装 [name] 时执行的附加任务,然后点击“下一步”。
|
||||
|
||||
; *** “选择开始菜单文件夹”向导页
|
||||
WizardSelectProgramGroup=选择开始菜单文件夹
|
||||
SelectStartMenuFolderDesc=安装程序应该在哪里放置程序的快捷方式?
|
||||
SelectStartMenuFolderLabel3=安装程序将在下列“开始”菜单文件夹中创建程序的快捷方式。
|
||||
SelectStartMenuFolderBrowseLabel=点击“下一步”继续。如果您想选择其他文件夹,点击“浏览”。
|
||||
MustEnterGroupName=您必须输入一个文件夹名。
|
||||
GroupNameTooLong=文件夹名或路径太长。
|
||||
InvalidGroupName=无效的文件夹名字。
|
||||
BadGroupName=文件夹名不能包含下列任何字符:%n%n%1
|
||||
NoProgramGroupCheck2=不创建开始菜单文件夹(&D)
|
||||
|
||||
; *** “准备安装”向导页
|
||||
WizardReady=准备安装
|
||||
ReadyLabel1=安装程序准备就绪,现在可以开始安装 [name] 到您的电脑。
|
||||
ReadyLabel2a=点击“安装”继续此安装程序。如果您想重新考虑或修改任何设置,点击“上一步”。
|
||||
ReadyLabel2b=点击“安装”继续此安装程序。
|
||||
ReadyMemoUserInfo=用户信息:
|
||||
ReadyMemoDir=目标位置:
|
||||
ReadyMemoType=安装类型:
|
||||
ReadyMemoComponents=已选择组件:
|
||||
ReadyMemoGroup=开始菜单文件夹:
|
||||
ReadyMemoTasks=附加任务:
|
||||
|
||||
; *** TExtractionWizardPage 向导页面与 ExtractArchive
|
||||
ExtractingLabel=正在解压文件...
|
||||
ButtonStopExtraction=停止解压(&S)
|
||||
StopExtraction=您确定要停止解压吗?
|
||||
ErrorExtractionAborted=解压已中止
|
||||
ErrorExtractionFailed=解压失败:%1
|
||||
|
||||
; *** 压缩文件解压失败详情
|
||||
ArchiveIncorrectPassword=压缩文件密码不正确
|
||||
ArchiveIsCorrupted=压缩文件已损坏
|
||||
ArchiveUnsupportedFormat=不支持的压缩文件格式
|
||||
|
||||
; *** TDownloadWizardPage 向导页面和 DownloadTemporaryFile
|
||||
DownloadingLabel2=正在下载文件...
|
||||
ButtonStopDownload=停止下载(&S)
|
||||
StopDownload=您确定要停止下载吗?
|
||||
ErrorDownloadAborted=下载已中止
|
||||
ErrorDownloadFailed=下载失败:%1 %2
|
||||
ErrorDownloadSizeFailed=获取下载大小失败:%1 %2
|
||||
ErrorProgress=无效的进度:%1 / %2
|
||||
ErrorFileSize=文件大小错误:预期 %1,实际 %2
|
||||
|
||||
; *** “正在准备安装”向导页
|
||||
WizardPreparing=正在准备安装
|
||||
PreparingDesc=安装程序正在准备安装 [name] 到您的电脑。
|
||||
PreviousInstallNotCompleted=先前的程序安装或卸载未完成,您需要重启您的电脑以完成。%n%n在重启电脑后,再次运行安装程序以完成 [name] 的安装。
|
||||
CannotContinue=安装程序不能继续。请点击“取消”退出。
|
||||
ApplicationsFound=以下应用程序正在使用将由安装程序更新的文件。建议您允许安装程序自动关闭这些应用程序。
|
||||
ApplicationsFound2=以下应用程序正在使用将由安装程序更新的文件。建议您允许安装程序自动关闭这些应用程序。安装完成后,安装程序将尝试重新启动这些应用程序。
|
||||
CloseApplications=自动关闭应用程序(&A)
|
||||
DontCloseApplications=不要关闭应用程序(&D)
|
||||
ErrorCloseApplications=安装程序无法自动关闭所有应用程序。建议您在继续之前,关闭所有在使用需要由安装程序更新的文件的应用程序。
|
||||
PrepareToInstallNeedsRestart=安装程序必须重启您的计算机。计算机重启后,请再次运行安装程序以完成 [name] 的安装。%n%n是否立即重新启动?
|
||||
|
||||
; *** “正在安装”向导页
|
||||
WizardInstalling=正在安装
|
||||
InstallingLabel=安装程序正在安装 [name] 到您的电脑,请稍候。
|
||||
|
||||
; *** “安装完成”向导页
|
||||
FinishedHeadingLabel=[name] 安装完成
|
||||
FinishedLabelNoIcons=安装程序已在您的电脑中安装了 [name]。
|
||||
FinishedLabel=安装程序已在您的电脑中安装了 [name]。您可以通过已安装的快捷方式运行此应用程序。
|
||||
ClickFinish=点击“完成”退出安装程序。
|
||||
FinishedRestartLabel=为完成 [name] 的安装,安装程序必须重新启动您的电脑。要立即重启吗?
|
||||
FinishedRestartMessage=为完成 [name] 的安装,安装程序必须重新启动您的电脑。%n%n要立即重启吗?
|
||||
ShowReadmeCheck=是,我想查阅自述文件
|
||||
YesRadio=是,立即重启电脑(&Y)
|
||||
NoRadio=否,稍后重启电脑(&N)
|
||||
; used for example as 'Run MyProg.exe'
|
||||
RunEntryExec=运行 %1
|
||||
; used for example as 'View Readme.txt'
|
||||
RunEntryShellExec=查阅 %1
|
||||
|
||||
; *** “安装程序需要下一张磁盘”提示
|
||||
ChangeDiskTitle=安装程序需要下一张磁盘
|
||||
SelectDiskLabel2=请插入磁盘 %1 并点击“确定”。%n%n如果这个磁盘中的文件可以在下列文件夹之外的文件夹中找到,请输入正确的路径或点击“浏览”。
|
||||
PathLabel=路径(&P):
|
||||
FileNotInDir2=“%2”中找不到文件“%1”。请插入正确的磁盘或选择其他文件夹。
|
||||
SelectDirectoryLabel=请指定下一张磁盘的位置。
|
||||
|
||||
; *** 安装阶段消息
|
||||
SetupAborted=安装程序未完成安装。%n%n请修正这个问题并重新运行安装程序。
|
||||
AbortRetryIgnoreSelectAction=选择操作
|
||||
AbortRetryIgnoreRetry=重试(&T)
|
||||
AbortRetryIgnoreIgnore=忽略错误并继续(&I)
|
||||
AbortRetryIgnoreCancel=关闭安装程序
|
||||
RetryCancelSelectAction=选择操作
|
||||
RetryCancelRetry=重试(&T)
|
||||
RetryCancelCancel=取消(&C)
|
||||
|
||||
; *** 安装状态消息
|
||||
StatusClosingApplications=正在关闭应用程序...
|
||||
StatusCreateDirs=正在创建目录...
|
||||
StatusExtractFiles=正在提取文件...
|
||||
StatusDownloadFiles=正在下载文件...
|
||||
StatusCreateIcons=正在创建快捷方式...
|
||||
StatusCreateIniEntries=正在创建 INI 条目...
|
||||
StatusCreateRegistryEntries=正在创建注册表条目...
|
||||
StatusRegisterFiles=正在注册文件...
|
||||
StatusSavingUninstall=正在保存卸载信息...
|
||||
StatusRunProgram=正在完成安装...
|
||||
StatusRestartingApplications=正在重启应用程序...
|
||||
StatusRollback=正在撤销更改...
|
||||
|
||||
; *** 其他错误
|
||||
ErrorInternal2=内部错误:%1
|
||||
ErrorFunctionFailedNoCode=%1 失败
|
||||
ErrorFunctionFailed=%1 失败;错误代码 %2
|
||||
ErrorFunctionFailedWithMessage=%1 失败;错误代码 %2.%n%3
|
||||
ErrorExecutingProgram=无法执行文件:%n%1
|
||||
|
||||
; *** 注册表错误
|
||||
ErrorRegOpenKey=打开注册表项时出错:%n%1\%2
|
||||
ErrorRegCreateKey=创建注册表项时出错:%n%1\%2
|
||||
ErrorRegWriteKey=写入注册表项时出错:%n%1\%2
|
||||
|
||||
; *** INI 错误
|
||||
ErrorIniEntry=在文件“%1”中创建 INI 条目时出错。
|
||||
|
||||
; *** 文件复制错误
|
||||
FileAbortRetryIgnoreSkipNotRecommended=跳过此文件(&S) (不推荐)
|
||||
FileAbortRetryIgnoreIgnoreNotRecommended=忽略错误并继续(&I) (不推荐)
|
||||
SourceIsCorrupted=源文件已损坏
|
||||
SourceDoesntExist=源文件“%1”不存在
|
||||
SourceVerificationFailed=源文件验证失败: %1
|
||||
VerificationSignatureDoesntExist=签名文件“%1”不存在
|
||||
VerificationSignatureInvalid=签名文件“%1”无效
|
||||
VerificationKeyNotFound=签名文件“%1”使用了未知密钥
|
||||
VerificationFileNameIncorrect=文件名不正确
|
||||
VerificationFileTagIncorrect=文件标签不正确
|
||||
VerificationFileSizeIncorrect=文件大小不正确
|
||||
VerificationFileHashIncorrect=文件哈希值不正确
|
||||
ExistingFileReadOnly2=无法替换现有文件,它是只读的。
|
||||
ExistingFileReadOnlyRetry=移除只读属性并重试(&R)
|
||||
ExistingFileReadOnlyKeepExisting=保留现有文件(&K)
|
||||
ErrorReadingExistingDest=尝试读取现有文件时出错:
|
||||
FileExistsSelectAction=选择操作
|
||||
FileExists2=文件已经存在。
|
||||
FileExistsOverwriteExisting=覆盖已存在的文件(&O)
|
||||
FileExistsKeepExisting=保留现有的文件(&K)
|
||||
FileExistsOverwriteOrKeepAll=为所有冲突文件执行此操作(&D)
|
||||
ExistingFileNewerSelectAction=选择操作
|
||||
ExistingFileNewer2=现有的文件比安装程序将要安装的文件还要新。
|
||||
ExistingFileNewerOverwriteExisting=覆盖已存在的文件(&O)
|
||||
ExistingFileNewerKeepExisting=保留现有的文件(&K) (推荐)
|
||||
ExistingFileNewerOverwriteOrKeepAll=为所有冲突文件执行此操作(&D)
|
||||
ErrorChangingAttr=尝试更改下列现有文件的属性时出错:
|
||||
ErrorCreatingTemp=尝试在目标目录创建文件时出错:
|
||||
ErrorReadingSource=尝试读取下列源文件时出错:
|
||||
ErrorCopying=尝试复制下列文件时出错:
|
||||
ErrorDownloading=下载文件时出错:
|
||||
ErrorExtracting=解压压缩文件时出错:
|
||||
ErrorReplacingExistingFile=尝试替换现有文件时出错:
|
||||
ErrorRestartReplace=重启并替换失败:
|
||||
ErrorRenamingTemp=尝试重命名下列目标目录中的一个文件时出错:
|
||||
ErrorRegisterServer=无法注册 DLL/OCX:%1
|
||||
ErrorRegSvr32Failed=RegSvr32 失败;退出代码 %1
|
||||
ErrorRegisterTypeLib=无法注册类库:%1
|
||||
|
||||
; *** 卸载显示名字标记
|
||||
; used for example as 'My Program (32-bit)'
|
||||
UninstallDisplayNameMark=%1 (%2)
|
||||
; used for example as 'My Program (32-bit, All users)'
|
||||
UninstallDisplayNameMarks=%1 (%2, %3)
|
||||
UninstallDisplayNameMark32Bit=32 位
|
||||
UninstallDisplayNameMark64Bit=64 位
|
||||
UninstallDisplayNameMarkAllUsers=所有用户
|
||||
UninstallDisplayNameMarkCurrentUser=当前用户
|
||||
|
||||
; *** 安装后错误
|
||||
ErrorOpeningReadme=尝试打开自述文件时出错。
|
||||
ErrorRestartingComputer=安装程序无法重启电脑,请手动重启。
|
||||
|
||||
; *** 卸载消息
|
||||
UninstallNotFound=文件“%1”不存在。无法卸载。
|
||||
UninstallOpenError=文件“%1”不能被打开。无法卸载。
|
||||
UninstallUnsupportedVer=此版本的卸载程序无法识别卸载日志文件“%1”的格式。无法卸载
|
||||
UninstallUnknownEntry=卸载日志中遇到一个未知条目 (%1)
|
||||
ConfirmUninstall=您确认要完全移除 %1 及其所有组件吗?
|
||||
UninstallOnlyOnWin64=仅允许在 64 位 Windows 中卸载此程序。
|
||||
OnlyAdminCanUninstall=仅使用管理员权限的用户能完成此卸载。
|
||||
UninstallStatusLabel=正在从您的电脑中移除 %1,请稍候。
|
||||
UninstalledAll=已顺利从您的电脑中移除 %1。
|
||||
UninstalledMost=%1 卸载完成。%n%n有部分内容未能被删除,但您可以手动删除它们。
|
||||
UninstalledAndNeedsRestart=为完成 %1 的卸载,需要重启您的电脑。%n%n立即重启电脑吗?
|
||||
UninstallDataCorrupted=文件“%1”已损坏。无法卸载
|
||||
|
||||
; *** 卸载状态消息
|
||||
ConfirmDeleteSharedFileTitle=删除共享的文件吗?
|
||||
ConfirmDeleteSharedFile2=系统表示下列共享的文件已不有其他程序使用。您希望卸载程序删除这些共享的文件吗?%n%n如果删除这些文件,但仍有程序在使用这些文件,则这些程序可能出现异常。如果您不能确定,请选择“否”,在系统中保留这些文件以免引发问题。
|
||||
SharedFileNameLabel=文件名:
|
||||
SharedFileLocationLabel=位置:
|
||||
WizardUninstalling=卸载状态
|
||||
StatusUninstalling=正在卸载 %1...
|
||||
|
||||
; *** Shutdown block reasons
|
||||
ShutdownBlockReasonInstallingApp=正在安装 %1。
|
||||
ShutdownBlockReasonUninstallingApp=正在卸载 %1。
|
||||
|
||||
; The custom messages below aren't used by Setup itself, but if you make
|
||||
; use of them in your scripts, you'll want to translate them.
|
||||
|
||||
[CustomMessages]
|
||||
|
||||
NameAndVersion=%1 版本 %2
|
||||
AdditionalIcons=附加快捷方式:
|
||||
CreateDesktopIcon=创建桌面快捷方式(&D)
|
||||
CreateQuickLaunchIcon=创建快速启动栏快捷方式(&Q)
|
||||
ProgramOnTheWeb=%1 网站
|
||||
UninstallProgram=卸载 %1
|
||||
LaunchProgram=运行 %1
|
||||
AssocFileExtension=将 %2 文件扩展名与 %1 建立关联(&A)
|
||||
AssocingFileExtension=正在将 %2 文件扩展名与 %1 建立关联...
|
||||
AutoStartProgramGroupDescription=启动:
|
||||
AutoStartProgram=自动启动 %1
|
||||
AddonHostProgramNotFound=您选择的文件夹中无法找到 %1。%n%n您要继续吗?
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#define MyAppName "智能制造MES工控"
|
||||
#define MyAppExeName "YY.Admin.exe"
|
||||
#define MyAppVersion "1.1.0"
|
||||
#define MyAppVersion "1.1.4"
|
||||
#define MyPublisher "星数连科技科技有限公司"
|
||||
; 相对本 .iss 文件位置(installer\ 下的上一级为 yy-admin-master)
|
||||
#define PublishRoot "..\YY.Admin\bin\Release\net8.0-windows10.0.19041\win-x64\publish"
|
||||
@@ -31,9 +31,9 @@ DisableDirPage=no
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||
SetupLogging=yes
|
||||
|
||||
; 向导语言:使用 Inno 自带的 Default.isl(英文)。若本机存在 Languages\ChineseSimplified.isl,
|
||||
; 可改为: Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
||||
; 向导语言:默认简体中文;语言文件与本 .iss 同目录(ChineseSimplified.isl),无需复制到 Inno 目录
|
||||
[Languages]
|
||||
Name: "chinesesimplified"; MessagesFile: "ChineseSimplified.isl"
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
cd /d "%~dp0"
|
||||
|
||||
if not exist "%~dp0build-installer.ps1" (
|
||||
echo [错误] 未找到同目录下的 build-installer.ps1
|
||||
echo.
|
||||
echo 请从仓库内运行本脚本,例如:
|
||||
echo qhmes\yy-admin-master\installer\build-installer.bat
|
||||
echo 不要只复制 .bat 到桌面;需与 build-installer.ps1 放在同一目录。
|
||||
echo.
|
||||
echo 当前目录: %~dp0
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Running build-installer.ps1 ...
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0build-installer.ps1"
|
||||
echo.
|
||||
|
||||
@@ -1,16 +1,54 @@
|
||||
# Release publish + WebView2 bootstrap download + Inno Setup ISCC
|
||||
# Requires Inno Setup 6 (ISCC.exe)
|
||||
#
|
||||
# 注意:与 YY.Admin\publish.cmd 输出目录不同;本脚本使用 bin\Release\...\win-x64\publish。
|
||||
# 本地 F5 / 双击 bin 下 exe 时,SQLite 实际写在 %LocalAppData%\YY.Admin\Data\(不是工程或 bin 目录)。
|
||||
# 同步步骤会优先把该目录下的库打进 publish,与其它机上「和你本机一致」的安装模板对齐。
|
||||
|
||||
param(
|
||||
[switch]$NoLocalSync
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent $PSScriptRoot
|
||||
$Csproj = Join-Path $Root 'YY.Admin\YY.Admin.csproj'
|
||||
$PublishRel = 'YY.Admin\bin\Release\net8.0-windows10.0.19041\win-x64\publish'
|
||||
$Tfm = 'net8.0-windows10.0.19041'
|
||||
$Rid = 'win-x64'
|
||||
$BinReleaseWin64 = Join-Path $Root "YY.Admin\bin\Release\$Tfm\$Rid"
|
||||
$BinDebugWin64 = Join-Path $Root "YY.Admin\bin\Debug\$Tfm\$Rid"
|
||||
$PublishRel = "YY.Admin\bin\Release\$Tfm\$Rid\publish"
|
||||
$PublishDir = Join-Path $Root $PublishRel
|
||||
$ProjAdmin = Join-Path $Root 'YY.Admin'
|
||||
# 与 SqlSugar 解析一致:相对路径 SQLite 落在当前 Windows 用户的 LocalAppData
|
||||
$DevUserDataDir = if ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA 'YY.Admin\Data' } else { '' }
|
||||
$DevUserAppSettingsDir = if ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA 'YY.Admin\AppSettings' } else { '' }
|
||||
$RedistDir = Join-Path $PSScriptRoot 'redist'
|
||||
$WebView2Exe = Join-Path $RedistDir 'MicrosoftEdgeWebview2Setup.exe'
|
||||
$WebView2Url = 'https://go.microsoft.com/fwlink/p/?LinkId=2124703'
|
||||
$SnapshotDir = Join-Path ([System.IO.Path]::GetTempPath()) ("yyadmin-publish-snap-{0}" -f [Guid]::NewGuid().ToString('n'))
|
||||
|
||||
Write-Host '>>> dotnet publish (Release, win-x64)...'
|
||||
# publish 会清空输出目录:若你平时只在 publish 里测,先把其中的库暂存,供同步步骤一并参与“最新”比较
|
||||
$hadPublishRoot = Test-Path -LiteralPath $PublishDir
|
||||
if ($hadPublishRoot -and -not $NoLocalSync) {
|
||||
$snapDb = @()
|
||||
foreach ($dbName in @('Admin.NET.db', 'Slave.db')) {
|
||||
$pp = Join-Path $PublishDir $dbName
|
||||
if (Test-Path -LiteralPath $pp) { $snapDb += , $pp }
|
||||
}
|
||||
$pubApps = Join-Path $PublishDir 'AppSettings'
|
||||
$hasPubApps = Test-Path -LiteralPath $pubApps
|
||||
if ($snapDb.Count -gt 0 -or $hasPubApps) {
|
||||
New-Item -ItemType Directory -Force -Path $SnapshotDir | Out-Null
|
||||
foreach ($p in $snapDb) {
|
||||
Copy-Item -LiteralPath $p -Destination (Join-Path $SnapshotDir (Split-Path $p -Leaf)) -Force
|
||||
}
|
||||
if ($hasPubApps) {
|
||||
Copy-Item -LiteralPath $pubApps -Destination (Join-Path $SnapshotDir 'AppSettings') -Recurse -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dotnet publish $Csproj -c Release `
|
||||
-p:IncludeNativeLibrariesForSelfExtract=true `
|
||||
-p:EnableCompressionInSingleFile=true `
|
||||
@@ -25,6 +63,81 @@ if (-not (Test-Path $cfgPublish)) {
|
||||
throw "Missing Configuration\appsettings.json under publish (ExcludeFromSingleFile required). Path: $cfgPublish"
|
||||
}
|
||||
|
||||
if (-not $NoLocalSync) {
|
||||
Write-Host '>>> Sync local runtime data into publish (databases + AppSettings, match local test)...'
|
||||
|
||||
function Get-BestExistingPath {
|
||||
param([string[]]$Paths)
|
||||
$bestItem = $null
|
||||
foreach ($p in $Paths) {
|
||||
if (-not $p -or -not (Test-Path -LiteralPath $p)) { continue }
|
||||
$fi = Get-Item -LiteralPath $p
|
||||
if (-not $bestItem) { $bestItem = $fi; continue }
|
||||
if ($fi.LastWriteTime -gt $bestItem.LastWriteTime) { $bestItem = $fi; continue }
|
||||
# 修改时间相同(例如复制残留)时优先体积更大的一份,一般数据更全
|
||||
if ($fi.LastWriteTime -eq $bestItem.LastWriteTime -and $fi.Length -gt $bestItem.Length) { $bestItem = $fi }
|
||||
}
|
||||
if ($bestItem) { return $bestItem.FullName }
|
||||
return $null
|
||||
}
|
||||
|
||||
# 同名库:当前用户 LocalAppData(F5 真数据源)、项目根、publish.cmd、bin、publish、快照…
|
||||
foreach ($dbName in @('Admin.NET.db', 'Slave.db')) {
|
||||
$paths = @()
|
||||
if ($DevUserDataDir -and (Test-Path -LiteralPath $DevUserDataDir)) {
|
||||
$paths += (Join-Path $DevUserDataDir $dbName)
|
||||
}
|
||||
$paths += @(
|
||||
(Join-Path $ProjAdmin $dbName),
|
||||
(Join-Path $ProjAdmin "publish\$dbName"),
|
||||
(Join-Path $BinReleaseWin64 $dbName),
|
||||
(Join-Path $BinDebugWin64 $dbName),
|
||||
(Join-Path $BinReleaseWin64 "publish\$dbName"),
|
||||
(Join-Path $BinDebugWin64 "publish\$dbName"),
|
||||
(Join-Path $PublishDir $dbName)
|
||||
)
|
||||
if (Test-Path -LiteralPath $SnapshotDir) {
|
||||
$sp = Join-Path $SnapshotDir $dbName
|
||||
if (Test-Path -LiteralPath $sp) { $paths += $sp }
|
||||
}
|
||||
$src = Get-BestExistingPath -Paths $paths
|
||||
if ($src) {
|
||||
$dst = Join-Path $PublishDir $dbName
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
$dstItem = Get-Item -LiteralPath $dst
|
||||
$t = $dstItem.LastWriteTime.ToString('yyyy-MM-dd HH:mm')
|
||||
$len = $dstItem.Length
|
||||
Write-Host " $dbName <= $src (publish 时间: $t, 大小: $len 字节)"
|
||||
} else {
|
||||
Write-Host " (skip) $dbName — 未在任意候选路径找到(含当前 publish 文件夹)"
|
||||
}
|
||||
}
|
||||
|
||||
# AppSettings\:先 Release、再 Debug,再上一版 publish 下的 AppSettings(后者覆盖,适配只在 publish 目录测试)
|
||||
foreach ($bin in @($BinReleaseWin64, $BinDebugWin64)) {
|
||||
$appSettingsSrc = Join-Path $bin 'AppSettings'
|
||||
if (Test-Path -LiteralPath $appSettingsSrc) {
|
||||
$appSettingsDst = Join-Path $PublishDir 'AppSettings'
|
||||
Copy-Item -LiteralPath $appSettingsSrc -Destination $appSettingsDst -Recurse -Force
|
||||
Write-Host " AppSettings\ <= $appSettingsSrc"
|
||||
}
|
||||
}
|
||||
$snapApps = Join-Path $SnapshotDir 'AppSettings'
|
||||
if (Test-Path -LiteralPath $snapApps) {
|
||||
$appSettingsDst = Join-Path $PublishDir 'AppSettings'
|
||||
Copy-Item -LiteralPath $snapApps -Destination $appSettingsDst -Recurse -Force
|
||||
Write-Host " AppSettings\ <= $snapApps (previous publish)"
|
||||
}
|
||||
# 最后覆盖为当前登录 Windows 用户在 LocalAppData 下的设置(与 F5 调试一致)
|
||||
if ($DevUserAppSettingsDir -and (Test-Path -LiteralPath $DevUserAppSettingsDir)) {
|
||||
$appSettingsDst = Join-Path $PublishDir 'AppSettings'
|
||||
Copy-Item -LiteralPath $DevUserAppSettingsDir -Destination $appSettingsDst -Recurse -Force
|
||||
Write-Host " AppSettings\ <= $DevUserAppSettingsDir (LocalAppData)"
|
||||
}
|
||||
} else {
|
||||
Write-Host '>>> Skip local sync (-NoLocalSync).'
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $RedistDir | Out-Null
|
||||
if (-not (Test-Path $WebView2Exe)) {
|
||||
Write-Host '>>> Downloading WebView2 Evergreen bootstrapper...'
|
||||
|
||||
Reference in New Issue
Block a user