Merge branch 'main' of http://27.223.88.102:33000/chenx/qhmes
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
-- MES 胶料小料锁定日志 + 锁定原因字段 reason_desc:可整文件一次执行
|
||||
-- 若已执行 V3.9.2_119 Flyway 可只跑本脚本补菜单/字段(幂等)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_log:*
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @reason_desc_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'mes_xsl_rubber_small_lock_reason'
|
||||
AND COLUMN_NAME = 'reason_desc'
|
||||
);
|
||||
SET @ddl_reason_desc := IF(
|
||||
@reason_desc_exists = 0,
|
||||
'ALTER TABLE `mes_xsl_rubber_small_lock_reason` ADD COLUMN `reason_desc` varchar(500) NOT NULL DEFAULT '''' COMMENT ''原因(手动输入,必填)'' AFTER `barcode_type`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_reason_desc FROM @ddl_reason_desc;
|
||||
EXECUTE stmt_reason_desc;
|
||||
DEALLOCATE PREPARE stmt_reason_desc;
|
||||
|
||||
UPDATE `mes_xsl_rubber_small_lock_reason` SET `reason_desc` = CONCAT('原因', `reason_code`) WHERE `reason_desc` = '' OR `reason_desc` IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_log` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`lock_reason_id` varchar(32) NOT NULL COMMENT '锁定原因ID',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型',
|
||||
`barcode` varchar(128) NOT NULL COMMENT '条码',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '状态',
|
||||
`reason_desc` varchar(500) NOT NULL COMMENT '原因',
|
||||
`log_date` date NOT NULL COMMENT '日期',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrsl_log_tenant_date` (`tenant_id`, `log_date`),
|
||||
KEY `idx_mrsl_log_barcode` (`tenant_id`, `barcode_type`, `barcode`),
|
||||
KEY `idx_mrsl_log_reason` (`lock_reason_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 ('1860000000000000215', @mes_quality_pid, '胶料小料锁定日志', '/xslmes/mesXslRubberSmallLockLog', 'xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList', 'MesXslRubberSmallLockLogList', 1, NULL, '1', 7, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`sort_no` = VALUES(`sort_no`), `is_leaf` = 0, `status` = '1', `del_flag` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:file-text-outlined' WHERE `id` = '1860000000000000215' AND `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000216', '1860000000000000215', '新增', 2, 'mes:mes_xsl_rubber_small_lock_log:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000217', '1860000000000000215', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_log:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000218', '1860000000000000215', '删除', 2, 'mes:mes_xsl_rubber_small_lock_log:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000219', '1860000000000000215', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_log:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000220', '1860000000000000215', '导出', 2, 'mes:mes_xsl_rubber_small_lock_log:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000221', '1860000000000000215', '导入', 2, 'mes:mes_xsl_rubber_small_lock_log:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000215',
|
||||
'1860000000000000216', '1860000000000000217', '1860000000000000218', '1860000000000000219',
|
||||
'1860000000000000220', '1860000000000000221'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -31,6 +31,7 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_reason` (
|
||||
`reason_code` varchar(16) NOT NULL COMMENT '编号(租户内从001递增自动生成,只读)',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '类型(字典xslmes_rubber_small_lock_type:lock锁定unlock解锁)',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type:small小料rubber胶料)',
|
||||
`reason_desc` varchar(500) NOT NULL COMMENT '原因(手动输入,必填)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
@@ -659,3 +659,22 @@ jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLoc
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/components/MesXslRubberSmallLockReasonModal.vue
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】锁定原因增加原因字段、新增胶料小料锁定日志 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_119__mes_xsl_rubber_small_lock_reason_desc_and_log.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-small-lock-log-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockLog.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockLogMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockLogService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockLogServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockLogController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLog.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLog.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/components/MesXslRubberSmallLockLogModal.vue
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockLogService;
|
||||
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/mesXslRubberSmallLockLog")
|
||||
@Slf4j
|
||||
public class MesXslRubberSmallLockLogController
|
||||
extends JeecgController<MesXslRubberSmallLockLog, IMesXslRubberSmallLockLogService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberSmallLockLogService mesXslRubberSmallLockLogService;
|
||||
|
||||
@Operation(summary = "MES胶料小料锁定日志-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberSmallLockLog>> queryPageList(
|
||||
MesXslRubberSmallLockLog model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberSmallLockLog> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslRubberSmallLockLog> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberSmallLockLog> pageList = mesXslRubberSmallLockLogService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-添加")
|
||||
@Operation(summary = "MES胶料小料锁定日志-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberSmallLockLog model) {
|
||||
try {
|
||||
mesXslRubberSmallLockLogService.save(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-编辑")
|
||||
@Operation(summary = "MES胶料小料锁定日志-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberSmallLockLog model) {
|
||||
try {
|
||||
mesXslRubberSmallLockLogService.updateById(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-删除")
|
||||
@Operation(summary = "MES胶料小料锁定日志-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberSmallLockLogService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-批量删除")
|
||||
@Operation(summary = "MES胶料小料锁定日志-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberSmallLockLogService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料小料锁定日志-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberSmallLockLog> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberSmallLockLog entity = mesXslRubberSmallLockLogService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberSmallLockLog model) {
|
||||
return super.exportXls(request, model, MesXslRubberSmallLockLog.class, "MES胶料小料锁定日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, MesXslRubberSmallLockLog.class);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -18,6 +19,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService;
|
||||
@@ -68,6 +70,9 @@ public class MesXslRubberSmallLockReasonController
|
||||
if (oConvertUtils.isEmpty(model.getBarcodeType())) {
|
||||
return Result.error("条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getReasonDesc()) || model.getReasonDesc().trim().isEmpty()) {
|
||||
return Result.error("原因不能为空");
|
||||
}
|
||||
model.setReasonCode(null);
|
||||
try {
|
||||
mesXslRubberSmallLockReasonService.save(model);
|
||||
@@ -93,12 +98,16 @@ public class MesXslRubberSmallLockReasonController
|
||||
if (oConvertUtils.isEmpty(model.getBarcodeType())) {
|
||||
return Result.error("条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getReasonDesc()) || model.getReasonDesc().trim().isEmpty()) {
|
||||
return Result.error("原因不能为空");
|
||||
}
|
||||
MesXslRubberSmallLockReason old = mesXslRubberSmallLockReasonService.getById(model.getId());
|
||||
if (old == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
old.setLockType(model.getLockType());
|
||||
old.setBarcodeType(model.getBarcodeType());
|
||||
old.setReasonDesc(model.getReasonDesc().trim());
|
||||
try {
|
||||
mesXslRubberSmallLockReasonService.updateById(old);
|
||||
} catch (JeecgBootException e) {
|
||||
@@ -143,6 +152,26 @@ public class MesXslRubberSmallLockReasonController
|
||||
return Result.OK(mesXslRubberSmallLockReasonService.generateNextReasonCode(ctx));
|
||||
}
|
||||
|
||||
@Operation(summary = "按条码类型查询锁定原因选项(日志表单联动)")
|
||||
@GetMapping(value = "/optionsByBarcodeType")
|
||||
public Result<List<MesXslRubberSmallLockReason>> optionsByBarcodeType(
|
||||
@RequestParam(name = "barcodeType", required = true) String barcodeType) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】锁定日志按条码类型加载原因选项-----------
|
||||
if (oConvertUtils.isEmpty(barcodeType)) {
|
||||
return Result.error("条码类型不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<MesXslRubberSmallLockReason> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberSmallLockReason::getBarcodeType, barcodeType.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslRubberSmallLockReason::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslRubberSmallLockReason::getDelFlag));
|
||||
w.orderByAsc(MesXslRubberSmallLockReason::getReasonCode);
|
||||
return Result.OK(mesXslRubberSmallLockReasonService.list(w));
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】锁定日志按条码类型加载原因选项-----------
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberSmallLockReason model) {
|
||||
@@ -179,6 +208,9 @@ public class MesXslRubberSmallLockReasonController
|
||||
if (oConvertUtils.isEmpty(row.getBarcodeType())) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getReasonDesc()) || row.getReasonDesc().trim().isEmpty()) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条原因不能为空");
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(row.getReasonCode())) {
|
||||
row.setReasonCode(row.getReasonCode().trim());
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 胶料小料锁定日志
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_small_lock_log")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料小料锁定日志")
|
||||
public class MesXslRubberSmallLockLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "锁定原因ID")
|
||||
private String lockReasonId;
|
||||
|
||||
@Excel(name = "类型", width = 12, dicCode = "xslmes_rubber_small_lock_barcode_type")
|
||||
@Dict(dicCode = "xslmes_rubber_small_lock_barcode_type")
|
||||
@Schema(description = "条码类型")
|
||||
private String barcodeType;
|
||||
|
||||
@Excel(name = "条码", width = 20)
|
||||
@Schema(description = "条码")
|
||||
private String barcode;
|
||||
|
||||
@Excel(name = "状态", width = 12, dicCode = "xslmes_rubber_small_lock_type")
|
||||
@Dict(dicCode = "xslmes_rubber_small_lock_type")
|
||||
@Schema(description = "状态(来自锁定原因类型)")
|
||||
private String lockType;
|
||||
|
||||
@Excel(name = "原因", width = 40)
|
||||
@Schema(description = "原因(来自锁定原因)")
|
||||
private String reasonDesc;
|
||||
|
||||
@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 logDate;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
|
||||
@Excel(name = "创建人", width = 12)
|
||||
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;
|
||||
|
||||
@Excel(name = "修改人", width = 12)
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -44,6 +44,10 @@ public class MesXslRubberSmallLockReason implements Serializable {
|
||||
@Schema(description = "条码类型(字典:small小料 rubber胶料)")
|
||||
private String barcodeType;
|
||||
|
||||
@Excel(name = "原因", width = 40)
|
||||
@Schema(description = "原因(手动输入,必填)")
|
||||
private String reasonDesc;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
|
||||
@Mapper
|
||||
public interface MesXslRubberSmallLockLogMapper extends BaseMapper<MesXslRubberSmallLockLog> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
|
||||
public interface IMesXslRubberSmallLockLogService extends IService<MesXslRubberSmallLockLog> {}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberSmallLockLogMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockLogService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberSmallLockLogServiceImpl
|
||||
extends ServiceImpl<MesXslRubberSmallLockLogMapper, MesXslRubberSmallLockLog>
|
||||
implements IMesXslRubberSmallLockLogService {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberSmallLockReasonService mesXslRubberSmallLockReasonService;
|
||||
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定日志保存时从原因主数据带出状态与原因-----------
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean save(MesXslRubberSmallLockLog entity) {
|
||||
fillAndValidate(entity);
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateById(MesXslRubberSmallLockLog entity) {
|
||||
if (oConvertUtils.isEmpty(entity.getId())) {
|
||||
throw new JeecgBootException("缺少主键");
|
||||
}
|
||||
fillAndValidate(entity);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
private void fillAndValidate(MesXslRubberSmallLockLog entity) {
|
||||
if (entity == null) {
|
||||
throw new JeecgBootException("数据不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getBarcodeType())) {
|
||||
throw new JeecgBootException("类型(条码类型)不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getBarcode()) || entity.getBarcode().trim().isEmpty()) {
|
||||
throw new JeecgBootException("条码不能为空");
|
||||
}
|
||||
entity.setBarcode(entity.getBarcode().trim());
|
||||
if (entity.getBarcode().length() > 128) {
|
||||
throw new JeecgBootException("条码长度不能超过128个字符");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getLockReasonId())) {
|
||||
throw new JeecgBootException("请选择锁定原因");
|
||||
}
|
||||
if (entity.getLogDate() == null) {
|
||||
throw new JeecgBootException("日期不能为空");
|
||||
}
|
||||
MesXslRubberSmallLockReason reason = mesXslRubberSmallLockReasonService.getById(entity.getLockReasonId());
|
||||
if (reason == null) {
|
||||
throw new JeecgBootException("锁定原因不存在或已删除");
|
||||
}
|
||||
if (!entity.getBarcodeType().equals(reason.getBarcodeType())) {
|
||||
throw new JeecgBootException("所选锁定原因与条码类型不一致");
|
||||
}
|
||||
entity.setLockType(reason.getLockType());
|
||||
entity.setReasonDesc(reason.getReasonDesc());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定日志保存时从原因主数据带出状态与原因-----------
|
||||
}
|
||||
@@ -57,6 +57,14 @@ public class MesXslRubberSmallLockReasonServiceImpl
|
||||
if (oConvertUtils.isEmpty(entity.getBarcodeType())) {
|
||||
throw new JeecgBootException("条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getReasonDesc()) || entity.getReasonDesc().trim().isEmpty()) {
|
||||
throw new JeecgBootException("原因不能为空");
|
||||
}
|
||||
String desc = entity.getReasonDesc().trim();
|
||||
if (desc.length() > 500) {
|
||||
throw new JeecgBootException("原因长度不能超过500个字符");
|
||||
}
|
||||
entity.setReasonDesc(desc);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编号001递增、类型与条码类型必填-----------
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
-- MES 胶料小料锁定原因增加原因字段 + 胶料小料锁定日志(质量管理菜单)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_log:*
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @reason_desc_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'mes_xsl_rubber_small_lock_reason'
|
||||
AND COLUMN_NAME = 'reason_desc'
|
||||
);
|
||||
SET @ddl_reason_desc := IF(
|
||||
@reason_desc_exists = 0,
|
||||
'ALTER TABLE `mes_xsl_rubber_small_lock_reason` ADD COLUMN `reason_desc` varchar(500) NOT NULL DEFAULT '''' COMMENT ''原因(手动输入,必填)'' AFTER `barcode_type`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_reason_desc FROM @ddl_reason_desc;
|
||||
EXECUTE stmt_reason_desc;
|
||||
DEALLOCATE PREPARE stmt_reason_desc;
|
||||
|
||||
UPDATE `mes_xsl_rubber_small_lock_reason` SET `reason_desc` = CONCAT('原因', `reason_code`) WHERE `reason_desc` = '' OR `reason_desc` IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_log` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`lock_reason_id` varchar(32) NOT NULL COMMENT '锁定原因ID mes_xsl_rubber_small_lock_reason.id',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type)',
|
||||
`barcode` varchar(128) NOT NULL COMMENT '条码',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '状态(字典xslmes_rubber_small_lock_type,来自锁定原因)',
|
||||
`reason_desc` varchar(500) NOT NULL COMMENT '原因(来自锁定原因冗余)',
|
||||
`log_date` date NOT NULL COMMENT '日期',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrsl_log_tenant_date` (`tenant_id`, `log_date`),
|
||||
KEY `idx_mrsl_log_barcode` (`tenant_id`, `barcode_type`, `barcode`),
|
||||
KEY `idx_mrsl_log_reason` (`lock_reason_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 ('1860000000000000215', @mes_quality_pid, '胶料小料锁定日志', '/xslmes/mesXslRubberSmallLockLog', 'xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList', 'MesXslRubberSmallLockLogList', 1, NULL, '1', 7, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`component_name` = VALUES(`component_name`), `sort_no` = VALUES(`sort_no`), `is_leaf` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:file-text-outlined' WHERE `id` = '1860000000000000215' 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
|
||||
('1860000000000000216', '1860000000000000215', '新增', 2, 'mes:mes_xsl_rubber_small_lock_log:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000217', '1860000000000000215', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_log:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000218', '1860000000000000215', '删除', 2, 'mes:mes_xsl_rubber_small_lock_log:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000219', '1860000000000000215', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_log:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000220', '1860000000000000215', '导出', 2, 'mes:mes_xsl_rubber_small_lock_log:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000221', '1860000000000000215', '导入', 2, 'mes:mes_xsl_rubber_small_lock_log:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE `perms` = VALUES(`perms`), `name` = VALUES(`name`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NOW(), '127.0.0.1'
|
||||
FROM sys_role r
|
||||
CROSS JOIN sys_permission p
|
||||
WHERE r.tenant_id = @mes_tenant_id
|
||||
AND r.role_code = 'admin'
|
||||
AND p.id IN (
|
||||
'1860000000000000215',
|
||||
'1860000000000000216', '1860000000000000217', '1860000000000000218', '1860000000000000219',
|
||||
'1860000000000000220', '1860000000000000221'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_role_permission rp
|
||||
WHERE rp.role_id = r.id AND rp.permission_id = p.id
|
||||
);
|
||||
Reference in New Issue
Block a user