Commit ade2759e6a1aa2e0facca2fed6b33fe6877b9cd1

Authored by 肖超群
1 parent bcb76a29

处理空出

处理重入
    处理取货错
ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue
... ... @@ -261,7 +261,7 @@ export default {
261 261 dataIndex: 'status_dictText',
262 262 },
263 263 {
264   - title: '是否重入',
  264 + title: '重入',
265 265 align: "center",
266 266 dataIndex: 'isDoubleIn_dictText',
267 267 },
... ...
ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue
... ... @@ -261,11 +261,16 @@ export default {
261 261 dataIndex: 'status_dictText',
262 262 },
263 263 {
264   - title: '是否空出',
  264 + title: '空出',
265 265 align: "center",
266 266 dataIndex: 'isEmptyOut_dictText',
267 267 },
268 268 {
  269 + title: '取货错',
  270 + align: "center",
  271 + dataIndex: 'isPickupError_dictText',
  272 + },
  273 + {
269 274 title: '创建人',
270 275 align: "center",
271 276 dataIndex: 'createBy'
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java
... ... @@ -40,4 +40,5 @@ public interface WcsService {
40 40 * 取货错处理
41 41 */
42 42 Result pickupErrorHandle(String taskNo);
  43 +
43 44 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -460,6 +460,7 @@ public class WcsServiceImpl implements WcsService {
460 460 return Result.error("任务已完成");
461 461 }
462 462  
  463 + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
463 464 taskHeader.setIsEmptyOut(QuantityConstant.EMPTY_OUT);
464 465 taskHeader.setExceptionName("空出处理");
465 466 taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_ERROR);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
... ... @@ -40,16 +40,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
40 40 import org.jeecgframework.poi.excel.entity.ImportParams;
41 41 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
42 42 import org.springframework.beans.factory.annotation.Autowired;
43   -import org.springframework.web.bind.annotation.DeleteMapping;
44   -import org.springframework.web.bind.annotation.GetMapping;
45   -import org.springframework.web.bind.annotation.PathVariable;
46   -import org.springframework.web.bind.annotation.PostMapping;
47   -import org.springframework.web.bind.annotation.RequestBody;
48   -import org.springframework.web.bind.annotation.RequestMapping;
49   -import org.springframework.web.bind.annotation.RequestMethod;
50   -import org.springframework.web.bind.annotation.RequestParam;
51   -import org.springframework.web.bind.annotation.ResponseBody;
52   -import org.springframework.web.bind.annotation.RestController;
  43 +import org.springframework.web.bind.annotation.*;
53 44 import org.springframework.web.multipart.MultipartFile;
54 45 import org.springframework.web.multipart.MultipartHttpServletRequest;
55 46 import org.springframework.web.servlet.ModelAndView;
... ... @@ -656,4 +647,5 @@ public class TaskHeaderController extends HuahengBaseController {
656 647 }
657 648 return Result.OK(portList);
658 649 }
  650 +
