更新胶料信息处理逻辑,优化字段描述及数据验证,增强系统稳定性和用户体验。

This commit is contained in:
geht
2026-05-20 19:06:58 +08:00
parent 9f37292eea
commit a10aae420a
17 changed files with 1731 additions and 0 deletions

View File

@@ -0,0 +1,261 @@
package org.jeecg.modules.xslmes.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
/**
* MES 密炼PS编制
*/
@Tag(name = "MES密炼PS编制")
@RestController
@RequestMapping("/xslmes/mesXslMixerPsCompile")
@Slf4j
public class MesXslMixerPsCompileController extends JeecgController<MesXslMixerPsCompile, IMesXslMixerPsCompileService> {
@Autowired
private IMesXslMixerPsCompileService mesXslMixerPsCompileService;
@Autowired
private ISysDepartService sysDepartService;
@Operation(summary = "MES密炼PS编制-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslMixerPsCompile>> queryPageList(
MesXslMixerPsCompile model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
customeRuleMap.put("psCode", QueryRuleEnum.LIKE);
customeRuleMap.put("title", QueryRuleEnum.LIKE);
QueryWrapper<MesXslMixerPsCompile> queryWrapper =
QueryGenerator.initQueryWrapper(model, req.getParameterMap(), customeRuleMap);
queryWrapper.orderByDesc("issue_date", "create_time");
Page<MesXslMixerPsCompile> page = new Page<>(pageNo, pageSize);
IPage<MesXslMixerPsCompile> pageList = mesXslMixerPsCompileService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES密炼PS编制-添加")
@Operation(summary = "MES密炼PS编制-添加")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslMixerPsCompile model) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
String err = validateAndFill(model);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
mesXslMixerPsCompileService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "MES密炼PS编制-编辑")
@Operation(summary = "MES密炼PS编制-编辑")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslMixerPsCompile model) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
String err = validateAndFill(model);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
MesXslMixerPsCompile existing = mesXslMixerPsCompileService.getById(model.getId());
if (existing == null) {
return Result.error("未找到对应数据");
}
if (!"compile".equals(existing.getStatus())) {
return Result.error("仅编制状态的单据允许编辑");
}
model.setStatus("compile");
model.setProofreadBy(existing.getProofreadBy());
model.setProofreadTime(existing.getProofreadTime());
model.setAuditBy(existing.getAuditBy());
model.setAuditTime(existing.getAuditTime());
model.setApproveBy(existing.getApproveBy());
model.setApproveTime(existing.getApproveTime());
mesXslMixerPsCompileService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES密炼PS编制-删除")
@Operation(summary = "MES密炼PS编制-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
MesXslMixerPsCompile existing = mesXslMixerPsCompileService.getById(id);
String err = assertCompileStatusForDelete(existing);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
mesXslMixerPsCompileService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES密炼PS编制-批量删除")
@Operation(summary = "MES密炼PS编制-批量删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
if (oConvertUtils.isEmpty(ids)) {
return Result.error("请选择要删除的记录");
}
for (String id : ids.split(",")) {
if (oConvertUtils.isEmpty(id)) {
continue;
}
MesXslMixerPsCompile existing = mesXslMixerPsCompileService.getById(id.trim());
String err = assertCompileStatusForDelete(existing);
if (err != null) {
return Result.error(err);
}
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
mesXslMixerPsCompileService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES密炼PS编制-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslMixerPsCompile> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixerPsCompile entity = mesXslMixerPsCompileService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixerPsCompile model) {
return super.exportXls(request, model, MesXslMixerPsCompile.class, "密炼PS编制");
}
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslMixerPsCompile.class);
}
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】校对/审核/批准-----------
@AutoLog(value = "MES密炼PS编制-校对")
@Operation(summary = "MES密炼PS编制-校对")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:proofread")
@PostMapping(value = "/proofread")
public Result<String> proofread(@RequestParam(name = "ids") String ids) {
return doChangeStatus(ids, "compile", "proofread", "校对");
}
@AutoLog(value = "MES密炼PS编制-审核")
@Operation(summary = "MES密炼PS编制-审核")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:audit")
@PostMapping(value = "/audit")
public Result<String> audit(@RequestParam(name = "ids") String ids) {
return doChangeStatus(ids, "proofread", "audit", "审核");
}
@AutoLog(value = "MES密炼PS编制-批准")
@Operation(summary = "MES密炼PS编制-批准")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:approve")
@PostMapping(value = "/approve")
public Result<String> approve(@RequestParam(name = "ids") String ids) {
return doChangeStatus(ids, "audit", "approve", "批准");
}
private Result<String> doChangeStatus(String ids, String expectedStatus, String targetStatus, String actionLabel) {
String err = mesXslMixerPsCompileService.changeStatusBatch(
ids, expectedStatus, targetStatus, actionLabel, getOperatorName());
if (err != null) {
return Result.error(err);
}
return Result.OK(actionLabel + "成功!");
}
private String getOperatorName() {
LoginUser loginUser = null;
try {
loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
} catch (Exception e) {
log.debug("获取当前登录用户失败", e);
}
if (loginUser == null) {
return null;
}
if (oConvertUtils.isNotEmpty(loginUser.getRealname())) {
return loginUser.getRealname();
}
return loginUser.getUsername();
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】校对/审核/批准-----------
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
private String validateAndFill(MesXslMixerPsCompile model) {
if (oConvertUtils.isEmpty(model.getReceiveDeptId())) {
return "请选择收信部门";
}
if (oConvertUtils.isEmpty(model.getReferenceDeptId())) {
return "请选择参照部门";
}
if (oConvertUtils.isEmpty(model.getTitle())) {
return "请输入标题";
}
if (oConvertUtils.isEmpty(model.getStatus())) {
model.setStatus("compile");
}
if (oConvertUtils.isNotEmpty(model.getFactoryId())) {
SysDepart factory = sysDepartService.getById(model.getFactoryId());
if (factory == null) {
return "所选所属工厂不存在,请重新选择";
}
model.setFactoryName(factory.getDepartName());
} else {
model.setFactoryName(null);
}
return null;
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
private String assertCompileStatusForDelete(MesXslMixerPsCompile entity) {
if (entity == null) {
return "记录不存在或已删除";
}
String status = entity.getStatus() == null ? "" : entity.getStatus();
if (!"compile".equals(status)) {
String psCode = oConvertUtils.isEmpty(entity.getPsCode()) ? entity.getId() : entity.getPsCode();
return "PS编码[" + psCode + "]当前状态不允许删除,仅编制状态可删除";
}
return null;
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
}

View File

@@ -0,0 +1,152 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.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 密炼PS编制
*/
@Data
@TableName("mes_xsl_mixer_ps_compile")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES密炼PS编制")
public class MesXslMixerPsCompile implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "所属工厂", width = 20)
@Schema(description = "所属工厂名称冗余(公司)")
private String factoryName;
@Schema(description = "所属工厂IDsys_depart.id公司")
private String factoryId;
@Excel(name = "PS编码", width = 18)
@Schema(description = "PS编码")
private String psCode;
@Excel(name = "类型", width = 15, dicCode = "xslmes_ps_belong")
@Dict(dicCode = "xslmes_ps_belong")
@Schema(description = "类型字典PS归属")
private String psType;
@Excel(name = "施工代号", width = 15, dicCode = "xslmes_construction_code")
@Dict(dicCode = "xslmes_construction_code")
@Schema(description = "施工代号")
private String constructionCode;
@Excel(name = "发放日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "发放日期")
private Date issueDate;
@Excel(name = "发送部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "发送部门ID")
private String sendDeptId;
@Excel(name = "收信部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "收信部门ID")
private String receiveDeptId;
@Excel(name = "参照部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "参照部门ID")
private String referenceDeptId;
@Excel(name = "标题", width = 25)
@Schema(description = "标题")
private String title;
@Excel(name = "目的", width = 30)
@Schema(description = "目的")
private String purpose;
@Excel(name = "依据", width = 30)
@Schema(description = "依据")
private String basis;
@Excel(name = "内容", width = 40)
@Schema(description = "内容")
private String content;
@Excel(name = "担当", width = 12)
@Schema(description = "担当")
private String responsiblePerson;
@Excel(name = "状态", width = 10, dicCode = "xslmes_mixer_ps_status")
@Dict(dicCode = "xslmes_mixer_ps_status")
@Schema(description = "状态")
private String status;
@Excel(name = "校对人", width = 15)
@Schema(description = "校对人")
private String proofreadBy;
@Excel(name = "校对时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "校对时间")
private Date proofreadTime;
@Excel(name = "审核人", width = 15)
@Schema(description = "审核人")
private String auditBy;
@Excel(name = "审核时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "审核时间")
private Date auditTime;
@Excel(name = "批准人", width = 15)
@Schema(description = "批准人")
private String approveBy;
@Excel(name = "批准时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "批准时间")
private Date approveTime;
@Excel(name = "创建人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】创建人翻译为姓名供编制人展示-----------
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】创建人翻译为姓名供编制人展示-----------
private String createBy;
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Excel(name = "修改人", width = 15)
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;
@Schema(description = "租户ID")
private Integer tenantId;
private String sysOrgCode;
private Integer delFlag;
}

View File

@@ -0,0 +1,12 @@
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.MesXslMixerPsCompile;
/**
* MES 密炼PS编制 Mapper
*/
@Mapper
public interface MesXslMixerPsCompileMapper extends BaseMapper<MesXslMixerPsCompile> {
}

View File

@@ -0,0 +1,19 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
/**
* MES 密炼PS编制
*/
public interface IMesXslMixerPsCompileService extends IService<MesXslMixerPsCompile> {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
/**
* 批量变更状态(校验当前状态后更新,并记录操作人/时间)
*
* @return 失败原因null 表示成功
*/
String changeStatusBatch(String ids, String expectedStatus, String targetStatus, String actionLabel, String operatorName);
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
}

View File

@@ -0,0 +1,64 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
import org.jeecg.modules.xslmes.mapper.MesXslMixerPsCompileMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* MES 密炼PS编制
*/
@Service
public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCompileMapper, MesXslMixerPsCompile>
implements IMesXslMixerPsCompileService {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
@Override
@Transactional(rollbackFor = Exception.class)
public String changeStatusBatch(String ids, String expectedStatus, String targetStatus, String actionLabel,
String operatorName) {
if (oConvertUtils.isEmpty(ids)) {
return "请选择要" + actionLabel + "的记录";
}
List<String> idList = Arrays.asList(ids.split(","));
Date now = new Date();
for (String id : idList) {
if (oConvertUtils.isEmpty(id)) {
continue;
}
MesXslMixerPsCompile entity = getById(id.trim());
if (entity == null) {
return "记录不存在或已删除";
}
String current = entity.getStatus() == null ? "" : entity.getStatus();
if (!expectedStatus.equals(current)) {
String psCode = oConvertUtils.isEmpty(entity.getPsCode()) ? id : entity.getPsCode();
return "PS编码[" + psCode + "]当前状态不允许" + actionLabel + ",请先完成上一环节";
}
entity.setStatus(targetStatus);
fillWorkflowInfo(entity, targetStatus, operatorName, now);
updateById(entity);
}
return null;
}
private void fillWorkflowInfo(MesXslMixerPsCompile entity, String targetStatus, String operatorName, Date now) {
if ("proofread".equals(targetStatus)) {
entity.setProofreadBy(operatorName);
entity.setProofreadTime(now);
} else if ("audit".equals(targetStatus)) {
entity.setAuditBy(operatorName);
entity.setAuditTime(now);
} else if ("approve".equals(targetStatus)) {
entity.setApproveBy(operatorName);
entity.setApproveTime(now);
}
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
}

View File

@@ -0,0 +1,47 @@
-- MES 字典PS归属施工代号租户 1002
SET NAMES utf8mb4;
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000001', 'PS归属', 'xslmes_ps_belong', 'MES PS归属', 0, 'admin', NOW(), 0, 1002);
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000101', '1995000000000000001', '密炼示方', 'ml_formula', 1, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000102', '1995000000000000001', '原材料检验标准', 'raw_inspect_std', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000103', '1995000000000000001', '密炼作业指导书', 'ml_work_instruction', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000002', '施工代号', 'xslmes_construction_code', 'MES 施工代号', 0, 'admin', NOW(), 0, 1002);
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000201', '1995000000000000002', '实验施工', 'exp_construction', 1, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000202', '1995000000000000002', '量试施工', 'trial_construction', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000203', '1995000000000000002', '正规施工', 'formal_construction', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000204', '1995000000000000002', '混配合', 'mixing_compound', 4, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000205', '1995000000000000002', '药品计量', 'chemical_dosing', 5, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000206', '1995000000000000002', '硫化施工', 'vulcanization_construction', 6, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000207', '1995000000000000002', '原材料检测标准', 'raw_test_std', 7, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000208', '1995000000000000002', '硫化作业指导书', 'vulcanization_work_instruction', 8, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000209', '1995000000000000002', '密炼作业指导书', 'ml_work_instruction', 9, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000210', '1995000000000000002', '半制品作业指导书', 'semi_product_work_instruction', 10, 1, 'admin', NOW());

View File

@@ -0,0 +1,96 @@
-- 密炼PS编制状态字典 + 建表 + 菜单 MES技术管理+ admin 授权
SET NAMES utf8mb4;
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000003', '密炼PS状态', 'xslmes_mixer_ps_status', 'MES密炼PS编制状态', 0, 'admin', NOW(), 0, 1002);
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000301', '1995000000000000003', '编制', 'compile', 1, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000302', '1995000000000000003', '校对', 'proofread', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000303', '1995000000000000003', '审核', 'audit', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000304', '1995000000000000003', '批准', 'approve', 4, 1, 'admin', NOW());
CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_ps_compile` (
`id` varchar(32) NOT NULL COMMENT '主键',
`factory_id` varchar(32) DEFAULT NULL COMMENT '所属工厂IDsys_depart.id公司',
`factory_name` varchar(200) DEFAULT NULL COMMENT '所属工厂名称冗余',
`ps_code` varchar(100) DEFAULT NULL COMMENT 'PS编码',
`ps_type` varchar(64) DEFAULT NULL COMMENT '类型字典xslmes_ps_belong',
`construction_code` varchar(64) DEFAULT NULL COMMENT '施工代号字典xslmes_construction_code',
`issue_date` date DEFAULT NULL COMMENT '发放日期',
`send_dept_id` varchar(32) DEFAULT NULL COMMENT '发送部门ID',
`receive_dept_id` varchar(32) DEFAULT NULL COMMENT '收信部门ID',
`reference_dept_id` varchar(32) DEFAULT NULL COMMENT '参照部门ID',
`title` varchar(500) DEFAULT NULL COMMENT '标题',
`purpose` text COMMENT '目的',
`basis` text COMMENT '依据',
`content` text COMMENT '内容',
`responsible_person` varchar(100) DEFAULT NULL COMMENT '担当',
`status` varchar(32) DEFAULT 'compile' COMMENT '状态字典xslmes_mixer_ps_status',
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '所属部门',
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(50) DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
`del_flag` int NOT NULL DEFAULT 0 COMMENT '逻辑删除0正常 1已删除',
PRIMARY KEY (`id`),
KEY `idx_mxmps_ps_code` (`ps_code`),
KEY `idx_mxmps_issue_date` (`issue_date`),
KEY `idx_mxmps_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES密炼PS编制';
UPDATE `sys_permission`
SET `is_leaf` = 0, `update_time` = NOW()
WHERE `id` = '1900000000000000810' AND `is_leaf` = 1;
INSERT IGNORE INTO `sys_permission` (
`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`,
`menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`,
`hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`,
`del_flag`, `rule_flag`, `status`, `internal_or_external`
) VALUES (
'177925970995518', '1900000000000000810', '密炼PS编制', '/xslmes/mesXslMixerPsCompile',
'xslmes/mesXslMixerPsCompile/MesXslMixerPsCompileList', 1, 'MesXslMixerPsCompileList', NULL,
1, NULL, '0', 3.00, 0, 'ant-design:file-text-outlined', 0, 1,
0, 0, 'MES密炼PS编制', 'admin', NOW(), 'admin', NOW(),
0, 0, '1', 0
);
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995519', '177925970995518', '新增', 2, 'xslmes:mes_xsl_mixer_ps_compile:add', '1', 1.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995520', '177925970995518', '编辑', 2, 'xslmes:mes_xsl_mixer_ps_compile:edit', '1', 2.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995521', '177925970995518', '删除', 2, 'xslmes:mes_xsl_mixer_ps_compile:delete', '1', 3.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995522', '177925970995518', '批量删除', 2, 'xslmes:mes_xsl_mixer_ps_compile:deleteBatch', '1', 4.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995523', '177925970995518', '导出', 2, 'xslmes:mes_xsl_mixer_ps_compile:exportXls', '1', 5.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995524', '177925970995518', '导入', 2, 'xslmes:mes_xsl_mixer_ps_compile:importExcel', '1', 6.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`)
SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NULL, NOW(), '127.0.0.1'
FROM `sys_role` r
CROSS JOIN `sys_permission` p
WHERE r.`role_code` = 'admin'
AND p.`id` IN (
'177925970995518', '177925970995519', '177925970995520',
'177925970995521', '177925970995522', '177925970995523', '177925970995524'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
);

View File

@@ -0,0 +1,36 @@
-- 密炼PS编制状态字典调整为 编制校对审核批准并增加按钮权限
SET NAMES utf8mb4;
UPDATE `sys_dict_item`
SET `item_text` = '校对', `item_value` = 'proofread', `sort_order` = 2, `update_by` = 'admin', `update_time` = NOW()
WHERE `dict_id` = '1995000000000000003' AND (`item_value` = 'submitted' OR `id` = '1995000000000000302');
UPDATE `sys_dict_item`
SET `item_text` = '审核', `item_value` = 'audit', `sort_order` = 3, `update_by` = 'admin', `update_time` = NOW()
WHERE `dict_id` = '1995000000000000003' AND (`item_value` = 'approved' OR `id` = '1995000000000000303');
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000304', '1995000000000000003', '批准', 'approve', 4, 1, 'admin', NOW());
UPDATE `mes_xsl_mixer_ps_compile` SET `status` = 'proofread' WHERE `status` = 'submitted';
UPDATE `mes_xsl_mixer_ps_compile` SET `status` = 'audit' WHERE `status` = 'approved';
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995525', '177925970995518', '校对', 2, 'xslmes:mes_xsl_mixer_ps_compile:proofread', '1', 7.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995526', '177925970995518', '审核', 2, 'xslmes:mes_xsl_mixer_ps_compile:audit', '1', 8.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995527', '177925970995518', '批准', 2, 'xslmes:mes_xsl_mixer_ps_compile:approve', '1', 9.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`)
SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NULL, NOW(), '127.0.0.1'
FROM `sys_role` r
CROSS JOIN `sys_permission` p
WHERE r.`role_code` = 'admin'
AND p.`id` IN ('177925970995525', '177925970995526', '177925970995527')
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
);

View File

@@ -0,0 +1,52 @@
-- 密炼PS编制校对/审核/批准人时间字段收信/参照部门支持多选逗号分隔存储
SET NAMES utf8mb4;
SET @db = DATABASE();
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'proofread_by') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `proofread_by` varchar(50) DEFAULT NULL COMMENT ''校对人'' AFTER `status`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'proofread_time') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `proofread_time` datetime DEFAULT NULL COMMENT ''校对时间'' AFTER `proofread_by`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'audit_by') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `audit_by` varchar(50) DEFAULT NULL COMMENT ''审核人'' AFTER `proofread_time`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'audit_time') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `audit_time` datetime DEFAULT NULL COMMENT ''审核时间'' AFTER `audit_by`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'approve_by') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `approve_by` varchar(50) DEFAULT NULL COMMENT ''批准人'' AFTER `audit_time`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'approve_time') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `approve_time` datetime DEFAULT NULL COMMENT ''批准时间'' AFTER `approve_by`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
ALTER TABLE `mes_xsl_mixer_ps_compile`
MODIFY COLUMN `receive_dept_id` varchar(500) DEFAULT NULL COMMENT '收信部门ID多个逗号分隔';
ALTER TABLE `mes_xsl_mixer_ps_compile`
MODIFY COLUMN `reference_dept_id` varchar(500) DEFAULT NULL COMMENT '参照部门ID多个逗号分隔';

