| | |
| | | package cn.iocoder.yudao.module.mes.service.wm.barcode; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES 条码清单 Service 实现类 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Service |
| | | @Validated |
| | |
| | | // 3. 保存条码记录 |
| | | MesWmBarcodeDO barcode = BeanUtils.toBean(createReqVO, MesWmBarcodeDO.class).setContent(content) |
| | | .setConfigId(config.getId()).setFormat(config.getFormat()); |
| | | // 未指定状态时默认启用,避免前端漏传导致状态为空 |
| | | if (barcode.getStatus() == null) { |
| | | barcode.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| | | } |
| | | barcodeMapper.insert(barcode); |
| | | return barcode.getId(); |
| | | } |
| | |
| | | barcodeMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteBarcodeByBizTypeAndBizIds(Integer bizType, Collection<Long> bizIds) { |
| | | if (CollUtil.isEmpty(bizIds)) { |
| | | return; |
| | | } |
| | | barcodeMapper.deleteByBizTypeAndBizIds(bizType, bizIds); |
| | | } |
| | | |
| | | private MesWmBarcodeDO validateBarcodeExists(Long id) { |
| | | MesWmBarcodeDO barcode = barcodeMapper.selectById(id); |
| | | if (barcode == null) { |