快检实验标准新增
This commit is contained in:
130
jeecg-boot/db/mes-xsl-rubber-quick-test-std-menu-permission.sql
Normal file
130
jeecg-boot/db/mes-xsl-rubber-quick-test-std-menu-permission.sql
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
-- 胶料快检实验标准(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||||
|
-- 权限前缀:mes:mes_xsl_rubber_quick_test_std:*
|
||||||
|
-- 菜单 ID 段 1860000000000000184(实验方法占用 177-183)
|
||||||
|
-- 可与 Flyway V3.9.2_103 重复执行(ON DUPLICATE / IF NOT EXISTS)
|
||||||
|
-- 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_mixer_type', '1普通密炼机2串密炼机', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mixer_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, '普通密炼机', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mixer_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '串密炼机', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mixer_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检标准启用状态', 'xslmes_rubber_quick_test_std_enable_status', '1使用中0已停用', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_std_enable_status' AND `del_flag` = 0);
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '使用中', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_std_enable_status' 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_std_enable_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检标准审核状态', 'xslmes_rubber_quick_test_std_audit_status', '0草稿1已批准', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_std_audit_status' AND `del_flag` = 0);
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '草稿', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_std_audit_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '已批准', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_std_audit_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_std` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`std_name` varchar(128) NOT NULL COMMENT '实验标准名称(同租户未删除唯一)',
|
||||||
|
`test_method_id` varchar(32) NOT NULL COMMENT '实验方法 mes_xsl_rubber_quick_test_method.id',
|
||||||
|
`test_method_name` varchar(128) DEFAULT NULL COMMENT '实验方法名称冗余',
|
||||||
|
`mixer_type` varchar(2) DEFAULT NULL COMMENT '密炼机类型(字典xslmes_rubber_quick_test_mixer_type:1普通密炼机2串密炼机)',
|
||||||
|
`rubber_material_id` varchar(32) DEFAULT NULL COMMENT '胶料 mes_material.id',
|
||||||
|
`rubber_material_name` varchar(128) DEFAULT NULL COMMENT '胶料名称冗余',
|
||||||
|
`ps_compile_id` varchar(32) DEFAULT NULL COMMENT '密炼PS编制 mes_xsl_mixer_ps_compile.id',
|
||||||
|
`issue_number` varchar(100) DEFAULT NULL COMMENT '发行编号(密炼PS编码冗余)',
|
||||||
|
`issue_date` date DEFAULT NULL COMMENT '发行日期',
|
||||||
|
`issue_dept_id` varchar(32) DEFAULT NULL COMMENT '发行部门ID',
|
||||||
|
`issue_dept_name` varchar(200) DEFAULT NULL COMMENT '发行部门名称冗余',
|
||||||
|
`enable_status` varchar(2) DEFAULT '1' COMMENT '启用状态(字典xslmes_rubber_quick_test_std_enable_status:1使用中0已停用)',
|
||||||
|
`audit_status` varchar(2) DEFAULT '0' COMMENT '审核状态(字典xslmes_rubber_quick_test_std_audit_status:0草稿1已批准)',
|
||||||
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
|
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||||
|
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mrqts_method` (`test_method_id`),
|
||||||
|
KEY `idx_mrqts_material` (`rubber_material_id`),
|
||||||
|
KEY `idx_mrqts_tenant` (`tenant_id`),
|
||||||
|
UNIQUE KEY `uk_mrqts_tenant_name_del` (`tenant_id`, `std_name`, `del_flag`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验标准';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_std_line` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`std_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_std.id',
|
||||||
|
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||||
|
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余(只读带出)',
|
||||||
|
`lower_limit` decimal(18,6) DEFAULT NULL COMMENT '下限值',
|
||||||
|
`lower_warn` decimal(18,6) DEFAULT NULL COMMENT '下警告值',
|
||||||
|
`target_value` decimal(18,6) DEFAULT NULL COMMENT '目标值',
|
||||||
|
`upper_warn` 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_mrqtsl_std` (`std_id`),
|
||||||
|
UNIQUE KEY `uk_mrqtsl_std_point` (`std_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 ('1860000000000000184', @mes_quality_pid, '胶料快检实验标准', '/xslmes/mesXslRubberQuickTestStd', 'xslmes/mesXslRubberQuickTestStd/MesXslRubberQuickTestStdList', 'MesXslRubberQuickTestStdList', 1, NULL, '1', 4, 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-protect-outlined' WHERE `id` = '1860000000000000184' 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
|
||||||
|
('1860000000000000185', '1860000000000000184', '新增', 2, 'mes:mes_xsl_rubber_quick_test_std:add', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000186', '1860000000000000184', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_std:edit', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000187', '1860000000000000184', '删除', 2, 'mes:mes_xsl_rubber_quick_test_std:delete', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000188', '1860000000000000184', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_std:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000189', '1860000000000000184', '导出', 2, 'mes:mes_xsl_rubber_quick_test_std:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000190', '1860000000000000184', '导入', 2, 'mes:mes_xsl_rubber_quick_test_std:importExcel', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000191', '1860000000000000184', '启用停用', 2, 'mes:mes_xsl_rubber_quick_test_std:updateStatus', '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 (
|
||||||
|
'1860000000000000184',
|
||||||
|
'1860000000000000185', '1860000000000000186', '1860000000000000187', '1860000000000000188',
|
||||||
|
'1860000000000000189', '1860000000000000190', '1860000000000000191'
|
||||||
|
)
|
||||||
|
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,18 @@
|
|||||||
|
package org.jeecg.modules.xslmes.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES xslmes 业务常量
|
||||||
|
*/
|
||||||
|
public final class XslMesBizConstants {
|
||||||
|
|
||||||
|
/** 密炼PS类型:原材料检验标准(字典 xslmes_ps_belong) */
|
||||||
|
public static final String PS_TYPE_RAW_INSPECT_STD = "raw_inspect_std";
|
||||||
|
|
||||||
|
/** 胶料快检实验标准审核状态:已批准 */
|
||||||
|
public static final String RUBBER_QUICK_TEST_STD_AUDIT_APPROVED = "1";
|
||||||
|
|
||||||
|
/** 胶料快检实验标准审核状态:草稿 */
|
||||||
|
public static final String RUBBER_QUICK_TEST_STD_AUDIT_DRAFT = "0";
|
||||||
|
|
||||||
|
private XslMesBizConstants() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
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.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
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.mes.material.entity.MesMaterial;
|
||||||
|
import org.jeecg.modules.mes.material.service.IMesMaterialService;
|
||||||
|
import org.jeecg.modules.system.entity.SysDepart;
|
||||||
|
import org.jeecg.modules.system.service.ISysDepartService;
|
||||||
|
import org.jeecg.modules.xslmes.common.XslMesBizConstants;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||||
|
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestStdPage;
|
||||||
|
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/mesXslRubberQuickTestStd")
|
||||||
|
@Slf4j
|
||||||
|
public class MesXslRubberQuickTestStdController
|
||||||
|
extends JeecgController<MesXslRubberQuickTestStd, IMesXslRubberQuickTestStdService> {
|
||||||
|
|
||||||
|
private static final String ENABLE_IN_USE = "1";
|
||||||
|
private static final String ENABLE_STOPPED = "0";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslRubberQuickTestStdService mesXslRubberQuickTestStdService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslRubberQuickTestMethodService mesXslRubberQuickTestMethodService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesMaterialService mesMaterialService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslMixerPsCompileService mesXslMixerPsCompileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDepartService sysDepartService;
|
||||||
|
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<MesXslRubberQuickTestStd>> queryPageList(
|
||||||
|
MesXslRubberQuickTestStd model,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<MesXslRubberQuickTestStd> queryWrapper =
|
||||||
|
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
Page<MesXslRubberQuickTestStd> page = new Page<>(pageNo, pageSize);
|
||||||
|
IPage<MesXslRubberQuickTestStd> pageList = mesXslRubberQuickTestStdService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES胶料快检实验标准-添加")
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-添加")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody MesXslRubberQuickTestStdPage page) {
|
||||||
|
MesXslRubberQuickTestStd main = new MesXslRubberQuickTestStd();
|
||||||
|
BeanUtils.copyProperties(page, main);
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||||
|
String err = validateForSave(main, page.getLineList(), null);
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||||
|
try {
|
||||||
|
mesXslRubberQuickTestStdService.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_std:edit")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody MesXslRubberQuickTestStdPage page) {
|
||||||
|
MesXslRubberQuickTestStd main = new MesXslRubberQuickTestStd();
|
||||||
|
BeanUtils.copyProperties(page, main);
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||||
|
String err = validateForSave(main, page.getLineList(), main.getId());
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||||
|
try {
|
||||||
|
mesXslRubberQuickTestStdService.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胶料快检实验标准-通过id删除")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
mesXslRubberQuickTestStdService.delMain(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES胶料快检实验标准-批量删除")
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-批量删除")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
mesXslRubberQuickTestStdService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<MesXslRubberQuickTestStd> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
MesXslRubberQuickTestStd entity = mesXslRubberQuickTestStdService.getById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-查询明细")
|
||||||
|
@GetMapping(value = "/queryLineListByStdId")
|
||||||
|
public Result<List<MesXslRubberQuickTestStdLine>> queryLineListByStdId(
|
||||||
|
@RequestParam(name = "id", required = true) String id) {
|
||||||
|
return Result.OK(mesXslRubberQuickTestStdService.selectLinesByStdId(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES胶料快检实验标准-启用/停用")
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-启用/停用(字典 xslmes_rubber_quick_test_std_enable_status:1使用中 0已停用)")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:updateStatus")
|
||||||
|
@PostMapping(value = "/updateStatus")
|
||||||
|
public Result<String> updateStatus(
|
||||||
|
@RequestParam(name = "id", required = true) String id,
|
||||||
|
@RequestParam(name = "enableStatus", required = true) String enableStatus) {
|
||||||
|
if (enableStatus != null) {
|
||||||
|
enableStatus = enableStatus.trim();
|
||||||
|
}
|
||||||
|
if (!ENABLE_IN_USE.equals(enableStatus) && !ENABLE_STOPPED.equals(enableStatus)) {
|
||||||
|
return Result.error("启用状态参数非法");
|
||||||
|
}
|
||||||
|
boolean updated = mesXslRubberQuickTestStdService.lambdaUpdate()
|
||||||
|
.eq(MesXslRubberQuickTestStd::getId, id)
|
||||||
|
.set(MesXslRubberQuickTestStd::getEnableStatus, enableStatus)
|
||||||
|
.update();
|
||||||
|
if (updated) {
|
||||||
|
return Result.OK("操作成功");
|
||||||
|
}
|
||||||
|
MesXslRubberQuickTestStd cur = mesXslRubberQuickTestStdService.getById(id);
|
||||||
|
if (cur != null && java.util.Objects.equals(enableStatus, cur.getEnableStatus())) {
|
||||||
|
return Result.OK("操作成功");
|
||||||
|
}
|
||||||
|
return Result.error("操作失败,请确认记录存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "MES胶料快检实验标准-校验名称唯一")
|
||||||
|
@GetMapping(value = "/checkStdName")
|
||||||
|
public Result<?> checkStdName(
|
||||||
|
@RequestParam(name = "stdName") String stdName,
|
||||||
|
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||||
|
if (oConvertUtils.isEmpty(stdName) || stdName.trim().isEmpty()) {
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
MesXslRubberQuickTestStd ctx = new MesXslRubberQuickTestStd();
|
||||||
|
if (mesXslRubberQuickTestStdService.isStdNameDuplicated(stdName.trim(), dataId, ctx)) {
|
||||||
|
return Result.error("实验标准名称已存在");
|
||||||
|
}
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestStd model) {
|
||||||
|
return super.exportXls(request, model, MesXslRubberQuickTestStd.class, "MES胶料快检实验标准");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, MesXslRubberQuickTestStd.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||||
|
private String validateForSave(
|
||||||
|
MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList, String excludeId) {
|
||||||
|
if (main == null) {
|
||||||
|
return "参数不能为空";
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(main.getStdName())) {
|
||||||
|
return "实验标准名称不能为空";
|
||||||
|
}
|
||||||
|
main.setStdName(main.getStdName().trim());
|
||||||
|
if (mesXslRubberQuickTestStdService.isStdNameDuplicated(main.getStdName(), excludeId, main)) {
|
||||||
|
return "实验标准名称已存在";
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(main.getTestMethodId())) {
|
||||||
|
return "请选择实验方法";
|
||||||
|
}
|
||||||
|
MesXslRubberQuickTestMethod method = mesXslRubberQuickTestMethodService.getById(main.getTestMethodId());
|
||||||
|
if (method == null || isDeleted(method.getDelFlag())) {
|
||||||
|
return "实验方法不存在或已删除";
|
||||||
|
}
|
||||||
|
main.setTestMethodName(method.getMethodName());
|
||||||
|
|
||||||
|
if (oConvertUtils.isNotEmpty(main.getRubberMaterialId())) {
|
||||||
|
MesMaterial material = mesMaterialService.getById(main.getRubberMaterialId());
|
||||||
|
if (material == null) {
|
||||||
|
return "所选胶料不存在";
|
||||||
|
}
|
||||||
|
main.setRubberMaterialName(material.getMaterialName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oConvertUtils.isNotEmpty(main.getPsCompileId())) {
|
||||||
|
MesXslMixerPsCompile ps = mesXslMixerPsCompileService.getById(main.getPsCompileId());
|
||||||
|
if (ps == null) {
|
||||||
|
return "所选密炼PS不存在";
|
||||||
|
}
|
||||||
|
if (!XslMesBizConstants.PS_TYPE_RAW_INSPECT_STD.equals(ps.getPsType())) {
|
||||||
|
return "发行编号须选择类型为原材料检验标准的密炼PS";
|
||||||
|
}
|
||||||
|
main.setIssueNumber(ps.getPsCode());
|
||||||
|
if (main.getIssueDate() == null && ps.getIssueDate() != null) {
|
||||||
|
main.setIssueDate(ps.getIssueDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oConvertUtils.isNotEmpty(main.getIssueDeptId())) {
|
||||||
|
SysDepart depart = sysDepartService.getById(main.getIssueDeptId());
|
||||||
|
if (depart != null) {
|
||||||
|
main.setIssueDeptName(depart.getDepartName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MesXslRubberQuickTestMethodLine> methodLines =
|
||||||
|
mesXslRubberQuickTestMethodService.selectLinesByMethodId(main.getTestMethodId());
|
||||||
|
if (methodLines == null || methodLines.isEmpty()) {
|
||||||
|
return "所选实验方法未维护数据点明细,请先在实验方法中配置数据点";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lineList == null || lineList.isEmpty()) {
|
||||||
|
return "请保存与实验方法一致的数据点明细";
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, MesXslRubberQuickTestMethodLine> methodLineByPointId = new HashMap<>();
|
||||||
|
for (MesXslRubberQuickTestMethodLine ml : methodLines) {
|
||||||
|
if (ml != null && oConvertUtils.isNotEmpty(ml.getDataPointId())) {
|
||||||
|
methodLineByPointId.put(ml.getDataPointId().trim(), ml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> submittedPointIds = new HashSet<>();
|
||||||
|
int sort = 0;
|
||||||
|
for (int i = 0; i < lineList.size(); i++) {
|
||||||
|
MesXslRubberQuickTestStdLine line = lineList.get(i);
|
||||||
|
if (line == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int rowNo = i + 1;
|
||||||
|
if (oConvertUtils.isEmpty(line.getDataPointId())) {
|
||||||
|
return "第 " + rowNo + " 行未关联数据点";
|
||||||
|
}
|
||||||
|
String pointId = line.getDataPointId().trim();
|
||||||
|
if (!submittedPointIds.add(pointId)) {
|
||||||
|
return "第 " + rowNo + " 行数据点重复";
|
||||||
|
}
|
||||||
|
MesXslRubberQuickTestMethodLine methodLine = methodLineByPointId.get(pointId);
|
||||||
|
if (methodLine == null) {
|
||||||
|
return "第 " + rowNo + " 行数据点不属于所选实验方法,请重新选择实验方法后保存";
|
||||||
|
}
|
||||||
|
line.setDataPointId(pointId);
|
||||||
|
line.setPointName(methodLine.getPointName());
|
||||||
|
line.setSortNo(sort++);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (submittedPointIds.size() != methodLineByPointId.size()) {
|
||||||
|
return "明细须包含实验方法中的全部数据点,且不可新增或删除数据点";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isDeleted(Integer delFlag) {
|
||||||
|
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
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_std")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Schema(description = "MES胶料快检实验标准")
|
||||||
|
public class MesXslRubberQuickTestStd implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Excel(name = "实验标准名称", width = 24)
|
||||||
|
@Schema(description = "实验标准名称(同租户未删除唯一)")
|
||||||
|
private String stdName;
|
||||||
|
|
||||||
|
@Schema(description = "实验方法ID mes_xsl_rubber_quick_test_method.id")
|
||||||
|
private String testMethodId;
|
||||||
|
|
||||||
|
@Excel(name = "实验方法", width = 20)
|
||||||
|
@Schema(description = "实验方法名称冗余")
|
||||||
|
private String testMethodName;
|
||||||
|
|
||||||
|
@Excel(name = "密炼机类型", width = 14, dicCode = "xslmes_rubber_quick_test_mixer_type")
|
||||||
|
@Dict(dicCode = "xslmes_rubber_quick_test_mixer_type")
|
||||||
|
@Schema(description = "密炼机类型(字典xslmes_rubber_quick_test_mixer_type)")
|
||||||
|
private String mixerType;
|
||||||
|
|
||||||
|
@Schema(description = "胶料ID mes_material.id")
|
||||||
|
private String rubberMaterialId;
|
||||||
|
|
||||||
|
@Excel(name = "胶料名称", width = 20)
|
||||||
|
@Schema(description = "胶料名称冗余")
|
||||||
|
private String rubberMaterialName;
|
||||||
|
|
||||||
|
@Schema(description = "密炼PS编制ID mes_xsl_mixer_ps_compile.id")
|
||||||
|
private String psCompileId;
|
||||||
|
|
||||||
|
@Excel(name = "发行编号", width = 16)
|
||||||
|
@Schema(description = "发行编号(密炼PS编码冗余)")
|
||||||
|
private String issueNumber;
|
||||||
|
|
||||||
|
@Excel(name = "发行日期", width = 15, format = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Schema(description = "发行日期")
|
||||||
|
private Date issueDate;
|
||||||
|
|
||||||
|
@Schema(description = "发行部门ID")
|
||||||
|
private String issueDeptId;
|
||||||
|
|
||||||
|
@Excel(name = "发行部门", width = 18)
|
||||||
|
@Schema(description = "发行部门名称冗余")
|
||||||
|
private String issueDeptName;
|
||||||
|
|
||||||
|
@Excel(name = "启用状态", width = 10, dicCode = "xslmes_rubber_quick_test_std_enable_status")
|
||||||
|
@Dict(dicCode = "xslmes_rubber_quick_test_std_enable_status")
|
||||||
|
@Schema(description = "启用状态(字典:1使用中0已停用)")
|
||||||
|
private String enableStatus;
|
||||||
|
|
||||||
|
@Excel(name = "审核状态", width = 10, dicCode = "xslmes_rubber_quick_test_std_audit_status")
|
||||||
|
@Dict(dicCode = "xslmes_rubber_quick_test_std_audit_status")
|
||||||
|
@Schema(description = "审核状态(字典:0草稿1已批准)")
|
||||||
|
private String auditStatus;
|
||||||
|
|
||||||
|
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
|
||||||
|
@Schema(description = "删除状态(0正常 1已删除)")
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description = "标准明细")
|
||||||
|
private List<MesXslRubberQuickTestStdLine> lineList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
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_std_line")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Schema(description = "MES胶料快检实验标准明细")
|
||||||
|
public class MesXslRubberQuickTestStdLine implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_std.id")
|
||||||
|
private String stdId;
|
||||||
|
|
||||||
|
@Schema(description = "数据点主键 mes_xsl_rubber_quick_test_data_point.id")
|
||||||
|
private String dataPointId;
|
||||||
|
|
||||||
|
@Excel(name = "数据点", width = 18)
|
||||||
|
@Schema(description = "数据点名称冗余(只读带出)")
|
||||||
|
private String pointName;
|
||||||
|
|
||||||
|
@Excel(name = "下限值", width = 12, type = 10)
|
||||||
|
@Schema(description = "下限值")
|
||||||
|
private BigDecimal lowerLimit;
|
||||||
|
|
||||||
|
@Excel(name = "下警告值", width = 12, type = 10)
|
||||||
|
@Schema(description = "下警告值")
|
||||||
|
private BigDecimal lowerWarn;
|
||||||
|
|
||||||
|
@Excel(name = "目标值", width = 12, type = 10)
|
||||||
|
@Schema(description = "目标值")
|
||||||
|
private BigDecimal targetValue;
|
||||||
|
|
||||||
|
@Excel(name = "上警告值", width = 12, type = 10)
|
||||||
|
@Schema(description = "上警告值")
|
||||||
|
private BigDecimal upperWarn;
|
||||||
|
|
||||||
|
@Excel(name = "上限值", width = 12, type = 10)
|
||||||
|
@Schema(description = "上限值")
|
||||||
|
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,9 @@
|
|||||||
|
package org.jeecg.modules.xslmes.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 胶料快检实验标准明细 Mapper
|
||||||
|
*/
|
||||||
|
public interface MesXslRubberQuickTestStdLineMapper extends BaseMapper<MesXslRubberQuickTestStdLine> {}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.jeecg.modules.xslmes.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 胶料快检实验标准 Mapper
|
||||||
|
*/
|
||||||
|
public interface MesXslRubberQuickTestStdMapper extends BaseMapper<MesXslRubberQuickTestStd> {}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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.MesXslRubberQuickTestStd;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||||
|
|
||||||
|
public interface IMesXslRubberQuickTestStdService extends IService<MesXslRubberQuickTestStd> {
|
||||||
|
|
||||||
|
boolean isStdNameDuplicated(String stdName, String excludeId, MesXslRubberQuickTestStd context);
|
||||||
|
|
||||||
|
void saveMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList);
|
||||||
|
|
||||||
|
void updateMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList);
|
||||||
|
|
||||||
|
void delMain(String id);
|
||||||
|
|
||||||
|
void delBatchMain(Collection<? extends Serializable> idList);
|
||||||
|
|
||||||
|
List<MesXslRubberQuickTestStdLine> selectLinesByStdId(String stdId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密炼PS(原材料检验标准)批准后,将关联实验标准审核状态置为已批准(仅写入,不随PS反审核回退)
|
||||||
|
*/
|
||||||
|
void markAuditApprovedByPsCompileIds(Collection<String> psCompileIds);
|
||||||
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
package org.jeecg.modules.xslmes.service.impl;
|
package org.jeecg.modules.xslmes.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.xslmes.common.XslMesBizConstants;
|
||||||
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
|
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
|
||||||
import org.jeecg.modules.xslmes.mapper.MesXslMixerPsCompileMapper;
|
import org.jeecg.modules.xslmes.mapper.MesXslMixerPsCompileMapper;
|
||||||
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
|
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -18,6 +22,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCompileMapper, MesXslMixerPsCompile>
|
public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCompileMapper, MesXslMixerPsCompile>
|
||||||
implements IMesXslMixerPsCompileService {
|
implements IMesXslMixerPsCompileService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslRubberQuickTestStdService mesXslRubberQuickTestStdService;
|
||||||
|
|
||||||
//update-begin---author:jiangxh ---date:20260520 for:【密炼PS编制】批量流转状态-----------
|
//update-begin---author:jiangxh ---date:20260520 for:【密炼PS编制】批量流转状态-----------
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -28,6 +35,9 @@ public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCo
|
|||||||
}
|
}
|
||||||
List<String> idList = Arrays.asList(ids.split(","));
|
List<String> idList = Arrays.asList(ids.split(","));
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||||
|
List<String> rawInspectStdApprovedPsIds = new ArrayList<>();
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||||
for (String id : idList) {
|
for (String id : idList) {
|
||||||
if (oConvertUtils.isEmpty(id)) {
|
if (oConvertUtils.isEmpty(id)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -44,7 +54,18 @@ public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCo
|
|||||||
entity.setStatus(targetStatus);
|
entity.setStatus(targetStatus);
|
||||||
fillWorkflowInfo(entity, targetStatus, operatorName, now);
|
fillWorkflowInfo(entity, targetStatus, operatorName, now);
|
||||||
updateById(entity);
|
updateById(entity);
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||||
|
if ("approve".equals(targetStatus)
|
||||||
|
&& XslMesBizConstants.PS_TYPE_RAW_INSPECT_STD.equals(entity.getPsType())) {
|
||||||
|
rawInspectStdApprovedPsIds.add(entity.getId());
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||||
}
|
}
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||||
|
if (!rawInspectStdApprovedPsIds.isEmpty()) {
|
||||||
|
mesXslRubberQuickTestStdService.markAuditApprovedByPsCompileIds(rawInspectStdApprovedPsIds);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
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.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
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.xslmes.common.XslMesBizConstants;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||||
|
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestStdLineMapper;
|
||||||
|
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestStdMapper;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||||
|
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 MesXslRubberQuickTestStdServiceImpl
|
||||||
|
extends ServiceImpl<MesXslRubberQuickTestStdMapper, MesXslRubberQuickTestStd>
|
||||||
|
implements IMesXslRubberQuickTestStdService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MesXslRubberQuickTestStdLineMapper mesXslRubberQuickTestStdLineMapper;
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准名称同租户唯一、主子保存-----------
|
||||||
|
@Override
|
||||||
|
public boolean isStdNameDuplicated(String stdName, String excludeId, MesXslRubberQuickTestStd context) {
|
||||||
|
if (oConvertUtils.isEmpty(stdName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Integer tenantId = resolveTenantId(context);
|
||||||
|
LambdaQueryWrapper<MesXslRubberQuickTestStd> w = new LambdaQueryWrapper<>();
|
||||||
|
w.eq(MesXslRubberQuickTestStd::getStdName, stdName.trim());
|
||||||
|
w.and(q -> q.eq(MesXslRubberQuickTestStd::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslRubberQuickTestStd::getDelFlag));
|
||||||
|
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||||
|
w.ne(MesXslRubberQuickTestStd::getId, excludeId);
|
||||||
|
}
|
||||||
|
if (tenantId != null) {
|
||||||
|
w.eq(MesXslRubberQuickTestStd::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
return this.count(w) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void saveMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList) {
|
||||||
|
assertStdNameUniqueForSave(main, null);
|
||||||
|
applyDefaultStatus(main, true);
|
||||||
|
this.save(main);
|
||||||
|
insertLines(main.getId(), lineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList) {
|
||||||
|
if (oConvertUtils.isEmpty(main.getId())) {
|
||||||
|
throw new JeecgBootException("缺少主键");
|
||||||
|
}
|
||||||
|
MesXslRubberQuickTestStd old = this.getById(main.getId());
|
||||||
|
if (old == null) {
|
||||||
|
throw new JeecgBootException("实验标准不存在");
|
||||||
|
}
|
||||||
|
main.setEnableStatus(old.getEnableStatus());
|
||||||
|
main.setAuditStatus(old.getAuditStatus());
|
||||||
|
assertStdNameUniqueForSave(main, main.getId());
|
||||||
|
this.updateById(main);
|
||||||
|
mesXslRubberQuickTestStdLineMapper.delete(
|
||||||
|
new LambdaQueryWrapper<MesXslRubberQuickTestStdLine>()
|
||||||
|
.eq(MesXslRubberQuickTestStdLine::getStdId, main.getId()));
|
||||||
|
insertLines(main.getId(), lineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyDefaultStatus(MesXslRubberQuickTestStd main, boolean isNew) {
|
||||||
|
if (!isNew) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(main.getEnableStatus())) {
|
||||||
|
main.setEnableStatus("1");
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(main.getAuditStatus())) {
|
||||||
|
main.setAuditStatus("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertLines(String stdId, List<MesXslRubberQuickTestStdLine> lineList) {
|
||||||
|
if (CollectionUtils.isEmpty(lineList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int sort = 0;
|
||||||
|
for (MesXslRubberQuickTestStdLine line : lineList) {
|
||||||
|
line.setId(null);
|
||||||
|
line.setStdId(stdId);
|
||||||
|
line.setSortNo(sort++);
|
||||||
|
mesXslRubberQuickTestStdLineMapper.insert(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void delMain(String id) {
|
||||||
|
mesXslRubberQuickTestStdLineMapper.delete(
|
||||||
|
new LambdaQueryWrapper<MesXslRubberQuickTestStdLine>().eq(MesXslRubberQuickTestStdLine::getStdId, 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<MesXslRubberQuickTestStdLine> selectLinesByStdId(String stdId) {
|
||||||
|
return mesXslRubberQuickTestStdLineMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<MesXslRubberQuickTestStdLine>()
|
||||||
|
.eq(MesXslRubberQuickTestStdLine::getStdId, stdId)
|
||||||
|
.orderByAsc(MesXslRubberQuickTestStdLine::getSortNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertStdNameUniqueForSave(MesXslRubberQuickTestStd entity, String excludeId) {
|
||||||
|
if (entity == null || oConvertUtils.isEmpty(entity.getStdName())) {
|
||||||
|
throw new JeecgBootException("实验标准名称不能为空");
|
||||||
|
}
|
||||||
|
String name = entity.getStdName().trim();
|
||||||
|
entity.setStdName(name);
|
||||||
|
if (isStdNameDuplicated(name, excludeId, entity)) {
|
||||||
|
throw new JeecgBootException("实验标准名称已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准密炼PS批准时关联实验标准置已批准-----------
|
||||||
|
@Override
|
||||||
|
public void markAuditApprovedByPsCompileIds(Collection<String> psCompileIds) {
|
||||||
|
if (CollectionUtils.isEmpty(psCompileIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<String> ids =
|
||||||
|
psCompileIds.stream().filter(id -> oConvertUtils.isNotEmpty(id)).map(String::trim).distinct().collect(Collectors.toList());
|
||||||
|
if (ids.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.lambdaUpdate()
|
||||||
|
.in(MesXslRubberQuickTestStd::getPsCompileId, ids)
|
||||||
|
.and(w -> w.eq(MesXslRubberQuickTestStd::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslRubberQuickTestStd::getDelFlag))
|
||||||
|
.set(MesXslRubberQuickTestStd::getAuditStatus, XslMesBizConstants.RUBBER_QUICK_TEST_STD_AUDIT_APPROVED)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准密炼PS批准时关联实验标准置已批准-----------
|
||||||
|
|
||||||
|
private static Integer resolveTenantId(MesXslRubberQuickTestStd 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:20260525 for:【MES】胶料快检实验标准名称同租户唯一、主子保存-----------
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.jeecg.modules.xslmes.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 胶料快检实验标准主子保存页 VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class MesXslRubberQuickTestStdPage extends MesXslRubberQuickTestStd {}
|
||||||
@@ -468,3 +468,28 @@ jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/
|
|||||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
|
||||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
|
||||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
|
||||||
|
|
||||||
|
-- author:jiangxh---date:20260525--for: 【MES】胶料快检实验标准主子表、质量管理菜单、明细从实验方法带出 ---
|
||||||
|
jeecg-boot/db/mes-xsl-rubber-quick-test-std-menu-permission.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_103__mes_xsl_rubber_quick_test_std.sql
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestStd.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestStdLine.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestStdPage.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestStdMapper.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestStdLineMapper.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestStdService.java
|
||||||
|
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/controller/MesXslRubberQuickTestStdController.java
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestStd/MesXslRubberQuickTestStdList.vue
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestStd/MesXslRubberQuickTestStd.data.ts
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestStd/MesXslRubberQuickTestStd.api.ts
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestStd/components/MesXslRubberQuickTestStdModal.vue
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestStd/components/MesXslRubberQuickTestMethodSelectModal.vue
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestStd/components/MesXslRubberQuickTestStdMixerPsSelectModal.vue
|
||||||
|
|
||||||
|
-- author:jiangxh---date:20260525--for: 【MES】原材料检验标准密炼PS批准时关联胶料快检实验标准置已批准(反审核不回退,触发由审核改为批准)---
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/common/XslMesBizConstants.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestStdService.java
|
||||||
|
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
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
-- MES 胶料快检实验标准(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||||
|
-- 依赖:mes_xsl_rubber_quick_test_method、质量管理目录
|
||||||
|
-- 权限前缀:mes:mes_xsl_rubber_quick_test_std:*
|
||||||
|
|
||||||
|
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_mixer_type', '1普通密炼机2串密炼机', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mixer_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, '普通密炼机', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mixer_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '串密炼机', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mixer_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检标准启用状态', 'xslmes_rubber_quick_test_std_enable_status', '1使用中0已停用', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_std_enable_status' AND `del_flag` = 0);
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '使用中', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_std_enable_status' 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_std_enable_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检标准审核状态', 'xslmes_rubber_quick_test_std_audit_status', '0草稿1已批准', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_std_audit_status' AND `del_flag` = 0);
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '草稿', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_std_audit_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '已批准', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_std_audit_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_std` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`std_name` varchar(128) NOT NULL COMMENT '实验标准名称(同租户未删除唯一)',
|
||||||
|
`test_method_id` varchar(32) NOT NULL COMMENT '实验方法 mes_xsl_rubber_quick_test_method.id',
|
||||||
|
`test_method_name` varchar(128) DEFAULT NULL COMMENT '实验方法名称冗余',
|
||||||
|
`mixer_type` varchar(2) DEFAULT NULL COMMENT '密炼机类型(字典xslmes_rubber_quick_test_mixer_type:1普通密炼机2串密炼机)',
|
||||||
|
`rubber_material_id` varchar(32) DEFAULT NULL COMMENT '胶料 mes_material.id',
|
||||||
|
`rubber_material_name` varchar(128) DEFAULT NULL COMMENT '胶料名称冗余',
|
||||||
|
`ps_compile_id` varchar(32) DEFAULT NULL COMMENT '密炼PS编制 mes_xsl_mixer_ps_compile.id',
|
||||||
|
`issue_number` varchar(100) DEFAULT NULL COMMENT '发行编号(密炼PS编码冗余)',
|
||||||
|
`issue_date` date DEFAULT NULL COMMENT '发行日期',
|
||||||
|
`issue_dept_id` varchar(32) DEFAULT NULL COMMENT '发行部门ID',
|
||||||
|
`issue_dept_name` varchar(200) DEFAULT NULL COMMENT '发行部门名称冗余',
|
||||||
|
`enable_status` varchar(2) DEFAULT '1' COMMENT '启用状态(字典xslmes_rubber_quick_test_std_enable_status:1使用中0已停用)',
|
||||||
|
`audit_status` varchar(2) DEFAULT '0' COMMENT '审核状态(字典xslmes_rubber_quick_test_std_audit_status:0草稿1已批准)',
|
||||||
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
|
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||||
|
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mrqts_method` (`test_method_id`),
|
||||||
|
KEY `idx_mrqts_material` (`rubber_material_id`),
|
||||||
|
KEY `idx_mrqts_tenant` (`tenant_id`),
|
||||||
|
UNIQUE KEY `uk_mrqts_tenant_name_del` (`tenant_id`, `std_name`, `del_flag`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验标准';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_std_line` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`std_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_std.id',
|
||||||
|
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||||
|
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余(只读带出)',
|
||||||
|
`lower_limit` decimal(18,6) DEFAULT NULL COMMENT '下限值',
|
||||||
|
`lower_warn` decimal(18,6) DEFAULT NULL COMMENT '下警告值',
|
||||||
|
`target_value` decimal(18,6) DEFAULT NULL COMMENT '目标值',
|
||||||
|
`upper_warn` 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_mrqtsl_std` (`std_id`),
|
||||||
|
UNIQUE KEY `uk_mrqtsl_std_point` (`std_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 ('1860000000000000184', @mes_quality_pid, '胶料快检实验标准', '/xslmes/mesXslRubberQuickTestStd', 'xslmes/mesXslRubberQuickTestStd/MesXslRubberQuickTestStdList', 'MesXslRubberQuickTestStdList', 1, NULL, '1', 4, 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-protect-outlined' WHERE `id` = '1860000000000000184' 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
|
||||||
|
('1860000000000000185', '1860000000000000184', '新增', 2, 'mes:mes_xsl_rubber_quick_test_std:add', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000186', '1860000000000000184', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_std:edit', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000187', '1860000000000000184', '删除', 2, 'mes:mes_xsl_rubber_quick_test_std:delete', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000188', '1860000000000000184', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_std:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000189', '1860000000000000184', '导出', 2, 'mes:mes_xsl_rubber_quick_test_std:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000190', '1860000000000000184', '导入', 2, 'mes:mes_xsl_rubber_quick_test_std:importExcel', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000191', '1860000000000000184', '启用停用', 2, 'mes:mes_xsl_rubber_quick_test_std:updateStatus', '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 (
|
||||||
|
'1860000000000000184',
|
||||||
|
'1860000000000000185', '1860000000000000186', '1860000000000000187', '1860000000000000188',
|
||||||
|
'1860000000000000189', '1860000000000000190', '1860000000000000191'
|
||||||
|
)
|
||||||
|
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,68 @@
|
|||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/xslmes/mesXslRubberQuickTestStd/list',
|
||||||
|
checkStdName = '/xslmes/mesXslRubberQuickTestStd/checkStdName',
|
||||||
|
save = '/xslmes/mesXslRubberQuickTestStd/add',
|
||||||
|
edit = '/xslmes/mesXslRubberQuickTestStd/edit',
|
||||||
|
deleteOne = '/xslmes/mesXslRubberQuickTestStd/delete',
|
||||||
|
deleteBatch = '/xslmes/mesXslRubberQuickTestStd/deleteBatch',
|
||||||
|
importExcel = '/xslmes/mesXslRubberQuickTestStd/importExcel',
|
||||||
|
exportXls = '/xslmes/mesXslRubberQuickTestStd/exportXls',
|
||||||
|
queryById = '/xslmes/mesXslRubberQuickTestStd/queryById',
|
||||||
|
queryLineList = '/xslmes/mesXslRubberQuickTestStd/queryLineListByStdId',
|
||||||
|
updateStatus = '/xslmes/mesXslRubberQuickTestStd/updateStatus',
|
||||||
|
}
|
||||||
|
|
||||||
|
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 queryLineListByStdId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
|
||||||
|
|
||||||
|
export const checkStdName = (params: { stdName: string; dataId?: string }) =>
|
||||||
|
defHttp.get(
|
||||||
|
{ url: Api.checkStdName, params },
|
||||||
|
{
|
||||||
|
successMessageMode: 'none',
|
||||||
|
errorMessageMode: 'none',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export const updateStatus = (params: { id: string; enableStatus: string }, handleSuccess?: () => void) => {
|
||||||
|
return defHttp.post({ url: Api.updateStatus, params }, { joinParamsToUrl: true }).then(() => {
|
||||||
|
handleSuccess?.();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
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,155 @@
|
|||||||
|
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||||
|
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||||
|
import { checkStdName } from './MesXslRubberQuickTestStd.api';
|
||||||
|
|
||||||
|
const numProps = { style: { width: '100%' }, precision: 6 };
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{ title: '实验标准名称', align: 'center', dataIndex: 'stdName', width: 180 },
|
||||||
|
{ title: '实验方法', align: 'center', dataIndex: 'testMethodName', width: 160 },
|
||||||
|
{ title: '密炼机类型', align: 'center', dataIndex: 'mixerType_dictText', width: 110 },
|
||||||
|
{ title: '胶料名称', align: 'center', dataIndex: 'rubberMaterialName', width: 140 },
|
||||||
|
{ title: '发行编号', align: 'center', dataIndex: 'issueNumber', width: 120 },
|
||||||
|
{ title: '发行日期', align: 'center', dataIndex: 'issueDate', width: 110 },
|
||||||
|
{ title: '发行部门', align: 'center', dataIndex: 'issueDeptName', width: 140 },
|
||||||
|
{ title: '启用状态', align: 'center', dataIndex: 'enableStatus_dictText', width: 90 },
|
||||||
|
{ title: '审核状态', align: 'center', dataIndex: 'auditStatus_dictText', width: 90 },
|
||||||
|
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
width: 165,
|
||||||
|
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{ label: '实验标准名称', field: 'stdName', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{ label: '实验方法', field: 'testMethodName', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{
|
||||||
|
label: '启用状态',
|
||||||
|
field: 'enableStatus',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
componentProps: { dictCode: 'xslmes_rubber_quick_test_std_enable_status' },
|
||||||
|
colProps: { span: 6 },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{ label: '', field: 'id', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'testMethodId', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'rubberMaterialId', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'psCompileId', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'issueDeptId', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'enableStatus', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'auditStatus', component: 'Input', show: false },
|
||||||
|
{
|
||||||
|
label: '实验标准名称',
|
||||||
|
field: 'stdName',
|
||||||
|
component: 'Input',
|
||||||
|
required: true,
|
||||||
|
componentProps: { placeholder: '同租户内不可重复' },
|
||||||
|
dynamicRules: ({ model }) => [
|
||||||
|
{ required: true, message: '请输入实验标准名称' },
|
||||||
|
{
|
||||||
|
validator: async (_rule, value) => {
|
||||||
|
const v = value == null ? '' : String(value).trim();
|
||||||
|
if (!v) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await checkStdName({ stdName: v, dataId: model?.id });
|
||||||
|
return Promise.resolve();
|
||||||
|
} catch (e: any) {
|
||||||
|
const msg = e?.response?.data?.message || e?.message || '实验标准名称已存在';
|
||||||
|
return Promise.reject(msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '实验方法',
|
||||||
|
field: 'testMethodName',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'testMethodPicker',
|
||||||
|
required: true,
|
||||||
|
dynamicRules: () => [{ required: true, message: '请选择实验方法' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '密炼机类型',
|
||||||
|
field: 'mixerType',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
required: true,
|
||||||
|
componentProps: { dictCode: 'xslmes_rubber_quick_test_mixer_type', placeholder: '请选择密炼机类型' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '胶料名称',
|
||||||
|
field: 'rubberMaterialName',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'rubberMaterialPicker',
|
||||||
|
required: true,
|
||||||
|
dynamicRules: () => [{ required: true, message: '请选择胶料信息' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '发行编号',
|
||||||
|
field: 'issueNumber',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'issueNumberPicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '发行日期',
|
||||||
|
field: 'issueDate',
|
||||||
|
component: 'DatePicker',
|
||||||
|
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '发行部门',
|
||||||
|
field: 'issueDeptName',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'issueDeptPicker',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const lineJVxeColumns: JVxeColumn[] = [
|
||||||
|
{ title: '', key: 'dataPointId', type: JVxeTypes.hidden },
|
||||||
|
{ title: '数据点', key: 'pointName', type: JVxeTypes.normal, width: 180, disabled: true },
|
||||||
|
{
|
||||||
|
title: '下限值',
|
||||||
|
key: 'lowerLimit',
|
||||||
|
type: JVxeTypes.inputNumber,
|
||||||
|
width: 110,
|
||||||
|
componentProps: numProps,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '下警告值',
|
||||||
|
key: 'lowerWarn',
|
||||||
|
type: JVxeTypes.inputNumber,
|
||||||
|
width: 110,
|
||||||
|
componentProps: numProps,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '目标值',
|
||||||
|
key: 'targetValue',
|
||||||
|
type: JVxeTypes.inputNumber,
|
||||||
|
width: 110,
|
||||||
|
componentProps: numProps,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '上警告值',
|
||||||
|
key: 'upperWarn',
|
||||||
|
type: JVxeTypes.inputNumber,
|
||||||
|
width: 110,
|
||||||
|
componentProps: numProps,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '上限值',
|
||||||
|
key: 'upperLimit',
|
||||||
|
type: JVxeTypes.inputNumber,
|
||||||
|
width: 110,
|
||||||
|
componentProps: numProps,
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<template #tableTitle>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_rubber_quick_test_std:add'"
|
||||||
|
@click="handleAdd"
|
||||||
|
preIcon="ant-design:plus-outlined"
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_rubber_quick_test_std:exportXls'"
|
||||||
|
preIcon="ant-design:export-outlined"
|
||||||
|
@click="onExportXls"
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</a-button>
|
||||||
|
<j-upload-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_rubber_quick_test_std: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_std:deleteBatch'">
|
||||||
|
批量操作
|
||||||
|
<Icon icon="mdi:chevron-down" />
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<MesXslRubberQuickTestStdModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="xslmes-mesXslRubberQuickTestStd" setup>
|
||||||
|
import { BasicTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import Icon from '/@/components/Icon';
|
||||||
|
import MesXslRubberQuickTestStdModal from './components/MesXslRubberQuickTestStdModal.vue';
|
||||||
|
import { columns, searchFormSchema } from './MesXslRubberQuickTestStd.data';
|
||||||
|
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl, updateStatus } from './MesXslRubberQuickTestStd.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: 220,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: '胶料快检实验标准',
|
||||||
|
url: getExportUrl,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
openModal(true, { isUpdate: false, showFooter: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRecordEnabled(record: Recordable) {
|
||||||
|
return record.enableStatus === '1' || record.enableStatus === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleToggleStatus(record: Recordable, enableStatus: string) {
|
||||||
|
await updateStatus({ id: record.id, enableStatus }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSuccess() {
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTableAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
auth: 'mes:mes_xsl_rubber_quick_test_std:edit',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
const enabled = isRecordEnabled(record);
|
||||||
|
return [
|
||||||
|
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||||
|
{
|
||||||
|
label: '启用',
|
||||||
|
ifShow: !enabled,
|
||||||
|
onClick: handleToggleStatus.bind(null, record, '1'),
|
||||||
|
auth: 'mes:mes_xsl_rubber_quick_test_std:updateStatus',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '停用',
|
||||||
|
ifShow: enabled,
|
||||||
|
onClick: handleToggleStatus.bind(null, record, '0'),
|
||||||
|
auth: 'mes:mes_xsl_rubber_quick_test_std:updateStatus',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||||
|
auth: 'mes:mes_xsl_rubber_quick_test_std:delete',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal v-bind="$attrs" title="选择实验方法" :width="960" @register="registerModal" @ok="handleOk">
|
||||||
|
<BasicTable @register="registerTable" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
|
import { BasicTable, useTable } from '/@/components/Table';
|
||||||
|
import type { FormSchema } from '/@/components/Table';
|
||||||
|
import { list as methodList, queryById as queryMethodById } from '../../mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api';
|
||||||
|
import { columns as methodColumns } from '../../mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
const emit = defineEmits(['register', 'select']);
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
|
||||||
|
const selectSearchSchema: FormSchema[] = [
|
||||||
|
{ label: '方法编号', field: 'methodCode', component: 'JInput', colProps: { span: 8 } },
|
||||||
|
{ label: '实验方法名称', field: 'methodName', component: 'JInput', colProps: { span: 8 } },
|
||||||
|
];
|
||||||
|
|
||||||
|
const selectedRow = ref<Recordable | null>(null);
|
||||||
|
|
||||||
|
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||||
|
api: methodList,
|
||||||
|
columns: methodColumns.slice(0, 4),
|
||||||
|
rowKey: 'id',
|
||||||
|
useSearchForm: true,
|
||||||
|
formConfig: {
|
||||||
|
labelWidth: 100,
|
||||||
|
schemas: selectSearchSchema,
|
||||||
|
},
|
||||||
|
pagination: { pageSize: 10 },
|
||||||
|
canResize: false,
|
||||||
|
showIndexColumn: false,
|
||||||
|
immediate: true,
|
||||||
|
rowSelection: {
|
||||||
|
type: 'radio',
|
||||||
|
columnWidth: 48,
|
||||||
|
onChange: (_keys, rows) => {
|
||||||
|
selectedRow.value = rows?.[0] ?? null;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
clickToRowSelect: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
selectedRow.value = null;
|
||||||
|
clearSelectedRowKeys?.();
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
const methodId = data?.testMethodId as string | undefined;
|
||||||
|
if (methodId) {
|
||||||
|
setSelectedRowKeys?.([methodId]);
|
||||||
|
try {
|
||||||
|
const raw = await queryMethodById({ id: methodId });
|
||||||
|
const row = (raw as Recordable)?.methodName != null ? raw : (raw as Recordable)?.result;
|
||||||
|
if (row) {
|
||||||
|
selectedRow.value = row;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleOk() {
|
||||||
|
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||||
|
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||||
|
if (!row && keys.length) {
|
||||||
|
try {
|
||||||
|
const raw = await queryMethodById({ id: keys[0] });
|
||||||
|
row = (raw as Recordable)?.methodName != null ? raw : (raw as Recordable)?.result;
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!row?.id) {
|
||||||
|
createMessage.warning('请选择一条实验方法');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit('select', {
|
||||||
|
testMethodId: row.id,
|
||||||
|
testMethodName: row.methodName || '',
|
||||||
|
methodCode: row.methodCode || '',
|
||||||
|
});
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal v-bind="$attrs" title="选择发行编号(原材料检验标准)" :width="960" @register="registerModal" @ok="handleOk">
|
||||||
|
<BasicTable @register="registerTable" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
|
import { BasicTable, useTable } from '/@/components/Table';
|
||||||
|
import type { FormSchema } from '/@/components/Table';
|
||||||
|
import { list as mixerPsList, queryById as queryMixerPsById } from '../../mesXslMixerPsCompile/MesXslMixerPsCompile.api';
|
||||||
|
import { columns as mixerPsColumns } from '../../mesXslMixerPsCompile/MesXslMixerPsCompile.data';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
const emit = defineEmits(['register', 'select']);
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
|
||||||
|
/** 密炼PS类型:原材料检验标准 */
|
||||||
|
const PS_TYPE_RAW_INSPECT_STD = 'raw_inspect_std';
|
||||||
|
|
||||||
|
const selectSearchSchema: FormSchema[] = [
|
||||||
|
{ label: 'PS编码', field: 'psCode', component: 'JInput', colProps: { span: 8 } },
|
||||||
|
{ label: '标题', field: 'title', component: 'JInput', colProps: { span: 8 } },
|
||||||
|
];
|
||||||
|
|
||||||
|
const selectedRow = ref<Recordable | null>(null);
|
||||||
|
|
||||||
|
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||||
|
api: mixerPsList,
|
||||||
|
columns: mixerPsColumns.slice(0, 7),
|
||||||
|
rowKey: 'id',
|
||||||
|
useSearchForm: true,
|
||||||
|
formConfig: {
|
||||||
|
labelWidth: 90,
|
||||||
|
schemas: selectSearchSchema,
|
||||||
|
},
|
||||||
|
pagination: { pageSize: 10 },
|
||||||
|
canResize: false,
|
||||||
|
showIndexColumn: false,
|
||||||
|
immediate: true,
|
||||||
|
beforeFetch: (params) => ({
|
||||||
|
...params,
|
||||||
|
psType: PS_TYPE_RAW_INSPECT_STD,
|
||||||
|
}),
|
||||||
|
rowSelection: {
|
||||||
|
type: 'radio',
|
||||||
|
columnWidth: 48,
|
||||||
|
onChange: (_keys, rows) => {
|
||||||
|
selectedRow.value = rows?.[0] ?? null;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
clickToRowSelect: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
selectedRow.value = null;
|
||||||
|
clearSelectedRowKeys?.();
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
const psId = data?.psCompileId as string | undefined;
|
||||||
|
if (psId) {
|
||||||
|
setSelectedRowKeys?.([psId]);
|
||||||
|
try {
|
||||||
|
const raw = await queryMixerPsById({ id: psId });
|
||||||
|
const row = (raw as Recordable)?.psCode != null ? raw : (raw as Recordable)?.result;
|
||||||
|
if (row) {
|
||||||
|
selectedRow.value = row;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleOk() {
|
||||||
|
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||||
|
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||||
|
if (!row && keys.length) {
|
||||||
|
try {
|
||||||
|
const raw = await queryMixerPsById({ id: keys[0] });
|
||||||
|
row = (raw as Recordable)?.psCode != null ? raw : (raw as Recordable)?.result;
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!row?.id) {
|
||||||
|
createMessage.warning('请选择一条密炼PS');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (row.psType && row.psType !== PS_TYPE_RAW_INSPECT_STD) {
|
||||||
|
createMessage.warning('仅可选择类型为原材料检验标准的密炼PS');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit('select', {
|
||||||
|
psCompileId: row.id,
|
||||||
|
issueNumber: row.psCode || '',
|
||||||
|
issueDate: row.issueDate || undefined,
|
||||||
|
issueDeptId: row.sendDeptId || undefined,
|
||||||
|
issueDeptName: row.sendDeptId_dictText || undefined,
|
||||||
|
});
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,290 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal
|
||||||
|
v-bind="$attrs"
|
||||||
|
destroyOnClose
|
||||||
|
:title="title"
|
||||||
|
width="1100px"
|
||||||
|
@register="registerModal"
|
||||||
|
@ok="handleSubmit"
|
||||||
|
>
|
||||||
|
<BasicForm @register="registerForm">
|
||||||
|
<template #testMethodPicker="{ 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="openMethodSelect">选择</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
<template #rubberMaterialPicker="{ 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="openMaterialSelect">选择</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
<template #issueNumberPicker="{ 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="openPsSelect">选择</a-button>
|
||||||
|
<a-button v-if="model.issueNumber && !isDetail" @click="clearIssueNumber(model)">清除</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
<template #issueDeptPicker="{ 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="openDeptSelect">选择</a-button>
|
||||||
|
<a-button v-if="model.issueDeptId && !isDetail" @click="clearIssueDept(model)">清除</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
</BasicForm>
|
||||||
|
<a-divider orientation="left">标准明细(由实验方法带出数据点,不可增删)</a-divider>
|
||||||
|
<JVxeTable
|
||||||
|
v-if="tableReady"
|
||||||
|
ref="lineTableRef"
|
||||||
|
toolbar
|
||||||
|
row-number
|
||||||
|
keep-source
|
||||||
|
:insert-row="false"
|
||||||
|
:remove-btn="false"
|
||||||
|
:max-height="380"
|
||||||
|
:loading="lineLoading"
|
||||||
|
:columns="lineJVxeColumns"
|
||||||
|
:dataSource="lineDataSource"
|
||||||
|
:disabled="isDetail"
|
||||||
|
:toolbar-config="{ btn: [] }"
|
||||||
|
:add-btn-cfg="{ enabled: false }"
|
||||||
|
/>
|
||||||
|
<MesXslRubberQuickTestMethodSelectModal @register="registerMethodModal" @select="onMethodSelect" />
|
||||||
|
<MesMaterialSelectModal @register="registerMaterialModal" @select="onMaterialSelect" />
|
||||||
|
<MesXslRubberQuickTestStdMixerPsSelectModal @register="registerPsModal" @select="onPsSelect" />
|
||||||
|
<DeptSelectModal @register="registerDeptModal" @getSelectResult="onIssueDeptSelect" />
|
||||||
|
</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 '../MesXslRubberQuickTestStd.data';
|
||||||
|
import { saveOrUpdate, queryById, queryLineListByStdId } from '../MesXslRubberQuickTestStd.api';
|
||||||
|
import { queryLineListByMethodId } from '../../mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api';
|
||||||
|
import MesXslRubberQuickTestMethodSelectModal from './MesXslRubberQuickTestMethodSelectModal.vue';
|
||||||
|
import MesXslRubberQuickTestStdMixerPsSelectModal from './MesXslRubberQuickTestStdMixerPsSelectModal.vue';
|
||||||
|
import MesMaterialSelectModal from '/@/views/mes/material/modules/MesMaterialSelectModal.vue';
|
||||||
|
import DeptSelectModal from '/@/components/Form/src/jeecg/components/modal/DeptSelectModal.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const isDetail = ref(false);
|
||||||
|
const tableReady = ref(false);
|
||||||
|
const lineLoading = ref(false);
|
||||||
|
const lineDataSource = ref<Recordable[]>([]);
|
||||||
|
const lineTableRef = ref<JVxeTableInstance>();
|
||||||
|
const lastMethodId = ref<string>('');
|
||||||
|
|
||||||
|
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||||
|
labelWidth: 120,
|
||||||
|
schemas: formSchema,
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
baseColProps: { span: 12 },
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerMethodModal, { openModal: openMethodModal }] = useModal();
|
||||||
|
const [registerMaterialModal, { openModal: openMaterialModal }] = useModal();
|
||||||
|
const [registerPsModal, { openModal: openPsModal }] = useModal();
|
||||||
|
const [registerDeptModal, { openModal: openDeptModal }] = useModal();
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
tableReady.value = false;
|
||||||
|
lineDataSource.value = [];
|
||||||
|
lastMethodId.value = '';
|
||||||
|
await resetFields();
|
||||||
|
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||||
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
isDetail.value = !data?.showFooter;
|
||||||
|
setProps({ disabled: !data?.showFooter });
|
||||||
|
|
||||||
|
if (unref(isUpdate) && 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 queryLineListByStdId({ id: data.record.id });
|
||||||
|
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
|
||||||
|
await setFieldsValue({ ...m });
|
||||||
|
lineDataSource.value = list || [];
|
||||||
|
lastMethodId.value = m?.testMethodId || '';
|
||||||
|
} finally {
|
||||||
|
lineLoading.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await setFieldsValue({ enableStatus: '1', auditStatus: '0' });
|
||||||
|
}
|
||||||
|
tableReady.value = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const title = computed(() =>
|
||||||
|
!unref(isUpdate) ? '新增胶料快检实验标准' : unref(isDetail) ? '实验标准详情' : '编辑胶料快检实验标准',
|
||||||
|
);
|
||||||
|
|
||||||
|
function methodLineToStdRow(ml: Recordable, existing?: Recordable): Recordable {
|
||||||
|
return {
|
||||||
|
dataPointId: ml.dataPointId,
|
||||||
|
pointName: ml.pointName,
|
||||||
|
lowerLimit: existing?.lowerLimit ?? null,
|
||||||
|
lowerWarn: existing?.lowerWarn ?? null,
|
||||||
|
targetValue: existing?.targetValue ?? null,
|
||||||
|
upperWarn: existing?.upperWarn ?? null,
|
||||||
|
upperLimit: existing?.upperLimit ?? null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadLinesFromMethod(methodId: string, mergeExisting = true) {
|
||||||
|
if (!methodId) {
|
||||||
|
lineDataSource.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lineLoading.value = true;
|
||||||
|
try {
|
||||||
|
const linesRaw = await queryLineListByMethodId({ id: methodId });
|
||||||
|
const methodLines = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
|
||||||
|
const existingMap = new Map<string, Recordable>();
|
||||||
|
if (mergeExisting) {
|
||||||
|
const current = (lineTableRef.value as any)?.getTableData?.() || lineDataSource.value || [];
|
||||||
|
for (const row of current as Recordable[]) {
|
||||||
|
if (row?.dataPointId) {
|
||||||
|
existingMap.set(String(row.dataPointId), row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lineDataSource.value = (methodLines || []).map((ml: Recordable) =>
|
||||||
|
methodLineToStdRow(ml, existingMap.get(String(ml.dataPointId))),
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
lineLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openMethodSelect() {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
openMethodModal(true, { testMethodId: vals?.testMethodId || '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onMethodSelect(payload: Recordable) {
|
||||||
|
const methodId = payload?.testMethodId || '';
|
||||||
|
await setFieldsValue({
|
||||||
|
testMethodId: methodId,
|
||||||
|
testMethodName: payload?.testMethodName || '',
|
||||||
|
});
|
||||||
|
if (methodId !== lastMethodId.value) {
|
||||||
|
lastMethodId.value = methodId;
|
||||||
|
await loadLinesFromMethod(methodId, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openMaterialSelect() {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
openMaterialModal(true, { materialId: vals?.rubberMaterialId || '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onMaterialSelect(payload: Recordable) {
|
||||||
|
await setFieldsValue({
|
||||||
|
rubberMaterialId: payload.materialId || '',
|
||||||
|
rubberMaterialName: payload.materialName || '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function openPsSelect() {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
openPsModal(true, { psCompileId: vals?.psCompileId || '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPsSelect(payload: Recordable) {
|
||||||
|
await setFieldsValue({
|
||||||
|
psCompileId: payload.psCompileId || '',
|
||||||
|
issueNumber: payload.issueNumber || '',
|
||||||
|
issueDate: payload.issueDate || undefined,
|
||||||
|
issueDeptId: payload.issueDeptId || undefined,
|
||||||
|
issueDeptName: payload.issueDeptName || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearIssueNumber(model: Recordable) {
|
||||||
|
model.psCompileId = '';
|
||||||
|
model.issueNumber = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function openDeptSelect() {
|
||||||
|
openDeptModal(true, { isUpdate: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveIssueDeptSelection(options: Recordable[] = [], values: Recordable[] = []) {
|
||||||
|
const opt = options?.[0] || {};
|
||||||
|
let id = '';
|
||||||
|
let name = opt.label != null ? String(opt.label) : '';
|
||||||
|
if (opt.value != null && opt.value !== '') {
|
||||||
|
if (typeof opt.value === 'string' || typeof opt.value === 'number') {
|
||||||
|
id = String(opt.value);
|
||||||
|
} else if (typeof opt.value === 'object') {
|
||||||
|
const row = opt.value as Recordable;
|
||||||
|
id = String(row.id ?? row.key ?? row.value ?? '');
|
||||||
|
if (!name) {
|
||||||
|
name = String(row.departName ?? row.title ?? row.label ?? '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const rawValue = values?.[0];
|
||||||
|
if (!id && rawValue != null && rawValue !== '') {
|
||||||
|
id = String(rawValue);
|
||||||
|
}
|
||||||
|
return { id, name };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onIssueDeptSelect(options: Recordable[], values: Recordable[]) {
|
||||||
|
const { id, name } = resolveIssueDeptSelection(options, values);
|
||||||
|
await setFieldsValue({
|
||||||
|
issueDeptId: id,
|
||||||
|
issueDeptName: name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearIssueDept(model: Recordable) {
|
||||||
|
model.issueDeptId = '';
|
||||||
|
model.issueDeptName = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const values = await validate();
|
||||||
|
if (!values?.testMethodId) {
|
||||||
|
createMessage.warning('请选择实验方法');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const lineRef = lineTableRef.value as any;
|
||||||
|
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
|
||||||
|
const lineList = tableData
|
||||||
|
.filter((r) => r && r.dataPointId)
|
||||||
|
.map((r) => ({
|
||||||
|
dataPointId: r.dataPointId,
|
||||||
|
pointName: r.pointName,
|
||||||
|
lowerLimit: r.lowerLimit,
|
||||||
|
lowerWarn: r.lowerWarn,
|
||||||
|
targetValue: r.targetValue,
|
||||||
|
upperWarn: r.upperWarn,
|
||||||
|
upperLimit: r.upperLimit,
|
||||||
|
}));
|
||||||
|
if (!lineList.length) {
|
||||||
|
createMessage.warning('请先选择实验方法以带出数据点明细');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setModalProps({ confirmLoading: true });
|
||||||
|
await saveOrUpdate({ ...values, lineList }, unref(isUpdate));
|
||||||
|
closeModal();
|
||||||
|
emit('success');
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user