Commit 3c45ba641a48dd28c650f1dbee670604f4e39dae

Authored by wangqian
1 parent c86e5ad0

耗材登记bug修改

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,7 +14,7 @@ public class MaterialInventoryOutSaveReqVO {
14 @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") 14 @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713")
15 private Long id; 15 private Long id;
16 @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 16 @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
17 - @NotNull(message = "库存ID不能为空") 17 + //@NotNull(message = "库存ID不能为空")
18 private Long inventoryId; 18 private Long inventoryId;
19 19
20 @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") 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,6 +15,7 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi;
15 import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; 15 import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO;
16 import jakarta.annotation.Resource; 16 import jakarta.annotation.Resource;
17 import org.apache.commons.collections4.CollectionUtils; 17 import org.apache.commons.collections4.CollectionUtils;
  18 +import org.apache.commons.lang3.StringUtils;
18 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
19 import org.springframework.transaction.annotation.Transactional; 20 import org.springframework.transaction.annotation.Transactional;
20 import org.springframework.validation.annotation.Validated; 21 import org.springframework.validation.annotation.Validated;
@@ -55,7 +56,14 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ @@ -55,7 +56,14 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
55 if(null == material){ 56 if(null == material){
56 throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId"); 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 if(null == materialInventory){ 67 if(null == materialInventory){
60 throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存"); 68 throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存");
61 } 69 }