胶料快检记录新增
This commit is contained in:
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
@@ -1,6 +1,24 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "jeecgboot-vue3: 调试前端 (Chrome)",
|
||||
"url": "http://localhost:3100",
|
||||
"webRoot": "${workspaceFolder}/jeecgboot-vue3",
|
||||
"preLaunchTask": "jeecgboot-vue3: dev"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "jeecgboot-vue3: dev",
|
||||
"runtimeExecutable": "pnpm",
|
||||
"runtimeArgs": ["run", "dev"],
|
||||
"cwd": "${workspaceFolder}/jeecgboot-vue3",
|
||||
"console": "integratedTerminal",
|
||||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"]
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "JeecgSystemApplication (单体)",
|
||||
|
||||
18
.vscode/tasks.json
vendored
18
.vscode/tasks.json
vendored
@@ -54,6 +54,24 @@
|
||||
"dependsOn": "YY.Admin: build",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "jeecgboot-vue3: dev",
|
||||
"type": "shell",
|
||||
"command": "pnpm run dev",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/jeecgboot-vue3"
|
||||
},
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "vite",
|
||||
"pattern": { "regexp": "^$" },
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": ".",
|
||||
"endsPattern": "(Local:|ready in|http://localhost)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "YY.Admin: run (script)",
|
||||
"type": "process",
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
-- 胶料快检记录(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 胶料信息「检验」按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_record:*
|
||||
-- 菜单 ID 段 1860000000000000192
|
||||
-- SET @mes_tenant_id:多租户 admin 授权目标租户
|
||||
|
||||
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_quick_test_record_result', '1合格0不合格', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_record_result' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '合格', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_record_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '不合格', '0', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_record_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检班次', 'xslmes_rubber_quick_test_work_shift', '班次', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_work_shift' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
CROSS JOIN (
|
||||
SELECT '早班' AS txt, '1' AS val, 1 AS ord UNION ALL
|
||||
SELECT '中班', '2', 2 UNION ALL
|
||||
SELECT '晚班', '3', 3
|
||||
) v
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_work_shift'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
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_quick_test_work_team', '班组', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_work_team' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
CROSS JOIN (
|
||||
SELECT '甲班' AS txt, '1' AS val, 1 AS ord UNION ALL
|
||||
SELECT '乙班', '2', 2 UNION ALL
|
||||
SELECT '丙班', '3', 3
|
||||
) v
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_work_team'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`record_no` varchar(32) DEFAULT NULL COMMENT '单号(JL+日期+4位流水,如JL202605280001)',
|
||||
`rubber_material_id` varchar(32) DEFAULT NULL COMMENT '胶料 mes_material.id',
|
||||
`rubber_material_name` varchar(128) DEFAULT NULL COMMENT '胶料名称冗余',
|
||||
`std_id` varchar(32) DEFAULT NULL COMMENT '引用的实验标准 mes_xsl_rubber_quick_test_std.id',
|
||||
`prod_equipment_ledger_id` varchar(32) DEFAULT NULL COMMENT '生产机台 mes_xsl_equipment_ledger.id',
|
||||
`prod_equipment_name` varchar(128) DEFAULT NULL COMMENT '生产机台名称冗余',
|
||||
`production_date` date DEFAULT NULL COMMENT '生产日期',
|
||||
`train_no` varchar(64) DEFAULT NULL COMMENT '车次编号',
|
||||
`work_shift` varchar(8) DEFAULT NULL COMMENT '班次(字典xslmes_rubber_quick_test_work_shift)',
|
||||
`work_team` varchar(8) DEFAULT NULL COMMENT '班组(字典xslmes_rubber_quick_test_work_team)',
|
||||
`inspect_times` int DEFAULT NULL COMMENT '检验次数',
|
||||
`inspect_time` datetime DEFAULT NULL COMMENT '检验时间',
|
||||
`inspector_user_id` varchar(32) DEFAULT NULL COMMENT '检验人用户ID',
|
||||
`inspector_username` varchar(64) DEFAULT NULL COMMENT '检验人账号冗余',
|
||||
`inspector_realname` varchar(64) DEFAULT NULL COMMENT '检验人姓名冗余',
|
||||
`quick_test_type_id` varchar(32) DEFAULT NULL COMMENT '检验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '检验类型名称冗余',
|
||||
`inspect_result` varchar(2) DEFAULT NULL COMMENT '检验结果(字典xslmes_rubber_quick_test_record_result:1合格0不合格)',
|
||||
`production_plan_no` varchar(100) DEFAULT NULL COMMENT '生产计划号',
|
||||
`inspect_equipment_ledger_id` varchar(32) DEFAULT NULL COMMENT '检验机台 mes_xsl_equipment_ledger.id',
|
||||
`inspect_equipment_name` varchar(128) DEFAULT NULL COMMENT '检验机台名称冗余',
|
||||
`rubber_card_no` varchar(100) DEFAULT NULL COMMENT '胶料卡片号',
|
||||
`rubber_batch_no` varchar(100) DEFAULT NULL COMMENT '胶料批次',
|
||||
`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`),
|
||||
UNIQUE KEY `uk_mrqtr_record_no` (`record_no`),
|
||||
KEY `idx_mrqtr_material` (`rubber_material_id`),
|
||||
KEY `idx_mrqtr_std` (`std_id`),
|
||||
KEY `idx_mrqtr_tenant` (`tenant_id`),
|
||||
KEY `idx_mrqtr_inspect_time` (`inspect_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_record_line` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`record_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_record.id',
|
||||
`data_point_id` varchar(32) DEFAULT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||
`inspect_item` varchar(128) DEFAULT NULL COMMENT '检验项目(数据点名称,只读带出)',
|
||||
`lower_limit` decimal(18,6) DEFAULT NULL COMMENT '检验下限(只读带出)',
|
||||
`inspect_value` decimal(18,6) DEFAULT NULL COMMENT '检验值',
|
||||
`upper_limit` decimal(18,6) DEFAULT NULL COMMENT '检验上限(只读带出)',
|
||||
`sort_no` int DEFAULT NULL COMMENT '排序号',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrqtrl_record` (`record_id`),
|
||||
UNIQUE KEY `uk_mrqtrl_record_point` (`record_id`, `data_point_id`)
|
||||
) 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 ('1860000000000000192', @mes_quality_pid, '胶料快检记录', '/xslmes/mesXslRubberQuickTestRecord', 'xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecordList', 'MesXslRubberQuickTestRecordList', 1, NULL, '1', 5, 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` = VALUES(`is_leaf`), `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:file-search-outlined' WHERE `id` = '1860000000000000192' 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
|
||||
('1860000000000000193', '1860000000000000192', '新增', 2, 'mes:mes_xsl_rubber_quick_test_record:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000194', '1860000000000000192', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_record:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000195', '1860000000000000192', '删除', 2, 'mes:mes_xsl_rubber_quick_test_record:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000196', '1860000000000000192', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_record:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000197', '1860000000000000192', '导出', 2, 'mes:mes_xsl_rubber_quick_test_record:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000198', '1860000000000000192', '导入', 2, 'mes:mes_xsl_rubber_quick_test_record:importExcel', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000199', '1860000000000000192', '从胶料生成', 2, 'mes:mes_xsl_rubber_quick_test_record:batchFromMaterial', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE `perms` = VALUES(`perms`), `name` = VALUES(`name`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000200', '1860000000000000011', '胶料快检', 2, 'mes:mes_material:rubberQuickTestInspect', '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 (
|
||||
'1860000000000000192',
|
||||
'1860000000000000193', '1860000000000000194', '1860000000000000195', '1860000000000000196',
|
||||
'1860000000000000197', '1860000000000000198', '1860000000000000199',
|
||||
'1860000000000000200'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_role_permission rp
|
||||
WHERE rp.role_id = r.id AND rp.permission_id = p.id
|
||||
);
|
||||
@@ -437,3 +437,32 @@ jeecgboot-vue3/src/views/xslmes/mesXslFormulaSpecEditLog/components/MesXslFormul
|
||||
-- author:cursor---date:20260526--for: 【配方日志查询】明细对比展示逐行逐字段变更内容 -----------
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/common/MesXslFormulaSpecEditLogDiffUtil.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslFormulaSpecEditLog/MesXslFormulaSpecEditLog.data.ts
|
||||
|
||||
-- author:jiangxh---date:20260525--for: 【MES】胶料快检记录主子表、质量管理菜单、胶料信息批量检验生成 ---
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-record-menu-permission.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_108__mes_xsl_rubber_quick_test_record.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestRecord.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestRecordLine.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestRecordPage.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestRecordBatchFromMaterialVO.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestRecordMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestRecordLineMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestRecordService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestRecordServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestRecordController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecordList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesMaterialList.vue
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_109__mes_xsl_rubber_quick_test_record_no.sql
|
||||
|
||||
-- author:jiangxh---date:20260528--for: 【MES】胶料快检记录单号、无弹窗直接生成、列表去掉新增、明细不可增删 ---
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-record-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestRecord.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestRecordService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestRecordServiceImpl.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecordList.vue
|
||||
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
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
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.List;
|
||||
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.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.service.IMesMaterialService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecordLine;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestRecordService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestRecordBatchFromMaterialVO;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestRecordPage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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/mesXslRubberQuickTestRecord")
|
||||
@Slf4j
|
||||
public class MesXslRubberQuickTestRecordController
|
||||
extends JeecgController<MesXslRubberQuickTestRecord, IMesXslRubberQuickTestRecordService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestRecordService mesXslRubberQuickTestRecordService;
|
||||
|
||||
@Autowired
|
||||
private IMesMaterialService mesMaterialService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
|
||||
|
||||
@Operation(summary = "MES胶料快检记录-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberQuickTestRecord>> queryPageList(
|
||||
MesXslRubberQuickTestRecord model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberQuickTestRecord> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("inspect_time", "create_time");
|
||||
Page<MesXslRubberQuickTestRecord> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberQuickTestRecord> pageList = mesXslRubberQuickTestRecordService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检记录-添加")
|
||||
@Operation(summary = "MES胶料快检记录-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_record:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberQuickTestRecordPage page) {
|
||||
MesXslRubberQuickTestRecord main = new MesXslRubberQuickTestRecord();
|
||||
BeanUtils.copyProperties(page, main);
|
||||
String err = validateForSave(main, page.getLineList());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
try {
|
||||
mesXslRubberQuickTestRecordService.saveMain(main, page.getLineList());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检记录-编辑")
|
||||
@Operation(summary = "MES胶料快检记录-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_record:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberQuickTestRecordPage page) {
|
||||
MesXslRubberQuickTestRecord main = new MesXslRubberQuickTestRecord();
|
||||
BeanUtils.copyProperties(page, main);
|
||||
String err = validateForSave(main, page.getLineList());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
try {
|
||||
mesXslRubberQuickTestRecordService.updateMain(main, page.getLineList());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检记录-从胶料批量生成")
|
||||
@Operation(summary = "MES胶料快检记录-从胶料信息批量生成")
|
||||
@RequiresPermissions("mes:mes_material:rubberQuickTestInspect")
|
||||
@PostMapping(value = "/batchFromMaterial")
|
||||
public Result<List<String>> batchFromMaterial(@RequestBody MesXslRubberQuickTestRecordBatchFromMaterialVO vo) {
|
||||
try {
|
||||
List<String> ids = mesXslRubberQuickTestRecordService.batchFromMaterial(vo);
|
||||
return Result.OK("成功生成 " + ids.size() + " 条快检记录", ids);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检记录-删除")
|
||||
@Operation(summary = "MES胶料快检记录-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_record:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberQuickTestRecordService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检记录-批量删除")
|
||||
@Operation(summary = "MES胶料快检记录-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_record:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberQuickTestRecordService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检记录-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberQuickTestRecord> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberQuickTestRecord entity = mesXslRubberQuickTestRecordService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检记录-查询明细")
|
||||
@GetMapping(value = "/queryLineListByRecordId")
|
||||
public Result<List<MesXslRubberQuickTestRecordLine>> queryLineListByRecordId(
|
||||
@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.OK(mesXslRubberQuickTestRecordService.selectLinesByRecordId(id));
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_record:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestRecord model) {
|
||||
return super.exportXls(request, model, MesXslRubberQuickTestRecord.class, "MES胶料快检记录");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_record:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, MesXslRubberQuickTestRecord.class);
|
||||
}
|
||||
|
||||
private String validateForSave(MesXslRubberQuickTestRecord main, List<MesXslRubberQuickTestRecordLine> lineList) {
|
||||
if (main == null) {
|
||||
return "参数不能为空";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(main.getRubberMaterialId())) {
|
||||
return "请选择胶料";
|
||||
}
|
||||
MesMaterial material = mesMaterialService.getById(main.getRubberMaterialId());
|
||||
if (material == null) {
|
||||
return "所选胶料不存在";
|
||||
}
|
||||
main.setRubberMaterialName(material.getMaterialName());
|
||||
|
||||
if (oConvertUtils.isNotEmpty(main.getQuickTestTypeId())) {
|
||||
MesXslRubberQuickTestType type = mesXslRubberQuickTestTypeService.getById(main.getQuickTestTypeId());
|
||||
if (type == null) {
|
||||
return "所选检验类型不存在";
|
||||
}
|
||||
main.setQuickTestTypeName(type.getTypeName());
|
||||
}
|
||||
|
||||
if (lineList == null || lineList.isEmpty()) {
|
||||
return "请维护检验明细";
|
||||
}
|
||||
for (int i = 0; i < lineList.size(); i++) {
|
||||
MesXslRubberQuickTestRecordLine line = lineList.get(i);
|
||||
if (line == null || oConvertUtils.isEmpty(line.getInspectItem())) {
|
||||
return "第 " + (i + 1) + " 行检验项目不能为空";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.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 java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 胶料快检记录主表
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_quick_test_record")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料快检记录")
|
||||
public class MesXslRubberQuickTestRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "单号", width = 16)
|
||||
@Schema(description = "单号(JL+yyyyMMdd+4位流水)")
|
||||
private String recordNo;
|
||||
|
||||
@Schema(description = "胶料ID mes_material.id")
|
||||
private String rubberMaterialId;
|
||||
|
||||
@Excel(name = "胶料名称", width = 20)
|
||||
@Schema(description = "胶料名称冗余")
|
||||
private String rubberMaterialName;
|
||||
|
||||
@Schema(description = "引用的实验标准ID")
|
||||
private String stdId;
|
||||
|
||||
@Schema(description = "生产机台ID")
|
||||
private String prodEquipmentLedgerId;
|
||||
|
||||
@Excel(name = "生产机台", width = 16)
|
||||
@Schema(description = "生产机台名称冗余")
|
||||
private String prodEquipmentName;
|
||||
|
||||
@Excel(name = "生产日期", width = 12, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date productionDate;
|
||||
|
||||
@Excel(name = "车次编号", width = 14)
|
||||
private String trainNo;
|
||||
|
||||
@Excel(name = "班次", width = 10, dicCode = "xslmes_rubber_quick_test_work_shift")
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_work_shift")
|
||||
private String workShift;
|
||||
|
||||
@Excel(name = "班组", width = 10, dicCode = "xslmes_rubber_quick_test_work_team")
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_work_team")
|
||||
private String workTeam;
|
||||
|
||||
@Excel(name = "检验次数", width = 10)
|
||||
private Integer inspectTimes;
|
||||
|
||||
@Excel(name = "检验时间", width = 18, 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 inspectTime;
|
||||
|
||||
@Schema(description = "检验人用户ID")
|
||||
private String inspectorUserId;
|
||||
|
||||
private String inspectorUsername;
|
||||
|
||||
@Excel(name = "检验人", width = 12)
|
||||
private String inspectorRealname;
|
||||
|
||||
@Schema(description = "检验类型ID")
|
||||
private String quickTestTypeId;
|
||||
|
||||
@Excel(name = "检验类型", width = 16)
|
||||
private String quickTestTypeName;
|
||||
|
||||
@Excel(name = "检验结果", width = 10, dicCode = "xslmes_rubber_quick_test_record_result")
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_record_result")
|
||||
private String inspectResult;
|
||||
|
||||
@Excel(name = "生产计划号", width = 16)
|
||||
private String productionPlanNo;
|
||||
|
||||
@Schema(description = "检验机台ID")
|
||||
private String inspectEquipmentLedgerId;
|
||||
|
||||
@Excel(name = "检验机台", width = 16)
|
||||
private String inspectEquipmentName;
|
||||
|
||||
@Excel(name = "胶料卡片号", width = 16)
|
||||
private String rubberCardNo;
|
||||
|
||||
@Excel(name = "胶料批次", width = 16)
|
||||
private String rubberBatchNo;
|
||||
|
||||
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;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<MesXslRubberQuickTestRecordLine> lineList;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
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.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 胶料快检记录明细
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_quick_test_record_line")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料快检记录明细")
|
||||
public class MesXslRubberQuickTestRecordLine implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
private String recordId;
|
||||
|
||||
private String dataPointId;
|
||||
|
||||
@Excel(name = "检验项目", width = 18)
|
||||
private String inspectItem;
|
||||
|
||||
@Excel(name = "检验下限", width = 12, type = 10)
|
||||
private BigDecimal lowerLimit;
|
||||
|
||||
@Excel(name = "检验值", width = 12, type = 10)
|
||||
private BigDecimal inspectValue;
|
||||
|
||||
@Excel(name = "检验上限", width = 12, type = 10)
|
||||
private BigDecimal upperLimit;
|
||||
|
||||
private Integer sortNo;
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecordLine;
|
||||
|
||||
public interface MesXslRubberQuickTestRecordLineMapper extends BaseMapper<MesXslRubberQuickTestRecordLine> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecord;
|
||||
|
||||
public interface MesXslRubberQuickTestRecordMapper extends BaseMapper<MesXslRubberQuickTestRecord> {}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecordLine;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestRecordBatchFromMaterialVO;
|
||||
|
||||
public interface IMesXslRubberQuickTestRecordService extends IService<MesXslRubberQuickTestRecord> {
|
||||
|
||||
void saveMain(MesXslRubberQuickTestRecord main, List<MesXslRubberQuickTestRecordLine> lineList);
|
||||
|
||||
void updateMain(MesXslRubberQuickTestRecord main, List<MesXslRubberQuickTestRecordLine> lineList);
|
||||
|
||||
void delMain(String id);
|
||||
|
||||
void delBatchMain(Collection<? extends Serializable> idList);
|
||||
|
||||
List<MesXslRubberQuickTestRecordLine> selectLinesByRecordId(String recordId);
|
||||
|
||||
String generateRecordNo(MesXslRubberQuickTestRecord context);
|
||||
|
||||
List<String> batchFromMaterial(MesXslRubberQuickTestRecordBatchFromMaterialVO vo);
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.service.IMesMaterialService;
|
||||
import org.jeecg.modules.xslmes.common.XslMesBizConstants;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecordLine;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestRecordLineMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestRecordMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestRecordService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestRecordBatchFromMaterialVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberQuickTestRecordServiceImpl
|
||||
extends ServiceImpl<MesXslRubberQuickTestRecordMapper, MesXslRubberQuickTestRecord>
|
||||
implements IMesXslRubberQuickTestRecordService {
|
||||
|
||||
private static final String STD_ENABLE_IN_USE = "1";
|
||||
|
||||
@Autowired
|
||||
private MesXslRubberQuickTestRecordLineMapper mesXslRubberQuickTestRecordLineMapper;
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestStdService mesXslRubberQuickTestStdService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestMethodService mesXslRubberQuickTestMethodService;
|
||||
|
||||
@Autowired
|
||||
private IMesMaterialService mesMaterialService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(MesXslRubberQuickTestRecord main, List<MesXslRubberQuickTestRecordLine> lineList) {
|
||||
if (oConvertUtils.isEmpty(main.getRecordNo())) {
|
||||
main.setRecordNo(generateRecordNo(main));
|
||||
}
|
||||
this.save(main);
|
||||
insertLines(main.getId(), lineList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(MesXslRubberQuickTestRecord main, List<MesXslRubberQuickTestRecordLine> lineList) {
|
||||
if (oConvertUtils.isNotEmpty(main.getId())) {
|
||||
MesXslRubberQuickTestRecord old = this.getById(main.getId());
|
||||
if (old != null) {
|
||||
main.setRecordNo(old.getRecordNo());
|
||||
}
|
||||
}
|
||||
this.updateById(main);
|
||||
mesXslRubberQuickTestRecordLineMapper.delete(
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestRecordLine>()
|
||||
.eq(MesXslRubberQuickTestRecordLine::getRecordId, main.getId()));
|
||||
insertLines(main.getId(), lineList);
|
||||
}
|
||||
|
||||
private void insertLines(String recordId, List<MesXslRubberQuickTestRecordLine> lineList) {
|
||||
if (CollectionUtils.isEmpty(lineList)) {
|
||||
return;
|
||||
}
|
||||
int sort = 0;
|
||||
for (MesXslRubberQuickTestRecordLine line : lineList) {
|
||||
line.setId(null);
|
||||
line.setRecordId(recordId);
|
||||
line.setSortNo(sort++);
|
||||
mesXslRubberQuickTestRecordLineMapper.insert(line);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delMain(String id) {
|
||||
mesXslRubberQuickTestRecordLineMapper.delete(
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestRecordLine>().eq(MesXslRubberQuickTestRecordLine::getRecordId, id));
|
||||
this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for (Serializable id : idList) {
|
||||
delMain(id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MesXslRubberQuickTestRecordLine> selectLinesByRecordId(String recordId) {
|
||||
return mesXslRubberQuickTestRecordLineMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestRecordLine>()
|
||||
.eq(MesXslRubberQuickTestRecordLine::getRecordId, recordId)
|
||||
.orderByAsc(MesXslRubberQuickTestRecordLine::getSortNo));
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260528 for:【MES】胶料快检记录单号JL+日期+4位流水自动生成-----------
|
||||
@Override
|
||||
public String generateRecordNo(MesXslRubberQuickTestRecord context) {
|
||||
String dateStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String prefix = "JL" + dateStr;
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestRecord> qw = new LambdaQueryWrapper<>();
|
||||
qw.likeRight(MesXslRubberQuickTestRecord::getRecordNo, prefix);
|
||||
qw.and(q -> q.eq(MesXslRubberQuickTestRecord::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslRubberQuickTestRecord::getDelFlag));
|
||||
if (tenantId != null) {
|
||||
qw.eq(MesXslRubberQuickTestRecord::getTenantId, tenantId);
|
||||
}
|
||||
qw.select(MesXslRubberQuickTestRecord::getRecordNo);
|
||||
qw.orderByDesc(MesXslRubberQuickTestRecord::getRecordNo);
|
||||
qw.last("LIMIT 1");
|
||||
|
||||
MesXslRubberQuickTestRecord last = this.getOne(qw, false);
|
||||
int nextSeq = 1;
|
||||
if (last != null
|
||||
&& oConvertUtils.isNotEmpty(last.getRecordNo())
|
||||
&& last.getRecordNo().length() >= prefix.length() + 4) {
|
||||
String suffix = last.getRecordNo().substring(prefix.length());
|
||||
try {
|
||||
nextSeq = Integer.parseInt(suffix) + 1;
|
||||
} catch (NumberFormatException ignored) {
|
||||
nextSeq = (int) this.count(qw) + 1;
|
||||
}
|
||||
}
|
||||
return prefix + String.format("%04d", nextSeq);
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslRubberQuickTestRecord context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260528 for:【MES】胶料快检记录单号JL+日期+4位流水自动生成-----------
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料信息多选按实验标准批量生成快检记录-----------
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<String> batchFromMaterial(MesXslRubberQuickTestRecordBatchFromMaterialVO vo) {
|
||||
if (vo == null || CollectionUtils.isEmpty(vo.getMaterialIds())) {
|
||||
throw new JeecgBootException("请至少选择一条胶料信息");
|
||||
}
|
||||
List<String> createdIds = new ArrayList<>();
|
||||
for (String materialId : vo.getMaterialIds()) {
|
||||
if (oConvertUtils.isEmpty(materialId)) {
|
||||
continue;
|
||||
}
|
||||
String mid = materialId.trim();
|
||||
MesMaterial material = mesMaterialService.getById(mid);
|
||||
if (material == null) {
|
||||
throw new JeecgBootException("胶料不存在:" + mid);
|
||||
}
|
||||
MesXslRubberQuickTestStd std = findApprovedStdForMaterial(mid);
|
||||
if (std == null) {
|
||||
throw new JeecgBootException(
|
||||
"胶料【" + material.getMaterialName() + "】未找到已启用且已批准的实验标准,请先在胶料快检实验标准中维护");
|
||||
}
|
||||
List<MesXslRubberQuickTestStdLine> stdLines = mesXslRubberQuickTestStdService.selectLinesByStdId(std.getId());
|
||||
if (CollectionUtils.isEmpty(stdLines)) {
|
||||
throw new JeecgBootException("胶料【" + material.getMaterialName() + "】关联的实验标准无明细数据");
|
||||
}
|
||||
MesXslRubberQuickTestRecord main = buildMainFromMaterial(material, std);
|
||||
List<MesXslRubberQuickTestRecordLine> recordLines = new ArrayList<>();
|
||||
for (MesXslRubberQuickTestStdLine stdLine : stdLines) {
|
||||
MesXslRubberQuickTestRecordLine rl = new MesXslRubberQuickTestRecordLine();
|
||||
rl.setDataPointId(stdLine.getDataPointId());
|
||||
rl.setInspectItem(stdLine.getPointName());
|
||||
rl.setLowerLimit(stdLine.getLowerLimit());
|
||||
rl.setUpperLimit(stdLine.getUpperLimit());
|
||||
recordLines.add(rl);
|
||||
}
|
||||
saveMain(main, recordLines);
|
||||
createdIds.add(main.getId());
|
||||
}
|
||||
if (createdIds.isEmpty()) {
|
||||
throw new JeecgBootException("未生成任何快检记录");
|
||||
}
|
||||
return createdIds;
|
||||
}
|
||||
|
||||
private MesXslRubberQuickTestStd findApprovedStdForMaterial(String materialId) {
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestStd> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberQuickTestStd::getRubberMaterialId, materialId);
|
||||
w.eq(MesXslRubberQuickTestStd::getEnableStatus, STD_ENABLE_IN_USE);
|
||||
w.eq(MesXslRubberQuickTestStd::getAuditStatus, XslMesBizConstants.RUBBER_QUICK_TEST_STD_AUDIT_APPROVED);
|
||||
w.and(q -> q.eq(MesXslRubberQuickTestStd::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslRubberQuickTestStd::getDelFlag));
|
||||
w.orderByDesc(MesXslRubberQuickTestStd::getCreateTime);
|
||||
w.last("LIMIT 1");
|
||||
return mesXslRubberQuickTestStdService.getOne(w, false);
|
||||
}
|
||||
|
||||
private MesXslRubberQuickTestRecord buildMainFromMaterial(MesMaterial material, MesXslRubberQuickTestStd std) {
|
||||
MesXslRubberQuickTestRecord main = new MesXslRubberQuickTestRecord();
|
||||
main.setRubberMaterialId(material.getId());
|
||||
main.setRubberMaterialName(material.getMaterialName());
|
||||
main.setStdId(std.getId());
|
||||
if (oConvertUtils.isNotEmpty(std.getTestMethodId())) {
|
||||
MesXslRubberQuickTestMethod method = mesXslRubberQuickTestMethodService.getById(std.getTestMethodId());
|
||||
if (method != null && oConvertUtils.isNotEmpty(method.getQuickTestTypeId())) {
|
||||
fillQuickTestType(main, method.getQuickTestTypeId());
|
||||
}
|
||||
}
|
||||
return main;
|
||||
}
|
||||
|
||||
private void fillQuickTestType(MesXslRubberQuickTestRecord main, String typeId) {
|
||||
MesXslRubberQuickTestType type = mesXslRubberQuickTestTypeService.getById(typeId);
|
||||
if (type != null) {
|
||||
main.setQuickTestTypeId(type.getId());
|
||||
main.setQuickTestTypeName(type.getTypeName());
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料信息多选按实验标准批量生成快检记录-----------
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 从胶料信息批量生成快检记录(共用主表字段)
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "胶料快检记录-从胶料批量生成")
|
||||
public class MesXslRubberQuickTestRecordBatchFromMaterialVO {
|
||||
|
||||
@Schema(description = "胶料ID列表 mes_material.id")
|
||||
private List<String> materialIds;
|
||||
|
||||
private String prodEquipmentLedgerId;
|
||||
private String prodEquipmentName;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date productionDate;
|
||||
|
||||
private String trainNo;
|
||||
private String workShift;
|
||||
private String workTeam;
|
||||
private Integer inspectTimes;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inspectTime;
|
||||
|
||||
private String inspectorUserId;
|
||||
private String inspectorUsername;
|
||||
private String inspectorRealname;
|
||||
|
||||
@Schema(description = "检验类型ID mes_xsl_rubber_quick_test_type.id")
|
||||
private String quickTestTypeId;
|
||||
|
||||
private String inspectResult;
|
||||
private String productionPlanNo;
|
||||
|
||||
private String inspectEquipmentLedgerId;
|
||||
private String inspectEquipmentName;
|
||||
|
||||
private String rubberCardNo;
|
||||
private String rubberBatchNo;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecord;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MesXslRubberQuickTestRecordPage extends MesXslRubberQuickTestRecord {}
|
||||
@@ -501,3 +501,32 @@ jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestStdServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerPsCompileServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestStdController.java
|
||||
|
||||
-- author:jiangxh---date:20260525--for: 【MES】胶料快检记录主子表、质量管理菜单、胶料信息批量检验生成 ---
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-record-menu-permission.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_108__mes_xsl_rubber_quick_test_record.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestRecord.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestRecordLine.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestRecordPage.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestRecordBatchFromMaterialVO.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestRecordMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestRecordLineMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestRecordService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestRecordServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestRecordController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecordList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesMaterialList.vue
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_109__mes_xsl_rubber_quick_test_record_no.sql
|
||||
|
||||
-- author:jiangxh---date:20260528--for: 【MES】胶料快检记录单号、无弹窗直接生成、列表去掉新增、明细不可增删 ---
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-record-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestRecord.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestRecordService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestRecordServiceImpl.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecordList.vue
|
||||
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
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
-- 胶料快检记录(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 胶料信息「检验」按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_record:*
|
||||
-- 菜单 ID 段 1860000000000000192
|
||||
-- SET @mes_tenant_id:多租户 admin 授权目标租户
|
||||
|
||||
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_quick_test_record_result', '1合格0不合格', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_record_result' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '合格', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_record_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '不合格', '0', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_record_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检班次', 'xslmes_rubber_quick_test_work_shift', '班次', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_work_shift' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
CROSS JOIN (
|
||||
SELECT '早班' AS txt, '1' AS val, 1 AS ord UNION ALL
|
||||
SELECT '中班', '2', 2 UNION ALL
|
||||
SELECT '晚班', '3', 3
|
||||
) v
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_work_shift'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
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_quick_test_work_team', '班组', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_work_team' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
CROSS JOIN (
|
||||
SELECT '甲班' AS txt, '1' AS val, 1 AS ord UNION ALL
|
||||
SELECT '乙班', '2', 2 UNION ALL
|
||||
SELECT '丙班', '3', 3
|
||||
) v
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_work_team'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`rubber_material_id` varchar(32) DEFAULT NULL COMMENT '胶料 mes_material.id',
|
||||
`rubber_material_name` varchar(128) DEFAULT NULL COMMENT '胶料名称冗余',
|
||||
`std_id` varchar(32) DEFAULT NULL COMMENT '引用的实验标准 mes_xsl_rubber_quick_test_std.id',
|
||||
`prod_equipment_ledger_id` varchar(32) DEFAULT NULL COMMENT '生产机台 mes_xsl_equipment_ledger.id',
|
||||
`prod_equipment_name` varchar(128) DEFAULT NULL COMMENT '生产机台名称冗余',
|
||||
`production_date` date DEFAULT NULL COMMENT '生产日期',
|
||||
`train_no` varchar(64) DEFAULT NULL COMMENT '车次编号',
|
||||
`work_shift` varchar(8) DEFAULT NULL COMMENT '班次(字典xslmes_rubber_quick_test_work_shift)',
|
||||
`work_team` varchar(8) DEFAULT NULL COMMENT '班组(字典xslmes_rubber_quick_test_work_team)',
|
||||
`inspect_times` int DEFAULT NULL COMMENT '检验次数',
|
||||
`inspect_time` datetime DEFAULT NULL COMMENT '检验时间',
|
||||
`inspector_user_id` varchar(32) DEFAULT NULL COMMENT '检验人用户ID',
|
||||
`inspector_username` varchar(64) DEFAULT NULL COMMENT '检验人账号冗余',
|
||||
`inspector_realname` varchar(64) DEFAULT NULL COMMENT '检验人姓名冗余',
|
||||
`quick_test_type_id` varchar(32) DEFAULT NULL COMMENT '检验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '检验类型名称冗余',
|
||||
`inspect_result` varchar(2) DEFAULT NULL COMMENT '检验结果(字典xslmes_rubber_quick_test_record_result:1合格0不合格)',
|
||||
`production_plan_no` varchar(100) DEFAULT NULL COMMENT '生产计划号',
|
||||
`inspect_equipment_ledger_id` varchar(32) DEFAULT NULL COMMENT '检验机台 mes_xsl_equipment_ledger.id',
|
||||
`inspect_equipment_name` varchar(128) DEFAULT NULL COMMENT '检验机台名称冗余',
|
||||
`rubber_card_no` varchar(100) DEFAULT NULL COMMENT '胶料卡片号',
|
||||
`rubber_batch_no` varchar(100) DEFAULT NULL COMMENT '胶料批次',
|
||||
`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_mrqtr_material` (`rubber_material_id`),
|
||||
KEY `idx_mrqtr_std` (`std_id`),
|
||||
KEY `idx_mrqtr_tenant` (`tenant_id`),
|
||||
KEY `idx_mrqtr_inspect_time` (`inspect_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_record_line` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`record_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_record.id',
|
||||
`data_point_id` varchar(32) DEFAULT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||
`inspect_item` varchar(128) DEFAULT NULL COMMENT '检验项目(数据点名称,只读带出)',
|
||||
`lower_limit` decimal(18,6) DEFAULT NULL COMMENT '检验下限(只读带出)',
|
||||
`inspect_value` decimal(18,6) DEFAULT NULL COMMENT '检验值',
|
||||
`upper_limit` decimal(18,6) DEFAULT NULL COMMENT '检验上限(只读带出)',
|
||||
`sort_no` int DEFAULT NULL COMMENT '排序号',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrqtrl_record` (`record_id`),
|
||||
UNIQUE KEY `uk_mrqtrl_record_point` (`record_id`, `data_point_id`)
|
||||
) 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 ('1860000000000000192', @mes_quality_pid, '胶料快检记录', '/xslmes/mesXslRubberQuickTestRecord', 'xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecordList', 'MesXslRubberQuickTestRecordList', 1, NULL, '1', 5, 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` = VALUES(`is_leaf`), `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:file-search-outlined' WHERE `id` = '1860000000000000192' 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
|
||||
('1860000000000000193', '1860000000000000192', '新增', 2, 'mes:mes_xsl_rubber_quick_test_record:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000194', '1860000000000000192', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_record:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000195', '1860000000000000192', '删除', 2, 'mes:mes_xsl_rubber_quick_test_record:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000196', '1860000000000000192', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_record:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000197', '1860000000000000192', '导出', 2, 'mes:mes_xsl_rubber_quick_test_record:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000198', '1860000000000000192', '导入', 2, 'mes:mes_xsl_rubber_quick_test_record:importExcel', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000199', '1860000000000000192', '从胶料生成', 2, 'mes:mes_xsl_rubber_quick_test_record:batchFromMaterial', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE `perms` = VALUES(`perms`), `name` = VALUES(`name`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000200', '1860000000000000011', '胶料快检', 2, 'mes:mes_material:rubberQuickTestInspect', '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 (
|
||||
'1860000000000000192',
|
||||
'1860000000000000193', '1860000000000000194', '1860000000000000195', '1860000000000000196',
|
||||
'1860000000000000197', '1860000000000000198', '1860000000000000199',
|
||||
'1860000000000000200'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_role_permission rp
|
||||
WHERE rp.role_id = r.id AND rp.permission_id = p.id
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
-- 胶料快检记录:单号 record_no(JL+yyyyMMdd+4位流水)
|
||||
ALTER TABLE `mes_xsl_rubber_quick_test_record`
|
||||
ADD COLUMN `record_no` varchar(32) DEFAULT NULL COMMENT '单号(JL+日期+4位流水,如JL202605280001)' AFTER `id`;
|
||||
|
||||
ALTER TABLE `mes_xsl_rubber_quick_test_record`
|
||||
ADD UNIQUE KEY `uk_mrqtr_record_no` (`record_no`);
|
||||
@@ -5,6 +5,15 @@
|
||||
<a-button type="primary" v-auth="'mes:mes_material:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
|
||||
<a-button type="primary" v-auth="'mes:mes_material:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'mes:mes_material:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_material:rubberQuickTestInspect'"
|
||||
preIcon="ant-design:experiment-outlined"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
@click="handleRubberQuickTest"
|
||||
>
|
||||
检验
|
||||
</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
@@ -29,7 +38,10 @@ import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesMaterialModal from './modules/MesMaterialModal.vue';
|
||||
import { columns, searchFormSchema } from './MesMaterial.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './MesMaterial.api';
|
||||
import { batchFromMaterial } from '/@/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.api';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -63,6 +75,18 @@ async function batchHandleDelete() {
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
async function handleRubberQuickTest() {
|
||||
if (!selectedRowKeys.value?.length) {
|
||||
createMessage.warning('请至少选择一条胶料');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await batchFromMaterial({ materialIds: [...selectedRowKeys.value] });
|
||||
createMessage.success('快检记录已生成,请到「胶料快检记录」中编辑');
|
||||
} catch (e: any) {
|
||||
createMessage.error(e?.message || '生成失败');
|
||||
}
|
||||
}
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_material:edit' }];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslRubberQuickTestRecord/list',
|
||||
save = '/xslmes/mesXslRubberQuickTestRecord/add',
|
||||
edit = '/xslmes/mesXslRubberQuickTestRecord/edit',
|
||||
deleteOne = '/xslmes/mesXslRubberQuickTestRecord/delete',
|
||||
deleteBatch = '/xslmes/mesXslRubberQuickTestRecord/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslRubberQuickTestRecord/importExcel',
|
||||
exportXls = '/xslmes/mesXslRubberQuickTestRecord/exportXls',
|
||||
queryById = '/xslmes/mesXslRubberQuickTestRecord/queryById',
|
||||
queryLineList = '/xslmes/mesXslRubberQuickTestRecord/queryLineListByRecordId',
|
||||
batchFromMaterial = '/xslmes/mesXslRubberQuickTestRecord/batchFromMaterial',
|
||||
}
|
||||
|
||||
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 queryLineListByRecordId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
|
||||
|
||||
export const batchFromMaterial = (params) => defHttp.post({ url: Api.batchFromMaterial, 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 });
|
||||
};
|
||||
@@ -0,0 +1,173 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||
|
||||
const numProps = { style: { width: '100%' }, precision: 6 };
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '单号', align: 'center', dataIndex: 'recordNo', width: 150 },
|
||||
{ title: '胶料名称', align: 'center', dataIndex: 'rubberMaterialName', width: 140 },
|
||||
{ title: '生产机台', align: 'center', dataIndex: 'prodEquipmentName', width: 120 },
|
||||
{ title: '生产日期', align: 'center', dataIndex: 'productionDate', width: 110 },
|
||||
{ title: '车次编号', align: 'center', dataIndex: 'trainNo', width: 100 },
|
||||
{ title: '班次', align: 'center', dataIndex: 'workShift_dictText', width: 80 },
|
||||
{ title: '班组', align: 'center', dataIndex: 'workTeam_dictText', width: 80 },
|
||||
{ title: '检验次数', align: 'center', dataIndex: 'inspectTimes', width: 90 },
|
||||
{ title: '检验时间', align: 'center', dataIndex: 'inspectTime', width: 165 },
|
||||
{ title: '检验人', align: 'center', dataIndex: 'inspectorRealname', width: 100 },
|
||||
{ title: '检验类型', align: 'center', dataIndex: 'quickTestTypeName', width: 120 },
|
||||
{ title: '检验结果', align: 'center', dataIndex: 'inspectResult_dictText', width: 90 },
|
||||
{ title: '生产计划号', align: 'center', dataIndex: 'productionPlanNo', width: 120 },
|
||||
{ title: '检验机台', align: 'center', dataIndex: 'inspectEquipmentName', width: 120 },
|
||||
{ title: '胶料卡片号', align: 'center', dataIndex: 'rubberCardNo', width: 120 },
|
||||
{ title: '胶料批次', align: 'center', dataIndex: 'rubberBatchNo', width: 120 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '单号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '生产计划号', field: 'productionPlanNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '胶料批次', field: 'rubberBatchNo', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '检验结果',
|
||||
field: 'inspectResult',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_record_result' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'stdId', component: 'Input', show: false },
|
||||
{ label: '', field: 'rubberMaterialId', component: 'Input', show: false },
|
||||
{ label: '', field: 'prodEquipmentLedgerId', component: 'Input', show: false },
|
||||
{ label: '', field: 'inspectEquipmentLedgerId', component: 'Input', show: false },
|
||||
{ label: '', field: 'inspectorUserId', component: 'Input', show: false },
|
||||
{ label: '', field: 'inspectorUsername', component: 'Input', show: false },
|
||||
{ label: '', field: 'quickTestTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '单号',
|
||||
field: 'recordNo',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true, placeholder: '保存时自动生成' },
|
||||
},
|
||||
{
|
||||
label: '胶料名称',
|
||||
field: 'rubberMaterialName',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
},
|
||||
{
|
||||
label: '生产机台',
|
||||
field: 'prodEquipmentName',
|
||||
component: 'Input',
|
||||
slot: 'prodEquipmentPicker',
|
||||
},
|
||||
{
|
||||
label: '生产日期',
|
||||
field: 'productionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
},
|
||||
{ label: '车次编号', field: 'trainNo', component: 'Input' },
|
||||
{
|
||||
label: '班次',
|
||||
field: 'workShift',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_shift', placeholder: '请选择班次' },
|
||||
},
|
||||
{
|
||||
label: '班组',
|
||||
field: 'workTeam',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_team', placeholder: '请选择班组' },
|
||||
},
|
||||
{
|
||||
label: '检验次数',
|
||||
field: 'inspectTimes',
|
||||
component: 'InputNumber',
|
||||
componentProps: { style: { width: '100%' }, min: 0, precision: 0 },
|
||||
},
|
||||
{
|
||||
label: '检验时间',
|
||||
field: 'inspectTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '检验人',
|
||||
field: 'inspectorUserId',
|
||||
component: 'JSelectUser',
|
||||
componentProps: ({ formActionType }) => ({
|
||||
rowKey: 'id',
|
||||
labelKey: 'realname',
|
||||
isRadioSelection: true,
|
||||
maxSelectCount: 1,
|
||||
onOptionsChange: (options) => {
|
||||
const row = options?.[0];
|
||||
if (row) {
|
||||
formActionType?.setFieldsValue?.({
|
||||
inspectorUsername: row.username,
|
||||
inspectorRealname: row.realname,
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
{ label: '', field: 'inspectorRealname', component: 'Input', show: false },
|
||||
{
|
||||
label: '检验类型',
|
||||
field: 'quickTestTypeId',
|
||||
component: 'JSearchSelect',
|
||||
componentProps: {
|
||||
dict: 'mes_xsl_rubber_quick_test_type,type_name,id',
|
||||
async: true,
|
||||
placeholder: '请选择检验类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '检验结果',
|
||||
field: 'inspectResult',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_record_result', placeholder: '合格/不合格' },
|
||||
},
|
||||
{ label: '生产计划号', field: 'productionPlanNo', component: 'Input' },
|
||||
{
|
||||
label: '检验机台',
|
||||
field: 'inspectEquipmentName',
|
||||
component: 'Input',
|
||||
slot: 'inspectEquipmentPicker',
|
||||
},
|
||||
{ label: '胶料卡片号', field: 'rubberCardNo', component: 'Input' },
|
||||
{ label: '胶料批次', field: 'rubberBatchNo', component: 'Input' },
|
||||
];
|
||||
|
||||
export const lineJVxeColumns: JVxeColumn[] = [
|
||||
{ title: '', key: 'dataPointId', type: JVxeTypes.hidden },
|
||||
{ title: '检验项目', key: 'inspectItem', type: JVxeTypes.normal, width: 180, disabled: true },
|
||||
{
|
||||
title: '检验下限',
|
||||
key: 'lowerLimit',
|
||||
type: JVxeTypes.normal,
|
||||
width: 110,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '检验值',
|
||||
key: 'inspectValue',
|
||||
type: JVxeTypes.inputNumber,
|
||||
width: 110,
|
||||
componentProps: numProps,
|
||||
},
|
||||
{
|
||||
title: '检验上限',
|
||||
key: 'upperLimit',
|
||||
type: JVxeTypes.normal,
|
||||
width: 110,
|
||||
disabled: true,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,118 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_record:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_record:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'mes:mes_xsl_rubber_quick_test_record:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslRubberQuickTestRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRubberQuickTestRecord" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslRubberQuickTestRecordModal from './components/MesXslRubberQuickTestRecordModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslRubberQuickTestRecord.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestRecord.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '胶料快检记录',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '胶料快检记录',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, reload);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, reload);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_rubber_quick_test_record:edit' }];
|
||||
}
|
||||
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_rubber_quick_test_record:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
destroyOnClose
|
||||
:title="title"
|
||||
width="1100px"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<BasicForm @register="registerForm">
|
||||
<template #prodEquipmentPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择生产机台" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openProdEquipmentSelect">选择</a-button>
|
||||
<a-button v-if="model.prodEquipmentLedgerId && !isDetail" @click="clearProdEquipment(model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #inspectEquipmentPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择检验机台" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openInspectEquipmentSelect">选择</a-button>
|
||||
<a-button v-if="model.inspectEquipmentLedgerId && !isDetail" @click="clearInspectEquipment(model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<a-divider orientation="left">检验明细(由实验标准带出,不可增删)</a-divider>
|
||||
<JVxeTable
|
||||
v-if="tableReady"
|
||||
ref="lineTableRef"
|
||||
row-number
|
||||
keep-source
|
||||
:toolbar="false"
|
||||
:insert-row="false"
|
||||
:remove-btn="false"
|
||||
:max-height="380"
|
||||
:loading="lineLoading"
|
||||
:columns="lineJVxeColumns"
|
||||
:dataSource="lineDataSource"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { formSchema, lineJVxeColumns } from '../MesXslRubberQuickTestRecord.data';
|
||||
import { saveOrUpdate, queryById, queryLineListByRecordId } from '../MesXslRubberQuickTestRecord.api';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const isDetail = ref(false);
|
||||
const tableReady = ref(false);
|
||||
const lineLoading = ref(false);
|
||||
const lineDataSource = ref<Recordable[]>([]);
|
||||
const lineTableRef = ref<JVxeTableInstance>();
|
||||
const ledgerPickTarget = ref<'prod' | 'inspect'>('prod');
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 120,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 12 },
|
||||
});
|
||||
|
||||
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
tableReady.value = false;
|
||||
lineDataSource.value = [];
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isDetail.value = !data?.showFooter;
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
|
||||
if (data?.record?.id) {
|
||||
lineLoading.value = true;
|
||||
try {
|
||||
const mainRaw = await queryById({ id: data.record.id });
|
||||
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
|
||||
const linesRaw = await queryLineListByRecordId({ id: data.record.id });
|
||||
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
|
||||
await setFieldsValue({ ...m });
|
||||
lineDataSource.value = list || [];
|
||||
} finally {
|
||||
lineLoading.value = false;
|
||||
}
|
||||
}
|
||||
tableReady.value = true;
|
||||
});
|
||||
|
||||
const title = computed(() => (unref(isDetail) ? '快检记录详情' : '编辑胶料快检记录'));
|
||||
|
||||
function openProdEquipmentSelect() {
|
||||
ledgerPickTarget.value = 'prod';
|
||||
const vals = getFieldsValue();
|
||||
openLedgerModal(true, { equipmentLedgerId: vals?.prodEquipmentLedgerId || '' });
|
||||
}
|
||||
|
||||
function openInspectEquipmentSelect() {
|
||||
ledgerPickTarget.value = 'inspect';
|
||||
const vals = getFieldsValue();
|
||||
openLedgerModal(true, { equipmentLedgerId: vals?.inspectEquipmentLedgerId || '' });
|
||||
}
|
||||
|
||||
async function onLedgerSelect(payload: Recordable) {
|
||||
if (ledgerPickTarget.value === 'prod') {
|
||||
await setFieldsValue({
|
||||
prodEquipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
prodEquipmentName: payload.equipmentName || '',
|
||||
});
|
||||
} else {
|
||||
await setFieldsValue({
|
||||
inspectEquipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
inspectEquipmentName: payload.equipmentName || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function clearProdEquipment(model: Recordable) {
|
||||
model.prodEquipmentLedgerId = '';
|
||||
model.prodEquipmentName = '';
|
||||
}
|
||||
|
||||
function clearInspectEquipment(model: Recordable) {
|
||||
model.inspectEquipmentLedgerId = '';
|
||||
model.inspectEquipmentName = '';
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (unref(isDetail)) {
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const values = await validate();
|
||||
const lineRef = lineTableRef.value as any;
|
||||
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
|
||||
const lineList = tableData
|
||||
.filter((r) => r && r.inspectItem)
|
||||
.map((r) => ({
|
||||
dataPointId: r.dataPointId,
|
||||
inspectItem: r.inspectItem,
|
||||
lowerLimit: r.lowerLimit,
|
||||
inspectValue: r.inspectValue,
|
||||
upperLimit: r.upperLimit,
|
||||
}));
|
||||
if (!lineList.length) {
|
||||
createMessage.warning('检验明细不能为空');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate({ ...values, lineList }, true);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user