新增模具页面

plp
kkk-ops 1 day ago
parent 6859b3d674
commit f4819d840d

@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO; import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandTreeRespVO;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService; import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -99,6 +100,14 @@ public class MoldBrandController {
ExcelUtils.write(response, "模具型号.xls", "数据", MoldBrandRespVO.class, moldBrandRespVOS); ExcelUtils.write(response, "模具型号.xls", "数据", MoldBrandRespVO.class, moldBrandRespVOS);
} }
@GetMapping("/tree")
@Operation(summary = "获得设备类型树")
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
public CommonResult<List<MoldBrandTreeRespVO>> getDeviceTypeTree() {
List<MoldBrandTreeRespVO> tree = moldBrandService.getMoldBrandTree();
return success(tree);
}
// ==================== 子表(模具) ==================== // ==================== 子表(模具) ====================
@GetMapping("/getMoldList") @GetMapping("/getMoldList")
@Operation(summary = "获得模具型号") @Operation(summary = "获得模具型号")

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "管理后台 - 模具类型树形结构 Response VO")
public class MoldBrandTreeRespVO extends MoldBrandRespVO{
@Schema(description = "模具类型列表")
private List<MoldBrandTreeRespVO> children;
@Schema(description = "是否叶子节点", example = "true")
private Boolean leaf = true;
}

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.common.controller.admin.mold.vo.*;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandTreeRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import javax.validation.Valid; import javax.validation.Valid;
@ -180,4 +181,6 @@ public interface MoldBrandService {
if(ids.isEmpty())return new HashMap<>(); if(ids.isEmpty())return new HashMap<>();
return convertMap(getMoldBrandList(ids), MoldBrandDO::getId); return convertMap(getMoldBrandList(ids), MoldBrandDO::getId);
} }
List<MoldBrandTreeRespVO> getMoldBrandTree();
} }

@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO; import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairLineDO; import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairLineDO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldticketresults.MoldTicketResultsDO; import cn.iocoder.yudao.module.common.dal.dataobject.moldticketresults.MoldTicketResultsDO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandTreeRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper; import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
@ -24,7 +25,6 @@ import cn.iocoder.yudao.module.common.controller.admin.moldticketmanagement.enum
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService; import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -317,4 +317,35 @@ public class MoldBrandServiceImpl implements MoldBrandService {
private void deleteMoldBrandProductByBrandId(Long brandId) { private void deleteMoldBrandProductByBrandId(Long brandId) {
moldBrandProductMapper.deleteByBrandId(brandId); moldBrandProductMapper.deleteByBrandId(brandId);
} }
@Override
public List<MoldBrandTreeRespVO> getMoldBrandTree() {
// 1. 查询所有模具类型
List<MoldBrandDO> allMoldBrands = moldBrandMapper.selectList();
// 2. 构建树形结构
return buildMoldBrandTree(allMoldBrands);
}
/**
*
*/
private List<MoldBrandTreeRespVO> buildMoldBrandTree(List<MoldBrandDO> allMoldBrands) {
return allMoldBrands.stream()
.map(this::convertToTreeRespVO)
.collect(Collectors.toList());
}
private MoldBrandTreeRespVO convertToTreeRespVO(MoldBrandDO moldBrand) {
// 使用BeanUtils或手动设置属性
MoldBrandTreeRespVO respVO = new MoldBrandTreeRespVO();
// 复制公共属性假设MoldBrandRespVO有对应的方法
BeanUtils.copyProperties(moldBrand, respVO);
// 设置树状结构属性
respVO.setChildren(new ArrayList<>()); // 空子节点
respVO.setLeaf(true); // 叶子节点
return respVO;
}
} }

@ -186,7 +186,7 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
//关键件列表 //关键件列表
List<CriticalComponentDO> componentList = new ArrayList<>(); List<CriticalComponentDO> componentList = new ArrayList<>();
if (StringUtils.isNotBlank(deviceLedgerDO.getComponentId())) { if (deviceLedgerDO != null && StringUtils.isNotBlank(deviceLedgerDO.getComponentId())) {
// 将逗号分隔的字符串转换为Long类型的List // 将逗号分隔的字符串转换为Long类型的List
List<Long> idList = Arrays.stream(deviceLedgerDO.getComponentId().split(",")) List<Long> idList = Arrays.stream(deviceLedgerDO.getComponentId().split(","))
.map(String::trim) // 去除可能存在的空格 .map(String::trim) // 去除可能存在的空格
@ -203,7 +203,7 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
//模具列表 //模具列表
List<MoldDO> moldList = new ArrayList<>(); List<MoldDO> moldList = new ArrayList<>();
if (StringUtils.isNotBlank(deviceLedgerDO.getMoldId())) { if (deviceLedgerDO != null && StringUtils.isNotBlank(deviceLedgerDO.getMoldId())) {
// 将逗号分隔的字符串转换为Long类型的List // 将逗号分隔的字符串转换为Long类型的List
List<Long> idList = Arrays.stream(deviceLedgerDO.getMoldId().split(",")) List<Long> idList = Arrays.stream(deviceLedgerDO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格 .map(String::trim) // 去除可能存在的空格
@ -220,7 +220,7 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
//备件列表 //备件列表
List<ErpProductDO> beijianList = new ArrayList<>(); List<ErpProductDO> beijianList = new ArrayList<>();
if (StringUtils.isNotBlank(deviceLedgerDO.getBeijianId())) { if (deviceLedgerDO != null && StringUtils.isNotBlank(deviceLedgerDO.getBeijianId())) {
// 将逗号分隔的字符串转换为Long类型的List // 将逗号分隔的字符串转换为Long类型的List
List<Long> idList = Arrays.stream(deviceLedgerDO.getBeijianId().split(",")) List<Long> idList = Arrays.stream(deviceLedgerDO.getBeijianId().split(","))
.map(String::trim) // 去除可能存在的空格 .map(String::trim) // 去除可能存在的空格

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.mes.service.devicetype; package cn.iocoder.yudao.module.mes.service.devicetype;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.DeviceTypeTreeRespVO; import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.DeviceTypeTreeRespVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO; import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper; import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
@ -9,8 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -21,15 +19,13 @@ import java.util.stream.Collectors;
import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.*; import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO; import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.devicetype.DeviceTypeMapper; import cn.iocoder.yudao.module.mes.dal.mysql.devicetype.DeviceTypeMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
import static com.baomidou.mybatisplus.extension.toolkit.Db.list;
/** /**
* Service * Service

Loading…
Cancel
Save