胶料小料锁定原因、锁定日志添加

This commit is contained in:
2026-06-02 16:37:48 +08:00
parent b8b06a881a
commit a08ca8985a
18 changed files with 942 additions and 0 deletions

View File

@@ -594,3 +594,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

View File

@@ -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);
}
}

View File

@@ -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 {

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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> {}

View File

@@ -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> {}

View File

@@ -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】胶料小料锁定日志保存时从原因主数据带出状态与原因-----------
}

View File

@@ -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递增、类型与条码类型必填-----------
}