Commit 51e1ea58ca0fc1c5fefb91d194eb0cfda4b6010c

Authored by 易文鹏
1 parent fdce854f

添加异常判断

src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java
@@ -130,17 +130,17 @@ public class TaskHeaderController extends BaseController { @@ -130,17 +130,17 @@ public class TaskHeaderController extends BaseController {
130 public TableDataInfo list(TaskHeader taskHeader, @ApiParam(name = "InternalTaskType", value = "类型") Integer InternalTaskType, 130 public TableDataInfo list(TaskHeader taskHeader, @ApiParam(name = "InternalTaskType", value = "类型") Integer InternalTaskType,
131 @ApiParam(name = "createdBegin", value = "类型") String createdBegin, @ApiParam(name = "createdEnd", value = "类型") String createdEnd,Integer taskHeaderStatus) { 131 @ApiParam(name = "createdBegin", value = "类型") String createdBegin, @ApiParam(name = "createdEnd", value = "类型") String createdEnd,Integer taskHeaderStatus) {
132 LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); 132 LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
133 - String zone=taskHeader.getZoneCode();  
134 - if(StringUtils.isEmpty(zone)&&ShiroUtils.getUser()!=null&& Arrays.asList(QuantityConstant.USERID_AGV).contains(ShiroUtils.getUserId().toString())) {  
135 - zone="B";  
136 - } 133 + //String zone=taskHeader.getZoneCode();
  134 + //if(StringUtils.isEmpty(zone)&&ShiroUtils.getUser()!=null&& Arrays.asList(QuantityConstant.USERID_AGV).contains(ShiroUtils.getUserId().toString())) {
  135 + // zone="B";
  136 + //}
137 lambdaQueryWrapper.eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) 137 lambdaQueryWrapper.eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode())
138 .eq(StringUtils.isNotNull(InternalTaskType), TaskHeader::getInternalTaskType, InternalTaskType) 138 .eq(StringUtils.isNotNull(InternalTaskType), TaskHeader::getInternalTaskType, InternalTaskType)
139 .eq(StringUtils.isNotNull(taskHeader.getId()), TaskHeader::getId, taskHeader.getId()) 139 .eq(StringUtils.isNotNull(taskHeader.getId()), TaskHeader::getId, taskHeader.getId())
140 .eq(StringUtils.isNotEmpty(taskHeader.getContainerCode()), TaskHeader::getContainerCode, taskHeader.getContainerCode()) 140 .eq(StringUtils.isNotEmpty(taskHeader.getContainerCode()), TaskHeader::getContainerCode, taskHeader.getContainerCode())
141 .eq(StringUtils.isNotEmpty(taskHeader.getToLocation()), TaskHeader::getToLocation, taskHeader.getToLocation()) 141 .eq(StringUtils.isNotEmpty(taskHeader.getToLocation()), TaskHeader::getToLocation, taskHeader.getToLocation())
142 .eq(StringUtils.isNotEmpty(taskHeader.getFromLocation()), TaskHeader::getFromLocation, taskHeader.getFromLocation()) 142 .eq(StringUtils.isNotEmpty(taskHeader.getFromLocation()), TaskHeader::getFromLocation, taskHeader.getFromLocation())
143 - .eq(StringUtils.isNotEmpty(zone), TaskHeader::getZoneCode,zone) 143 + .eq(StringUtils.isNotEmpty(taskHeader.getZoneCode()), TaskHeader::getZoneCode,taskHeader.getZoneCode())
144 .eq(StringUtils.isNotNull(taskHeader.getPriority()), TaskHeader::getPriority, taskHeader.getPriority()) 144 .eq(StringUtils.isNotNull(taskHeader.getPriority()), TaskHeader::getPriority, taskHeader.getPriority())
145 .eq(StringUtils.isNotNull(taskHeader.getPush()), TaskHeader::getPush, taskHeader.getPush()) 145 .eq(StringUtils.isNotNull(taskHeader.getPush()), TaskHeader::getPush, taskHeader.getPush())
146 .eq(StringUtils.isNotNull(taskHeader.getStatus()), TaskHeader::getStatus, taskHeader.getStatus()) 146 .eq(StringUtils.isNotNull(taskHeader.getStatus()), TaskHeader::getStatus, taskHeader.getStatus())
src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
@@ -165,6 +165,9 @@ public class ShipmentTaskService { @@ -165,6 +165,9 @@ public class ShipmentTaskService {
165 List<InventoryDetail> inventories = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); 165 List<InventoryDetail> inventories = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
166 if (inventories.size()>0) { 166 if (inventories.size()>0) {
167 List<InventoryHeader> list = inventoryHeaderService.list(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getId, inventories.get(0).getInventoryHeaderId())); 167 List<InventoryHeader> list = inventoryHeaderService.list(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getId, inventories.get(0).getInventoryHeaderId()));
  168 + if (list.isEmpty()) {
  169 + throw new ServiceException("生成任务失败,该库存头不存在:"+inventories.get(0).getInventoryHeaderId());
  170 + }
168 barCodeHeaderCode=list.get(0).getBarCodeHeaderCode(); 171 barCodeHeaderCode=list.get(0).getBarCodeHeaderCode();
169 } 172 }
170 BigDecimal inventoryTotal = new BigDecimal("0"); 173 BigDecimal inventoryTotal = new BigDecimal("0");
@@ -337,7 +340,9 @@ public class ShipmentTaskService { @@ -337,7 +340,9 @@ public class ShipmentTaskService {
337 } 340 }
338 //减扣库存单 341 //减扣库存单
339 inventoryHeader = inventoryHeaderService.getById(inventoryDetail.getInventoryHeaderId()); 342 inventoryHeader = inventoryHeaderService.getById(inventoryDetail.getInventoryHeaderId());
340 - 343 + if (inventoryHeader==null) {
  344 + throw new ServiceException("该库存ID不存在:"+inventoryDetail.getInventoryHeaderId());
  345 + }
