master
ljw 2026-01-17 16:58:55 +08:00
parent 08715a54fc
commit ff8ce551db
5 changed files with 78 additions and 7 deletions

View File

@ -109,7 +109,7 @@ public class BomService extends ServiceImpl<BomMapper, BomEntity> implements ISe
.ne(excludeId != null, BomEntity::getId, excludeId)); .ne(excludeId != null, BomEntity::getId, excludeId));
if (count > 0) { if (count > 0) {
throw Exceptions.clierr("同一主产品的BOM版本号必须唯一"); throw Exceptions.clierr("同一主产品的物料版本号必须唯一");
} }
} }
@ -126,7 +126,7 @@ public class BomService extends ServiceImpl<BomMapper, BomEntity> implements ISe
.ne(excludeId != null, BomEntity::getId, excludeId)); .ne(excludeId != null, BomEntity::getId, excludeId));
if (count > 0) { if (count > 0) {
throw Exceptions.clierr("同一主产品只能有一个可用的BOM"); throw Exceptions.clierr("同一主产品只能有一个可用的物料");
} }
} }

View File

@ -4,6 +4,7 @@ import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam; import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult; import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.dispose.mfg.craft.pojo.entity.CraftOperationEntity; import com.njzscloud.dispose.mfg.craft.pojo.entity.CraftOperationEntity;
import com.njzscloud.dispose.mfg.craft.pojo.param.SearchCraftOperationParam;
import com.njzscloud.dispose.mfg.craft.service.CraftOperationService; import com.njzscloud.dispose.mfg.craft.service.CraftOperationService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -13,6 +14,7 @@ import java.util.List;
/** /**
* *
* @author ljw
*/ */
@Slf4j @Slf4j
@RestController @RestController
@ -60,7 +62,7 @@ public class CraftOperationController {
* *
*/ */
@GetMapping("/paging") @GetMapping("/paging")
public R<PageResult<CraftOperationEntity>> paging(PageParam pageParam, CraftOperationEntity craftOperationEntity) { public R<PageResult<CraftOperationEntity>> paging(PageParam pageParam, SearchCraftOperationParam operationParam) {
return R.success(craftOperationService.paging(pageParam, craftOperationEntity)); return R.success(craftOperationService.paging(pageParam, operationParam));
} }
} }

View File

@ -1,6 +1,9 @@
package com.njzscloud.dispose.mfg.craft.pojo.entity; package com.njzscloud.dispose.mfg.craft.pojo.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.common.core.ienum.DictItem;
import com.njzscloud.common.core.ienum.DictKey;
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
@ -11,6 +14,7 @@ import java.time.LocalDateTime;
/** /**
* *
* @author ljw
*/ */
@Getter @Getter
@Setter @Setter
@ -38,7 +42,9 @@ public class CraftOperationEntity {
/** /**
* operation_category * operation_category
*/ */
private String operationCategory; @DictKey("operation_category")
@TableField(typeHandler = DictItemTypeHandler.class)
private DictItem operationCategory;
/** /**
* N/ * N/

View File

@ -0,0 +1,39 @@
package com.njzscloud.dispose.mfg.craft.pojo.param;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
*
*
* @author ljw
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SearchCraftOperationParam {
/**
*
*/
private String sn;
/**
*
*/
private String operationName;
/**
* 0-->1-->
*/
private Boolean checkPoint;
/**
* 0-->1-->
*/
private Boolean canuse;
}

View File

@ -1,12 +1,15 @@
package com.njzscloud.dispose.mfg.craft.service; package com.njzscloud.dispose.mfg.craft.service;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.mp.support.PageParam; import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult; import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.common.sn.support.SnUtil;
import com.njzscloud.dispose.mfg.craft.mapper.CraftOperationMapper; import com.njzscloud.dispose.mfg.craft.mapper.CraftOperationMapper;
import com.njzscloud.dispose.mfg.craft.pojo.entity.CraftOperationEntity; import com.njzscloud.dispose.mfg.craft.pojo.entity.CraftOperationEntity;
import com.njzscloud.dispose.mfg.craft.pojo.param.SearchCraftOperationParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -16,6 +19,8 @@ import java.util.List;
/** /**
* *
*
* @author ljw
*/ */
@Slf4j @Slf4j
@Service @Service
@ -26,6 +31,7 @@ public class CraftOperationService extends ServiceImpl<CraftOperationMapper, Cra
* *
*/ */
public void add(CraftOperationEntity craftOperationEntity) { public void add(CraftOperationEntity craftOperationEntity) {
craftOperationEntity.setSn(this.generateSn());
this.save(craftOperationEntity); this.save(craftOperationEntity);
} }
@ -54,7 +60,25 @@ public class CraftOperationService extends ServiceImpl<CraftOperationMapper, Cra
/** /**
* *
*/ */
public PageResult<CraftOperationEntity> paging(PageParam pageParam, CraftOperationEntity craftOperationEntity) { public PageResult<CraftOperationEntity> paging(PageParam pageParam, SearchCraftOperationParam operationParam) {
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<CraftOperationEntity>query(craftOperationEntity))); return PageResult.of(this.page(pageParam.toPage(), Wrappers.<CraftOperationEntity>lambdaQuery()
.like(StrUtil.isNotBlank(operationParam.getSn()), CraftOperationEntity::getSn, operationParam.getSn())
.like(StrUtil.isNotBlank(operationParam.getOperationName()), CraftOperationEntity::getOperationName, operationParam.getOperationName())
.eq(operationParam.getCheckPoint() != null, CraftOperationEntity::getCheckPoint, operationParam.getCheckPoint())
.eq(operationParam.getCanuse() != null, CraftOperationEntity::getCanuse, operationParam.getCanuse())));
} }
/**
*
*
* @return sn
*/
public String generateSn() {
String sn = SnUtil.next("Operation-SN");
if (this.exists(Wrappers.<CraftOperationEntity>lambdaQuery().eq(CraftOperationEntity::getSn, sn).eq(CraftOperationEntity::getDeleted, Boolean.FALSE))) {
this.generateSn();
}
return sn;
}
} }