659 651 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java
... ... @@ -85,6 +85,11 @@ public class TaskHeader implements Serializable {
85 85 @Dict(dicCode = "is_or_not")
86 86 @ApiModelProperty(value = "是否重入")
87 87 private Integer isDoubleIn;
  88 + /** 取货错 */
  89 + @Excel(name = "取货错", width = 15, dicCode = "is_or_not")
  90 + @Dict(dicCode = "is_or_not")
  91 + @ApiModelProperty(value = "取货错")
  92 + private Integer isPickupError;
88 93 /** 重入库位号 */
89 94 @Excel(name = "重入库位号", width = 15)
90 95 @ApiModelProperty(value = "重入库位号")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... ... @@ -193,4 +193,24 @@ public interface ITaskHeaderService extends IService<TaskHeader> {
193 193 */
194 194 Result addMesTryTimes(TaskHeader taskHeader);
195 195  
  196 + /**
  197 + * 处理空出
  198 + * @param taskNo
  199 + * @return
  200 + */
  201 + Result handleEmptyOut(String taskNo);
  202 +
  203 + /**
  204 + * 处理重入
  205 + * @param taskNo
  206 + * @return
  207 + */
  208 + Result handleDoubleIn(String taskNo);
  209 +
  210 + /**
  211 + * 处理取货错
  212 + * @param taskNo
  213 + * @return
  214 + */
  215 + Result handlePickupError(String taskNo);
196 216 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -639,6 +639,146 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
639 639 }
640 640  
641 641 @Override
  642 + public Result handleEmptyOut(String taskNo) {
  643 + // 1、判断非空字段
  644 + if (StringUtils.isEmpty(taskNo)) {
  645 + return Result.error("处理空出失败,任务号为空");
  646 + }
  647 + // 2、根据任务号查找任务
  648 + TaskHeader taskHeader = taskHeaderService.getById(taskNo);
  649 + if (taskHeader == null) {
  650 + return Result.error("处理空出失败,没有找到该任务");
  651 + }
  652 + // 3、已经完成的任务,不需要在处理
  653 + if (taskHeader.getStatus() != QuantityConstant.TASK_STATUS_COMPLETED) {
  654 + return Result.OK("处理空出失败, 任务没有完成");
  655 + }
  656 + String containerCode = taskHeader.getContainerCode();
  657 + String fromLocationCode = taskHeader.getFromLocationCode();
  658 + String warehouseCode = taskHeader.getWarehouseCode();
  659 + // 4、容器号、库位号、仓库编码 不能为空
  660 + if (StringUtils.isEmpty(containerCode)) {
  661 + return Result.error("处理空出失败,容器号为空");
  662 + }
  663 + if (StringUtils.isEmpty(fromLocationCode)) {
  664 + return Result.error("处理空出失败,起始库号位为空");
  665 + }
  666 + if (StringUtils.isEmpty(warehouseCode)) {
  667 + return Result.error("处理空出失败,仓库编码为空");
  668 + }
  669 + Container container = containerService.getContainerByCode(containerCode, warehouseCode);
  670 + if (container == null) {
  671 + return Result.error("处理空出失败,没有找到容器");
  672 + }
  673 + Location fronLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
  674 + if (fronLocation == null) {
  675 + return Result.error("处理空出失败,没有找到库位");
  676 + }
  677 + // 5、删除容器上的库位号,并设置状态为空盘
  678 + boolean success =
  679 + containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
  680 + if (!success) {
  681 + throw new ServiceException("处理空出失败, 更新容器状态失败");
  682 + }
  683 + // 6、删除库位上的容器号,并设置状态为空闲
  684 + success =
  685 + locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
  686 + if (!success) {
  687 + throw new ServiceException("处理空出失败, 更新库位状态失败");
  688 + }
  689 + // 7、删除库存头失败
  690 + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode);
  691 + if (inventoryHeader != null) {
  692 + success = inventoryHeaderService.removeById(inventoryHeader.getId());
  693 + if (!success) {
  694 + throw new ServiceException("处理空出失败, 删除库存头失败");
  695 + }
  696 + }
  697 + // 8、删除库存详情失败
  698 + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode);
  699 + if (inventoryDetailList.size() != 0) {
  700 + success = inventoryDetailService.removeByIds(inventoryDetailList);
  701 + if (!success) {
  702 + throw new ServiceException("处理空出失败, 删除库存详情失败");
  703 + }
  704 + }
  705 + return Result.error("处理空出成功");
  706 + }
  707 +
  708 + @Override
  709 + public Result handleDoubleIn(String taskNo) {
  710 + // 1、判断非空字段
  711 + if (StringUtils.isEmpty(taskNo)) {
  712 + return Result.error("处理重入失败,任务号为空");
  713 + }
  714 + // 2、根据任务号查找任务
  715 + TaskHeader taskHeader = taskHeaderService.getById(taskNo);
  716 + if (taskHeader == null) {
  717 + return Result.error("处理重入失败,没有找到该任务");
  718 + }
  719 + // 3、已经完成的任务,不需要在处理
  720 + if (taskHeader.getStatus() != QuantityConstant.TASK_STATUS_COMPLETED) {
  721 + return Result.OK("处理重入失败, 任务没有完成");
  722 + }
  723 +
  724 + String containerCode = taskHeader.getContainerCode();
  725 + String originLocationCode = taskHeader.getOriginLocationCode();
  726 + String warehouseCode = taskHeader.getWarehouseCode();
  727 + // 4、容器号、库位号、仓库编码 不能为空
  728 + if (StringUtils.isEmpty(containerCode)) {
  729 + return Result.error("处理重入失败,容器号为空");
  730 + }
  731 + if (StringUtils.isEmpty(originLocationCode)) {
  732 + return Result.error("处理重入失败,终点库号位为空");
  733 + }
  734 + if (StringUtils.isEmpty(warehouseCode)) {
  735 + return Result.error("处理重入失败,仓库编码为空");
  736 + }
  737 + Container container = containerService.getContainerByCode(containerCode, warehouseCode);
  738 + if (container == null) {
  739 + return Result.error("处理重入失败,没有找到容器");
  740 + }
  741 + String[] locationCodes = originLocationCode.split(",");
  742 + for (String locationCode : locationCodes) {
  743 + Location toLocation = locationService.getLocationByCode(locationCode, warehouseCode);
  744 + if (toLocation == null) {
  745 + return Result.error("处理重入失败,没有找到库位");
  746 + }
  747 + toLocation.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY);
  748 + boolean success = locationService.updateById(toLocation);
  749 + if (!success) {
  750 + throw new ServiceException("处理重入失败,更新库位失败");
  751 + }
  752 + }
  753 +
  754 + return Result.ok("处理重入成功");
  755 + }
  756 +
  757 + @Override
  758 + public Result handlePickupError(String taskNo) {
  759 + // 1、判断非空字段
  760 + if (StringUtils.isEmpty(taskNo)) {
  761 + return Result.error("处理取货错失败,任务号为空");
  762 + }
  763 + // 2、根据任务号查找任务
  764 + TaskHeader taskHeader = taskHeaderService.getById(taskNo);
  765 + if (taskHeader == null) {
  766 + return Result.error("处理取货错失败,没有找到该任务");
  767 + }
  768 + // 3、已经完成的任务,不需要在处理
  769 + if (taskHeader.getStatus() != QuantityConstant.TASK_STATUS_COMPLETED) {
  770 + return Result.OK("处理取货错失败, 任务没有完成");
  771 + }
  772 +
  773 + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD);
  774 + boolean success = taskHeaderService.updateById(taskHeader);
  775 + if (!success) {
  776 + throw new ServiceException("处理取货错失败,更新任务失败");
  777 + }
  778 + return Result.ok("处理取货错成功");
  779 + }
  780 +
  781 + @Override
642 782 public TaskHeader getUnCompleteTaskByFromLocationCode(String fromLocationCode, String warehouseCode) {
643 783 LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
644 784 taskHeaderLambdaQueryWrapper.eq(TaskHeader::getFromLocationCode, fromLocationCode).eq(TaskHeader::getWarehouseCode, warehouseCode).lt(TaskHeader::getStatus,
... ...