2 Commits

24 changed files with 1443 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
-- 日罐物料对应信息菜单与权限挂到MES密炼工程目录
SET NAMES utf8mb4;
SET @mixer_parent_id = (
SELECT id
FROM sys_permission
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
);
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
SELECT id
FROM sys_permission
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
));
SET @mixer_parent_id = IFNULL(@mixer_parent_id, '1860000000000000001');
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 (
'1860000000000099311', @mixer_parent_id, '日罐物料对应信息',
'/mes/daytankmaterialmapinfo',
'mes/daytankmaterialmapinfo/index',
'MesXslDayTankMaterialMapList', 1, NULL, '1', 31,
1, 1, 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),
menu_type = VALUES(menu_type),
perms = VALUES(perms),
perms_type = VALUES(perms_type),
sort_no = VALUES(sort_no),
is_route = VALUES(is_route),
is_leaf = VALUES(is_leaf),
hidden = VALUES(hidden),
status = VALUES(status),
del_flag = VALUES(del_flag),
keep_alive = VALUES(keep_alive),
internal_or_external = VALUES(internal_or_external);
INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time) VALUES
('1860000000000099312', '1860000000000099311', '新增', 2, 'xslmes:mes_xsl_day_tank_material_map:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099313', '1860000000000099311', '编辑', 2, 'xslmes:mes_xsl_day_tank_material_map:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099314', '1860000000000099311', '删除', 2, 'xslmes:mes_xsl_day_tank_material_map:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099315', '1860000000000099311', '批量删除', 2, 'xslmes:mes_xsl_day_tank_material_map:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099316', '1860000000000099311', '导出', 2, 'xslmes:mes_xsl_day_tank_material_map:exportXls', '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),
status = VALUES(status),
del_flag = VALUES(del_flag);
-- admin 角色授权
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
FROM sys_permission p
WHERE p.id IN (
'1860000000000099311',
'1860000000000099312', '1860000000000099313', '1860000000000099314', '1860000000000099315', '1860000000000099316'
)
AND NOT EXISTS (
SELECT 1
FROM sys_role_permission rp
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
AND rp.permission_id = p.id
);
-- 强制修复确保菜单路由与组件路径正确避免历史错误路径导致查看组件引用是否正确
UPDATE sys_permission
SET
parent_id = @mixer_parent_id,
url = '/mes/daytankmaterialmapinfo',
component = 'mes/daytankmaterialmapinfo/index',
component_name = 'MesXslDayTankMaterialMapList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099311';

View File

@@ -0,0 +1,92 @@
-- 密炼机动作维护菜单与权限挂到MES密炼工程目录
SET NAMES utf8mb4;
SET @mixer_parent_id = (
SELECT id
FROM sys_permission
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
);
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
SELECT id
FROM sys_permission
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
));
SET @mixer_parent_id = IFNULL(@mixer_parent_id, '1860000000000000001');
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 (
'1860000000000099211', @mixer_parent_id, '密炼机动作维护',
'/mes/mixeractioninfo',
'mes/mixeractioninfo/index',
'MesXslMixerActionList', 1, NULL, '1', 30,
1, 1, 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),
menu_type = VALUES(menu_type),
perms = VALUES(perms),
perms_type = VALUES(perms_type),
sort_no = VALUES(sort_no),
is_route = VALUES(is_route),
is_leaf = VALUES(is_leaf),
hidden = VALUES(hidden),
status = VALUES(status),
del_flag = VALUES(del_flag),
keep_alive = VALUES(keep_alive),
internal_or_external = VALUES(internal_or_external);
INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time) VALUES
('1860000000000099212', '1860000000000099211', '新增', 2, 'xslmes:mes_xsl_mixer_action:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099213', '1860000000000099211', '编辑', 2, 'xslmes:mes_xsl_mixer_action:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099214', '1860000000000099211', '删除', 2, 'xslmes:mes_xsl_mixer_action:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099215', '1860000000000099211', '批量删除', 2, 'xslmes:mes_xsl_mixer_action:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099216', '1860000000000099211', '导出', 2, 'xslmes:mes_xsl_mixer_action:exportXls', '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),
status = VALUES(status),
del_flag = VALUES(del_flag);
-- admin 角色授权
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
FROM sys_permission p
WHERE p.id IN (
'1860000000000099211',
'1860000000000099212', '1860000000000099213', '1860000000000099214', '1860000000000099215', '1860000000000099216'
)
AND NOT EXISTS (
SELECT 1
FROM sys_role_permission rp
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
AND rp.permission_id = p.id
);
-- 强制修复确保菜单路由与组件路径正确避免历史错误路径导致查看组件引用是否正确
UPDATE sys_permission
SET
parent_id = @mixer_parent_id,
url = '/mes/mixeractioninfo',
component = 'mes/mixeractioninfo/index',
component_name = 'MesXslMixerActionList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099211';

View File

@@ -0,0 +1,151 @@
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 java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
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.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
import org.jeecg.modules.xslmes.service.IMesXslDayTankMaterialMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@Tag(name = "日罐物料对应信息")
@RestController
@RequestMapping("/xslmes/mesXslDayTankMaterialMap")
public class MesXslDayTankMaterialMapController
extends JeecgController<MesXslDayTankMaterialMap, IMesXslDayTankMaterialMapService> {
@Autowired private IMesXslDayTankMaterialMapService dayTankMaterialMapService;
@Operation(summary = "日罐物料对应信息-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslDayTankMaterialMap>> queryPageList(
MesXslDayTankMaterialMap model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslDayTankMaterialMap> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslDayTankMaterialMap> pageList = dayTankMaterialMapService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "日罐物料对应信息-添加")
@Operation(summary = "日罐物料对应信息-添加")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslDayTankMaterialMap model) {
String err = validateForSave(model);
if (err != null) {
return Result.error(err);
}
dayTankMaterialMapService.fillReferenceFields(model);
if (StringUtils.isBlank(model.getMachineCode()) || StringUtils.isBlank(model.getMachineName())) {
return Result.error("请选择有效的机台名称");
}
if (StringUtils.isBlank(model.getMaterialName())) {
return Result.error("请选择有效的物料名称");
}
dayTankMaterialMapService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "日罐物料对应信息-编辑")
@Operation(summary = "日罐物料对应信息-编辑")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslDayTankMaterialMap model) {
String err = validateForSave(model);
if (err != null) {
return Result.error(err);
}
dayTankMaterialMapService.fillReferenceFields(model);
if (StringUtils.isBlank(model.getMachineCode()) || StringUtils.isBlank(model.getMachineName())) {
return Result.error("请选择有效的机台名称");
}
if (StringUtils.isBlank(model.getMaterialName())) {
return Result.error("请选择有效的物料名称");
}
dayTankMaterialMapService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "日罐物料对应信息-通过id删除")
@Operation(summary = "日罐物料对应信息-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
dayTankMaterialMapService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "日罐物料对应信息-批量删除")
@Operation(summary = "日罐物料对应信息-批量删除")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
dayTankMaterialMapService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "日罐物料对应信息-通过id查询")
@GetMapping("/queryById")
public Result<MesXslDayTankMaterialMap> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslDayTankMaterialMap entity = dayTankMaterialMapService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslDayTankMaterialMap model) {
return super.exportXls(request, model, MesXslDayTankMaterialMap.class, "日罐物料对应信息");
}
private String validateForSave(MesXslDayTankMaterialMap model) {
if (oConvertUtils.isEmpty(model.getEquipmentId()) || StringUtils.isBlank(model.getEquipmentId())) {
return "机台名称不能为空";
}
model.setEquipmentId(model.getEquipmentId().trim());
if (oConvertUtils.isEmpty(model.getMaterialId()) || StringUtils.isBlank(model.getMaterialId())) {
return "物料名称不能为空";
}
model.setMaterialId(model.getMaterialId().trim());
if (model.getUseStatus() == null) {
model.setUseStatus(1);
}
if (model.getAllowSync() == null) {
model.setAllowSync(1);
}
if (model.getSiloCategoryId() != null) {
model.setSiloCategoryId(model.getSiloCategoryId().trim());
}
if (model.getStation() != null) {
model.setStation(model.getStation().trim());
}
if (model.getSiloNo() != null) {
model.setSiloNo(model.getSiloNo().trim());
}
return null;
}
}

