Commit 3c45ba641a48dd28c650f1dbee670604f4e39dae
1 parent
c86e5ad0
耗材登记bug修改
Showing
2 changed files
with
10 additions
and
2 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialinventoryout/vo/MaterialInventoryOutSaveReqVO.java
| ... | ... | @@ -14,7 +14,7 @@ public class MaterialInventoryOutSaveReqVO { |
| 14 | 14 | @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") |
| 15 | 15 | private Long id; |
| 16 | 16 | @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 17 | - @NotNull(message = "库存ID不能为空") | |
| 17 | + //@NotNull(message = "库存ID不能为空") | |
| 18 | 18 | private Long inventoryId; |
| 19 | 19 | |
| 20 | 20 | @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryout/MaterialInventoryOutServiceImpl.java
| ... | ... | @@ -15,6 +15,7 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi; |
| 15 | 15 | import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; |
| 16 | 16 | import jakarta.annotation.Resource; |
| 17 | 17 | import org.apache.commons.collections4.CollectionUtils; |
| 18 | +import org.apache.commons.lang3.StringUtils; | |
| 18 | 19 | import org.springframework.stereotype.Service; |
| 19 | 20 | import org.springframework.transaction.annotation.Transactional; |
| 20 | 21 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -55,7 +56,14 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ |
| 55 | 56 | if(null == material){ |
| 56 | 57 | throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId"); |
| 57 | 58 | } |
| 58 | - MaterialInventoryDO materialInventory = materialInventoryService.getMaterialInventory(createReqVO.getInventoryId()); | |
| 59 | + | |
| 60 | + MaterialInventoryDO materialInventory = null; | |
| 61 | + if(createReqVO.getInventoryId() != null) { | |
| 62 | + materialInventory = materialInventoryService.getMaterialInventory(createReqVO.getInventoryId()); | |
| 63 | + } else { | |
| 64 | + //耗材登记没有库存id,只能使用耗材id+单位查询 | |
| 65 | + materialInventory = materialInventoryService.selectMaterialInventoryByMaterialId(material.getMaterialId(), getCompanyId()); | |
| 66 | + } | |
| 59 | 67 | if(null == materialInventory){ |
| 60 | 68 | throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存"); |
| 61 | 69 | } | ... | ... |