Commit 4ae7124c1dfe851255aabf7bdb8f6b554ecb2a8c
1 parent
98be0688
库存查询抛异常
Showing
4 changed files
with
31 additions
and
4 deletions
src/main/java/com/huaheng/api/U8/Service/ComputationUnitApiService.java
... | ... | @@ -32,6 +32,9 @@ public class ComputationUnitApiService { |
32 | 32 | if(StringUtils.isEmpty(icsComputationUnit.getcComunitCode())){ |
33 | 33 | return AjaxResult.error("没有计量单位编码信息"); |
34 | 34 | } |
35 | + if(StringUtils.isEmpty(icsComputationUnit.getcComunitName())){ | |
36 | + return AjaxResult.error("没有计量单位名称信息"); | |
37 | + } | |
35 | 38 | WarehouseCompany warehouseCompany = new WarehouseCompany(); |
36 | 39 | warehouseCompany.setCompanyCode(icsComputationUnit.getCompanyCode()); |
37 | 40 | List<WarehouseCompany> list = warehouseCompanyMapperAuto.selectListEntityByEqual(warehouseCompany); |
... | ... |
src/main/java/com/huaheng/api/U8/Service/ICSInventoryAPIService.java
... | ... | @@ -7,6 +7,8 @@ import com.huaheng.framework.web.domain.AjaxResult; |
7 | 7 | import com.huaheng.pc.general.company.service.ICompanyService; |
8 | 8 | import com.huaheng.pc.general.material.domain.Material; |
9 | 9 | import com.huaheng.pc.general.material.service.IMaterialService; |
10 | +import com.huaheng.pc.general.warehouse.domain.Warehouse; | |
11 | +import com.huaheng.pc.general.warehouse.service.IWarehouseService; | |
10 | 12 | import com.huaheng.pc.inventory.inventory.domain.Inventory; |
11 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 14 | import org.springframework.stereotype.Service; |
... | ... | @@ -26,6 +28,8 @@ public class ICSInventoryAPIService { |
26 | 28 | private ICompanyService companyService; |
27 | 29 | @Autowired |
28 | 30 | private IMaterialService materialService; |
31 | + @Autowired | |
32 | + private IWarehouseService warehouseService; | |
29 | 33 | |
30 | 34 | public AjaxResult GetCurrentStock(ICSInventory icsInventory){ |
31 | 35 | Inventory inventory=new Inventory(); |
... | ... | @@ -38,10 +42,18 @@ public class ICSInventoryAPIService { |
38 | 42 | if(StringUtils.isEmpty(icsInventory.getcWhCode())){ |
39 | 43 | return AjaxResult.error("没有仓库编码信息"); |
40 | 44 | } |
45 | + Warehouse warehouse=new Warehouse(); | |
46 | + warehouse.setCode(icsInventory.getcWhCode()); | |
47 | + if(warehouseService.selectFirstEntity(warehouse)==null){ | |
48 | + return AjaxResult.error("系统没有该仓库:"+icsInventory.getcWhCode()); | |
49 | + } | |
41 | 50 | Material material=new Material(); |
42 | 51 | material.setWarehouseCode(icsInventory.getcWhCode()); |
43 | 52 | material.setCode(icsInventory.getcInvCode()); |
44 | 53 | material=materialService.selectFirstEntity(material); |
54 | + if(material==null){ | |
55 | + return AjaxResult.error("该仓库没有这个物料编码:"+icsInventory.getcInvCode()); | |
56 | + } | |
45 | 57 | if(!material.getName().equals(icsInventory.getcInvName())){ |
46 | 58 | return AjaxResult.error("物料名称错误"); |
47 | 59 | } |
... | ... |
src/main/java/com/huaheng/api/general/service/InventoryAPIService.java
1 | 1 | package com.huaheng.api.general.service; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSON; | |
4 | 3 | import com.huaheng.common.utils.StringUtils; |
5 | -import com.huaheng.common.utils.http.HttpUtils; | |
6 | 4 | import com.huaheng.framework.web.domain.AjaxResult; |
5 | +import com.huaheng.pc.general.company.service.ICompanyService; | |
6 | +import com.huaheng.pc.general.warehouse.domain.Warehouse; | |
7 | +import com.huaheng.pc.general.warehouse.service.IWarehouseService; | |
7 | 8 | import com.huaheng.pc.inventory.inventory.domain.Inventory; |
8 | 9 | import com.huaheng.pc.inventory.inventory.service.IInventoryService; |
9 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -21,7 +22,10 @@ import java.util.List; |
21 | 22 | public class InventoryAPIService { |
22 | 23 | @Autowired |
23 | 24 | private IInventoryService inventoryService; |
24 | - | |
25 | + @Autowired | |
26 | + private ICompanyService companyService; | |
27 | + @Autowired | |
28 | + private IWarehouseService warehouseService; | |
25 | 29 | |
26 | 30 | public AjaxResult select(Inventory inventory) |
27 | 31 | { |
... | ... | @@ -34,6 +38,13 @@ public class InventoryAPIService { |
34 | 38 | if(StringUtils.isEmpty(inventory.getWarehouseCode())){ |
35 | 39 | return AjaxResult.error("没有仓库编码信息"); |
36 | 40 | } |
41 | + Warehouse warehouse=new Warehouse(); | |
42 | + warehouse.setCode(inventory.getWarehouseCode()); | |
43 | + if(warehouseService.selectFirstEntity(warehouse)==null){ | |
44 | + return AjaxResult.error("系统没有该仓库:"+inventory.getWarehouseCode()); | |
45 | + } | |
46 | + //判断系统中有没有该货主 | |
47 | + companyService.checkwarehouseCompany(inventory.getCompanyCode()); | |
37 | 48 | inventory= inventoryService.selectFirstEntity(inventory); |
38 | 49 | if(inventory==null){ |
39 | 50 | return AjaxResult.error("没有查到任何库存"); |
... | ... |
src/main/java/com/huaheng/pc/general/company/service/CompanyServiceImpl.java
1 | 1 | package com.huaheng.pc.general.company.service; |
2 | 2 | |
3 | +import com.huaheng.common.exception.service.ServiceException; | |
3 | 4 | import com.huaheng.common.support.Convert; |
4 | 5 | import com.huaheng.common.utils.StringUtils; |
5 | 6 | import com.huaheng.common.utils.security.ShiroUtils; |
... | ... | @@ -253,7 +254,7 @@ public class CompanyServiceImpl implements ICompanyService { |
253 | 254 | warehouseCompany.setCompanyCode(code); |
254 | 255 | List<WarehouseCompany> list = warehouseCompanyMapperAuto.selectListEntityByEqual(warehouseCompany); |
255 | 256 | if (list == null || list.size() == 0){ |
256 | - return AjaxResult.error("系统中没有该货主:"+warehouseCompany.toString()+" 信息,请先录入货主信息!"); | |
257 | + throw new ServiceException("系统没有该货主:"+code); | |
257 | 258 | }else { |
258 | 259 | return AjaxResult.success("请继续"); |
259 | 260 | } |
... | ... |