View File

@@ -0,0 +1,167 @@
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 java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
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.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
import org.jeecg.modules.xslmes.service.IMesXslMixerActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@Tag(name = "密炼机动作维护")
@RestController
@RequestMapping("/xslmes/mesXslMixerAction")
public class MesXslMixerActionController extends JeecgController<MesXslMixerAction, IMesXslMixerActionService> {
@Autowired private IMesXslMixerActionService mesXslMixerActionService;
@Operation(summary = "密炼机动作维护-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslMixerAction>> queryPageList(
MesXslMixerAction model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslMixerAction> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslMixerAction> pageList = mesXslMixerActionService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "密炼机动作维护-添加")
@Operation(summary = "密炼机动作维护-添加")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslMixerAction model) {
String err = validateForSave(model, null);
if (err != null) {
return Result.error(err);
}
mesXslMixerActionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerActionService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "密炼机动作维护-编辑")
@Operation(summary = "密炼机动作维护-编辑")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslMixerAction model) {
String err = validateForSave(model, model.getId());
if (err != null) {
return Result.error(err);
}
mesXslMixerActionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerActionService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "密炼机动作维护-通过id删除")
@Operation(summary = "密炼机动作维护-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslMixerActionService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "密炼机动作维护-批量删除")
@Operation(summary = "密炼机动作维护-批量删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslMixerActionService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "密炼机动作维护-通过id查询")
@GetMapping("/queryById")
public Result<MesXslMixerAction> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixerAction entity = mesXslMixerActionService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "校验动作名称是否重复")
@GetMapping("/checkActionName")
public Result<String> checkActionName(
@RequestParam(name = "actionName", required = true) String actionName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(actionName) || actionName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerActionService.isActionNameDuplicated(actionName, dataId)) {
return Result.error("动作名称不能重复");
}
return Result.OK("该值可用!");
}
@Operation(summary = "校验动作代号是否重复")
@GetMapping("/checkActionCode")
public Result<String> checkActionCode(
@RequestParam(name = "actionCode", required = true) String actionCode,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(actionCode) || actionCode.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerActionService.isActionCodeDuplicated(actionCode, dataId)) {
return Result.error("动作代号不能重复");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("xslmes:mes_xsl_mixer_action:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixerAction model) {
return super.exportXls(request, model, MesXslMixerAction.class, "密炼机动作维护");
}
private String validateForSave(MesXslMixerAction model, String excludeId) {
if (oConvertUtils.isEmpty(model.getEquipmentId()) || StringUtils.isBlank(model.getEquipmentId())) {
return "设备名称不能为空";
}
model.setEquipmentId(model.getEquipmentId().trim());
if (oConvertUtils.isEmpty(model.getActionName()) || StringUtils.isBlank(model.getActionName())) {
return "动作名称不能为空";
}
model.setActionName(model.getActionName().trim());
if (mesXslMixerActionService.isActionNameDuplicated(model.getActionName(), excludeId)) {
return "动作名称不能重复";
}
if (oConvertUtils.isEmpty(model.getActionCode()) || StringUtils.isBlank(model.getActionCode())) {
return "动作代号不能为空";
}
model.setActionCode(model.getActionCode().trim());
if (mesXslMixerActionService.isActionCodeDuplicated(model.getActionCode(), excludeId)) {
return "动作代号不能重复";
}
return null;
}
}

