|
|
|
|
@ -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;
|
|
|
|
|
@ -22,6 +25,7 @@ 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;
|
|
|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
|