Browse Source

修改拆单

visual
chenlong 4 months ago
parent
commit
1167fdf256
  1. 6
      blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitAllTaskStateConstant.java
  2. 83
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  3. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddPackageCodeDTO.java
  4. 12
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddTaskDTO.java
  5. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/CancelPackageCodeDTO.java
  6. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/TaskId.java
  7. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

6
blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitAllTaskStateConstant.java

@ -10,9 +10,9 @@ import lombok.Getter;
@Getter
public enum OrderSplitAllTaskStateConstant {
InProgress("未完成",0),
finish("已完成",1),
cancel("已撤销",2);
InProgress("未完成",1),
finish("已完成",2),
cancel("已撤销",3);
private final String name;
private final Integer value;

83
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java

@ -2,17 +2,19 @@ package com.logpm.distribution.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO;
import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO;
import com.logpm.distribution.dto.splitOrder.*;
import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import com.logpm.distribution.service.IDistributionSplitOrderTaskService;
import com.logpm.distribution.vo.SplitPackageOrderVO;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@ -23,8 +25,8 @@ public class DistributionSplitOrderTaskController {
@PostMapping("/add-package-code")
public R<String> addPackageCode(Long taskId, List<String> packageCodes) {
return distributionSplitOrderTaskService.addPackageCode(taskId, packageCodes);
public R<String> addPackageCode(@RequestBody AddPackageCodeDTO addPackageCodeDTO) {
return distributionSplitOrderTaskService.addPackageCode(addPackageCodeDTO.getTaskId(), addPackageCodeDTO.getPackageCodes());
}
@GetMapping("/all-task-list")
@ -33,81 +35,92 @@ public class DistributionSplitOrderTaskController {
}
@PostMapping("/batch-create-task")
public R<String> batchCreateTask(@RequestBody List<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList) {
public R<String> batchCreateTask(@RequestBody ArrayList<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList) {
return distributionSplitOrderTaskService.batchCreateTask(distributionSplitOrderTaskList);
}
@PostMapping("/add-task")
public R<String> addTask(Long allTaskId, List<DistributionSplitOrderTaskEntity> task) {
return distributionSplitOrderTaskService.addTask(allTaskId, task);
public R<String> addTask(@RequestBody AddTaskDTO addTaskDTO) {
return distributionSplitOrderTaskService.addTask(addTaskDTO.getAllTaskId(), addTaskDTO.getTask());
}
@PostMapping("/cancel-all-task")
public R<String> cancelAllTask(Long allTaskId) {
return distributionSplitOrderTaskService.cancelAllTask(allTaskId);
public R<String> cancelAllTask(@RequestBody TaskId allTaskId) {
return distributionSplitOrderTaskService.cancelAllTask(allTaskId.getAllTaskId());
}
@RequestMapping("/cancel-package-code")
public R<String> cancelPackageCode(Long taskId, List<String> packageCodes) {
return distributionSplitOrderTaskService.cancelPackageCode(taskId, packageCodes);
@PostMapping("/cancel-package-code")
public R<String> cancelPackageCode(@RequestBody CancelPackageCodeDTO cancelPackageCodeDTO) {
return distributionSplitOrderTaskService.cancelPackageCode(cancelPackageCodeDTO.getTaskId(), cancelPackageCodeDTO.getPackageCodes());
}
@RequestMapping("/cancel-task")
public R<String> cancelTask(Long taskId) {
return distributionSplitOrderTaskService.cancelTask(taskId);
@PostMapping("/cancel-task")
public R<String> cancelTask(@RequestBody TaskId taskId) {
return distributionSplitOrderTaskService.cancelTask(taskId.getTaskId());
}
/**
* 用不着
* @param distributionSplitOrderTaskEntity
* @param packageCodeList
* @return
*/
@RequestMapping("/create-task")
public R<String> createTask(DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity, List<String> packageCodeList) {
public R<String> createTask(DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity, ArrayList<String> packageCodeList) {
return distributionSplitOrderTaskService.createTask(distributionSplitOrderTaskEntity, packageCodeList);
}
@RequestMapping("/delete-all-task")
public R<String> deleteAllTask(Long allTaskId) {
return distributionSplitOrderTaskService.deleteAllTask(allTaskId);
@PostMapping("/delete-all-task")
public R<String> deleteAllTask(@RequestBody TaskId allTaskId) {
return distributionSplitOrderTaskService.deleteAllTask(allTaskId.getAllTaskId());
}
@RequestMapping("/delete-task")
public R<String> deleteTask(Long taskId) {
return distributionSplitOrderTaskService.deleteTask(taskId);
@PostMapping("/delete-task")
public R<String> deleteTask(@RequestBody TaskId taskId) {
return distributionSplitOrderTaskService.deleteTask(taskId.getTaskId());
}
@RequestMapping("/finish-all-task")
public R<String> finishAllTask(Long allTaskId) {
return distributionSplitOrderTaskService.finishAllTask(allTaskId);
@PostMapping("/finish-all-task")
public R<String> finishAllTask(@RequestBody TaskId allTaskId) {
return distributionSplitOrderTaskService.finishAllTask(allTaskId.getAllTaskId());
}
@RequestMapping("/finish-task")
public R<String> finishTask(Long taskId) {
return distributionSplitOrderTaskService.finishTask(taskId);
@PostMapping("/finish-task")
public R<String> finishTask(@RequestBody TaskId taskId) {
return distributionSplitOrderTaskService.finishTask(taskId.getTaskId());
}
@RequestMapping("/get-task-detail")
@GetMapping("/get-task-detail")
public R<Object> getTaskDetail(Long taskId) {
return distributionSplitOrderTaskService.getTaskDetail(taskId);
}
@RequestMapping("/task-list")
@GetMapping("/task-list")
public R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) {
return distributionSplitOrderTaskService.taskList(query, distributionSplitTaskSearchDTO);
}
@RequestMapping("/update-task")
public R<String> updateTask(DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity) {
@PostMapping("/update-task")
public R<String> updateTask(@RequestBody DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity) {
return distributionSplitOrderTaskService.updateTask(distributionSplitOrderTaskEntity);
}
@RequestMapping("/check-order-code")
/**
* 检查是否已经被拆单
* @param orderCode
* @return
*/
@GetMapping("/check-order-code")
public R<String> checkOrderCode(String orderCode) {
return distributionSplitOrderTaskService.checkOrderCode(orderCode);
}
@RequestMapping("/get-package-code-by-order-code")
@GetMapping("/get-package-code-by-order-code")
public R<IPage<SplitPackageOrderVO>> getPackageCodeByOrderCode(Query query, String orderCode) {
return distributionSplitOrderTaskService.getPackageCodeByOrderCode(query, orderCode);
}
@RequestMapping("/get-package-code-by-task-id")
@GetMapping("/get-package-code-by-task-id")
public R<List<SplitPackageOrderVO>> getPackageCodeByTaskId(Long taskId) {
return distributionSplitOrderTaskService.getPackageCodeByTaskId( taskId);
}

14
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddPackageCodeDTO.java

@ -0,0 +1,14 @@
package com.logpm.distribution.dto.splitOrder;
import lombok.Data;
import java.util.List;
@Data
public class AddPackageCodeDTO {
private Long taskId;
private List<String> packageCodes;
}

12
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddTaskDTO.java

@ -0,0 +1,12 @@
package com.logpm.distribution.dto.splitOrder;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import lombok.Data;
import java.util.List;
@Data
public class AddTaskDTO {
private Long allTaskId;
private List<DistributionSplitOrderTaskEntity> task;
}

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/CancelPackageCodeDTO.java

@ -0,0 +1,7 @@
package com.logpm.distribution.dto.splitOrder;
public class CancelPackageCodeDTO extends AddPackageCodeDTO{
}

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/TaskId.java

@ -0,0 +1,10 @@
package com.logpm.distribution.dto.splitOrder;
import lombok.Data;
@Data
public class TaskId {
private Long taskId;
private Long allTaskId;
}

14
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

@ -26,6 +26,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.order.OrderSplitAllTaskStateConstant;
import org.springblade.common.constant.order.OrderSplitStateConstant;
import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageSplitStateConstant;
import org.springblade.common.exception.CustomerException;
@ -80,6 +81,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
queryWrapper.between(DistributionSplitOrderTaskEntity::getCreateTime, distributionSplitTaskSearchDTO.getCreateTime()[0], distributionSplitTaskSearchDTO.getCreateTime()[1]);
}
queryWrapper.in(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue(), OrderSplitStateConstant.finish.getValue());
IPage<DistributionSplitOrderTaskEntity> page = Condition.getPage(query);
List<DistributionSplitOrderTaskEntity> list = list(page, queryWrapper);
page.setRecords(list);
@ -113,7 +115,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
allTask.setStockArticleId(stockArticleId);
allTask.setOrderCode(distributionStockArticle.getOrderCode());
allTask.setNumber(distributionSplitOrderTaskList.size());
allTask.setState(OrderSplitStateConstant.InProgress.getValue());
allTask.setState(OrderSplitAllTaskStateConstant.InProgress.getValue());
allTask.setMallName(distributionStockArticle.getMallName());
int taskNumber = distributionSplitOrderTaskList.stream()
.map(DistributionSplitOrderTaskEntity::getTaskNumber)
@ -204,7 +206,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
if (task == null) {
return R.fail("拆单任务不存在");
}
if (!task.getState().equals(OrderSplitAllTaskStateConstant.InProgress.getValue())) {
if (!task.getState().equals(OrderSplitStateConstant.InProgress.getValue())) {
return R.fail("拆单任务已完成,无法添加");
}
@ -538,9 +540,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
allTask.setOrderPackageNumber(allTask.getOrderPackageNumber() - task.getTaskNumber());
distributionSplitOrderAllTaskService.updateById(allTask);
task.setIsDeleted(1);
task.setNumber(0);
updateById(task);
removeById(task);
return R.success("success");
} catch (Exception e) {
@ -775,8 +775,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
}
allTask.setIsDeleted(1);
distributionSplitOrderAllTaskService.updateById(allTask);
distributionSplitOrderAllTaskService.removeById(allTask);
} catch (Exception e) {
if (e instanceof CustomerException) {
throw new CustomerException(e.getMessage());
@ -906,6 +905,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
List<DistributionSplitOrderDetailEntity> details = distributionSplitOrderDetailService.list(
Wrappers.<DistributionSplitOrderDetailEntity>lambdaQuery()
.eq(DistributionSplitOrderDetailEntity::getSplitOrderTaskId, taskId)
.eq(DistributionSplitOrderDetailEntity::getState, OrderPackageSplitStateConstant.finish.getValue())
);
List<SplitPackageOrderVO> res = new ArrayList<>();
if (!details.isEmpty()){

Loading…
Cancel
Save