View File

@@ -0,0 +1,90 @@
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 日罐物料对应信息
*/
@Data
@TableName("mes_xsl_day_tank_material_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES日罐物料对应信息")
public class MesXslDayTankMaterialMap implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "机台名称", width = 20, dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Schema(description = "设备台账ID")
private String equipmentId;
@Excel(name = "机台代码", width = 20)
@Schema(description = "机台代码(设备编号冗余)")
private String machineCode;
@Excel(name = "机台名称", width = 20)
@Schema(description = "机台名称冗余")
private String machineName;
@Excel(name = "料仓分类", width = 20, dictTable = "sys_category", dicText = "name", dicCode = "id")
@Dict(dictTable = "sys_category", dicText = "name", dicCode = "id")
@Schema(description = "料仓分类ID分类字典")
private String siloCategoryId;
@Excel(name = "工位", width = 20)
@Schema(description = "工位")
private String station;
@Excel(name = "料仓号", width = 20)
@Schema(description = "料仓号")
private String siloNo;
@Excel(name = "物料名称", width = 20, dictTable = "mes_material", dicText = "material_name", dicCode = "id")
@Dict(dictTable = "mes_material", dicText = "material_name", dicCode = "id")
@Schema(description = "胶料信息ID")
private String materialId;
@Excel(name = "物料名称", width = 20)
@Schema(description = "物料名称冗余")
private String materialName;
@Excel(name = "使用状态", width = 12, replace = {"使用中_1", "停用_0"})
@Schema(description = "使用状态1使用中 0停用")
private Integer useStatus;
@Excel(name = "是否允许同步", width = 12, replace = {"允许_1", "不允许_0"})
@Schema(description = "是否允许同步1允许 0不允许")
private Integer allowSync;
private Integer tenantId;
private String sysOrgCode;
private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer delFlag;
}

