Commit 15045d70 LN

元器件数量需大于0

1 个父辈 7cf932bf
...@@ -81,6 +81,7 @@ public class ComponentController { ...@@ -81,6 +81,7 @@ public class ComponentController {
public ResponseEntity<Object> create(@Validated @RequestBody ComponentDto resources) { public ResponseEntity<Object> create(@Validated @RequestBody ComponentDto resources) {
Component component=componentMapper.toEntity(resources); Component component=componentMapper.toEntity(resources);
component.setPartNumber(component.getPartNumber().trim()); component.setPartNumber(component.getPartNumber().trim());
componentManager.saveComponent(component); componentManager.saveComponent(component);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
} }
...@@ -94,17 +95,6 @@ public class ComponentController { ...@@ -94,17 +95,6 @@ public class ComponentController {
if (component.getId() == null) { if (component.getId() == null) {
throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
//判断最大库存和最小库存
if(component.getMinStoreNum()>0 )
{
if(component.getMinStoreNum()<=component.getSafetyStoreNum()&& component.getSafetyStoreNum()<=component.getMaxStoreNum()){
}else{
throw new ValidateException("smfcore.component.storeError","请输入正确的库存,最小库存<=安全库存<=最大库存" );
}
}
componentManager.saveComponent(component); componentManager.saveComponent(component);
// //修改元器件时更新storagePos中的数据 // //修改元器件时更新storagePos中的数据
// if(!ObjectUtil.isEmpty(component.getPartNumber())) // if(!ObjectUtil.isEmpty(component.getPartNumber()))
......
...@@ -169,6 +169,18 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -169,6 +169,18 @@ public class ComponentManagerImpl implements IComponentManager {
throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"partNumber"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"partNumber"} );
// throw new BadRequestException("料号不能为空"); // throw new BadRequestException("料号不能为空");
} }
if(resources.getAmount()<=0){
throw new ValidateException("smfcore.component.amount.error","元器件数量必须大于0" );
}
//判断最大库存和最小库存
if(resources.getMinStoreNum()>0 )
{
if(resources.getMinStoreNum()<=resources.getSafetyStoreNum()&& resources.getSafetyStoreNum()<=resources.getMaxStoreNum()){
}else{
throw new ValidateException("smfcore.component.storeError","请输入正确的库存,最小库存<=安全库存<=最大库存" );
}
}
if(resources.getProvider()==null){ if(resources.getProvider()==null){
resources.setProvider(""); resources.setProvider("");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!