diff --git a/XSLPrintDot/backend_windows.go b/XSLPrintDot/backend_windows.go index df39c97c..efd21d6e 100644 --- a/XSLPrintDot/backend_windows.go +++ b/XSLPrintDot/backend_windows.go @@ -324,17 +324,26 @@ func waitForWindowsPrintCompletion(printerName string, existingIDs map[int]bool, queued := false jobID := 0 + sumatraDone := false for { select { case err := <-cmdDone: + sumatraDone = true if err != nil && !queued { return fmt.Errorf("sumatra print failed: %v", err) } + // Sumatra 已正常退出且 spooler 未出现新任务:部分驱动/打印机直接出纸,不经过队列 + if err == nil && !queued { + return nil + } default: } now := time.Now() + if !queued && sumatraDone { + return nil + } if !queued && now.After(appearDeadline) { return fmt.Errorf("print job not queued within %s", printQueueAppearTimeout) } diff --git a/jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql b/jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql new file mode 100644 index 00000000..1720549e --- /dev/null +++ b/jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql @@ -0,0 +1,82 @@ +-- MES 停机记录:建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行) +-- 权限前缀:mes:mes_xsl_downtime_record:* +-- 依赖:mes_xsl_equipment_ledger、mes_xsl_downtime_type;父菜单 设备管理 +-- Flyway:V3.9.2_117__mes_xsl_downtime_record.sql +SET NAMES utf8mb4; + +CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_record` ( + `id` varchar(32) NOT NULL COMMENT '主键', + `equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id', + `equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余', + `equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余', + `downtime_type_id` varchar(32) NOT NULL COMMENT '停机类型主键 mes_xsl_downtime_type.id', + `downtime_type_name` varchar(500) DEFAULT NULL COMMENT '停机类型名称冗余', + `start_time` datetime NOT NULL COMMENT '开始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `equipment_part_id` varchar(32) DEFAULT NULL COMMENT '设备部位主键 mes_xsl_equipment_part.id', + `equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余', + `inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id', + `inspect_maintain_item_name` varchar(500) DEFAULT NULL COMMENT '点检项目名称冗余', + `maintenance_result` varchar(500) DEFAULT NULL COMMENT '维修结果', + `maintainer_user_id` varchar(32) DEFAULT NULL COMMENT '维修人用户ID', + `maintainer_username` varchar(500) DEFAULT NULL COMMENT '维修人账号', + `maintainer_realname` varchar(500) DEFAULT NULL COMMENT '维修人姓名', + `maintenance_filled_flag` varchar(1) DEFAULT '0' COMMENT '是否已录入维修结果(字典yn:1是0否)', + `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_mdr_equipment` (`equipment_ledger_id`), + KEY `idx_mdr_downtime_type` (`downtime_type_id`), + KEY `idx_mdr_start_time` (`start_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机记录'; + +SET @mes_tenant_id = 1002; + +SET @mes_equip_pid = ( + SELECT `id` FROM `sys_permission` + WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理' + LIMIT 1 +); +SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133'); + +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 ('1860000000000000201', @mes_equip_pid, '停机记录', '/xslmes/mesXslDowntimeRecord', 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', 'MesXslDowntimeRecordList', 1, NULL, '1', 12, 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`), `icon` = 'ant-design:history-outlined'; + +UPDATE `sys_permission` SET `icon` = 'ant-design:history-outlined' WHERE `id` = '1860000000000000201' AND `del_flag` = 0; + +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES +('1860000000000000202', '1860000000000000201', '新增', 2, 'mes:mes_xsl_downtime_record:add', '1', '1', 0, 'admin', NOW()), +('1860000000000000203', '1860000000000000201', '编辑', 2, 'mes:mes_xsl_downtime_record:edit', '1', '1', 0, 'admin', NOW()), +('1860000000000000204', '1860000000000000201', '删除', 2, 'mes:mes_xsl_downtime_record:delete', '1', '1', 0, 'admin', NOW()), +('1860000000000000205', '1860000000000000201', '批量删除', 2, 'mes:mes_xsl_downtime_record:deleteBatch', '1', '1', 0, 'admin', NOW()), +('1860000000000000206', '1860000000000000201', '导出', 2, 'mes:mes_xsl_downtime_record:exportXls', '1', '1', 0, 'admin', NOW()), +('1860000000000000207', '1860000000000000201', '导入', 2, 'mes:mes_xsl_downtime_record: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 ( + '1860000000000000201', + '1860000000000000202', '1860000000000000203', '1860000000000000204', '1860000000000000205', + '1860000000000000206', '1860000000000000207' + ) + AND NOT EXISTS ( + SELECT 1 FROM `sys_role_permission` rp + WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id` + ); diff --git a/jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql b/jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql new file mode 100644 index 00000000..0517c94b --- /dev/null +++ b/jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql @@ -0,0 +1,86 @@ +-- MES 胶料小料锁定原因:字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权(可整文件一次执行) +-- 权限前缀:mes:mes_xsl_rubber_small_lock_reason:* +-- 菜单 ID 段:1860000000000000208(按钮 209-214) +-- 修改租户:改 SET @mes_tenant_id +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_rubber_small_lock_type', '锁定/解锁', 0, 'admin', NOW(), 0, 0 +WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_type' 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, '锁定', 'lock', 1, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'lock'); +INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) +SELECT REPLACE(UUID(), '-', ''), d.id, '解锁', 'unlock', 2, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'unlock'); + +INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) +SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定条码类型', 'xslmes_rubber_small_lock_barcode_type', '小料/胶料', 0, 'admin', NOW(), 0, 0 +WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_barcode_type' 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, '小料', 'small', 1, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'small'); +INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) +SELECT REPLACE(UUID(), '-', ''), d.id, '胶料', 'rubber', 2, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'rubber'); + +CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_reason` ( + `id` varchar(32) NOT NULL COMMENT '主键', + `reason_code` varchar(16) NOT NULL COMMENT '编号(租户内从001递增自动生成,只读)', + `lock_type` varchar(16) NOT NULL COMMENT '类型(字典xslmes_rubber_small_lock_type:lock锁定unlock解锁)', + `barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type:small小料rubber胶料)', + `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_mrslr_tenant_code` (`tenant_id`, `reason_code`), + KEY `idx_mrslr_tenant_lock` (`tenant_id`, `lock_type`, `barcode_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定原因'; + +SET @mes_tenant_id = 1002; + +SET @mes_quality_pid = IFNULL( + (SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1), + '1860000000000000162' +); + +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 ('1860000000000000208', @mes_quality_pid, '胶料小料锁定原因', '/xslmes/mesXslRubberSmallLockReason', 'xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList', 'MesXslRubberSmallLockReasonList', 1, NULL, '1', 6, 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`), `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`); + +UPDATE `sys_permission` SET `icon` = 'ant-design:lock-outlined' WHERE `id` = '1860000000000000208' AND `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 +('1860000000000000209', '1860000000000000208', '新增', 2, 'mes:mes_xsl_rubber_small_lock_reason:add', '1', 1, '1', 0, 'admin', NOW()), +('1860000000000000210', '1860000000000000208', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_reason:edit', '1', 1, '1', 0, 'admin', NOW()), +('1860000000000000211', '1860000000000000208', '删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:delete', '1', 1, '1', 0, 'admin', NOW()), +('1860000000000000212', '1860000000000000208', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:deleteBatch', '1', 1, '1', 0, 'admin', NOW()), +('1860000000000000213', '1860000000000000208', '导出', 2, 'mes:mes_xsl_rubber_small_lock_reason:exportXls', '1', 1, '1', 0, 'admin', NOW()), +('1860000000000000214', '1860000000000000208', '导入', 2, 'mes:mes_xsl_rubber_small_lock_reason: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 ( + '1860000000000000208', + '1860000000000000209', '1860000000000000210', '1860000000000000211', '1860000000000000212', + '1860000000000000213', '1860000000000000214' + ) + AND NOT EXISTS ( + SELECT 1 FROM `sys_role_permission` rp + WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id` + ); diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index ace9fb25..126f6a7b 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -211,6 +211,10 @@ public class ShiroConfig { filterChainDefinitionMap.put("/xslmes/mesXslWarehouse/anon/**", "anon"); // MES库区管理免密接口(供桌面端调用) filterChainDefinitionMap.put("/xslmes/mesXslWarehouseArea/anon/**", "anon"); + // MES密炼物料皮重策略免密接口(供桌面端调用) + filterChainDefinitionMap.put("/xslmes/mesXslMixerMaterialTareStrategy/anon/**", "anon"); + // MES单位只读免密接口(供桌面端单位下拉调用) + filterChainDefinitionMap.put("/xslmes/mesXslUnit/anon/**", "anon"); // MES密炼物料管理免密接口(供桌面端调用) filterChainDefinitionMap.put("/mes/material/mixerMaterial/anon/**", "anon"); // 打印模板免密接口(供桌面端调用) diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 index bd757718..e4c8a3b6 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 @@ -521,3 +521,141 @@ jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules -- author:GHT---date:20260529--for: 【QH-MES审批流设计】审批IM消息升级为可跳转业务卡片(biz_record):点击可定位到对应单据,无法定位功能页时退回纯文本 --- jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/approval/controller/MesXslApprovalLaunchController.java + +-- author:cursor---date:20250602--for: 【密炼物料皮重策略】桌面端同步 --- +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/MesXslStompNotifyService.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDesktopAnonController.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerMaterialTareStrategyController.java +jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java + +-- author:cursor---date:20250602--for: 【密炼物料皮重策略】新增物料规格/托盘重量,皮重改名为包装物重量 --- +jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_mixer_material_tare_strategy_fields.sql +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialTareStrategyServiceImpl.java +yy-admin-master/YY.Admin.Core/Entity/MesXslMixerMaterialTareStrategy.cs +yy-admin-master/YY.Admin.Services/Service/MixerMaterialTareStrategy/MixerMaterialTareStrategyService.cs +yy-admin-master/YY.Admin/Views/MixerMaterialTareStrategy/MixerMaterialTareStrategyListView.xaml +yy-admin-master/YY.Admin/Views/MixerMaterialTareStrategy/MixerMaterialTareStrategyEditDialogView.xaml +yy-admin-master/YY.Admin/ViewModels/MixerMaterialTareStrategy/MixerMaterialTareStrategyEditDialogViewModel.cs +yy-admin-master/YY.Admin/ViewModels/MixerMaterialTareStrategy/MixerMaterialTareStrategyListViewModel.cs +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategy.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/components/MesXslMixerMaterialTareStrategyModal.vue + +-- author:cursor---date:20250602--for: 【原料入场/原材料卡片】皮重字段落库 --- +jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_119__mes_xsl_raw_material_entry_tare_fields.sql +jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_120__mes_xsl_raw_material_card_tare_fields.sql +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialEntry.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialCard.java +yy-admin-master/YY.Admin.Core/Entity/MesXslRawMaterialEntry.cs +yy-admin-master/YY.Admin.Core/Entity/MesXslRawMaterialCard.cs +yy-admin-master/YY.Admin.Services/Service/RawMaterialEntry/RawMaterialEntryService.cs +yy-admin-master/YY.Admin.Services/Service/RawMaterialCard/RawMaterialCardService.cs +yy-admin-master/YY.Admin/ViewModels/RawMaterialEntry/RawMaterialEntryEditDialogViewModel.cs +yy-admin-master/YY.Admin/ViewModels/RawMaterialEntry/RawMaterialEntryOperationViewModel.cs +yy-admin-master/YY.Admin/ViewModels/RawMaterialCard/RawMaterialCardEditDialogViewModel.cs + +-- author:cursor---date:20250602--for: 【原料入场/原材料卡片】列表展示皮重相关字段 --- +yy-admin-master/YY.Admin/Views/RawMaterialEntry/RawMaterialEntryListView.xaml +yy-admin-master/YY.Admin/Views/RawMaterialCard/RawMaterialCardListView.xaml +jeecgboot-vue3/src/views/xslmes/mesXslRawMaterialEntry/MesXslRawMaterialEntry.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslRawMaterialCard/MesXslRawMaterialCard.data.ts + +-- author:cursor---date:20250602--for: 【原料入场/原材料卡片】后端列表与详情展示皮重字段 --- +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialWorkshopRemain.java +jeecgboot-vue3/src/views/xslmes/mesXslRawMaterialEntry/MesXslRawMaterialEntry.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslRawMaterialCard/MesXslRawMaterialCard.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslRawMaterialWorkshopRemain/MesXslRawMaterialWorkshopRemain.data.ts + +-- author:cursor---date:20250602--for: 【磅单记录】列表展示货物皮重(关联入场记录托盘及皮重合计,不落库) --- +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslWeightRecord.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialEntryService.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialEntryServiceImpl.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslWeightRecordController.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDesktopAnonController.java +jeecgboot-vue3/src/views/xslmes/mesXslWeightRecord/MesXslWeightRecord.data.ts +yy-admin-master/YY.Admin.Core/Entity/MesXslWeightRecord.cs +yy-admin-master/YY.Admin.Core/Util/CargoTareWeightCalculator.cs +yy-admin-master/YY.Admin.Services/Service/WeightRecord/WeightRecordService.cs +yy-admin-master/YY.Admin/Views/WeightRecord/WeightRecordListView.xaml +yy-admin-master/YY.Admin/Views/RawMaterialEntry/WeightRecordPickerDialogView.xaml + +-- author:cursor---date:20250602--for: 【磅单记录】列表展示原料重量(净重-货物皮重,不落库) --- +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslWeightRecord.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialEntryServiceImpl.java +jeecgboot-vue3/src/views/xslmes/mesXslWeightRecord/MesXslWeightRecord.data.ts +yy-admin-master/YY.Admin.Core/Entity/MesXslWeightRecord.cs +yy-admin-master/YY.Admin.Services/Service/WeightRecord/WeightRecordService.cs +yy-admin-master/YY.Admin/Views/WeightRecord/WeightRecordListView.xaml + +-- author:jiangxh---date:20250602--for: 【MES】停机记录:建表+菜单+CRUD+列表录入维修结果弹窗 --- +jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql +jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue + +-- author:jiangxh---date:20250602--for: 【MES】停机记录弹窗日期时间选择器下拉被裁剪导致点击无反应 --- +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts + +-- author:jiangxh---date:20250602--for: 【MES】停机记录维修项目按设备部位筛选(点检保养项目均含小部位) --- +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java + +-- author:jiangxh---date:20250602--for: 【MES】设备台账列表所属工序查询改为工序选择器 --- +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue + +-- author:jiangxh---date:20250602--for: 【MES】设备管理各功能列表查询与表单一致改为选择器 --- +jeecgboot-vue3/src/views/xslmes/components/MesSearchPickerInput.vue +jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategory.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList.vue +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentType.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentTypeList.vue +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPartList.vue +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPart.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPartList.vue +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue +jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePart.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePartList.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue +jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItemList.vue +jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue +jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue + +-- author:jiangxh---date:20250602--for: 【MES】胶料小料锁定原因(质量管理菜单、编号001自增、类型与条码类型字典) --- +jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql +jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_rubber_small_lock_reason.sql +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockReasonMapper.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockReasonService.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java +jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api.ts +jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList.vue +jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/components/MesXslRubberSmallLockReasonModal.vue diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDesktopAnonController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDesktopAnonController.java index fa458a80..538091f8 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDesktopAnonController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDesktopAnonController.java @@ -27,6 +27,8 @@ import org.jeecg.modules.xslmes.entity.MesXslCustomer; import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard; import org.jeecg.modules.xslmes.entity.MesXslRawMaterialEntry; import org.jeecg.modules.xslmes.entity.MesXslSupplier; +import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialTareStrategy; +import org.jeecg.modules.xslmes.entity.MesXslUnit; import org.jeecg.modules.xslmes.entity.MesXslVehicle; import org.jeecg.modules.xslmes.entity.MesXslWarehouse; import org.jeecg.modules.xslmes.entity.MesXslWarehouseArea; @@ -35,6 +37,8 @@ import org.jeecg.modules.xslmes.service.IMesXslCustomerService; import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService; import org.jeecg.modules.xslmes.service.IMesXslRawMaterialEntryService; import org.jeecg.modules.xslmes.service.IMesXslSupplierService; +import org.jeecg.modules.xslmes.service.IMesXslMixerMaterialTareStrategyService; +import org.jeecg.modules.xslmes.service.IMesXslUnitService; import org.jeecg.modules.xslmes.service.IMesXslVehicleService; import org.jeecg.modules.xslmes.service.IMesXslWarehouseAreaService; import org.jeecg.modules.xslmes.service.IMesXslWarehouseService; @@ -60,6 +64,8 @@ import org.apache.commons.lang3.StringUtils; * ShiroConfig 白名单: * /xslmes/mesXslVehicle/anon/** * /xslmes/mesXslCustomer/anon/** + * /xslmes/mesXslMixerMaterialTareStrategy/anon/** + * /xslmes/mesXslUnit/anon/** */ @Tag(name = "桌面端免密接口") @RestController @@ -75,6 +81,8 @@ public class MesXslDesktopAnonController { private final IMesXslRawMaterialCardService rawMaterialCardService; private final IMesXslWarehouseService warehouseService; private final IMesXslWarehouseAreaService warehouseAreaService; + private final IMesXslMixerMaterialTareStrategyService tareStrategyService; + private final IMesXslUnitService unitService; private final MesXslStompNotifyService stompNotify; private final IPrintBizTemplateBindService printBizTemplateBindService; private final IPrintTemplateService printTemplateService; @@ -390,6 +398,7 @@ public class MesXslDesktopAnonController { QueryWrapper qw = QueryGenerator.initQueryWrapper(mesXslWeightRecord, req.getParameterMap()); qw.orderByDesc("create_time"); IPage page = weightRecordService.page(new Page<>(pageNo, pageSize), qw); + rawMaterialEntryService.fillWeightRecordDerivedFields(page.getRecords()); return Result.OK(page); } @@ -397,7 +406,11 @@ public class MesXslDesktopAnonController { @GetMapping("/xslmes/mesXslWeightRecord/anon/queryById") public Result weightRecordAnonQueryById(@RequestParam(name = "id") String id) { MesXslWeightRecord entity = weightRecordService.getById(id); - return entity != null ? Result.OK(entity) : Result.error("未找到对应数据"); + if (entity == null) { + return Result.error("未找到对应数据"); + } + rawMaterialEntryService.fillWeightRecordDerivedFields(Collections.singletonList(entity)); + return Result.OK(entity); } @Operation(summary = "磅单-免密添加") @@ -828,6 +841,90 @@ public class MesXslDesktopAnonController { return Result.OK("该值可用!"); } + // ═══════════════════════════ 密炼物料皮重策略 ═══════════════════════════ + + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端免密CRUD----------- + @Operation(summary = "密炼物料皮重策略-免密分页列表查询") + @GetMapping("/xslmes/mesXslMixerMaterialTareStrategy/anon/list") + public Result> tareStrategyAnonList( + MesXslMixerMaterialTareStrategy model, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper qw = QueryGenerator.initQueryWrapper(model, req.getParameterMap()); + qw.orderByDesc("effective_start_date", "create_time"); + IPage page = tareStrategyService.page(new Page<>(pageNo, pageSize), qw); + return Result.OK(page); + } + + @Operation(summary = "密炼物料皮重策略-免密通过id查询") + @GetMapping("/xslmes/mesXslMixerMaterialTareStrategy/anon/queryById") + public Result tareStrategyAnonQueryById(@RequestParam(name = "id") String id) { + MesXslMixerMaterialTareStrategy entity = tareStrategyService.getById(id); + return entity != null ? Result.OK(entity) : Result.error("未找到对应数据"); + } + + @Operation(summary = "密炼物料皮重策略-免密添加") + @PostMapping("/xslmes/mesXslMixerMaterialTareStrategy/anon/add") + public Result tareStrategyAnonAdd(@RequestBody MesXslMixerMaterialTareStrategy model) { + String err = tareStrategyService.validateBeforeSave(model, false); + if (err != null) { + return Result.error(err); + } + tareStrategyService.save(model); + stompNotify.publishMixerMaterialTareStrategyChanged("add", model.getId()); + return Result.OK("添加成功!"); + } + + @Operation(summary = "密炼物料皮重策略-免密编辑") + @RequestMapping(value = "/xslmes/mesXslMixerMaterialTareStrategy/anon/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result tareStrategyAnonEdit(@RequestBody MesXslMixerMaterialTareStrategy model) { + if (oConvertUtils.isEmpty(model.getId())) { + return Result.error("主键不能为空"); + } + String err = tareStrategyService.validateBeforeSave(model, true); + if (err != null) { + return Result.error(err); + } + boolean ok = tareStrategyService.updateById(model); + if (!ok) { + return Result.error("数据已被他人修改,请刷新后重试"); + } + stompNotify.publishMixerMaterialTareStrategyChanged("edit", model.getId()); + return Result.OK("编辑成功!"); + } + + @Operation(summary = "密炼物料皮重策略-免密删除") + @DeleteMapping("/xslmes/mesXslMixerMaterialTareStrategy/anon/delete") + public Result tareStrategyAnonDelete(@RequestParam(name = "id") String id) { + tareStrategyService.removeById(id); + stompNotify.publishMixerMaterialTareStrategyChanged("delete", id); + return Result.OK("删除成功!"); + } + + @Operation(summary = "密炼物料皮重策略-免密批量删除") + @DeleteMapping("/xslmes/mesXslMixerMaterialTareStrategy/anon/deleteBatch") + public Result tareStrategyAnonDeleteBatch(@RequestParam(name = "ids") String ids) { + tareStrategyService.removeByIds(Arrays.asList(ids.split(","))); + stompNotify.publishMixerMaterialTareStrategyChanged("batchDelete", ids); + return Result.OK("批量删除成功!"); + } + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端免密CRUD----------- + + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端单位下拉只读----------- + @Operation(summary = "单位-免密分页列表查询(供桌面端单位下拉)") + @GetMapping("/xslmes/mesXslUnit/anon/list") + public Result> unitAnonList( + MesXslUnit mesXslUnit, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, + HttpServletRequest req) { + QueryWrapper qw = QueryGenerator.initQueryWrapper(mesXslUnit, req.getParameterMap()); + IPage page = unitService.page(new Page<>(pageNo, pageSize), qw); + return Result.OK(page); + } + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端单位下拉只读----------- + // ─────────────────────────── 车辆私有辅助 ──────────────────────────── private void applyWeightNetAndBillType(MesXslWeightRecord record) { diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java new file mode 100644 index 00000000..2264053d --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java @@ -0,0 +1,220 @@ +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 jakarta.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.Date; +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.MesXslDowntimeRecord; +import org.jeecg.modules.xslmes.entity.MesXslDowntimeType; +import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger; +import org.jeecg.modules.xslmes.service.IMesXslDowntimeRecordService; +import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService; +import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService; +import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +/** + * MES 停机记录 + */ +@Tag(name = "MES停机记录") +@RestController +@RequestMapping("/xslmes/mesXslDowntimeRecord") +@Slf4j +public class MesXslDowntimeRecordController extends JeecgController { + + @Autowired + private IMesXslDowntimeRecordService mesXslDowntimeRecordService; + + @Autowired + private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService; + + @Autowired + private IMesXslDowntimeTypeService mesXslDowntimeTypeService; + + @Operation(summary = "MES停机记录-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList( + MesXslDowntimeRecord model, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap()); + //update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录列表默认按开始时间倒序----------- + queryWrapper.orderByDesc("start_time").orderByDesc("create_time"); + //update-end---author:jiangxh ---date:20250602 for:【MES】停机记录列表默认按开始时间倒序----------- + Page page = new Page<>(pageNo, pageSize); + IPage pageList = mesXslDowntimeRecordService.page(page, queryWrapper); + return Result.OK(pageList); + } + + @AutoLog(value = "MES停机记录-添加") + @Operation(summary = "MES停机记录-添加") + @RequiresPermissions("mes:mes_xsl_downtime_record:add") + @PostMapping(value = "/add") + public Result add(@RequestBody MesXslDowntimeRecord model) { + //update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验----------- + String err = validateForSave(model); + if (err != null) { + return Result.error(err); + } + clearMaintenanceFieldsForFormSave(model); + //update-end---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验----------- + mesXslDowntimeRecordService.save(model); + return Result.OK("添加成功!"); + } + + @AutoLog(value = "MES停机记录-编辑") + @Operation(summary = "MES停机记录-编辑") + @RequiresPermissions("mes:mes_xsl_downtime_record:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody MesXslDowntimeRecord model) { + //update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验----------- + String err = validateForSave(model); + if (err != null) { + return Result.error(err); + } + MesXslDowntimeRecord old = mesXslDowntimeRecordService.getById(model.getId()); + if (old == null) { + return Result.error("未找到对应数据"); + } + preserveMaintenanceFields(model, old); + //update-end---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验----------- + mesXslDowntimeRecordService.updateById(model); + return Result.OK("编辑成功!"); + } + + @AutoLog(value = "MES停机记录-录入维修结果") + @Operation(summary = "MES停机记录-录入维修结果") + @RequiresPermissions("mes:mes_xsl_downtime_record:edit") + @PostMapping(value = "/saveMaintenanceResult") + public Result saveMaintenanceResult(@RequestBody MesXslDowntimeRecordMaintenanceDTO dto) { + //update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果----------- + mesXslDowntimeRecordService.saveMaintenanceResult(dto); + //update-end---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果----------- + return Result.OK("录入成功!"); + } + + @AutoLog(value = "MES停机记录-删除") + @Operation(summary = "MES停机记录-通过id删除") + @RequiresPermissions("mes:mes_xsl_downtime_record:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + mesXslDowntimeRecordService.removeById(id); + return Result.OK("删除成功!"); + } + + @AutoLog(value = "MES停机记录-批量删除") + @Operation(summary = "MES停机记录-批量删除") + @RequiresPermissions("mes:mes_xsl_downtime_record:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + mesXslDowntimeRecordService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + @Operation(summary = "MES停机记录-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + MesXslDowntimeRecord entity = mesXslDowntimeRecordService.getById(id); + if (entity == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(entity); + } + + @RequiresPermissions("mes:mes_xsl_downtime_record:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeRecord model) { + return super.exportXls(request, model, MesXslDowntimeRecord.class, "MES停机记录"); + } + + @RequiresPermissions("mes:mes_xsl_downtime_record:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MesXslDowntimeRecord.class); + } + + //update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验、关联设备与停机类型回填----------- + private String validateForSave(MesXslDowntimeRecord model) { + if (model == null) { + return "参数无效"; + } + if (oConvertUtils.isEmpty(model.getEquipmentLedgerId())) { + return "请选择机台"; + } + MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(model.getEquipmentLedgerId()); + if (ledger == null + || (ledger.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(ledger.getDelFlag()))) { + return "所选设备不存在"; + } + model.setEquipmentCode(ledger.getEquipmentCode()); + model.setEquipmentName(ledger.getEquipmentName()); + + if (oConvertUtils.isEmpty(model.getDowntimeTypeId())) { + return "请选择停机原因"; + } + MesXslDowntimeType downtimeType = mesXslDowntimeTypeService.getById(model.getDowntimeTypeId()); + if (downtimeType == null + || (downtimeType.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(downtimeType.getDelFlag()))) { + return "所选停机类型不存在"; + } + if (!"0".equals(downtimeType.getStatus())) { + return "所选停机类型未启用"; + } + model.setDowntimeTypeName(downtimeType.getDowntimeType()); + + if (model.getStartTime() == null) { + return "开始时间不能为空"; + } + Date endTime = model.getEndTime(); + if (endTime != null && endTime.before(model.getStartTime())) { + return "结束时间不能早于开始时间"; + } + + if (oConvertUtils.isEmpty(model.getMaintenanceFilledFlag())) { + model.setMaintenanceFilledFlag("0"); + } + return null; + } + + private void clearMaintenanceFieldsForFormSave(MesXslDowntimeRecord model) { + model.setEquipmentPartId(null); + model.setEquipmentPartName(null); + model.setInspectMaintainItemId(null); + model.setInspectMaintainItemName(null); + model.setMaintenanceResult(null); + model.setMaintainerUserId(null); + model.setMaintainerUsername(null); + model.setMaintainerRealname(null); + model.setMaintenanceFilledFlag("0"); + } + + private void preserveMaintenanceFields(MesXslDowntimeRecord model, MesXslDowntimeRecord old) { + model.setEquipmentPartId(old.getEquipmentPartId()); + model.setEquipmentPartName(old.getEquipmentPartName()); + model.setInspectMaintainItemId(old.getInspectMaintainItemId()); + model.setInspectMaintainItemName(old.getInspectMaintainItemName()); + model.setMaintenanceResult(old.getMaintenanceResult()); + model.setMaintainerUserId(old.getMaintainerUserId()); + model.setMaintainerUsername(old.getMaintainerUsername()); + model.setMaintainerRealname(old.getMaintainerRealname()); + model.setMaintenanceFilledFlag( + oConvertUtils.isEmpty(old.getMaintenanceFilledFlag()) ? "0" : old.getMaintenanceFilledFlag()); + } + //update-end---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验、关联设备与停机类型回填----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerMaterialTareStrategyController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerMaterialTareStrategyController.java new file mode 100644 index 00000000..06143cf4 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerMaterialTareStrategyController.java @@ -0,0 +1,151 @@ +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 jakarta.servlet.http.HttpServletResponse; +import java.util.Arrays; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; +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.common.system.vo.LoginUser; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialTareStrategy; +import org.jeecg.modules.xslmes.service.IMesXslMixerMaterialTareStrategyService; +import org.jeecg.modules.xslmes.service.MesXslStompNotifyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +/** + * MES 密炼物料皮重策略 + */ +@Tag(name = "MES密炼物料皮重策略") +@RestController +@RequestMapping("/xslmes/mesXslMixerMaterialTareStrategy") +@Slf4j +public class MesXslMixerMaterialTareStrategyController + extends JeecgController { + + @Autowired + private IMesXslMixerMaterialTareStrategyService mesXslMixerMaterialTareStrategyService; + + @Autowired + private MesXslStompNotifyService stompNotify; + + @Operation(summary = "MES密炼物料皮重策略-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList( + MesXslMixerMaterialTareStrategy model, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = + QueryGenerator.initQueryWrapper(model, req.getParameterMap()); + queryWrapper.orderByDesc("effective_start_date", "create_time"); + Page page = new Page<>(pageNo, pageSize); + IPage pageList = mesXslMixerMaterialTareStrategyService.page(page, queryWrapper); + return Result.OK(pageList); + } + + @AutoLog(value = "MES密炼物料皮重策略-添加") + @Operation(summary = "MES密炼物料皮重策略-添加") + @RequiresPermissions("xslmes:mes_xsl_mixer_material_tare_strategy:add") + @PostMapping(value = "/add") + public Result add(@RequestBody MesXslMixerMaterialTareStrategy model) { + fillMaintainBy(model); + String err = mesXslMixerMaterialTareStrategyService.validateBeforeSave(model, false); + if (err != null) { + return Result.error(err); + } + mesXslMixerMaterialTareStrategyService.save(model); + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + stompNotify.publishMixerMaterialTareStrategyChanged("add", model.getId()); + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + return Result.OK("添加成功!"); + } + + @AutoLog(value = "MES密炼物料皮重策略-编辑") + @Operation(summary = "MES密炼物料皮重策略-编辑") + @RequiresPermissions("xslmes:mes_xsl_mixer_material_tare_strategy:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody MesXslMixerMaterialTareStrategy model) { + fillMaintainBy(model); + String err = mesXslMixerMaterialTareStrategyService.validateBeforeSave(model, true); + if (err != null) { + return Result.error(err); + } + mesXslMixerMaterialTareStrategyService.updateById(model); + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + stompNotify.publishMixerMaterialTareStrategyChanged("edit", model.getId()); + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + return Result.OK("编辑成功!"); + } + + @AutoLog(value = "MES密炼物料皮重策略-删除") + @Operation(summary = "MES密炼物料皮重策略-通过id删除") + @RequiresPermissions("xslmes:mes_xsl_mixer_material_tare_strategy:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + mesXslMixerMaterialTareStrategyService.removeById(id); + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + stompNotify.publishMixerMaterialTareStrategyChanged("delete", id); + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + return Result.OK("删除成功!"); + } + + @AutoLog(value = "MES密炼物料皮重策略-批量删除") + @Operation(summary = "MES密炼物料皮重策略-批量删除") + @RequiresPermissions("xslmes:mes_xsl_mixer_material_tare_strategy:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + mesXslMixerMaterialTareStrategyService.removeByIds(Arrays.asList(ids.split(","))); + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + stompNotify.publishMixerMaterialTareStrategyChanged("batchDelete", ids); + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + return Result.OK("批量删除成功!"); + } + + @Operation(summary = "MES密炼物料皮重策略-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + MesXslMixerMaterialTareStrategy entity = mesXslMixerMaterialTareStrategyService.getById(id); + if (entity == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(entity); + } + + @RequiresPermissions("xslmes:mes_xsl_mixer_material_tare_strategy:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MesXslMixerMaterialTareStrategy model) { + return super.exportXls(request, model, MesXslMixerMaterialTareStrategy.class, "密炼物料皮重策略"); + } + + @RequiresPermissions("xslmes:mes_xsl_mixer_material_tare_strategy:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MesXslMixerMaterialTareStrategy.class); + } + + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】维护人自动回填当前登录用户----------- + private void fillMaintainBy(MesXslMixerMaterialTareStrategy model) { + LoginUser loginUser = null; + try { + loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + } catch (Exception e) { + log.debug("获取登录用户失败", e); + } + if (loginUser != null && oConvertUtils.isNotEmpty(loginUser.getUsername())) { + model.setMaintainBy(loginUser.getUsername()); + } + } + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】维护人自动回填当前登录用户----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java new file mode 100644 index 00000000..ebb20345 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java @@ -0,0 +1,212 @@ +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 jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +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.exception.JeecgBootException; +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.MesXslRubberSmallLockReason; +import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService; +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/mesXslRubberSmallLockReason") +@Slf4j +public class MesXslRubberSmallLockReasonController + extends JeecgController { + + @Autowired + private IMesXslRubberSmallLockReasonService mesXslRubberSmallLockReasonService; + + @Operation(summary = "MES胶料小料锁定原因-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList( + MesXslRubberSmallLockReason model, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = + QueryGenerator.initQueryWrapper(model, req.getParameterMap()); + Page page = new Page<>(pageNo, pageSize); + IPage pageList = mesXslRubberSmallLockReasonService.page(page, queryWrapper); + return Result.OK(pageList); + } + + @AutoLog(value = "MES胶料小料锁定原因-添加") + @Operation(summary = "MES胶料小料锁定原因-添加") + @RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:add") + @PostMapping(value = "/add") + public Result add(@RequestBody MesXslRubberSmallLockReason model) { + //update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因新增校验与自动编号----------- + if (oConvertUtils.isEmpty(model.getLockType())) { + return Result.error("类型不能为空"); + } + if (oConvertUtils.isEmpty(model.getBarcodeType())) { + return Result.error("条码类型不能为空"); + } + model.setReasonCode(null); + try { + mesXslRubberSmallLockReasonService.save(model); + } catch (JeecgBootException e) { + return Result.error(e.getMessage()); + } + //update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因新增校验与自动编号----------- + return Result.OK("添加成功!"); + } + + @AutoLog(value = "MES胶料小料锁定原因-编辑") + @Operation(summary = "MES胶料小料锁定原因-编辑") + @RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody MesXslRubberSmallLockReason model) { + //update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编辑仅改类型与条码类型、编号只读----------- + if (oConvertUtils.isEmpty(model.getId())) { + return Result.error("缺少主键"); + } + if (oConvertUtils.isEmpty(model.getLockType())) { + return Result.error("类型不能为空"); + } + if (oConvertUtils.isEmpty(model.getBarcodeType())) { + return Result.error("条码类型不能为空"); + } + MesXslRubberSmallLockReason old = mesXslRubberSmallLockReasonService.getById(model.getId()); + if (old == null) { + return Result.error("未找到对应数据"); + } + old.setLockType(model.getLockType()); + old.setBarcodeType(model.getBarcodeType()); + try { + mesXslRubberSmallLockReasonService.updateById(old); + } catch (JeecgBootException e) { + return Result.error(e.getMessage()); + } + //update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编辑仅改类型与条码类型、编号只读----------- + return Result.OK("编辑成功!"); + } + + @AutoLog(value = "MES胶料小料锁定原因-删除") + @Operation(summary = "MES胶料小料锁定原因-通过id删除") + @RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + mesXslRubberSmallLockReasonService.removeById(id); + return Result.OK("删除成功!"); + } + + @AutoLog(value = "MES胶料小料锁定原因-批量删除") + @Operation(summary = "MES胶料小料锁定原因-批量删除") + @RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + mesXslRubberSmallLockReasonService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + @Operation(summary = "MES胶料小料锁定原因-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + MesXslRubberSmallLockReason entity = mesXslRubberSmallLockReasonService.getById(id); + if (entity == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(entity); + } + + @Operation(summary = "预览下一编号(001起)") + @GetMapping(value = "/nextReasonCode") + public Result nextReasonCode() { + MesXslRubberSmallLockReason ctx = new MesXslRubberSmallLockReason(); + return Result.OK(mesXslRubberSmallLockReasonService.generateNextReasonCode(ctx)); + } + + @RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MesXslRubberSmallLockReason model) { + return super.exportXls(request, model, MesXslRubberSmallLockReason.class, "MES胶料小料锁定原因"); + } + + @RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + //update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因导入:类型与条码类型必填,编号可空则自动生成----------- + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry ent : fileMap.entrySet()) { + MultipartFile file = ent.getValue(); + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List list = + ExcelImportUtil.importExcel(file.getInputStream(), MesXslRubberSmallLockReason.class, params); + if (list == null) { + list = List.of(); + } + for (int i = 0; i < list.size(); i++) { + MesXslRubberSmallLockReason row = list.get(i); + int rowNo = i + 1; + if (row == null) { + return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)"); + } + if (oConvertUtils.isEmpty(row.getLockType())) { + return Result.error("文件导入失败:第 " + rowNo + " 条类型不能为空"); + } + if (oConvertUtils.isEmpty(row.getBarcodeType())) { + return Result.error("文件导入失败:第 " + rowNo + " 条条码类型不能为空"); + } + if (oConvertUtils.isNotEmpty(row.getReasonCode())) { + row.setReasonCode(row.getReasonCode().trim()); + } else { + row.setReasonCode(null); + } + } + for (MesXslRubberSmallLockReason row : list) { + try { + mesXslRubberSmallLockReasonService.save(row); + } catch (JeecgBootException e) { + return Result.error("文件导入失败:" + e.getMessage()); + } + } + log.info("胶料小料锁定原因Excel导入完成,行数={}", list.size()); + return Result.ok("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + String msg = e.getMessage(); + log.error(msg, e); + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + } + //update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因导入:类型与条码类型必填,编号可空则自动生成----------- + return Result.error("文件导入失败!"); + } +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslWeightRecordController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslWeightRecordController.java index 08cfd8d7..c99264cd 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslWeightRecordController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslWeightRecordController.java @@ -27,9 +27,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Random; -import java.util.stream.Collectors; /** * 地磅数据记录 @@ -57,7 +55,7 @@ public class MesXslWeightRecordController extends JeecgController page = new Page<>(pageNo, pageSize); IPage pageList = mesXslWeightRecordService.page(page, queryWrapper); - fillEnteredWeight(pageList.getRecords()); + rawMaterialEntryService.fillWeightRecordDerivedFields(pageList.getRecords()); return Result.OK(pageList); } @@ -120,7 +118,7 @@ public class MesXslWeightRecordController extends JeecgController records) { - if (records == null || records.isEmpty()) { - return; - } - List billNos = records.stream() - .map(MesXslWeightRecord::getBillNo) - .filter(s -> s != null && !s.isBlank()) - .distinct() - .collect(Collectors.toList()); - if (billNos.isEmpty()) { - return; - } - Map sumMap = rawMaterialEntryService.sumEnteredWeightByBillNos(billNos); - for (MesXslWeightRecord r : records) { - BigDecimal v = (r.getBillNo() == null) ? null : sumMap.get(r.getBillNo()); - r.setEnteredWeight(v != null ? v : BigDecimal.ZERO); - } + private void fillWeightRecordDerivedFields(List records) { + rawMaterialEntryService.fillWeightRecordDerivedFields(records); } } diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java new file mode 100644 index 00000000..1db90880 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java @@ -0,0 +1,106 @@ +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.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_record) + */ +@Data +@TableName("mes_xsl_downtime_record") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@Schema(description = "MES停机记录") +public class MesXslDowntimeRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.ASSIGN_ID) + private String id; + + @Schema(description = "设备台账主键 mes_xsl_equipment_ledger.id") + private String equipmentLedgerId; + + @Excel(name = "设备编号", width = 18) + @Schema(description = "设备编号冗余") + private String equipmentCode; + + @Excel(name = "机台", width = 22) + @Schema(description = "设备名称冗余") + private String equipmentName; + + @Schema(description = "停机类型主键 mes_xsl_downtime_type.id") + private String downtimeTypeId; + + @Excel(name = "停机原因", width = 24) + @Schema(description = "停机类型名称冗余") + private String downtimeTypeName; + + @Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "开始时间") + private Date startTime; + + @Excel(name = "结束时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "结束时间") + private Date endTime; + + @Schema(description = "设备部位主键 mes_xsl_equipment_part.id") + private String equipmentPartId; + + @Excel(name = "设备部位", width = 18) + @Schema(description = "设备部位名称冗余") + private String equipmentPartName; + + @Schema(description = "点检及保养项目主键 mes_xsl_inspect_maintain_item.id") + private String inspectMaintainItemId; + + @Excel(name = "维修项目", width = 22) + @Schema(description = "点检项目名称冗余") + private String inspectMaintainItemName; + + @Excel(name = "维修结果", width = 28) + @Schema(description = "维修结果") + private String maintenanceResult; + + @Schema(description = "维修人用户ID") + private String maintainerUserId; + + @Schema(description = "维修人账号") + private String maintainerUsername; + + @Excel(name = "维修人", width = 12) + @Schema(description = "维修人姓名") + private String maintainerRealname; + + @Excel(name = "是否已录入维修", width = 14, dicCode = "yn") + @Dict(dicCode = "yn") + @Schema(description = "是否已录入维修结果(字典yn:1是0否)") + private String maintenanceFilledFlag; + + 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; +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java new file mode 100644 index 00000000..e76bc291 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java @@ -0,0 +1,107 @@ +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.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * MES 密炼物料皮重策略 + */ +@Data +@TableName("mes_xsl_mixer_material_tare_strategy") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@Schema(description = "MES密炼物料皮重策略") +public class MesXslMixerMaterialTareStrategy implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.ASSIGN_ID) + private String id; + + @Schema(description = "租户ID") + private Integer tenantId; + + @Excel(name = "密炼物料", width = 18, dictTable = "mes_mixer_material", dicText = "material_name", dicCode = "id") + @Dict(dictTable = "mes_mixer_material", dicText = "material_name", dicCode = "id") + @Schema(description = "密炼物料ID(关联 mes_mixer_material.id)") + private String mixerMaterialId; + + @Excel(name = "密炼物料名称", width = 20) + @Schema(description = "密炼物料名称冗余") + private String mixerMaterialName; + + @Excel(name = "供应商", width = 18, dictTable = "mes_xsl_supplier", dicText = "supplier_name", dicCode = "id") + @Dict(dictTable = "mes_xsl_supplier", dicText = "supplier_name", dicCode = "id") + @Schema(description = "供应商ID(关联 mes_xsl_supplier.id)") + private String supplierId; + + @Excel(name = "供应商名称", width = 20) + @Schema(description = "供应商名称冗余") + private String supplierName; + + @Excel(name = "物料规格", width = 16) + @Schema(description = "物料规格(与密炼物料、供应商、生效日期共同参与唯一性校验,不同规格可分别维护)") + private String materialSpec; + + @Excel(name = "包装物重量", width = 12) + @Schema(description = "包装物重量") + private BigDecimal tareWeight; + + @Excel(name = "托盘重量", width = 12) + @Schema(description = "托盘重量") + private BigDecimal palletWeight; + + @Schema(description = "单位ID(关联 mes_xsl_unit.id)") + private String unitId; + + @Excel(name = "单位", width = 10) + @Schema(description = "单位名称冗余") + private String unitName; + + @Excel(name = "生效开始日期", width = 14, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Schema(description = "生效开始日期") + private Date effectiveStartDate; + + @Excel(name = "生效截止日期", width = 14, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Schema(description = "生效截止日期") + private Date effectiveEndDate; + + @Excel(name = "维护人", width = 12, dictTable = "sys_user", dicText = "realname", dicCode = "username") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") + @Schema(description = "维护人(登录账号)") + private String maintainBy; + + @Excel(name = "创建人", width = 12) + private String createBy; + + @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @Excel(name = "修改人", width = 12) + 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 String sysOrgCode; + private Integer delFlag; +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialCard.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialCard.java index 96ccbd45..7400e7a6 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialCard.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialCard.java @@ -86,6 +86,14 @@ public class MesXslRawMaterialCard implements Serializable { @Schema(description = "总重") private BigDecimal totalWeight; + @Excel(name = "包装物皮重", width = 12) + @Schema(description = "包装物皮重(KG)") + private BigDecimal packagingTare; + + @Excel(name = "托盘重量", width = 12) + @Schema(description = "托盘重量(KG)") + private BigDecimal palletWeight; + @Excel(name = "剩余重量", width = 12) @Schema(description = "剩余重量") private BigDecimal remainingWeight; diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialEntry.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialEntry.java index 9635bcfc..21db0a6b 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialEntry.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialEntry.java @@ -89,6 +89,10 @@ public class MesXslRawMaterialEntry implements Serializable { @Schema(description = "总重(KG)") private BigDecimal totalWeight; + @Excel(name = "托盘及皮重合计", width = 14) + @Schema(description = "托盘及皮重(合计)") + private BigDecimal palletTareTotal; + // 总份数 / 每份总重 / 每份包数:从 数值类型 升级为 字符串类型, // 支持桌面端「拆码明细」多行拼接保存(如 20/1/ 与 100/200/)。 @Excel(name = "总份数", width = 12) @@ -99,6 +103,17 @@ public class MesXslRawMaterialEntry implements Serializable { @Schema(description = "每份总重(KG)(支持多行拆码明细拼接,如 100/200/)") private String portionWeight; + @Excel(name = "包装物皮重", width = 14) + @Schema(description = "拆码明细包装物皮重拼接(以 / 分隔,末尾带 /)") + private String portionPackagingTare; + + @Excel(name = "托盘重量", width = 14) + @Schema(description = "拆码明细托盘重量拼接(以 / 分隔,末尾带 /)") + private String portionPalletWeight; + + @Schema(description = "拆码明细皮重策略ID拼接(以 / 分隔,末尾带 /)") + private String portionTareStrategyIds; + @Excel(name = "每份包数", width = 12) @Schema(description = "每份包数(支持多行拆码明细拼接)") private String portionPackages; diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialWorkshopRemain.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialWorkshopRemain.java index 6c5ea9bf..c5555eba 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialWorkshopRemain.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRawMaterialWorkshopRemain.java @@ -56,6 +56,14 @@ public class MesXslRawMaterialWorkshopRemain extends JeecgEntity { @Schema(description = "总重") private BigDecimal totalWeight; + @Excel(name = "包装物皮重", width = 12) + @Schema(description = "包装物皮重(KG)") + private BigDecimal packagingTare; + + @Excel(name = "托盘重量", width = 12) + @Schema(description = "托盘重量(KG)") + private BigDecimal palletWeight; + @Excel(name = "剩余重量", width = 12) @Schema(description = "剩余重量") private BigDecimal remainingWeight; diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java new file mode 100644 index 00000000..136f30fb --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java @@ -0,0 +1,67 @@ +package org.jeecg.modules.xslmes.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +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 胶料小料锁定原因 + */ +@Data +@TableName("mes_xsl_rubber_small_lock_reason") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@Schema(description = "MES胶料小料锁定原因") +public class MesXslRubberSmallLockReason implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.ASSIGN_ID) + private String id; + + @Excel(name = "编号", width = 12) + @Schema(description = "编号(租户内从001递增自动生成,只读)") + private String reasonCode; + + @Excel(name = "类型", width = 12, dicCode = "xslmes_rubber_small_lock_type") + @Dict(dicCode = "xslmes_rubber_small_lock_type") + @Schema(description = "类型(字典:lock锁定 unlock解锁)") + private String lockType; + + @Excel(name = "条码类型", width = 12, dicCode = "xslmes_rubber_small_lock_barcode_type") + @Dict(dicCode = "xslmes_rubber_small_lock_barcode_type") + @Schema(description = "条码类型(字典:small小料 rubber胶料)") + private String barcodeType; + + private Integer tenantId; + private String sysOrgCode; + + @Excel(name = "创建人", width = 12) + private String createBy; + + @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @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; + + @TableLogic + @Schema(description = "删除状态(0正常 1已删除)") + private Integer delFlag; +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslWeightRecord.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslWeightRecord.java index 26f87531..dd64966b 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslWeightRecord.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslWeightRecord.java @@ -43,7 +43,10 @@ import java.util.Date; "driverName", "driverPhone", "billType", - "tenantId" + "tenantId", + "enteredWeight", + "cargoTareWeight", + "rawMaterialWeight" }) public class MesXslWeightRecord extends JeecgEntity implements Serializable { @@ -129,4 +132,20 @@ public class MesXslWeightRecord extends JeecgEntity implements Serializable { @TableField(exist = false) @Schema(description = "已入场重量(KG),由原料入场记录的拆码明细实时累计") private BigDecimal enteredWeight; + + /** + * 货物皮重(KG)—— 实时计算,不落库。 + * 数据来源:所有引用本榜单(bill_no 匹配)的原料入场记录的 pallet_tare_total(托盘及皮重合计)累加。 + */ + @TableField(exist = false) + @Schema(description = "货物皮重(KG),关联原料入场记录的托盘及皮重合计累计") + private BigDecimal cargoTareWeight; + + /** + * 原料重量(KG)—— 实时计算,不落库。 + * 公式:净重(KG) - 货物皮重(KG)。 + */ + @TableField(exist = false) + @Schema(description = "原料重量(KG)=净重-货物皮重") + private BigDecimal rawMaterialWeight; } diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java new file mode 100644 index 00000000..23b55c54 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java @@ -0,0 +1,9 @@ +package org.jeecg.modules.xslmes.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord; + +/** + * MES 停机记录 + */ +public interface MesXslDowntimeRecordMapper extends BaseMapper {} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixerMaterialTareStrategyMapper.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixerMaterialTareStrategyMapper.java new file mode 100644 index 00000000..14163139 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixerMaterialTareStrategyMapper.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.xslmes.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialTareStrategy; + +/** + * MES 密炼物料皮重策略 Mapper + */ +@Mapper +public interface MesXslMixerMaterialTareStrategyMapper extends BaseMapper {} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockReasonMapper.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockReasonMapper.java new file mode 100644 index 00000000..727f7660 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockReasonMapper.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.xslmes.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason; + +/** + * MES 胶料小料锁定原因 Mapper + */ +@Mapper +public interface MesXslRubberSmallLockReasonMapper extends BaseMapper { + + //update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因租户内最大三位数字编号----------- + @Select( + "SELECT IFNULL(MAX(CAST(reason_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_small_lock_reason " + + "WHERE del_flag = 0 AND reason_code REGEXP '^[0-9]+$' " + + "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})") + Integer selectMaxNumericReasonCode(@Param("tenantId") Integer tenantId); + //update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因租户内最大三位数字编号----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java new file mode 100644 index 00000000..6d1f6aaa --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.xslmes.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord; +import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO; + +/** + * MES 停机记录 + */ +public interface IMesXslDowntimeRecordService extends IService { + + /** + * 录入维修结果 + */ + void saveMaintenanceResult(MesXslDowntimeRecordMaintenanceDTO dto); +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerMaterialTareStrategyService.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerMaterialTareStrategyService.java new file mode 100644 index 00000000..6328bbb4 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerMaterialTareStrategyService.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.xslmes.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialTareStrategy; + +/** + * MES 密炼物料皮重策略 + */ +public interface IMesXslMixerMaterialTareStrategyService extends IService { + + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】保存前校验生效日期重叠(含物料规格)----------- + /** + * 校验同一租户、同一供应商、同一密炼物料、同一物料规格在生效日期内是否已存在记录。 + * 同一密炼物料不同规格可分别维护;仅规格相同且生效日期重叠时不允许重复。 + * + * @param entity 待保存实体 + * @param isUpdate 是否编辑 + * @return 错误信息,null 表示通过 + */ + String validateBeforeSave(MesXslMixerMaterialTareStrategy entity, boolean isUpdate); + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】保存前校验生效日期重叠(含物料规格)----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialEntryService.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialEntryService.java index a38537a9..3f45bbce 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialEntryService.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialEntryService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.xslmes.entity.MesXslRawMaterialEntry; +import org.jeecg.modules.xslmes.entity.MesXslWeightRecord; import org.jeecg.modules.xslmes.vo.MesXslRawMaterialCardBriefVO; import org.jeecg.modules.xslmes.vo.MesXslRawMaterialEntryDeleteLogVO; @@ -62,6 +63,19 @@ public interface IMesXslRawMaterialEntryService extends IService sumEnteredWeightByBillNos(Collection billNos); + /** + * 按榜单号批量统计「货物皮重」(托盘及皮重合计累加)。 + * + * @param billNos 榜单号集合 + * @return billNo -> 累计货物皮重;查不到的 billNo 不会出现在 map 中 + */ + Map sumCargoTareByBillNos(Collection billNos); + + /** + * 给磅单列表/详情填充由原料入场记录衍生的 transient 字段(已入场重量、货物皮重)。 + */ + void fillWeightRecordDerivedFields(List records); + /** * 结存入库并汇总原材料库存。 *

diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockReasonService.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockReasonService.java new file mode 100644 index 00000000..668543f5 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockReasonService.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.xslmes.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason; + +public interface IMesXslRubberSmallLockReasonService extends IService { + + /** 生成下一编号(001 起,三位数字,租户维度) */ + String generateNextReasonCode(MesXslRubberSmallLockReason context); +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/MesXslStompNotifyService.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/MesXslStompNotifyService.java index d55282cf..72308ef3 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/MesXslStompNotifyService.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/MesXslStompNotifyService.java @@ -75,6 +75,14 @@ public class MesXslStompNotifyService { publish("/topic/sync/print-templates", "PRINT_TEMPLATE_CHANGED", "templateId", templateId, action); } + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + /** 广播密炼物料皮重策略变更事件到 /topic/sync/mes-mixer-material-tare-strategies */ + public void publishMixerMaterialTareStrategyChanged(String action, String tareStrategyId) { + publish("/topic/sync/mes-mixer-material-tare-strategies", "MES_MIXER_MATERIAL_TARE_STRATEGY_CHANGED", + "tareStrategyId", tareStrategyId, action); + } + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】桌面端同步----------- + // ─────────────────────────── 私有辅助 ──────────────────────────── private void publish(String topic, String cmd, String idKey, String idValue, String action) { diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java new file mode 100644 index 00000000..4177d691 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java @@ -0,0 +1,92 @@ +package org.jeecg.modules.xslmes.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord; +import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart; +import org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem; +import org.jeecg.modules.xslmes.mapper.MesXslDowntimeRecordMapper; +import org.jeecg.modules.xslmes.service.IMesXslDowntimeRecordService; +import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService; +import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService; +import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * MES 停机记录 + */ +@Service +public class MesXslDowntimeRecordServiceImpl extends ServiceImpl + implements IMesXslDowntimeRecordService { + + @Autowired + private IMesXslEquipmentPartService mesXslEquipmentPartService; + + @Autowired + private IMesXslInspectMaintainItemService mesXslInspectMaintainItemService; + + //update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果----------- + @Override + @Transactional(rollbackFor = Exception.class) + public void saveMaintenanceResult(MesXslDowntimeRecordMaintenanceDTO dto) { + if (dto == null || oConvertUtils.isEmpty(dto.getId())) { + throw new JeecgBootException("停机记录不存在"); + } + MesXslDowntimeRecord record = this.getById(dto.getId()); + if (record == null + || (record.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(record.getDelFlag()))) { + throw new JeecgBootException("停机记录不存在"); + } + if (oConvertUtils.isEmpty(dto.getEquipmentPartId())) { + throw new JeecgBootException("请选择设备部位"); + } + if (oConvertUtils.isEmpty(dto.getInspectMaintainItemId())) { + throw new JeecgBootException("请选择维修项目"); + } + if (oConvertUtils.isEmpty(dto.getMaintenanceResult()) || dto.getMaintenanceResult().trim().isEmpty()) { + throw new JeecgBootException("维修结果不能为空"); + } + if (oConvertUtils.isEmpty(dto.getMaintainerUserId())) { + throw new JeecgBootException("请选择维修人"); + } + + MesXslEquipmentPart part = mesXslEquipmentPartService.getById(dto.getEquipmentPartId()); + if (part == null + || (part.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(part.getDelFlag()))) { + throw new JeecgBootException("设备部位不存在"); + } + + MesXslInspectMaintainItem item = mesXslInspectMaintainItemService.getById(dto.getInspectMaintainItemId()); + if (item == null + || (item.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(item.getDelFlag()))) { + throw new JeecgBootException("维修项目不存在"); + } + if (!dto.getEquipmentPartId().equals(item.getEquipmentPartId())) { + throw new JeecgBootException("维修项目与所选设备部位不匹配"); + } + + record.setEquipmentPartId(part.getId()); + record.setEquipmentPartName(part.getPartName()); + record.setInspectMaintainItemId(item.getId()); + record.setInspectMaintainItemName(item.getItemName()); + record.setMaintenanceResult(dto.getMaintenanceResult().trim()); + record.setMaintainerUserId(dto.getMaintainerUserId()); + record.setMaintainerUsername(trimToNull(dto.getMaintainerUsername())); + record.setMaintainerRealname(trimToNull(dto.getMaintainerRealname())); + record.setMaintenanceFilledFlag("1"); + this.updateById(record); + } + + private static String trimToNull(String value) { + if (value == null) { + return null; + } + String v = value.trim(); + return v.isEmpty() ? null : v; + } + //update-end---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java index 55ef2ff0..23076c8e 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java @@ -773,7 +773,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl + implements IMesXslMixerMaterialTareStrategyService { + + @Autowired + private IMesMixerMaterialService mesMixerMaterialService; + + @Autowired + private IMesXslSupplierService mesXslSupplierService; + + @Autowired + private IMesXslUnitService mesXslUnitService; + + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】保存前校验与冗余回填----------- + @Override + public String validateBeforeSave(MesXslMixerMaterialTareStrategy entity, boolean isUpdate) { + if (oConvertUtils.isEmpty(entity.getMixerMaterialId())) { + return "请选择密炼物料"; + } + if (oConvertUtils.isEmpty(entity.getSupplierId())) { + return "请选择供应商"; + } + if (entity.getTareWeight() == null) { + return "请填写包装物重量"; + } + if (entity.getPalletWeight() != null && entity.getPalletWeight().signum() < 0) { + return "托盘重量不能为负数"; + } + if (oConvertUtils.isEmpty(entity.getUnitId())) { + return "请选择单位"; + } + Date startDate = entity.getEffectiveStartDate(); + Date endDate = entity.getEffectiveEndDate(); + if (startDate == null || endDate == null) { + return "请填写完整的生效日期"; + } + if (startDate.after(endDate)) { + return "生效开始日期不能晚于截止日期"; + } + + MesMixerMaterial mixerMaterial = mesMixerMaterialService.getById(entity.getMixerMaterialId()); + if (mixerMaterial == null) { + return "所选密炼物料不存在,请重新选择"; + } + MesXslSupplier supplier = mesXslSupplierService.getById(entity.getSupplierId()); + if (supplier == null) { + return "所选供应商不存在,请重新选择"; + } + MesXslUnit unit = mesXslUnitService.getById(entity.getUnitId()); + if (unit == null) { + return "所选单位不存在,请重新选择"; + } + + entity.setMixerMaterialName(mixerMaterial.getMaterialName()); + entity.setSupplierName(supplier.getSupplierName()); + entity.setUnitName(unit.getUnitName()); + //update-begin---author:cursor ---date:20250602 for:【密炼物料皮重策略】重叠校验增加物料规格维度----------- + if (entity.getMaterialSpec() != null) { + entity.setMaterialSpec(entity.getMaterialSpec().trim()); + } + if (oConvertUtils.isEmpty(entity.getMaterialSpec())) { + entity.setMaterialSpec(null); + } + + String normalizedSpec = oConvertUtils.isEmpty(entity.getMaterialSpec()) ? "" : entity.getMaterialSpec(); + LambdaQueryWrapper overlapQw = new LambdaQueryWrapper<>(); + overlapQw.eq(MesXslMixerMaterialTareStrategy::getMixerMaterialId, entity.getMixerMaterialId()) + .eq(MesXslMixerMaterialTareStrategy::getSupplierId, entity.getSupplierId()) + .le(MesXslMixerMaterialTareStrategy::getEffectiveStartDate, endDate) + .ge(MesXslMixerMaterialTareStrategy::getEffectiveEndDate, startDate) + .apply("IFNULL(TRIM(material_spec), '') = {0}", normalizedSpec); + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】重叠校验增加物料规格维度----------- + if (entity.getTenantId() != null) { + overlapQw.eq(MesXslMixerMaterialTareStrategy::getTenantId, entity.getTenantId()); + } + if (isUpdate && oConvertUtils.isNotEmpty(entity.getId())) { + overlapQw.ne(MesXslMixerMaterialTareStrategy::getId, entity.getId()); + } + if (count(overlapQw) > 0) { + return "同一租户、同一供应商、同一密炼物料且物料规格相同的时间段内,已存在策略,请勿重复维护"; + } + return null; + } + //update-end---author:cursor ---date:20250602 for:【密炼物料皮重策略】保存前校验与冗余回填----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialEntryServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialEntryServiceImpl.java index 9d535114..57dac60d 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialEntryServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialEntryServiceImpl.java @@ -10,6 +10,7 @@ import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard; import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInventory; import org.jeecg.modules.xslmes.entity.MesXslRawMaterialEntry; import org.jeecg.modules.xslmes.entity.MesXslWarehouseArea; +import org.jeecg.modules.xslmes.entity.MesXslWeightRecord; import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialEntryMapper; import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService; import org.jeecg.modules.xslmes.service.IMesXslRawMaterialInventoryService; @@ -217,6 +218,75 @@ public class MesXslRawMaterialEntryServiceImpl return result; } + @Override + public Map sumCargoTareByBillNos(Collection billNos) { + if (billNos == null || billNos.isEmpty()) { + return Collections.emptyMap(); + } + Set distinct = billNos.stream() + .filter(s -> s != null && !s.isBlank()) + .collect(Collectors.toCollection(HashSet::new)); + if (distinct.isEmpty()) { + return Collections.emptyMap(); + } + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.in(MesXslRawMaterialEntry::getBillNo, distinct) + .select(MesXslRawMaterialEntry::getBillNo, MesXslRawMaterialEntry::getPalletTareTotal); + List rows = this.list(qw); + Map result = new HashMap<>(); + for (MesXslRawMaterialEntry row : rows) { + if (row.getBillNo() == null || row.getPalletTareTotal() == null) { + continue; + } + result.merge(row.getBillNo(), row.getPalletTareTotal(), BigDecimal::add); + } + return result; + } + + @Override + public void fillWeightRecordDerivedFields(List records) { + if (records == null || records.isEmpty()) { + return; + } + List billNos = records.stream() + .map(MesXslWeightRecord::getBillNo) + .filter(s -> s != null && !s.isBlank()) + .distinct() + .collect(Collectors.toList()); + if (billNos.isEmpty()) { + for (MesXslWeightRecord r : records) { + r.setEnteredWeight(BigDecimal.ZERO); + r.setCargoTareWeight(BigDecimal.ZERO); + applyRawMaterialWeight(r); + } + return; + } + Map enteredMap = sumEnteredWeightByBillNos(billNos); + Map cargoTareMap = sumCargoTareByBillNos(billNos); + for (MesXslWeightRecord r : records) { + String billNo = r.getBillNo(); + if (billNo == null || billNo.isBlank()) { + r.setEnteredWeight(BigDecimal.ZERO); + r.setCargoTareWeight(BigDecimal.ZERO); + } else { + r.setEnteredWeight(enteredMap.getOrDefault(billNo, BigDecimal.ZERO)); + r.setCargoTareWeight(cargoTareMap.getOrDefault(billNo, BigDecimal.ZERO)); + } + applyRawMaterialWeight(r); + } + } + + /** 原料重量 = 净重 - 货物皮重(不落库) */ + private static void applyRawMaterialWeight(MesXslWeightRecord record) { + BigDecimal net = record.getNetWeight(); + if (net == null) { + record.setRawMaterialWeight(null); + return; + } + BigDecimal cargo = record.getCargoTareWeight() != null ? record.getCargoTareWeight() : BigDecimal.ZERO; + record.setRawMaterialWeight(net.subtract(cargo)); + } + @Override @Transactional(rollbackFor = Exception.class) public void batchStockInAndSyncInventory(Collection ids) { diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java new file mode 100644 index 00000000..aab3b02d --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.xslmes.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.xslmes.common.MesXslTenantUtils; +import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason; +import org.jeecg.modules.xslmes.mapper.MesXslRubberSmallLockReasonMapper; +import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class MesXslRubberSmallLockReasonServiceImpl + extends ServiceImpl + implements IMesXslRubberSmallLockReasonService { + + //update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编号001递增、类型与条码类型必填----------- + @Override + public String generateNextReasonCode(MesXslRubberSmallLockReason context) { + Integer tenantId = MesXslTenantUtils.resolveTenantId(context != null ? context.getTenantId() : null); + Integer max = baseMapper.selectMaxNumericReasonCode(tenantId); + int next = (max == null ? 0 : max) + 1; + if (next > 999) { + throw new IllegalStateException("编号已超过999,请联系管理员"); + } + return String.format("%03d", next); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean save(MesXslRubberSmallLockReason entity) { + validateRequiredFields(entity); + if (oConvertUtils.isEmpty(entity.getReasonCode())) { + entity.setReasonCode(generateNextReasonCode(entity)); + } + return super.save(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateById(MesXslRubberSmallLockReason entity) { + if (oConvertUtils.isEmpty(entity.getId())) { + throw new JeecgBootException("缺少主键"); + } + validateRequiredFields(entity); + return super.updateById(entity); + } + + private void validateRequiredFields(MesXslRubberSmallLockReason entity) { + if (entity == null) { + throw new JeecgBootException("数据不能为空"); + } + if (oConvertUtils.isEmpty(entity.getLockType())) { + throw new JeecgBootException("类型不能为空"); + } + if (oConvertUtils.isEmpty(entity.getBarcodeType())) { + throw new JeecgBootException("条码类型不能为空"); + } + } + //update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编号001递增、类型与条码类型必填----------- +} diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java new file mode 100644 index 00000000..462be573 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.xslmes.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 停机记录-录入维修结果入参 + */ +@Data +@Schema(description = "停机记录-录入维修结果") +public class MesXslDowntimeRecordMaintenanceDTO { + + @Schema(description = "停机记录主键", requiredMode = Schema.RequiredMode.REQUIRED) + private String id; + + @Schema(description = "设备部位主键") + private String equipmentPartId; + + @Schema(description = "点检及保养项目主键") + private String inspectMaintainItemId; + + @Schema(description = "维修结果") + private String maintenanceResult; + + @Schema(description = "维修人用户ID") + private String maintainerUserId; + + @Schema(description = "维修人账号") + private String maintainerUsername; + + @Schema(description = "维修人姓名") + private String maintainerRealname; +} diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 b/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 index 01b0b7c2..97aa8b14 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 @@ -540,3 +540,52 @@ jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTes jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.data.ts jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue jeecgboot-vue3/src/views/mes/material/MesMaterialList.vue + +-- author:cursor---date:20250602--for: 【密炼物料皮重策略】建表、CRUD、生效日期重叠校验、菜单授权 --- +jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_mixer_material_tare_strategy.sql +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixerMaterialTareStrategyMapper.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerMaterialTareStrategyService.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialTareStrategyServiceImpl.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerMaterialTareStrategyController.java +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategyList.vue +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategy.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategy.api.ts +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/components/MesXslMixerMaterialTareStrategyModal.vue + +-- author:cursor---date:20250602--for: 【密炼物料皮重策略】新增物料规格/托盘重量,皮重改名为包装物重量 --- +jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_mixer_material_tare_strategy_fields.sql +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialTareStrategyServiceImpl.java +yy-admin-master/YY.Admin.Core/Entity/MesXslMixerMaterialTareStrategy.cs +yy-admin-master/YY.Admin.Services/Service/MixerMaterialTareStrategy/MixerMaterialTareStrategyService.cs +yy-admin-master/YY.Admin/Views/MixerMaterialTareStrategy/MixerMaterialTareStrategyListView.xaml +yy-admin-master/YY.Admin/Views/MixerMaterialTareStrategy/MixerMaterialTareStrategyEditDialogView.xaml +yy-admin-master/YY.Admin/ViewModels/MixerMaterialTareStrategy/MixerMaterialTareStrategyEditDialogViewModel.cs +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategy.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/components/MesXslMixerMaterialTareStrategyModal.vue + +-- author:cursor---date:20250602--for: 【密炼物料皮重策略】重叠校验明确纳入物料规格维度 --- +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerMaterialTareStrategyService.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialTareStrategyServiceImpl.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java +jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategy.data.ts +yy-admin-master/YY.Admin/Views/MixerMaterialTareStrategy/MixerMaterialTareStrategyEditDialogView.xaml + +-- author:jiangxh---date:20250602--for: 【MES】停机记录:建表+菜单+CRUD+列表录入维修结果弹窗 --- +jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql +jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue +jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql new file mode 100644 index 00000000..a495a895 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql @@ -0,0 +1,91 @@ +-- MES 停机记录:建表 + 菜单 + 按钮 + 租户 admin 授权 +-- 权限前缀:mes:mes_xsl_downtime_record:* +-- 父菜单:设备管理;依赖设备台账、停机类型 +-- 独立脚本:jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql +SET NAMES utf8mb4; + +CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_record` ( + `id` varchar(32) NOT NULL COMMENT '主键', + `equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id', + `equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余', + `equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余', + `downtime_type_id` varchar(32) NOT NULL COMMENT '停机类型主键 mes_xsl_downtime_type.id', + `downtime_type_name` varchar(500) DEFAULT NULL COMMENT '停机类型名称冗余', + `start_time` datetime NOT NULL COMMENT '开始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `equipment_part_id` varchar(32) DEFAULT NULL COMMENT '设备部位主键 mes_xsl_equipment_part.id', + `equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余', + `inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id', + `inspect_maintain_item_name` varchar(500) DEFAULT NULL COMMENT '点检项目名称冗余', + `maintenance_result` varchar(500) DEFAULT NULL COMMENT '维修结果', + `maintainer_user_id` varchar(32) DEFAULT NULL COMMENT '维修人用户ID', + `maintainer_username` varchar(500) DEFAULT NULL COMMENT '维修人账号', + `maintainer_realname` varchar(500) DEFAULT NULL COMMENT '维修人姓名', + `maintenance_filled_flag` varchar(1) DEFAULT '0' COMMENT '是否已录入维修结果(字典yn:1是0否)', + `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_mdr_equipment` (`equipment_ledger_id`), + KEY `idx_mdr_downtime_type` (`downtime_type_id`), + KEY `idx_mdr_start_time` (`start_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机记录'; + +SET @mes_tenant_id = 1002; + +SET @mes_equip_pid = ( + SELECT `id` FROM `sys_permission` + WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理' + LIMIT 1 +); +SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133'); + +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`) +SELECT '1860000000000000201', @mes_equip_pid, '停机记录', '/xslmes/mesXslDowntimeRecord', 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', 'MesXslDowntimeRecordList', 1, NULL, '1', 12, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000201'); + +UPDATE `sys_permission` SET + `parent_id` = @mes_equip_pid, `name` = '停机记录', `url` = '/xslmes/mesXslDowntimeRecord', + `component` = 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', `component_name` = 'MesXslDowntimeRecordList', + `menu_type` = 1, `sort_no` = 12, `is_route` = 1, `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0, + `keep_alive` = 1, `internal_or_external` = 0, `icon` = 'ant-design:history-outlined' +WHERE `id` = '1860000000000000201'; + +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '1860000000000000202', '1860000000000000201', '新增', 2, 'mes:mes_xsl_downtime_record:add', '1', '1', 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000202'); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '1860000000000000203', '1860000000000000201', '编辑', 2, 'mes:mes_xsl_downtime_record:edit', '1', '1', 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000203'); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '1860000000000000204', '1860000000000000201', '删除', 2, 'mes:mes_xsl_downtime_record:delete', '1', '1', 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000204'); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '1860000000000000205', '1860000000000000201', '批量删除', 2, 'mes:mes_xsl_downtime_record:deleteBatch', '1', '1', 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000205'); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '1860000000000000206', '1860000000000000201', '导出', 2, 'mes:mes_xsl_downtime_record:exportXls', '1', '1', 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000206'); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '1860000000000000207', '1860000000000000201', '导入', 2, 'mes:mes_xsl_downtime_record:importExcel', '1', '1', 0, 'admin', NOW() +WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000207'); + +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 ( + '1860000000000000201', + '1860000000000000202', '1860000000000000203', '1860000000000000204', '1860000000000000205', + '1860000000000000206', '1860000000000000207' + ) + AND NOT EXISTS ( + SELECT 1 FROM `sys_role_permission` rp + WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id` + ); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_mixer_material_tare_strategy.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_mixer_material_tare_strategy.sql new file mode 100644 index 00000000..7ea78023 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_mixer_material_tare_strategy.sql @@ -0,0 +1,121 @@ +-- 密炼物料皮重策略:建表 + 菜单(挂 MES基础资料)+ admin 授权 +SET NAMES utf8mb4; + +CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_material_tare_strategy` ( + `id` varchar(32) NOT NULL COMMENT '主键', + `tenant_id` int DEFAULT NULL COMMENT '租户ID', + `mixer_material_id` varchar(32) NOT NULL COMMENT '密炼物料ID(关联 mes_mixer_material.id)', + `mixer_material_name` varchar(200) DEFAULT NULL COMMENT '密炼物料名称冗余', + `supplier_id` varchar(36) NOT NULL COMMENT '供应商ID(关联 mes_xsl_supplier.id)', + `supplier_name` varchar(100) DEFAULT NULL COMMENT '供应商名称冗余', + `tare_weight` decimal(12,3) NOT NULL COMMENT '皮重', + `unit_id` varchar(36) DEFAULT NULL COMMENT '单位ID(关联 mes_xsl_unit.id)', + `unit_name` varchar(64) DEFAULT NULL COMMENT '单位名称冗余', + `effective_start_date` date NOT NULL COMMENT '生效开始日期', + `effective_end_date` date NOT NULL COMMENT '生效截止日期', + `maintain_by` varchar(50) DEFAULT NULL COMMENT '维护人(登录账号)', + `sys_org_code` varchar(64) DEFAULT NULL COMMENT '所属部门', + `create_by` varchar(50) DEFAULT NULL COMMENT '创建人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(50) DEFAULT NULL COMMENT '修改人', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `del_flag` int NOT NULL DEFAULT 0 COMMENT '逻辑删除(0正常 1已删除)', + PRIMARY KEY (`id`), + KEY `idx_mxmts_tenant_supplier_material` (`tenant_id`, `supplier_id`, `mixer_material_id`), + KEY `idx_mxmts_effective_dates` (`effective_start_date`, `effective_end_date`) +) 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'); + +UPDATE `sys_permission` +SET `is_leaf` = 0, `update_time` = NOW() +WHERE `id` = @mes_base_pid AND `is_leaf` = 1; + +INSERT INTO `sys_permission` ( + `id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, + `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, + `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, + `del_flag`, `rule_flag`, `status`, `internal_or_external` +) +SELECT + '177925970995580', @mes_base_pid, '密炼物料皮重策略', '/xslmes/mesXslMixerMaterialTareStrategy', + 'xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategyList', 1, 'MesXslMixerMaterialTareStrategyList', NULL, + 1, NULL, '0', 18.00, 0, 'ant-design:database-outlined', 0, 1, + 0, 0, 'MES密炼物料皮重策略', 'admin', NOW(), 'admin', NOW(), + 0, 0, '1', 0 +FROM DUAL +WHERE NOT EXISTS ( + SELECT 1 FROM `sys_permission` + WHERE `id` = '177925970995580' + OR (`del_flag` = 0 AND `menu_type` = 1 AND `name` = '密炼物料皮重策略' AND `parent_id` = @mes_base_pid) +); + +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '177925970995581', '177925970995580', '新增', 2, 'xslmes:mes_xsl_mixer_material_tare_strategy:add', '1', 1.00, 0, 1, 0, '1', 0, 'admin', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '177925970995581'); + +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '177925970995582', '177925970995580', '编辑', 2, 'xslmes:mes_xsl_mixer_material_tare_strategy:edit', '1', 2.00, 0, 1, 0, '1', 0, 'admin', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '177925970995582'); + +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '177925970995583', '177925970995580', '删除', 2, 'xslmes:mes_xsl_mixer_material_tare_strategy:delete', '1', 3.00, 0, 1, 0, '1', 0, 'admin', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '177925970995583'); + +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '177925970995584', '177925970995580', '批量删除', 2, 'xslmes:mes_xsl_mixer_material_tare_strategy:deleteBatch', '1', 4.00, 0, 1, 0, '1', 0, 'admin', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '177925970995584'); + +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '177925970995585', '177925970995580', '导出', 2, 'xslmes:mes_xsl_mixer_material_tare_strategy:exportXls', '1', 5.00, 0, 1, 0, '1', 0, 'admin', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '177925970995585'); + +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`) +SELECT '177925970995586', '177925970995580', '导入', 2, 'xslmes:mes_xsl_mixer_material_tare_strategy:importExcel', '1', 6.00, 0, 1, 0, '1', 0, 'admin', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '177925970995586'); + +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) +SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NULL, 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 ( + '177925970995580', + '177925970995581', + '177925970995582', + '177925970995583', + '177925970995584', + '177925970995585', + '177925970995586' + ) + AND NOT EXISTS ( + SELECT 1 FROM `sys_role_permission` rp + WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id + ); + +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) +SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NULL, NOW(), '127.0.0.1' +FROM `sys_role` r +CROSS JOIN `sys_permission` p +WHERE r.`role_code` = 'admin' + AND r.`tenant_id` IS NULL + AND p.`id` IN ( + '177925970995580', + '177925970995581', + '177925970995582', + '177925970995583', + '177925970995584', + '177925970995585', + '177925970995586' + ) + AND NOT EXISTS ( + SELECT 1 FROM `sys_role_permission` rp + WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id + ); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_mixer_material_tare_strategy_fields.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_mixer_material_tare_strategy_fields.sql new file mode 100644 index 00000000..5f8a5443 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_mixer_material_tare_strategy_fields.sql @@ -0,0 +1,9 @@ +-- 密炼物料皮重策略:新增物料规格、托盘重量;皮重字段注释改为包装物重量 +SET NAMES utf8mb4; + +ALTER TABLE `mes_xsl_mixer_material_tare_strategy` + ADD COLUMN `material_spec` varchar(200) DEFAULT NULL COMMENT '物料规格' AFTER `supplier_name`, + ADD COLUMN `pallet_weight` decimal(12,3) DEFAULT NULL COMMENT '托盘重量' AFTER `tare_weight`; + +ALTER TABLE `mes_xsl_mixer_material_tare_strategy` + MODIFY COLUMN `tare_weight` decimal(12,3) NOT NULL COMMENT '包装物重量'; diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_rubber_small_lock_reason.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_rubber_small_lock_reason.sql new file mode 100644 index 00000000..6f174b34 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_rubber_small_lock_reason.sql @@ -0,0 +1,82 @@ +-- MES 胶料小料锁定原因:字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权 +-- 权限前缀:mes:mes_xsl_rubber_small_lock_reason:* +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_rubber_small_lock_type', '锁定/解锁', 0, 'admin', NOW(), 0, 0 +WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_type' 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, '锁定', 'lock', 1, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'lock'); +INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) +SELECT REPLACE(UUID(), '-', ''), d.id, '解锁', 'unlock', 2, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'unlock'); + +INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) +SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定条码类型', 'xslmes_rubber_small_lock_barcode_type', '小料/胶料', 0, 'admin', NOW(), 0, 0 +WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_barcode_type' 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, '小料', 'small', 1, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'small'); +INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) +SELECT REPLACE(UUID(), '-', ''), d.id, '胶料', 'rubber', 2, 1, 'admin', NOW() FROM `sys_dict` d +WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'rubber'); + +CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_reason` ( + `id` varchar(32) NOT NULL COMMENT '主键', + `reason_code` varchar(16) NOT NULL COMMENT '编号(租户内从001递增自动生成,只读)', + `lock_type` varchar(16) NOT NULL COMMENT '类型(字典xslmes_rubber_small_lock_type:lock锁定unlock解锁)', + `barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type:small小料rubber胶料)', + `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_mrslr_tenant_code` (`tenant_id`, `reason_code`), + KEY `idx_mrslr_tenant_lock` (`tenant_id`, `lock_type`, `barcode_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定原因'; + +SET @mes_tenant_id = 1002; + +SET @mes_quality_pid = IFNULL( + (SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1), + '1860000000000000162' +); + +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 ('1860000000000000208', @mes_quality_pid, '胶料小料锁定原因', '/xslmes/mesXslRubberSmallLockReason', 'xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList', 'MesXslRubberSmallLockReasonList', 1, NULL, '1', 6, 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`), `sort_no` = VALUES(`sort_no`), `is_leaf` = 0, `keep_alive` = VALUES(`keep_alive`); + +UPDATE `sys_permission` SET `icon` = 'ant-design:lock-outlined' WHERE `id` = '1860000000000000208' AND `del_flag` = 0; + +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES +('1860000000000000209', '1860000000000000208', '新增', 2, 'mes:mes_xsl_rubber_small_lock_reason:add', '1', '1', 0, 'admin', NOW()), +('1860000000000000210', '1860000000000000208', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_reason:edit', '1', '1', 0, 'admin', NOW()), +('1860000000000000211', '1860000000000000208', '删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:delete', '1', '1', 0, 'admin', NOW()), +('1860000000000000212', '1860000000000000208', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:deleteBatch', '1', '1', 0, 'admin', NOW()), +('1860000000000000213', '1860000000000000208', '导出', 2, 'mes:mes_xsl_rubber_small_lock_reason:exportXls', '1', '1', 0, 'admin', NOW()), +('1860000000000000214', '1860000000000000208', '导入', 2, 'mes:mes_xsl_rubber_small_lock_reason:importExcel', '1', '1', 0, 'admin', NOW()) +ON DUPLICATE KEY UPDATE `perms` = VALUES(`perms`), `name` = VALUES(`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 ( + '1860000000000000208', + '1860000000000000209', '1860000000000000210', '1860000000000000211', '1860000000000000212', + '1860000000000000213', '1860000000000000214' + ) + AND NOT EXISTS ( + SELECT 1 FROM sys_role_permission rp + WHERE rp.role_id = r.id AND rp.permission_id = p.id + ); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_119__mes_xsl_raw_material_entry_tare_fields.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_119__mes_xsl_raw_material_entry_tare_fields.sql new file mode 100644 index 00000000..59018f4e --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_119__mes_xsl_raw_material_entry_tare_fields.sql @@ -0,0 +1,8 @@ +-- 原料入场记录:托盘及皮重合计 + 拆码明细皮重策略相关字段 +SET NAMES utf8mb4; + +ALTER TABLE `mes_xsl_raw_material_entry` + ADD COLUMN `pallet_tare_total` decimal(12,3) DEFAULT NULL COMMENT '托盘及皮重(合计)' AFTER `total_weight`, + ADD COLUMN `portion_packaging_tare` varchar(500) DEFAULT NULL COMMENT '拆码明细包装物皮重拼接(以/分隔,末尾带/)' AFTER `portion_weight`, + ADD COLUMN `portion_pallet_weight` varchar(500) DEFAULT NULL COMMENT '拆码明细托盘重量拼接(以/分隔,末尾带/)' AFTER `portion_packaging_tare`, + ADD COLUMN `portion_tare_strategy_ids` varchar(1000) DEFAULT NULL COMMENT '拆码明细皮重策略ID拼接(以/分隔,末尾带/)' AFTER `portion_pallet_weight`; diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_120__mes_xsl_raw_material_card_tare_fields.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_120__mes_xsl_raw_material_card_tare_fields.sql new file mode 100644 index 00000000..0d59fc13 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_120__mes_xsl_raw_material_card_tare_fields.sql @@ -0,0 +1,6 @@ +-- 原材料卡片:包装物皮重、托盘重量 +SET NAMES utf8mb4; + +ALTER TABLE `mes_xsl_raw_material_card` + ADD COLUMN `packaging_tare` decimal(12,3) DEFAULT NULL COMMENT '包装物皮重(KG)' AFTER `total_weight`, + ADD COLUMN `pallet_weight` decimal(12,3) DEFAULT NULL COMMENT '托盘重量(KG)' AFTER `packaging_tare`; diff --git a/jeecgboot-vue3/src/views/xslmes/components/MesSearchPickerInput.vue b/jeecgboot-vue3/src/views/xslmes/components/MesSearchPickerInput.vue new file mode 100644 index 00000000..7bf8a3c8 --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/components/MesSearchPickerInput.vue @@ -0,0 +1,18 @@ + + + diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts index 84ee5efc..3bf29a0c 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts @@ -44,7 +44,14 @@ export const columns: BasicColumn[] = [ ]; export const searchFormSchema: FormSchema[] = [ - { label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } }, + { label: '', field: 'processOperationId', component: 'Input', show: false }, + { + label: '所属工序', + field: 'processOperationName', + component: 'Input', + slot: 'processOperationPicker', + colProps: { span: 6 }, + }, { label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } }, { label: '是否启用', diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue index 22adcb2d..b784df8a 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue @@ -1,6 +1,16 @@ @@ -54,11 +65,17 @@ import { useModal } from '/@/components/Modal'; import { useListPage } from '/@/hooks/system/useListPage'; import Icon from '/@/components/Icon'; + import MesSearchPickerInput from '../components/MesSearchPickerInput.vue'; import MesXslDowntimeMainTypeModal from './components/MesXslDowntimeMainTypeModal.vue'; + import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue'; + import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil'; import { columns, searchFormSchema } from './MesXslDowntimeMainType.data'; import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeMainType.api'; + const SEARCH_ID_NAME_PAIRS = [{ idField: 'processOperationId', nameField: 'processOperationName' }]; + const [registerModal, { openModal }] = useModal(); + const [registerProcessModal, { openModal: openProcessModal }] = useModal(); const { tableContext, onExportXls, onImportXls } = useListPage({ tableProps: { @@ -66,6 +83,7 @@ api: list, columns, canResize: true, + beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS), formConfig: { schemas: searchFormSchema, labelWidth: 100, @@ -87,7 +105,19 @@ }, }); - const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; + const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext; + + function openProcessSelect() { + const v = getForm()?.getFieldsValue?.() || {}; + openProcessModal(true, { processOperationId: v.processOperationId }); + } + + function onProcessSelect(payload: Recordable) { + getForm()?.setFieldsValue?.({ + processOperationId: payload.processOperationId || '', + processOperationName: payload.processOperationName || '', + }); + } function handleAdd() { openModal(true, { isUpdate: false, showFooter: true }); diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts new file mode 100644 index 00000000..734534e4 --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts @@ -0,0 +1,51 @@ +import { defHttp } from '/@/utils/http/axios'; +import { useMessage } from '/@/hooks/web/useMessage'; + +const { createConfirm } = useMessage(); + +enum Api { + list = '/xslmes/mesXslDowntimeRecord/list', + save = '/xslmes/mesXslDowntimeRecord/add', + edit = '/xslmes/mesXslDowntimeRecord/edit', + deleteOne = '/xslmes/mesXslDowntimeRecord/delete', + deleteBatch = '/xslmes/mesXslDowntimeRecord/deleteBatch', + importExcel = '/xslmes/mesXslDowntimeRecord/importExcel', + exportXls = '/xslmes/mesXslDowntimeRecord/exportXls', + queryById = '/xslmes/mesXslDowntimeRecord/queryById', + saveMaintenanceResult = '/xslmes/mesXslDowntimeRecord/saveMaintenanceResult', +} + +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 saveMaintenanceResult = (params) => defHttp.post({ url: Api.saveMaintenanceResult, params }); + +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 }); +}; diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts new file mode 100644 index 00000000..1e5a1ad7 --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts @@ -0,0 +1,177 @@ +import { BasicColumn, FormSchema } from '/@/components/Table'; + +/** 弹窗内日期时间选择:下拉挂到 body,避免被 Modal 滚动区裁剪 */ +const dateTimePickerProps = { + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + style: { width: '100%' }, + getPopupContainer: () => document.body, +}; + +export const columns: BasicColumn[] = [ + { title: '机台', align: 'center', dataIndex: 'equipmentName', width: 150 }, + { title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 }, + { title: '停机原因', align: 'center', dataIndex: 'downtimeTypeName', width: 150 }, + { + title: '开始时间', + align: 'center', + dataIndex: 'startTime', + width: 165, + customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text), + }, + { + title: '结束时间', + align: 'center', + dataIndex: 'endTime', + width: 165, + customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text), + }, + { title: '设备部位', align: 'center', dataIndex: 'equipmentPartName', width: 120 }, + { title: '维修项目', align: 'center', dataIndex: 'inspectMaintainItemName', width: 140 }, + { title: '维修结果', align: 'center', dataIndex: 'maintenanceResult', width: 160, ellipsis: true }, + { title: '维修人', align: 'center', dataIndex: 'maintainerRealname', width: 100 }, + { title: '是否已录入维修', align: 'center', dataIndex: 'maintenanceFilledFlag_dictText', width: 120 }, + { 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: 'equipmentLedgerId', component: 'Input', show: false }, + { + label: '机台', + field: 'equipmentName', + component: 'Input', + slot: 'equipmentPicker', + colProps: { span: 6 }, + }, + { label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } }, + { label: '', field: 'downtimeTypeId', component: 'Input', show: false }, + { + label: '停机原因', + field: 'downtimeTypeName', + component: 'Input', + slot: 'downtimeTypePicker', + colProps: { span: 6 }, + }, + { + label: '是否已录入维修', + field: 'maintenanceFilledFlag', + component: 'JDictSelectTag', + componentProps: { dictCode: 'yn' }, + colProps: { span: 6 }, + }, +]; + +export const formSchema: FormSchema[] = [ + { label: '', field: 'id', component: 'Input', show: false }, + { + label: '', + field: 'equipmentLedgerId', + component: 'Input', + show: false, + dynamicRules: () => [{ required: true, message: '请选择机台' }], + }, + { + label: '机台', + field: 'equipmentName', + component: 'Input', + slot: 'equipmentPicker', + }, + { + label: '', + field: 'downtimeTypeId', + component: 'Input', + show: false, + dynamicRules: () => [{ required: true, message: '请选择停机原因' }], + }, + { + label: '停机原因', + field: 'downtimeTypeName', + component: 'Input', + slot: 'downtimeTypePicker', + }, + { + label: '开始时间', + field: 'startTime', + component: 'DatePicker', + required: true, + componentProps: { ...dateTimePickerProps, placeholder: '请选择开始时间' }, + }, + { + label: '结束时间', + field: 'endTime', + component: 'DatePicker', + componentProps: { ...dateTimePickerProps, placeholder: '请选择结束时间' }, + }, +]; + +/** 录入维修结果弹窗 */ +export const maintenanceFormSchema: FormSchema[] = [ + { label: '', field: 'id', component: 'Input', show: false }, + { label: '', field: 'equipmentLedgerId', component: 'Input', show: false }, + { label: '', field: 'equipmentCategoryId', component: 'Input', show: false }, + { label: '', field: 'equipmentTypeId', component: 'Input', show: false }, + { label: '', field: 'maintainerUsername', component: 'Input', show: false }, + { label: '', field: 'maintainerRealname', component: 'Input', show: false }, + { + label: '', + field: 'equipmentPartId', + component: 'Input', + show: false, + dynamicRules: () => [{ required: true, message: '请选择设备部位' }], + }, + { + label: '设备部位', + field: 'equipmentPartName', + component: 'Input', + slot: 'equipmentPartPicker', + }, + { + label: '', + field: 'inspectMaintainItemId', + component: 'Input', + show: false, + dynamicRules: () => [{ required: true, message: '请选择维修项目' }], + }, + { + label: '维修项目', + field: 'inspectMaintainItemName', + component: 'Input', + slot: 'inspectItemPicker', + }, + { + label: '维修结果', + field: 'maintenanceResult', + component: 'InputTextArea', + required: true, + componentProps: { rows: 3, placeholder: '手输维修结果' }, + }, + { + label: '维修人', + field: 'maintainerUserId', + component: 'JSelectUser', + required: true, + componentProps: ({ formActionType }) => ({ + rowKey: 'id', + labelKey: 'realname', + isRadioSelection: true, + maxSelectCount: 1, + onOptionsChange: (options) => { + const row = options?.[0]; + if (row && formActionType) { + formActionType.setFieldsValue({ + maintainerUsername: row.username, + maintainerRealname: row.realname, + }); + } + }, + }), + }, +]; diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue new file mode 100644 index 00000000..0e29ac23 --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue @@ -0,0 +1,198 @@ + + + diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue new file mode 100644 index 00000000..6340dcad --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue @@ -0,0 +1,160 @@ + + + diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue new file mode 100644 index 00000000..ca7aa402 --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue @@ -0,0 +1,108 @@ + + + diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue new file mode 100644 index 00000000..f92241ff --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue @@ -0,0 +1,96 @@ + + + diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue new file mode 100644 index 00000000..9e96320b --- /dev/null +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue @@ -0,0 +1,117 @@ + + + diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts index 8c657de9..95dff4b6 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts @@ -47,8 +47,22 @@ export const columns: BasicColumn[] = [ ]; export const searchFormSchema: FormSchema[] = [ - { label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } }, - { label: '主类型', field: 'downtimeMainTypeName', component: 'Input', colProps: { span: 6 } }, + { label: '', field: 'processOperationId', component: 'Input', show: false }, + { + label: '所属工序', + field: 'processOperationName', + component: 'Input', + slot: 'processOperationPicker', + colProps: { span: 6 }, + }, + { label: '', field: 'downtimeMainTypeId', component: 'Input', show: false }, + { + label: '所属主类型', + field: 'downtimeMainTypeName', + component: 'Input', + slot: 'downtimeMainTypePicker', + colProps: { span: 6 }, + }, { label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } }, { label: '是否启用', diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue index 92f079f7..91b4e77a 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue @@ -1,6 +1,26 @@ @@ -53,12 +75,26 @@ import { BasicTable, TableAction } from '/@/components/Table'; import { useModal } from '/@/components/Modal'; import { useListPage } from '/@/hooks/system/useListPage'; + import { useMessage } from '/@/hooks/web/useMessage'; import Icon from '/@/components/Icon'; + import MesSearchPickerInput from '../components/MesSearchPickerInput.vue'; import MesXslDowntimeTypeModal from './components/MesXslDowntimeTypeModal.vue'; + import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue'; + import MesXslDowntimeMainTypeSelectModal from './components/MesXslDowntimeMainTypeSelectModal.vue'; + import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil'; import { columns, searchFormSchema } from './MesXslDowntimeType.data'; import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeType.api'; + const { createMessage } = useMessage(); + + const SEARCH_ID_NAME_PAIRS = [ + { idField: 'processOperationId', nameField: 'processOperationName' }, + { idField: 'downtimeMainTypeId', nameField: 'downtimeMainTypeName' }, + ]; + const [registerModal, { openModal }] = useModal(); + const [registerProcessModal, { openModal: openProcessModal }] = useModal(); + const [registerMainTypeModal, { openModal: openMainTypeModal }] = useModal(); const { tableContext, onExportXls, onImportXls } = useListPage({ tableProps: { @@ -66,6 +102,7 @@ api: list, columns, canResize: true, + beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS), formConfig: { schemas: searchFormSchema, labelWidth: 100, @@ -87,7 +124,58 @@ }, }); - const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; + const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext; + + function openProcessSelect() { + const v = getForm()?.getFieldsValue?.() || {}; + openProcessModal(true, { processOperationId: v.processOperationId }); + } + + function clearProcess(model: Recordable) { + clearModelFields(model, [ + 'processOperationId', + 'processOperationName', + 'downtimeMainTypeId', + 'downtimeMainTypeName', + ]); + } + + function onProcessSelect(payload: Recordable) { + const v = getForm()?.getFieldsValue?.() || {}; + const pid = payload.processOperationId || ''; + if (v.downtimeMainTypeId && v.processOperationId && v.processOperationId !== pid) { + getForm()?.setFieldsValue?.({ + processOperationId: pid, + processOperationName: payload.processOperationName || '', + downtimeMainTypeId: '', + downtimeMainTypeName: '', + }); + } else { + getForm()?.setFieldsValue?.({ + processOperationId: pid, + processOperationName: payload.processOperationName || '', + }); + } + } + + function openMainTypeSelect() { + const v = getForm()?.getFieldsValue?.() || {}; + if (!v.processOperationId) { + createMessage.warning('请先选择所属工序'); + return; + } + openMainTypeModal(true, { + processOperationId: v.processOperationId, + downtimeMainTypeId: v.downtimeMainTypeId, + }); + } + + function onMainTypeSelect(payload: Recordable) { + getForm()?.setFieldsValue?.({ + downtimeMainTypeId: payload.downtimeMainTypeId || '', + downtimeMainTypeName: payload.downtimeMainTypeName || '', + }); + } function handleAdd() { openModal(true, { isUpdate: false, showFooter: true }); diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts index d9c97f17..c2ebfbd9 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts @@ -16,7 +16,14 @@ export const columns: BasicColumn[] = [ ]; export const searchFormSchema: FormSchema[] = [ - { label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } }, + { label: '', field: 'equipmentLedgerId', component: 'Input', show: false }, + { + label: '设备名称', + field: 'equipmentName', + component: 'Input', + slot: 'equipmentLedgerPicker', + colProps: { span: 6 }, + }, { label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } }, { label: '类型', diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue b/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue index 8a7a751e..2e37b56e 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue @@ -1,6 +1,16 @@