341 //扣减库存明细 346 //扣减库存明细
342 inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().subtract(taskDetail.getQty())); 347 inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().subtract(taskDetail.getQty()));
343 inventoryDetail.setQty(inventoryDetail.getQty().subtract(taskDetail.getQty())); 348 inventoryDetail.setQty(inventoryDetail.getQty().subtract(taskDetail.getQty()));
@@ -356,6 +361,7 @@ public class ShipmentTaskService { @@ -356,6 +361,7 @@ public class ShipmentTaskService {
356 if (inventoryDetail.getQty().signum() == 0&& inventoryDetail.getTaskQty().signum() == 0) { 361 if (inventoryDetail.getQty().signum() == 0&& inventoryDetail.getTaskQty().signum() == 0) {
357 //如果库存没有了,就删除这个库存 362 //如果库存没有了,就删除这个库存
358 inventoryDetailService.removeById(inventoryDetail.getId()); 363 inventoryDetailService.removeById(inventoryDetail.getId());
  364 +
359 inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().subtract(taskDetail.getQty())); 365 inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().subtract(taskDetail.getQty()));
360 inventoryHeader.setTotalLines(inventoryHeader.getTotalLines() - 1); 366 inventoryHeader.setTotalLines(inventoryHeader.getTotalLines() - 1);
361 if (inventoryHeader.getTotalQty().signum() == 0) { 367 if (inventoryHeader.getTotalQty().signum() == 0) {
src/main/resources/templates/inventory/inventoryHeader/inventoryHeader.html
@@ -78,6 +78,9 @@ @@ -78,6 +78,9 @@
78 shiro:hasPermission="inventory:inventoryHeader:seeOut"> 78 shiro:hasPermission="inventory:inventoryHeader:seeOut">
79 <i class="fa fa-eye"></i> 出库查看盘点 79 <i class="fa fa-eye"></i> 出库查看盘点
80 </a> 80 </a>
  81 + <a class="btn btn-outline btn-info btn-rounded" onclick="$.table.exportExcel()">
  82 + <i class="fa fa-download"></i> 导出库存
  83 + </a>
81 <!-- <a class="btn btn-outline btn-info btn-rounded" onclick="emptyIn()"--> 84 <!-- <a class="btn btn-outline btn-info btn-rounded" onclick="emptyIn()"-->
82 <!-- shiro:hasPermission="inventory:inventoryHeader:emptyIn">--> 85 <!-- shiro:hasPermission="inventory:inventoryHeader:emptyIn">-->
83 <!-- <i class="fa fa-level-down"></i> 空托入库--> 86 <!-- <i class="fa fa-level-down"></i> 空托入库-->