2 Commits

30 changed files with 1509 additions and 5 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 (
'1860000000000099411', @mixer_parent_id, '密炼机条件维护',
'/mes/mixerconditioninfo',
'mes/mixerconditioninfo/index',
'MesXslMixerConditionList', 1, NULL, '1', 32,
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
('1860000000000099412', '1860000000000099411', '新增', 2, 'xslmes:mes_xsl_mixer_condition:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099413', '1860000000000099411', '编辑', 2, 'xslmes:mes_xsl_mixer_condition:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099414', '1860000000000099411', '删除', 2, 'xslmes:mes_xsl_mixer_condition:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099415', '1860000000000099411', '批量删除', 2, 'xslmes:mes_xsl_mixer_condition:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099416', '1860000000000099411', '导出', 2, 'xslmes:mes_xsl_mixer_condition: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 (
'1860000000000099411',
'1860000000000099412', '1860000000000099413', '1860000000000099414', '1860000000000099415', '1860000000000099416'
)
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/mixerconditioninfo',
component = 'mes/mixerconditioninfo/index',
component_name = 'MesXslMixerConditionList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099411';

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 (
'1860000000000099511', @mixer_parent_id, '生产订单',
'/mes/productionorderinfo',
'mes/productionorderinfo/index',
'MesXslProductionOrderList', 1, NULL, '1', 33,
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
('1860000000000099512', '1860000000000099511', '新增', 2, 'xslmes:mes_xsl_production_order:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099513', '1860000000000099511', '编辑', 2, 'xslmes:mes_xsl_production_order:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099514', '1860000000000099511', '删除', 2, 'xslmes:mes_xsl_production_order:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099515', '1860000000000099511', '批量删除', 2, 'xslmes:mes_xsl_production_order:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099516', '1860000000000099511', '导出', 2, 'xslmes:mes_xsl_production_order: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 (
'1860000000000099511',
'1860000000000099512', '1860000000000099513', '1860000000000099514', '1860000000000099515', '1860000000000099516'
)
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/productionorderinfo',
component = 'mes/productionorderinfo/index',
component_name = 'MesXslProductionOrderList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099511';

View File

@@ -0,0 +1,168 @@
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.MesXslMixerCondition;
import org.jeecg.modules.xslmes.service.IMesXslMixerConditionService;
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/mesXslMixerCondition")
public class MesXslMixerConditionController
extends JeecgController<MesXslMixerCondition, IMesXslMixerConditionService> {
@Autowired private IMesXslMixerConditionService mesXslMixerConditionService;
@Operation(summary = "密炼机条件维护-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslMixerCondition>> queryPageList(
MesXslMixerCondition model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslMixerCondition> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslMixerCondition> pageList = mesXslMixerConditionService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "密炼机条件维护-添加")
@Operation(summary = "密炼机条件维护-添加")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslMixerCondition model) {
String err = validateForSave(model, null);
if (err != null) {
return Result.error(err);
}
mesXslMixerConditionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerConditionService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "密炼机条件维护-编辑")
@Operation(summary = "密炼机条件维护-编辑")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslMixerCondition model) {
String err = validateForSave(model, model.getId());
if (err != null) {
return Result.error(err);
}
mesXslMixerConditionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerConditionService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "密炼机条件维护-通过id删除")
@Operation(summary = "密炼机条件维护-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslMixerConditionService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "密炼机条件维护-批量删除")
@Operation(summary = "密炼机条件维护-批量删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslMixerConditionService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "密炼机条件维护-通过id查询")
@GetMapping("/queryById")
public Result<MesXslMixerCondition> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixerCondition entity = mesXslMixerConditionService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "校验条件名称是否重复")
@GetMapping("/checkConditionName")
public Result<String> checkConditionName(
@RequestParam(name = "conditionName", required = true) String conditionName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(conditionName) || conditionName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerConditionService.isConditionNameDuplicated(conditionName, dataId)) {
return Result.error("条件名称不能重复");
}
return Result.OK("该值可用!");
}
@Operation(summary = "校验条件代码是否重复")
@GetMapping("/checkConditionCode")
public Result<String> checkConditionCode(
@RequestParam(name = "conditionCode", required = true) String conditionCode,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(conditionCode) || conditionCode.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerConditionService.isConditionCodeDuplicated(conditionCode, dataId)) {
return Result.error("条件代码不能重复");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixerCondition model) {
return super.exportXls(request, model, MesXslMixerCondition.class, "密炼机条件维护");
}
private String validateForSave(MesXslMixerCondition model, String excludeId) {
if (oConvertUtils.isEmpty(model.getEquipmentId()) || StringUtils.isBlank(model.getEquipmentId())) {
return "设备名称不能为空";
}
model.setEquipmentId(model.getEquipmentId().trim());
if (oConvertUtils.isEmpty(model.getConditionName()) || StringUtils.isBlank(model.getConditionName())) {
return "条件名称不能为空";
}
model.setConditionName(model.getConditionName().trim());
if (mesXslMixerConditionService.isConditionNameDuplicated(model.getConditionName(), excludeId)) {
return "条件名称不能重复";
}
if (oConvertUtils.isEmpty(model.getConditionCode()) || StringUtils.isBlank(model.getConditionCode())) {
return "条件代码不能为空";
}
model.setConditionCode(model.getConditionCode().trim());
if (mesXslMixerConditionService.isConditionCodeDuplicated(model.getConditionCode(), excludeId)) {
return "条件代码不能重复";
}
return null;
}
}