View File

@@ -0,0 +1,44 @@
-- PS审批历史状态展示字典键值与原状态一致批准改为正式发布+ 菜单
SET NAMES utf8mb4;
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000004', '密炼PS审批历史状态', 'xslmes_mixer_ps_history_status', 'PS审批历史状态展示approve显示为正式发布', 0, 'admin', NOW(), 0, 1002);
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000401', '1995000000000000004', '编制', 'compile', 1, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000402', '1995000000000000004', '校对', 'proofread', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000403', '1995000000000000004', '审核', 'audit', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000404', '1995000000000000004', '正式发布', 'approve', 4, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_permission` (
`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`,
`menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`,
`hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`,
`del_flag`, `rule_flag`, `status`, `internal_or_external`
) VALUES (
'177925970995528', '1900000000000000810', 'PS审批历史', '/xslmes/mesXslMixerPsHistory',
'xslmes/mesXslMixerPsHistory/MesXslMixerPsHistoryList', 1, 'MesXslMixerPsHistoryList', NULL,
1, NULL, '0', 4.00, 0, 'ant-design:history-outlined', 0, 1,
0, 0, '查询密炼PS编制已批准记录', 'admin', NOW(), 'admin', NOW(),
0, 0, '1', 0
);
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
VALUES ('177925970995529', '177925970995528', '导出', 2, 'xslmes:mes_xsl_mixer_ps_history:exportXls', '1', 1.00, 0, 1, 0, '1', 0, 'admin', NOW());
INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`)
SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NULL, NOW(), '127.0.0.1'
FROM `sys_role` r
CROSS JOIN `sys_permission` p
WHERE r.`role_code` = 'admin'
AND p.`id` IN ('177925970995528', '177925970995529')
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
);