View File

@@ -0,0 +1,68 @@
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 密炼机动作维护
*/
@Data
@TableName("mes_xsl_mixer_action")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES密炼机动作维护")
public class MesXslMixerAction implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "设备名称", width = 20, dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Schema(description = "设备台账ID")
private String equipmentId;
@Excel(name = "设备名称", width = 20)
@Schema(description = "设备名称冗余")
private String equipmentName;
@Excel(name = "动作名称", width = 20)
@Schema(description = "动作名称")
private String actionName;
@Excel(name = "动作代号", width = 20)
@Schema(description = "动作代号")
private String actionCode;
@Excel(name = "备注", width = 30)
@Schema(description = "备注")
private String remark;
private Integer tenantId;
private String sysOrgCode;
private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer delFlag;
}

View File

@@ -0,0 +1,6 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
public interface MesXslDayTankMaterialMapMapper extends BaseMapper<MesXslDayTankMaterialMap> {}

View File

@@ -0,0 +1,6 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
public interface MesXslMixerActionMapper extends BaseMapper<MesXslMixerAction> {}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
public interface IMesXslDayTankMaterialMapService extends IService<MesXslDayTankMaterialMap> {
/**
* 由选择类字段ID回填冗余展示信息机台代码/机台名称/物料名称)
*/
void fillReferenceFields(MesXslDayTankMaterialMap model);
}

View File

@@ -0,0 +1,13 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
public interface IMesXslMixerActionService extends IService<MesXslMixerAction> {
boolean isActionNameDuplicated(String actionName, String excludeId);
boolean isActionCodeDuplicated(String actionCode, String excludeId);
void fillEquipmentName(MesXslMixerAction model);
}

View File

@@ -0,0 +1,56 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.mes.material.entity.MesMaterial;
import org.jeecg.modules.mes.material.mapper.MesMaterialMapper;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.mapper.MesXslDayTankMaterialMapMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.service.IMesXslDayTankMaterialMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MesXslDayTankMaterialMapServiceImpl
extends ServiceImpl<MesXslDayTankMaterialMapMapper, MesXslDayTankMaterialMap>
implements IMesXslDayTankMaterialMapService {
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
@Autowired private MesMaterialMapper mesMaterialMapper;
@Override
public void fillReferenceFields(MesXslDayTankMaterialMap model) {
if (model == null) {
return;
}
fillEquipmentFields(model);
fillMaterialFields(model);
}
private void fillEquipmentFields(MesXslDayTankMaterialMap model) {
if (StringUtils.isBlank(model.getEquipmentId())) {
model.setMachineCode(null);
model.setMachineName(null);
return;
}
MesXslEquipmentLedger equipment = equipmentLedgerMapper.selectById(model.getEquipmentId().trim());
if (equipment == null) {
model.setMachineCode(null);
model.setMachineName(null);
return;
}
model.setMachineCode(equipment.getEquipmentCode());
model.setMachineName(equipment.getEquipmentName());
}
private void fillMaterialFields(MesXslDayTankMaterialMap model) {
if (StringUtils.isBlank(model.getMaterialId())) {
model.setMaterialName(null);
return;
}
MesMaterial material = mesMaterialMapper.selectById(model.getMaterialId().trim());
model.setMaterialName(material == null ? null : material.getMaterialName());
}
}

