Commit dc7fd2eef011044ef3bf7a03fffb4c13dd5a2758
1 parent
1ca89a52
feat: 修复了容器管理增加托盘1个会失败的问题
Showing
2 changed files
with
27 additions
and
19 deletions
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -24,7 +24,7 @@ import java.util.Date; |
24 | 24 | import java.util.List; |
25 | 25 | |
26 | 26 | @Service |
27 | -public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container> implements ContainerService{ | |
27 | +public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container> implements ContainerService { | |
28 | 28 | |
29 | 29 | @Resource |
30 | 30 | private ContainerTypeService containerTypeService; |
... | ... | @@ -37,10 +37,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
37 | 37 | |
38 | 38 | @Override |
39 | 39 | public AjaxResult<List<Container>> insertContainer(String type, Integer quantity) { |
40 | - List<Container> containerList = new ArrayList<>(); | |
41 | - List<Container> containers =new ArrayList<>(); | |
40 | + List<Container> containers = new ArrayList<>(); | |
42 | 41 | Integer number = getNumber(type); |
43 | - for(int i=0; i<quantity; i++) { | |
42 | + for (int i = 0; i < quantity; i++) { | |
44 | 43 | number++; |
45 | 44 | Container container = new Container(); |
46 | 45 | container.setContainerType(type); |
... | ... | @@ -51,10 +50,10 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
51 | 50 | container.setLastUpdated(null); |
52 | 51 | container.setLastUpdatedBy(null); |
53 | 52 | container.setEnable(true); |
54 | - //container.setCompanyCode(ShiroUtils.getCompanyCodeList().get(0)); | |
55 | 53 | container.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
56 | 54 | containers.add(container); |
57 | - if( i>0 && (i%1000==0 || i == quantity-1)){ | |
55 | + | |
56 | + if (i % 1000 == 0 || i == quantity - 1) { | |
58 | 57 | containerMapper.addList(containers); |
59 | 58 | containers = new ArrayList<>(); |
60 | 59 | } |
... | ... | @@ -75,16 +74,16 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
75 | 74 | //如果指定类型的最后的code存在,那么 code = 容器类型 + (排序号 + 1) |
76 | 75 | if (container != null && container.getCode() != null) { |
77 | 76 | Integer number = Integer.valueOf(container.getCode().substring(container.getCode().length() - 5, container.getCode().length())); |
78 | - return number; | |
77 | + return number; | |
79 | 78 | } else { |
80 | - return 0; | |
79 | + return 0; | |
81 | 80 | } |
82 | 81 | } |
83 | 82 | |
84 | 83 | @Override |
85 | - public String importContainer(List<Container> containerList, Boolean updateSupport, String operName){ | |
84 | + public String importContainer(List<Container> containerList, Boolean updateSupport, String operName) { | |
86 | 85 | if (StringUtils.isNull(containerList) || containerList.size() == 0) { |
87 | - throw new BusinessException("导入数据不能为空!"); | |
86 | + throw new BusinessException("导入数据不能为空!"); | |
88 | 87 | } |
89 | 88 | int successNum = 0; |
90 | 89 | int failureNum = 0; |
... | ... | @@ -127,15 +126,15 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
127 | 126 | |
128 | 127 | /** |
129 | 128 | * 已入空容器展示 |
130 | - * */ | |
129 | + */ | |
131 | 130 | @Override |
132 | 131 | public List<Location> getEmptyContainerInLocation(String zoneCode, String containerCode, String locationCode, String warehouseCode) { |
133 | - return containerMapper.getEmptyContainerInLocation(zoneCode, containerCode,locationCode,warehouseCode); | |
132 | + return containerMapper.getEmptyContainerInLocation(zoneCode, containerCode, locationCode, warehouseCode); | |
134 | 133 | } |
135 | 134 | |
136 | 135 | /** |
137 | 136 | * 修改容器库位和状态 |
138 | - * */ | |
137 | + */ | |
139 | 138 | @Override |
140 | 139 | public void updateLocationCodeAndStatus(String containerCode, String locationCode, String status) { |
141 | 140 | if (StringUtils.isNotEmpty(containerCode) || StringUtils.isNotEmpty(locationCode)) { |
... | ... | @@ -154,15 +153,16 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
154 | 153 | public boolean updateStatus(String containerCode, String status, String warehouseCode) { |
155 | 154 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
156 | 155 | containerLambdaQueryWrapper.eq(Container::getCode, containerCode) |
157 | - .eq(Container::getWarehouseCode, warehouseCode); | |
156 | + .eq(Container::getWarehouseCode, warehouseCode); | |
158 | 157 | Container container = getOne(containerLambdaQueryWrapper); |
159 | 158 | container.setStatus(status); |
160 | - boolean result = update(container, containerLambdaQueryWrapper); | |
159 | + boolean result = update(container, containerLambdaQueryWrapper); | |
161 | 160 | return result; |
162 | 161 | } |
163 | 162 | |
164 | 163 | /** |
165 | 164 | * 如果为临时容器,在取消组盘和出库任务完成时删除容器 |
165 | + * | |
166 | 166 | * @param containerType 容器类型 |
167 | 167 | * @param containerCode 容器编码 |
168 | 168 | * @return |
... | ... | @@ -172,8 +172,8 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
172 | 172 | public void removeContainer(String containerType, String containerCode) { |
173 | 173 | if ("LS".equals(containerType)) { |
174 | 174 | LambdaQueryWrapper<Container> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
175 | - lambdaQueryWrapper.eq(Container::getCode,containerCode); | |
176 | - if (!this.remove(lambdaQueryWrapper)){ | |
175 | + lambdaQueryWrapper.eq(Container::getCode, containerCode); | |
176 | + if (!this.remove(lambdaQueryWrapper)) { | |
177 | 177 | throw new ServiceException("删除临时容器失败"); |
178 | 178 | } |
179 | 179 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java
... | ... | @@ -112,8 +112,16 @@ public class InventoryHeaderController extends BaseController { |
112 | 112 | .in(InventoryHeader::getCompanyCode, ShiroUtils.getCompanyCodeList()) |
113 | 113 | .orderByDesc(InventoryHeader::getId); |
114 | 114 | |
115 | - IPage<InventoryHeader> iPage = inventoryHeaderService.page(new Page<>(pageNum, pageSize), lambdaQueryWrapper); | |
116 | - return getMpDataTable(inventoryHeaderService.inventoryToDto(iPage.getRecords()), iPage.getTotal()); | |
115 | + | |
116 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | |
117 | + //分页查询 | |
118 | + Page<InventoryHeader> page = new Page<>(pageNum, pageSize); | |
119 | + IPage<InventoryHeader> iPage = inventoryHeaderService.page(page, lambdaQueryWrapper); | |
120 | + return getMpDataTable(inventoryHeaderService.inventoryToDto(iPage.getRecords()), iPage.getTotal()); | |
121 | + } else { | |
122 | + List<InventoryHeader> list = inventoryHeaderService.list(lambdaQueryWrapper); | |
123 | + return getDataTable(inventoryHeaderService.inventoryToDto(list)); | |
124 | + } | |
117 | 125 | } |
118 | 126 | |
119 | 127 | |
... | ... |