Compare commits

...

5 Commits

Author SHA1 Message Date
86158 aa7c6da293 Merge branch 'refs/heads/plp'
# Conflicts:
#	yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldServiceImpl.java
1 day ago
86158 c7ef7a4e97 fix:修改模具和模具类型的编码为唯一 1 day ago
HuangHuiKang d2c45b0ff2 fix:修改模具下模问题 1 day ago
kkk-ops 6464295857 Merge branch 'main' of https://git.ngsk.tech/linweidong/besure_server 1 day ago
kkk-ops f4819d840d 新增模具页面 1 day ago

@ -170,6 +170,12 @@ public interface ErrorCodeConstants {
ErrorCode MOLD_NOT_EXISTS = new ErrorCode(1_111_002, "模具不存在");
ErrorCode MOLD_BRAND_PRODUCT_NOT_EXISTS = new ErrorCode(1_111_003, "模具产品不存在");
ErrorCode MOLD_BRAND_PRODUCT_EXISTS = new ErrorCode(1_111_004, "模具产品已存在");
ErrorCode MOLD_CODE_DUPLICATE = new ErrorCode(1_003_000_004, "编码已存在");
ErrorCode MOLD_CODE_EMPTY = new ErrorCode(1_003_000_005, "模具编码不能为空");
ErrorCode MOLD_BRAND_CODE_DUPLICATE = new ErrorCode(1_003_000_006, "模具品牌编码已存在");
ErrorCode MOLD_BRAND_CODE_EMPTY = new ErrorCode(1_003_000_007, "模具品牌编码不能为空");
ErrorCode AUTOCODE_RECORD_NOT_EXISTS = new ErrorCode(1_111_003, "编码生成记录不存在");
@ -178,4 +184,5 @@ public interface ErrorCodeConstants {
ErrorCode AUTOCODE_GEN_NOT_UNIQUE = new ErrorCode(1_111_006, "编码已存在");
ErrorCode PRODUCT_REFERENCES_EXIST = new ErrorCode(1_003_000_000, "存在产品已被引用,请先删除引用。");
}

@ -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.MoldDO;
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.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
@ -99,6 +100,14 @@ public class MoldBrandController {
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")
@Operation(summary = "获得模具型号")
@ -133,8 +142,8 @@ public class MoldBrandController {
@PostMapping("/mold/create")
@Operation(summary = "创建模具")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:create')")
public CommonResult<Long> createMold(@Valid @RequestBody MoldDO mold) {
return success(moldBrandService.createMold(mold));
public CommonResult<Long> createMold(@Valid @RequestBody MoldSaveReqVO createReqVO) {
return success(moldBrandService.createMold(createReqVO));
}
@PutMapping("/mold/update")

@ -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.MoldBrandProductDO;
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 javax.validation.Valid;
@ -94,7 +95,7 @@ public interface MoldBrandService {
* @param mold
* @return
*/
Long createMold(@Valid MoldDO mold);
Long createMold(@Valid MoldSaveReqVO createReqVO);
/**
*
@ -180,4 +181,6 @@ public interface MoldBrandService {
if(ids.isEmpty())return new HashMap<>();
return convertMap(getMoldBrandList(ids), MoldBrandDO::getId);
}
List<MoldBrandTreeRespVO> getMoldBrandTree();
}

@ -1,10 +1,13 @@
package cn.iocoder.yudao.module.erp.service.mold;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
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.MoldBrandProductDO;
@ -12,6 +15,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.MoldRepairLineDO;
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.ErpProductUnitDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
@ -21,10 +25,10 @@ import cn.iocoder.yudao.module.common.dal.mysql.moldrepair.MoldRepairLineMapper;
import cn.iocoder.yudao.module.common.dal.mysql.moldrepair.MoldRepairMapper;
import cn.iocoder.yudao.module.common.dal.mysql.moldticketresults.MoldTicketResultsMapper;
import cn.iocoder.yudao.module.common.controller.admin.moldticketmanagement.enums.MoldPlanTypeEnum;
import cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -65,6 +69,17 @@ public class MoldBrandServiceImpl implements MoldBrandService {
@Override
public Long createMoldBrand(MoldBrandSaveReqVO createReqVO) {
// 插入
// MoldBrandDO moldBrand = BeanUtils.toBean(createReqVO, MoldBrandDO.class);
String Code = createReqVO.getCode();
if (StrUtil.isBlank(Code)) {
throw new ServiceException(ErrorCodeConstants.MOLD_BRAND_CODE_EMPTY);
}
boolean exists = moldBrandMapper.exists(
new LambdaQueryWrapperX<MoldBrandDO>().eq(MoldBrandDO::getCode, Code)
);
if (exists) {
throw new ServiceException(ErrorCodeConstants.MOLD_BRAND_CODE_DUPLICATE);
}
MoldBrandDO moldBrand = BeanUtils.toBean(createReqVO, MoldBrandDO.class);
moldBrandMapper.insert(moldBrand);
// 返回
@ -158,7 +173,18 @@ public class MoldBrandServiceImpl implements MoldBrandService {
});
}
@Override
public Long createMold(MoldDO mold) {
public Long createMold(MoldSaveReqVO createReqVO) {
String Code = createReqVO.getCode();
if (StrUtil.isBlank(Code)) {
throw new ServiceException(ErrorCodeConstants.MOLD_CODE_EMPTY);
}
boolean exists = moldMapper.exists(
new LambdaQueryWrapperX<MoldDO>().eq(MoldDO::getCode, Code)
);
if (exists) {
throw new ServiceException(ErrorCodeConstants.MOLD_CODE_DUPLICATE);
}
MoldDO mold = BeanUtils.toBean(createReqVO, MoldDO.class);
moldMapper.insert(mold);
return mold.getId();
}
@ -317,4 +343,35 @@ public class MoldBrandServiceImpl implements MoldBrandService {
private void deleteMoldBrandProductByBrandId(Long 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;
}
}

@ -1,13 +1,17 @@
package cn.iocoder.yudao.module.erp.service.mold;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
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.stock.ErpWarehouseDO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@ -42,6 +46,17 @@ public class MoldServiceImpl implements MoldService {
@Override
public Long createMold(MoldSaveReqVO createReqVO) {
// 插入
// MoldDO mold = BeanUtils.toBean(createReqVO, MoldDO.class);
String Code = createReqVO.getCode();
if (StrUtil.isBlank(Code)) {
throw new ServiceException(ErrorCodeConstants.MOLD_CODE_EMPTY);
}
boolean exists = moldMapper.exists(
new LambdaQueryWrapperX<MoldDO>().eq(MoldDO::getCode, Code)
);
if (exists) {
throw new ServiceException(ErrorCodeConstants.MOLD_CODE_DUPLICATE);
}
MoldDO mold = BeanUtils.toBean(createReqVO, MoldDO.class);
moldMapper.insert(mold);
// 返回

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

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.mes.service.devicetype;
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.dal.dataobject.deviceledger.DeviceLedgerDO;
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 org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
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.dal.dataobject.devicetype.DeviceTypeDO;
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.module.mes.dal.mysql.devicetype.DeviceTypeMapper;
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 com.baomidou.mybatisplus.extension.toolkit.Db.list;
/**
* Service

@ -50,10 +50,21 @@ public class MoldOperateServiceImpl implements MoldOperateService {
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(createReqVO.getDeviceId());
moldOperate.setDeviceName(deviceLedgerDO.getDeviceName());
List<Long> idList = Arrays.stream(createReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
List<Long> idList;
if (createReqVO.getLowerMoldId()!=null){
idList = Arrays.stream(createReqVO.getLowerMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
}else {
idList = Arrays.stream(createReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
}
if (!idList.isEmpty()) {
StringBuilder moldNameBuilder = new StringBuilder();

Loading…
Cancel
Save