View File

@@ -0,0 +1,58 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.mapper.MesXslMixerActionMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixerActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MesXslMixerActionServiceImpl extends ServiceImpl<MesXslMixerActionMapper, MesXslMixerAction>
implements IMesXslMixerActionService {
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
@Override
public boolean isActionNameDuplicated(String actionName, String excludeId) {
if (StringUtils.isBlank(actionName)) {
return false;
}
LambdaQueryWrapper<MesXslMixerAction> wrapper =
new LambdaQueryWrapper<MesXslMixerAction>().eq(MesXslMixerAction::getActionName, actionName.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerAction::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public boolean isActionCodeDuplicated(String actionCode, String excludeId) {
if (StringUtils.isBlank(actionCode)) {
return false;
}
LambdaQueryWrapper<MesXslMixerAction> wrapper =
new LambdaQueryWrapper<MesXslMixerAction>().eq(MesXslMixerAction::getActionCode, actionCode.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerAction::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public void fillEquipmentName(MesXslMixerAction model) {
if (model == null) {
return;
}
if (StringUtils.isBlank(model.getEquipmentId())) {
model.setEquipmentName(null);
return;
}
MesXslEquipmentLedger ledger = equipmentLedgerMapper.selectById(model.getEquipmentId().trim());
model.setEquipmentName(ledger == null ? null : ledger.getEquipmentName());
}
}

View File

@@ -0,0 +1,20 @@
-- MES 密炼机动作维护
CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_action` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_id` varchar(32) NOT NULL COMMENT '设备台账IDmes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称冗余',
`action_name` varchar(500) NOT NULL COMMENT '动作名称同租户未删除数据中唯一',
`action_code` varchar(500) NOT NULL COMMENT '动作代号同租户未删除数据中唯一',
`remark` varchar(1000) DEFAULT NULL COMMENT '备注',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
KEY `idx_mxma_equipment` (`equipment_id`),
KEY `idx_mxma_tenant_action_name` (`tenant_id`, `action_name`, `del_flag`),
KEY `idx_mxma_tenant_action_code` (`tenant_id`, `action_code`, `del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES密炼机动作维护';

View File

@@ -0,0 +1,24 @@
-- MES 日罐物料对应信息
CREATE TABLE IF NOT EXISTS `mes_xsl_day_tank_material_map` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_id` varchar(32) NOT NULL COMMENT '设备台账IDmes_xsl_equipment_ledger.id',
`machine_code` varchar(500) DEFAULT NULL COMMENT '机台代码设备编号冗余',
`machine_name` varchar(500) DEFAULT NULL COMMENT '机台名称冗余',
`silo_category_id` varchar(32) DEFAULT NULL COMMENT '料仓分类IDsys_category.id',
`station` varchar(500) DEFAULT NULL COMMENT '工位',
`silo_no` varchar(500) DEFAULT NULL COMMENT '料仓号',
`material_id` varchar(32) NOT NULL COMMENT '物料IDmes_material.id',
`material_name` varchar(500) DEFAULT NULL COMMENT '物料名称冗余',
`use_status` int DEFAULT 1 COMMENT '使用状态1使用中 0停用',
`allow_sync` int DEFAULT 1 COMMENT '是否允许同步1允许 0不允许',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
KEY `idx_mxdtm_equipment` (`equipment_id`),
KEY `idx_mxdtm_material` (`material_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES日罐物料对应信息';

View File

@@ -0,0 +1,7 @@
<template>
<MesXslDayTankMaterialMapList />
</template>
<script lang="ts" setup>
import MesXslDayTankMaterialMapList from '../../xslmes/mesXslDayTankMaterialMap/MesXslDayTankMaterialMapList.vue';
</script>

View File

@@ -0,0 +1,7 @@
<template>
<MesXslMixerActionList />
</template>
<script lang="ts" setup>
import MesXslMixerActionList from '../../xslmes/mesXslMixerAction/MesXslMixerActionList.vue';
</script>

View File

@@ -0,0 +1,28 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslDayTankMaterialMap/list',
save = '/xslmes/mesXslDayTankMaterialMap/add',
edit = '/xslmes/mesXslDayTankMaterialMap/edit',
deleteOne = '/xslmes/mesXslDayTankMaterialMap/delete',
deleteBatch = '/xslmes/mesXslDayTankMaterialMap/deleteBatch',
queryById = '/xslmes/mesXslDayTankMaterialMap/queryById',
exportXls = '/xslmes/mesXslDayTankMaterialMap/exportXls',
equipmentQueryById = '/xslmes/mesXslEquipmentLedger/queryById',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const queryEquipmentById = (params: { id: string }) => defHttp.get({ url: Api.equipmentQueryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,154 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { loadTreeData } from '/@/api/common/api';
import { queryEquipmentById } from './MesXslDayTankMaterialMap.api';
function useStatusText(v: unknown) {
if (v === 1) return '使用中';
if (v === 0) return '停用';
return '-';
}
function allowSyncText(v: unknown) {
if (v === 1) return '允许';
if (v === 0) return '不允许';
return '-';
}
const useStatusOptions = [
{ label: '使用中', value: 1 },
{ label: '停用', value: 0 },
];
const allowSyncOptions = [
{ label: '允许', value: 1 },
{ label: '不允许', value: 0 },
];
export const columns: BasicColumn[] = [
{ title: '机台代码', align: 'center', dataIndex: 'machineCode', width: 140 },
{ title: '机台名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 160 },
{ title: '料仓分类', align: 'center', dataIndex: 'siloCategoryId_dictText', width: 140 },
{ title: '工位', align: 'center', dataIndex: 'station', width: 120 },
{ title: '料仓号', align: 'center', dataIndex: 'siloNo', width: 120 },
{ title: '物料名称', align: 'center', dataIndex: 'materialId_dictText', width: 160 },
{
title: '使用状态',
align: 'center',
dataIndex: 'useStatus',
width: 120,
customRender: ({ text }) => useStatusText(text),
},
{
title: '是否允许同步',
align: 'center',
dataIndex: 'allowSync',
width: 120,
customRender: ({ text }) => allowSyncText(text),
},
];
export const searchFormSchema: FormSchema[] = [
{
label: '机台名称',
field: 'equipmentId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
colProps: { span: 6 },
},
{
label: '物料名称',
field: 'materialId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_material,material_name,id' },
colProps: { span: 6 },
},
{
label: '料仓分类',
field: 'siloCategoryId',
component: 'ApiSelect',
componentProps: {
api: loadTreeData,
params: { pcode: 'XSLMES_LCTYPE' },
resultField: '',
labelField: 'title',
valueField: 'key',
placeholder: '请选择料仓分类',
},
colProps: { span: 6 },
},
{
label: '使用状态',
field: 'useStatus',
component: 'Select',
componentProps: { options: useStatusOptions },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '机台名称',
field: 'equipmentId',
component: 'JDictSelectTag',
required: true,
componentProps: ({ formModel }) => ({
dictCode: 'mes_xsl_equipment_ledger,equipment_name,id',
placeholder: '请选择设备台账中的机台名称',
onChange: async (value: string) => {
if (!value) {
formModel.machineCode = '';
return;
}
try {
const equipment = await queryEquipmentById({ id: value });
formModel.machineCode = equipment?.equipmentCode || '';
} catch {
formModel.machineCode = '';
}
},
}),
},
{
label: '机台代码',
field: 'machineCode',
component: 'Input',
componentProps: { disabled: true, placeholder: '选择机台名称后自动带出设备编号' },
},
{
label: '料仓分类',
field: 'siloCategoryId',
component: 'ApiSelect',
componentProps: {
api: loadTreeData,
params: { pcode: 'XSLMES_LCTYPE' },
resultField: '',
labelField: 'title',
valueField: 'key',
placeholder: '请选择料仓分类',
},
},
{ label: '工位', field: 'station', component: 'Input' },
{ label: '料仓号', field: 'siloNo', component: 'Input' },
{
label: '物料名称',
field: 'materialId',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息中的物料名称' },
},
{
label: '使用状态',
field: 'useStatus',
component: 'Select',
defaultValue: 1,
componentProps: { options: useStatusOptions },
},
{
label: '是否允许同步',
field: 'allowSync',
component: 'Select',
defaultValue: 1,
componentProps: { options: allowSyncOptions },
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_day_tank_material_map:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_day_tank_material_map:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-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>批量操作<Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslDayTankMaterialMapModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslDayTankMaterialMapModal from './modules/MesXslDayTankMaterialMapModal.vue';
import { columns, searchFormSchema } from './MesXslDayTankMaterialMap.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslDayTankMaterialMap.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '日罐物料对应信息',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
actionColumn: { width: 120, fixed: 'right' },
},
exportConfig: { name: '日罐物料对应信息', url: getExportUrl },
});
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 }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_day_tank_material_map:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_day_tank_material_map:delete',
},
];
}
</script>

View File

@@ -0,0 +1,67 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="760px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</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 '../MesXslDayTankMaterialMap.data';
import { queryEquipmentById, saveOrUpdate } from '../MesXslDayTankMaterialMap.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
} else {
await setFieldsValue({ useStatus: 1, allowSync: 1 });
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() =>
!unref(isUpdate) ? '新增日罐物料对应信息' : unref(isDetail) ? '日罐物料对应信息详情' : '编辑日罐物料对应信息',
);
async function fillMachineCodeByEquipment() {
const values = getFieldsValue();
if (!values?.equipmentId) {
await setFieldsValue({ machineCode: '' });
return;
}
try {
const equipment = await queryEquipmentById({ id: values.equipmentId });
await setFieldsValue({ machineCode: equipment?.equipmentCode || '' });
} catch {
await setFieldsValue({ machineCode: '' });
}
}
async function handleSubmit() {
try {
await fillMachineCodeByEquipment();
const values = await validate();
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,33 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslMixerAction/list',
checkActionName = '/xslmes/mesXslMixerAction/checkActionName',
checkActionCode = '/xslmes/mesXslMixerAction/checkActionCode',
save = '/xslmes/mesXslMixerAction/add',
edit = '/xslmes/mesXslMixerAction/edit',
deleteOne = '/xslmes/mesXslMixerAction/delete',
deleteBatch = '/xslmes/mesXslMixerAction/deleteBatch',
queryById = '/xslmes/mesXslMixerAction/queryById',
exportXls = '/xslmes/mesXslMixerAction/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const checkActionName = (params: { actionName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkActionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const checkActionCode = (params: { actionCode: string; dataId?: string }) =>
defHttp.get({ url: Api.checkActionCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,76 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkActionCode, checkActionName } from './MesXslMixerAction.api';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 180 },
{ title: '动作名称', align: 'center', dataIndex: 'actionName', width: 180 },
{ title: '动作代号', align: 'center', dataIndex: 'actionCode', width: 160 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
];
export const searchFormSchema: FormSchema[] = [
{
label: '设备名称',
field: 'equipmentId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
colProps: { span: 6 },
},
{ label: '动作名称', field: 'actionName', component: 'Input', colProps: { span: 6 } },
{ label: '动作代号', field: 'actionCode', component: 'Input', colProps: { span: 6 } },
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '设备名称',
field: 'equipmentId',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择设备台账中的设备' },
},
{
label: '动作名称',
field: 'actionName',
component: 'Input',
required: true,
dynamicRules: ({ model }) => [
{ required: true, message: '请输入动作名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkActionName({ actionName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '动作名称不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '动作代号',
field: 'actionCode',
component: 'Input',
required: true,
dynamicRules: ({ model }) => [
{ required: true, message: '请输入动作代号' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkActionCode({ actionCode: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '动作代号不能重复');
}
},
trigger: 'blur',
},
],
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_mixer_action:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_action:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-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>批量操作<Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslMixerActionModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslMixerActionModal from './modules/MesXslMixerActionModal.vue';
import { columns, searchFormSchema } from './MesXslMixerAction.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMixerAction.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '密炼机动作维护',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
actionColumn: { width: 120, fixed: 'right' },
},
exportConfig: { name: '密炼机动作维护', url: getExportUrl },
});
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 }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_mixer_action:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_mixer_action:delete',
},
];
}
</script>

View File

@@ -0,0 +1,48 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="680px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</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 '../MesXslMixerAction.data';
import { saveOrUpdate } from '../MesXslMixerAction.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
}
setProps({ disabled: !data?.showFooter });
});
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>