Compare commits
2 Commits
e92cab555f
...
38f22ef8bd
| Author | SHA1 | Date | |
|---|---|---|---|
| 38f22ef8bd | |||
| a08ca8985a |
@@ -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
|
||||
);
|
||||
@@ -0,0 +1,48 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslRubberSmallLockLog/list',
|
||||
save = '/xslmes/mesXslRubberSmallLockLog/add',
|
||||
edit = '/xslmes/mesXslRubberSmallLockLog/edit',
|
||||
deleteOne = '/xslmes/mesXslRubberSmallLockLog/delete',
|
||||
deleteBatch = '/xslmes/mesXslRubberSmallLockLog/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslRubberSmallLockLog/importExcel',
|
||||
exportXls = '/xslmes/mesXslRubberSmallLockLog/exportXls',
|
||||
queryById = '/xslmes/mesXslRubberSmallLockLog/queryById',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const 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,110 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '类型', align: 'center', dataIndex: 'barcodeType_dictText', width: 90 },
|
||||
{ title: '条码', align: 'center', dataIndex: 'barcode', width: 140 },
|
||||
{ title: '状态', align: 'center', dataIndex: 'lockType_dictText', width: 90 },
|
||||
{ title: '原因', align: 'center', dataIndex: 'reasonDesc', width: 200, ellipsis: true },
|
||||
{ title: '日期', align: 'center', dataIndex: 'logDate', width: 110 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100 },
|
||||
{
|
||||
title: '修改日期',
|
||||
align: 'center',
|
||||
dataIndex: 'updateTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '类型',
|
||||
field: 'barcodeType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择类型' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '条码', field: 'barcode', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '状态',
|
||||
field: 'lockType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', placeholder: '请选择状态' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '日期',
|
||||
field: 'logDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'barcodeType',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
|
||||
},
|
||||
{
|
||||
label: '条码',
|
||||
field: 'barcode',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: { placeholder: '请输入条码', maxlength: 128 },
|
||||
},
|
||||
{
|
||||
label: '锁定原因',
|
||||
field: 'lockReasonId',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
slot: 'lockReasonSelect',
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'lockType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', disabled: true, placeholder: '选择锁定原因后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '原因',
|
||||
field: 'reasonDesc',
|
||||
component: 'InputTextArea',
|
||||
componentProps: { rows: 2, readonly: true, placeholder: '选择锁定原因后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '日期',
|
||||
field: 'logDate',
|
||||
component: 'DatePicker',
|
||||
required: true,
|
||||
defaultValue: dayjs().format('YYYY-MM-DD'),
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '创建人',
|
||||
field: 'createBy',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
{
|
||||
label: '修改人',
|
||||
field: 'updateBy',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
{
|
||||
label: '修改日期',
|
||||
field: 'updateTime',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_log:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_log:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_log: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_small_lock_log:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'mes:mes_xsl_rubber_small_lock_log:edit',
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslRubberSmallLockLogModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRubberSmallLockLog" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslRubberSmallLockLogModal from './components/MesXslRubberSmallLockLogModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslRubberSmallLockLog.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberSmallLockLog.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '胶料小料锁定日志',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '胶料小料锁定日志',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
selectedRowKeys.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_rubber_small_lock_log:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="640px" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #lockReasonSelect="{ model, field }">
|
||||
<a-select
|
||||
v-model:value="model[field]"
|
||||
:options="reasonOptions"
|
||||
:disabled="isDetail || !model.barcodeType"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
placeholder="请先选择类型,再选择锁定原因"
|
||||
style="width: 100%"
|
||||
@change="(val) => onLockReasonChange(val, model)"
|
||||
/>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslRubberSmallLockLog.data';
|
||||
import { saveOrUpdate } from '../MesXslRubberSmallLockLog.api';
|
||||
import { optionsByBarcodeType } from '../../mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(false);
|
||||
const isDetail = ref(false);
|
||||
const reasonOptions = ref<{ label: string; value: string; lockType?: string; reasonDesc?: string }[]>([]);
|
||||
const reasonMap = ref<Record<string, { lockType?: string; reasonDesc?: string }>>({});
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue, updateSchema }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
async function loadReasonOptions(barcodeType?: string, keepReasonId?: string) {
|
||||
reasonOptions.value = [];
|
||||
reasonMap.value = {};
|
||||
if (!barcodeType) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const list = await optionsByBarcodeType({ barcodeType });
|
||||
const rows = Array.isArray(list) ? list : [];
|
||||
reasonOptions.value = rows.map((r: Recordable) => {
|
||||
const label = `${r.reasonCode || ''} ${r.reasonDesc || ''}`.trim();
|
||||
reasonMap.value[r.id] = { lockType: r.lockType, reasonDesc: r.reasonDesc };
|
||||
return { label, value: r.id, lockType: r.lockType, reasonDesc: r.reasonDesc };
|
||||
});
|
||||
if (keepReasonId && reasonMap.value[keepReasonId]) {
|
||||
onLockReasonChange(keepReasonId, getFieldsValue());
|
||||
}
|
||||
} catch {
|
||||
reasonOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
function onLockReasonChange(val: string | undefined, model: Recordable) {
|
||||
if (!val) {
|
||||
model.lockType = undefined;
|
||||
model.reasonDesc = undefined;
|
||||
return;
|
||||
}
|
||||
const row = reasonMap.value[val];
|
||||
if (row) {
|
||||
model.lockType = row.lockType;
|
||||
model.reasonDesc = row.reasonDesc;
|
||||
}
|
||||
}
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
reasonOptions.value = [];
|
||||
reasonMap.value = {};
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
const record = { ...data.record };
|
||||
await setFieldsValue(record);
|
||||
await loadReasonOptions(record.barcodeType, record.lockReasonId);
|
||||
} else {
|
||||
await setFieldsValue({ logDate: dayjs().format('YYYY-MM-DD') });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
updateSchema({
|
||||
field: 'barcodeType',
|
||||
componentProps: {
|
||||
dictCode: 'xslmes_rubber_small_lock_barcode_type',
|
||||
placeholder: '请选择条码类型',
|
||||
disabled: !data?.showFooter,
|
||||
onChange: async (val: string) => {
|
||||
await setFieldsValue({ lockReasonId: undefined, lockType: undefined, reasonDesc: undefined });
|
||||
await loadReasonOptions(val);
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增胶料小料锁定日志' : unref(isDetail) ? '锁定日志详情' : '编辑胶料小料锁定日志',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -13,6 +13,7 @@ enum Api {
|
||||
importExcel = '/xslmes/mesXslRubberSmallLockReason/importExcel',
|
||||
exportXls = '/xslmes/mesXslRubberSmallLockReason/exportXls',
|
||||
queryById = '/xslmes/mesXslRubberSmallLockReason/queryById',
|
||||
optionsByBarcodeType = '/xslmes/mesXslRubberSmallLockReason/optionsByBarcodeType',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -24,6 +25,9 @@ export const queryById = (params: { id: string }) => defHttp.get({ url: Api.quer
|
||||
|
||||
export const fetchNextReasonCode = () => defHttp.get({ url: Api.nextReasonCode }, { successMessageMode: 'none' });
|
||||
|
||||
export const optionsByBarcodeType = (params: { barcodeType: string }) =>
|
||||
defHttp.get({ url: Api.optionsByBarcodeType, params }, { successMessageMode: 'none' });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
|
||||
@@ -4,6 +4,7 @@ export const columns: BasicColumn[] = [
|
||||
{ title: '编号', align: 'center', dataIndex: 'reasonCode', width: 100 },
|
||||
{ title: '类型', align: 'center', dataIndex: 'lockType_dictText', width: 100 },
|
||||
{ title: '条码类型', align: 'center', dataIndex: 'barcodeType_dictText', width: 100 },
|
||||
{ title: '原因', align: 'center', dataIndex: 'reasonDesc', width: 220, ellipsis: true },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{
|
||||
title: '创建日期',
|
||||
@@ -16,6 +17,7 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '编号', field: 'reasonCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '原因', field: 'reasonDesc', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'lockType',
|
||||
@@ -54,6 +56,14 @@ export const formSchema: FormSchema[] = [
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
|
||||
},
|
||||
{
|
||||
label: '原因',
|
||||
field: 'reasonDesc',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: { rows: 3, maxlength: 500, showCount: true, placeholder: '请输入原因' },
|
||||
},
|
||||
{
|
||||
label: '创建人',
|
||||
field: 'createBy',
|
||||
|
||||
Reference in New Issue
Block a user