View File

@@ -0,0 +1,100 @@
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.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.modules.xslmes.entity.MesXslProductionOrder;
import org.jeecg.modules.xslmes.service.IMesXslProductionOrderService;
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/mesXslProductionOrder")
public class MesXslProductionOrderController
extends JeecgController<MesXslProductionOrder, IMesXslProductionOrderService> {
@Autowired private IMesXslProductionOrderService mesXslProductionOrderService;
@Operation(summary = "生产订单-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslProductionOrder>> queryPageList(
MesXslProductionOrder model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslProductionOrder> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslProductionOrder> pageList = mesXslProductionOrderService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "生产订单-添加")
@Operation(summary = "生产订单-添加")
@RequiresPermissions("xslmes:mes_xsl_production_order:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslProductionOrder model) {
mesXslProductionOrderService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "生产订单-编辑")
@Operation(summary = "生产订单-编辑")
@RequiresPermissions("xslmes:mes_xsl_production_order:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslProductionOrder model) {
mesXslProductionOrderService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "生产订单-通过id删除")
@Operation(summary = "生产订单-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_production_order:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslProductionOrderService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "生产订单-批量删除")
@Operation(summary = "生产订单-批量删除")
@RequiresPermissions("xslmes:mes_xsl_production_order:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslProductionOrderService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "生产订单-通过id查询")
@GetMapping("/queryById")
public Result<MesXslProductionOrder> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslProductionOrder entity = mesXslProductionOrderService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("xslmes:mes_xsl_production_order:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslProductionOrder model) {
return super.exportXls(request, model, MesXslProductionOrder.class, "生产订单");
}
}

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_condition")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES密炼机条件维护")
public class MesXslMixerCondition 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 conditionName;
@Excel(name = "条件代码", width = 20)
@Schema(description = "条件代码")
private String conditionCode;
@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,82 @@
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.math.BigDecimal;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 生产订单
*/
@Data
@TableName("mes_xsl_production_order")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES生产订单")
public class MesXslProductionOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "销售订单号", width = 20)
private String salesOrderNo;
@Excel(name = "生产订单号", width = 20)
private String productionOrderNo;
@Excel(name = "订单日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date orderDate;
@Excel(name = "生产车间", width = 20)
private String productionWorkshop;
@Excel(name = "加工段数", width = 12)
private Integer processSegmentCount;
@Excel(name = "物料编号", width = 20)
private String materialCode;
@Excel(name = "MES胶料名称", width = 20)
private String mesMaterialName;
@Excel(name = "金蝶物料名称", width = 20)
private String kingdeeMaterialName;
@Excel(name = "金蝶物料规格", width = 20)
private String kingdeeMaterialSpec;
@Excel(name = "计划数量", width = 15)
private BigDecimal planQty;
@Excel(name = "拆分状态", width = 12, replace = {"已拆分_1", "未拆分_0"})
private Integer splitStatus;
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.MesXslMixerCondition;
public interface MesXslMixerConditionMapper extends BaseMapper<MesXslMixerCondition> {}

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.MesXslProductionOrder;
public interface MesXslProductionOrderMapper extends BaseMapper<MesXslProductionOrder> {}

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.MesXslMixerCondition;
public interface IMesXslMixerConditionService extends IService<MesXslMixerCondition> {
void fillEquipmentName(MesXslMixerCondition model);
boolean isConditionNameDuplicated(String conditionName, String excludeId);
boolean isConditionCodeDuplicated(String conditionCode, String excludeId);
}

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.MesXslProductionOrder;
public interface IMesXslProductionOrderService extends IService<MesXslProductionOrder> {}

View File

@@ -0,0 +1,59 @@
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.MesXslMixerCondition;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.mapper.MesXslMixerConditionMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixerConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MesXslMixerConditionServiceImpl
extends ServiceImpl<MesXslMixerConditionMapper, MesXslMixerCondition>
implements IMesXslMixerConditionService {
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
@Override
public boolean isConditionNameDuplicated(String conditionName, String excludeId) {
if (StringUtils.isBlank(conditionName)) {
return false;
}
LambdaQueryWrapper<MesXslMixerCondition> wrapper =
new LambdaQueryWrapper<MesXslMixerCondition>().eq(MesXslMixerCondition::getConditionName, conditionName.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerCondition::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public boolean isConditionCodeDuplicated(String conditionCode, String excludeId) {
if (StringUtils.isBlank(conditionCode)) {
return false;
}
LambdaQueryWrapper<MesXslMixerCondition> wrapper =
new LambdaQueryWrapper<MesXslMixerCondition>().eq(MesXslMixerCondition::getConditionCode, conditionCode.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerCondition::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public void fillEquipmentName(MesXslMixerCondition model) {
if (model == null) {
return;
}
if (StringUtils.isBlank(model.getEquipmentId())) {
model.setEquipmentName(null);
return;
}
MesXslEquipmentLedger equipment = equipmentLedgerMapper.selectById(model.getEquipmentId().trim());
model.setEquipmentName(equipment == null ? null : equipment.getEquipmentName());
}
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
import org.jeecg.modules.xslmes.mapper.MesXslProductionOrderMapper;
import org.jeecg.modules.xslmes.service.IMesXslProductionOrderService;
import org.springframework.stereotype.Service;
@Service
public class MesXslProductionOrderServiceImpl
extends ServiceImpl<MesXslProductionOrderMapper, MesXslProductionOrder>
implements IMesXslProductionOrderService {}

View File

@@ -31,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.servlet.http.HttpServletRequest;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -61,7 +63,7 @@ public class ThirdAppController {
*/
@GetMapping("/getEnabledType")
public Result getEnabledType() {
Map<String, Boolean> enabledMap = new HashMap(5);
Map<String, Boolean> enabledMap = new HashMap<>(5);
int tenantId;
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
@@ -75,6 +77,8 @@ public class ThirdAppController {
boolean dingConfig = false;
//企业微信是否已配置
boolean qywxConfig = false;
//金蝶是否已配置
boolean kingdeeConfig = false;
if(null != list && list.size()>0){
for (SysThirdAppConfig config:list) {
if(MessageTypeEnum.DD.getType().equals(config.getThirdType())){
@@ -85,10 +89,14 @@ public class ThirdAppController {
qywxConfig = true;
continue;
}
if("kingdee".equals(config.getThirdType())){
kingdeeConfig = true;
}
}
}
enabledMap.put("wechatEnterprise", qywxConfig);
enabledMap.put("dingtalk", dingConfig);
enabledMap.put("kingdee", kingdeeConfig);
return Result.OK(enabledMap);
}
@@ -473,6 +481,59 @@ public class ThirdAppController {
return result;
}
/**
* 测试金蝶配置连通性
*/
@GetMapping("/testKingdeeConnect")
public Result<String> testKingdeeConnect(@RequestParam(name = "tenantId", required = false) Integer tenantId) {
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
if (tenantId == null) {
return Result.error("开启多租户模式租户ID参数不允许为空");
}
} else if (tenantId == null) {
tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
}
SysThirdAppConfig config = appConfigService.getThirdConfigByThirdType(tenantId, "kingdee");
if (config == null) {
return Result.error("金蝶尚未配置,请先完成配置");
}
String rawUrl = config.getCorpId();
if (oConvertUtils.isEmpty(rawUrl)) {
return Result.error("金蝶服务地址为空,请先维护服务地址");
}
String endpoint = normalizeUrl(rawUrl);
HttpURLConnection conn = null;
try {
URL url = new URL(endpoint);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setUseCaches(false);
int code = conn.getResponseCode();
if (code >= 200 && code < 400) {
return Result.OK("连接成功HTTP状态码" + code);
}
return Result.error("连接失败HTTP状态码" + code);
} catch (Exception e) {
log.error("金蝶连通性测试失败", e);
return Result.error("连接失败:" + e.getMessage());
} finally {
if (conn != null) {
conn.disconnect();
}
}
}
private String normalizeUrl(String rawUrl) {
String url = rawUrl == null ? "" : rawUrl.trim();
if (!url.startsWith("http://") && !url.startsWith("https://")) {
url = "http://" + url;
}
return url;
}
/**
* 同步【钉钉】[部门和用户]到本地
*

View File

@@ -0,0 +1,18 @@
-- MES 密炼机条件维护
CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_condition` (
`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 '设备名称冗余',
`condition_name` varchar(500) NOT NULL COMMENT '条件名称',
`condition_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_mxmc_equipment` (`equipment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES密炼机条件维护';

View File

@@ -0,0 +1,24 @@
-- MES 生产订单
CREATE TABLE IF NOT EXISTS `mes_xsl_production_order` (
`id` varchar(32) NOT NULL COMMENT '主键',
`sales_order_no` varchar(500) DEFAULT NULL COMMENT '销售订单号',
`production_order_no` varchar(500) DEFAULT NULL COMMENT '生产订单号',
`order_date` date DEFAULT NULL COMMENT '订单日期',
`production_workshop` varchar(500) DEFAULT NULL COMMENT '生产车间',
`process_segment_count` int DEFAULT NULL COMMENT '加工段数',
`material_code` varchar(500) DEFAULT NULL COMMENT '物料编号',
`mes_material_name` varchar(500) DEFAULT NULL COMMENT 'MES胶料名称',
`kingdee_material_name` varchar(500) DEFAULT NULL COMMENT '金蝶物料名称',
`kingdee_material_spec` varchar(500) DEFAULT NULL COMMENT '金蝶物料规格',
`plan_qty` decimal(18,4) DEFAULT NULL COMMENT '计划数量',
`split_status` int DEFAULT 0 COMMENT '拆分状态0未拆分 1已拆分',
`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_mxpo_production_order_no` (`production_order_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES生产订单';

View File

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

View File

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

View File

@@ -11,6 +11,7 @@ enum Api {
getThirdUserBindByWechat = '/sys/thirdApp/getThirdUserBindByWechat',
deleteThirdAccount = '/sys/thirdApp/deleteThirdAccount',
deleteThirdAppConfig = '/sys/thirdApp/deleteThirdAppConfig',
testKingdeeConnect = '/sys/thirdApp/testKingdeeConnect',
}
/**
@@ -78,4 +79,11 @@ export const deleteThirdAppConfig = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteThirdAppConfig, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
/**
* 测试金蝶连接
*/
export const testKingdeeConnect = (params) => {
return defHttp.get({ url: Api.testKingdeeConnect, params }, { isTransformResponse: false });
};

View File

@@ -16,31 +16,43 @@ export const thirdAppFormSchema: FormSchema[] = [
show: false,
},
{
label: 'CorpId',
label: 'CorpId/服务地址',
field: 'corpId',
component: 'Input',
ifShow: ({ values }) => {
return values.thirdType === 'dingtalk';
return values.thirdType === 'dingtalk' || values.thirdType === 'kingdee';
},
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶服务地址,例如 https://xxx.xxx.com' : '请输入CorpId',
}),
},
{
label: 'Agentld',
label: 'AgentId/账套ID',
field: 'agentId',
component: 'Input',
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入账套ID可选业务标识' : '请输入AgentId',
}),
},
{
label: 'AppKey',
label: 'AppKey/AppId',
field: 'clientId',
component: 'Input',
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶AppId' : '请输入AppKey',
}),
},
{
label: 'AppSecret',
field: 'clientSecret',
component: 'Input',
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶AppSecret' : '请输入AppSecret',
}),
},{
label: '启用',
field: 'status',

View File

@@ -4,6 +4,7 @@
<ul class="ding-menu-tab">
<li :class="activeKey === 'ding' ? 'active' : ''" @click="dingLiClick('ding')"><a>钉钉集成</a></li>
<li :class="activeKey === 'wechat' ? 'active' : ''" @click="dingLiClick('wechat')"><a>企业微信集成</a></li>
<li :class="activeKey === 'kingdee' ? 'active' : ''" @click="dingLiClick('kingdee')"><a>金蝶集成</a></li>
</ul>
</div>
<div v-show="activeKey === 'ding'" class="base-collapse">
@@ -12,6 +13,9 @@
<div v-show="activeKey === 'wechat'" class="base-collapse">
<ThirdAppWeEnterpriseConfigForm />
</div>
<div v-show="activeKey === 'kingdee'" class="base-collapse">
<ThirdAppKingdeeConfigForm />
</div>
</div>
</template>
@@ -19,6 +23,7 @@
import { defineComponent, ref } from 'vue';
import ThirdAppDingTalkConfigForm from './ThirdAppDingTalkConfigForm.vue';
import ThirdAppWeEnterpriseConfigForm from './ThirdAppWeEnterpriseConfigForm.vue';
import ThirdAppKingdeeConfigForm from './ThirdAppKingdeeConfigForm.vue';
import { useDesign } from '/@/hooks/web/useDesign';
export default defineComponent({
@@ -26,6 +31,7 @@
components: {
ThirdAppDingTalkConfigForm,
ThirdAppWeEnterpriseConfigForm,
ThirdAppKingdeeConfigForm,
},
setup() {
const { prefixCls } = useDesign('j-dd-container');

View File

@@ -27,6 +27,8 @@
setModalProps({ confirmLoading: true });
if (data.thirdType == 'dingtalk') {
title.value = '钉钉配置';
} else if (data.thirdType == 'kingdee') {
title.value = '金蝶配置';
} else {
title.value = '企业微信配置';
}

View File

@@ -0,0 +1,182 @@
<template>
<div class="base-collapse">
<div class="header"> 金蝶集成 </div>
<a-collapse expand-icon-position="right" :bordered="false">
<a-collapse-panel key="1">
<template #header>
<div style="font-size: 16px"> 1.配置对接信息</div>
</template>
<div class="base-desc">先配置金蝶服务地址AppIdAppSecret保存后可进行连通性测试</div>
</a-collapse-panel>
</a-collapse>
<div class="sync-padding">
<a-collapse expand-icon-position="right" :bordered="false">
<a-collapse-panel key="2">
<template #header>
<div style="width: 100%; justify-content: space-between; display: flex">
<div style="font-size: 16px"> 2.配置录入及解绑</div>
</div>
</template>
<div class="flex-flow">
<div class="base-title">服务地址</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.corpId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">账套ID</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.agentId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">AppId</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.clientId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">AppSecret</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.clientSecret" readonly />
</div>
</div>
<div style="margin-top: 20px; width: 100%; text-align: right">
<a-button @click="kingdeeEditClick">编辑</a-button>
<a-button @click="testConnectClick" style="margin-left: 10px">连接测试</a-button>
<a-button v-if="appConfigData.id" @click="cancelBindClick" danger style="margin-left: 10px">取消绑定</a-button>
</div>
</a-collapse-panel>
</a-collapse>
</div>
</div>
<ThirdAppConfigModal @register="registerAppConfigModal" @success="handleSuccess" />
</template>
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import { deleteThirdAppConfig, getThirdConfigByTenantId, testKingdeeConnect } from './ThirdApp.api';
import { useModal } from '/@/components/Modal';
import ThirdAppConfigModal from './ThirdAppConfigModal.vue';
import { Modal } from 'ant-design-vue';
import { getTenantId } from '/@/utils/auth';
import { useMessage } from '/@/hooks/web/useMessage';
export default defineComponent({
name: 'ThirdAppKingdeeConfigForm',
components: { ThirdAppConfigModal },
setup() {
const { createMessage } = useMessage();
const appConfigData = ref<any>({ corpId: '', agentId: '', clientId: '', clientSecret: '' });
const [registerAppConfigModal, { openModal }] = useModal();
async function kingdeeEditClick() {
const tenantId = getTenantId();
openModal(true, { tenantId, thirdType: 'kingdee' });
}
async function initThirdAppConfigData(params) {
const values = await getThirdConfigByTenantId(params);
appConfigData.value = values || '';
}
function handleSuccess() {
const tenantId = getTenantId();
initThirdAppConfigData({ tenantId, thirdType: 'kingdee' });
}
async function testConnectClick() {
const tenantId = getTenantId();
const res = await testKingdeeConnect({ tenantId });
if (res.success) {
createMessage.success(res.message || '连接成功');
} else {
createMessage.warning(res.message || '连接失败');
}
}
function cancelBindClick() {
if (!appConfigData.value.id) {
createMessage.warning('请先绑定金蝶应用!');
return;
}
Modal.confirm({
title: '取消绑定',
content: '是否要解除当前组织的金蝶配置绑定?',
okText: '确认',
cancelText: '取消',
onOk: () => deleteThirdAppConfig({ id: appConfigData.value.id }, handleSuccess),
});
}
onMounted(() => {
const tenantId = getTenantId();
initThirdAppConfigData({ tenantId, thirdType: 'kingdee' });
});
return {
appConfigData,
registerAppConfigModal,
kingdeeEditClick,
testConnectClick,
cancelBindClick,
handleSuccess,
};
},
});
</script>
<style lang="less" scoped>
.header {
align-items: center;
box-sizing: border-box;
display: flex;
height: 50px;
justify-content: space-between;
font-weight: 700;
font-size: 18px;
color: @text-color;
}
.flex-flow {
display: flex;
min-height: 0;
}
.sync-padding {
padding: 12px 0 16px;
color: @text-color;
}
.base-collapse {
margin-top: 20px;
padding: 0 24px;
font-size: 20px;
.base-desc {
font-size: 14px;
}
.base-title {
width: 100px;
text-align: left;
height: 50px;
line-height: 50px;
}
.base-message {
width: 100%;
height: 50px;
line-height: 50px;
}
:deep(.ant-collapse-header) {
padding: 12px 0 16px;
}
:deep(.ant-collapse-content-box) {
padding-left: 0;
}
}
</style>

View File

@@ -0,0 +1,33 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslMixerCondition/list',
checkConditionName = '/xslmes/mesXslMixerCondition/checkConditionName',
checkConditionCode = '/xslmes/mesXslMixerCondition/checkConditionCode',
save = '/xslmes/mesXslMixerCondition/add',
edit = '/xslmes/mesXslMixerCondition/edit',
deleteOne = '/xslmes/mesXslMixerCondition/delete',
deleteBatch = '/xslmes/mesXslMixerCondition/deleteBatch',
queryById = '/xslmes/mesXslMixerCondition/queryById',
exportXls = '/xslmes/mesXslMixerCondition/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const checkConditionName = (params: { conditionName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkConditionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const checkConditionCode = (params: { conditionCode: string; dataId?: string }) =>
defHttp.get({ url: Api.checkConditionCode, 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,78 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkConditionCode, checkConditionName } from './MesXslMixerCondition.api';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 180 },
{ title: '条件名称', align: 'center', dataIndex: 'conditionName', width: 180 },
{ title: '条件代码', align: 'center', dataIndex: 'conditionCode', width: 160 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
{ title: '创建用户', align: 'center', dataIndex: 'createBy', width: 120 },
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', 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: 'conditionName', component: 'Input', colProps: { span: 6 } },
{ label: '条件代码', field: 'conditionCode', 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: 'conditionName',
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 checkConditionName({ conditionName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '条件名称不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '条件代码',
field: 'conditionCode',
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 checkConditionCode({ conditionCode: 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_condition:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_condition: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>
<MesXslMixerConditionModal @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 MesXslMixerConditionModal from './modules/MesXslMixerConditionModal.vue';
import { columns, searchFormSchema } from './MesXslMixerCondition.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMixerCondition.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_condition:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_mixer_condition:delete',
},
];
}
</script>

View File

@@ -0,0 +1,50 @@
<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 '../MesXslMixerCondition.data';
import { saveOrUpdate } from '../MesXslMixerCondition.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>

View File

@@ -0,0 +1,25 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslProductionOrder/list',
save = '/xslmes/mesXslProductionOrder/add',
edit = '/xslmes/mesXslProductionOrder/edit',
deleteOne = '/xslmes/mesXslProductionOrder/delete',
deleteBatch = '/xslmes/mesXslProductionOrder/deleteBatch',
queryById = '/xslmes/mesXslProductionOrder/queryById',
exportXls = '/xslmes/mesXslProductionOrder/exportXls',
}
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 getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,66 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
function splitStatusText(v: unknown) {
if (v === 1) return '已拆分';
if (v === 0) return '未拆分';
return '-';
}
const splitStatusOptions = [
{ label: '未拆分', value: 0 },
{ label: '已拆分', value: 1 },
];
export const columns: BasicColumn[] = [
{ title: '销售订单号', align: 'center', dataIndex: 'salesOrderNo', width: 150 },
{ title: '生产订单号', align: 'center', dataIndex: 'productionOrderNo', width: 150 },
{ title: '订单日期', align: 'center', dataIndex: 'orderDate', width: 130 },
{ title: '生产车间', align: 'center', dataIndex: 'productionWorkshop', width: 130 },
{ title: '加工段数', align: 'center', dataIndex: 'processSegmentCount', width: 100 },
{ title: '物料编号', align: 'center', dataIndex: 'materialCode', width: 130 },
{ title: 'MES胶料名称', align: 'center', dataIndex: 'mesMaterialName', width: 150 },
{ title: '金蝶物料名称', align: 'center', dataIndex: 'kingdeeMaterialName', width: 150 },
{ title: '金蝶物料规格', align: 'center', dataIndex: 'kingdeeMaterialSpec', width: 150 },
{ title: '计划数量', align: 'center', dataIndex: 'planQty', width: 110 },
{ title: '拆分状态', align: 'center', dataIndex: 'splitStatus', width: 100, customRender: ({ text }) => splitStatusText(text) },
];
export const searchFormSchema: FormSchema[] = [
{ label: '销售订单号', field: 'salesOrderNo', component: 'Input', colProps: { span: 6 } },
{ label: '生产订单号', field: 'productionOrderNo', component: 'Input', colProps: { span: 6 } },
{ label: '物料编号', field: 'materialCode', component: 'Input', colProps: { span: 6 } },
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input', colProps: { span: 6 } },
{
label: '拆分状态',
field: 'splitStatus',
component: 'Select',
componentProps: { options: splitStatusOptions },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '销售订单号', field: 'salesOrderNo', component: 'Input' },
{ label: '生产订单号', field: 'productionOrderNo', component: 'Input' },
{
label: '订单日期',
field: 'orderDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
},
{ label: '生产车间', field: 'productionWorkshop', component: 'Input' },
{ label: '加工段数', field: 'processSegmentCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
{ label: '物料编号', field: 'materialCode', component: 'Input' },
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input' },
{ label: '金蝶物料名称', field: 'kingdeeMaterialName', component: 'Input' },
{ label: '金蝶物料规格', field: 'kingdeeMaterialSpec', component: 'Input' },
{ label: '计划数量', field: 'planQty', component: 'InputNumber', componentProps: { min: 0 } },
{
label: '拆分状态',
field: 'splitStatus',
component: 'Select',
defaultValue: 0,
componentProps: { options: splitStatusOptions },
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_production_order:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_production_order: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>
<MesXslProductionOrderModal @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 MesXslProductionOrderModal from './modules/MesXslProductionOrderModal.vue';
import { columns, searchFormSchema } from './MesXslProductionOrder.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslProductionOrder.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '生产订单',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true, showAdvancedButton: 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_production_order:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_production_order:delete',
},
];
}
</script>

View File

@@ -0,0 +1,53 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="860px" @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 '../MesXslProductionOrder.data';
import { saveOrUpdate } from '../MesXslProductionOrder.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,
baseColProps: { span: 12 },
});
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({ splitStatus: 0 });
}
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>