| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.TaskItem; |
| | | import com.vincent.rsf.server.manager.entity.Wave; |
| | | import com.vincent.rsf.server.manager.entity.WaveItem; |
| | | import com.vincent.rsf.server.manager.enums.WaveExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.WaveItemExceStatus; |
| | | import com.vincent.rsf.server.manager.service.TaskItemService; |
| | | import com.vincent.rsf.server.manager.service.WaveService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @Autowired |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private TaskItemService taskItemService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:wave:list')") |
| | | @PostMapping("/wave/page") |
| | |
| | | @OperationLog("Delete 波次单据") |
| | | @PostMapping("/wave/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!waveService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | if (Objects.isNull(ids)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | List<Long> list = Arrays.asList(ids); |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getSourceId, list)); |
| | | if (!taskItems.isEmpty()) { |
| | | throw new CoolException("有未完成任务,不可执行删除操作!!"); |
| | | } |
| | | return waveService.cancelWave(list); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:wave:list')") |
| | |
| | | if (Cools.isEmpty(map) || Cools.isEmpty(map.get("wave"))) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return waveService.publicTask(map); |
| | | return waveService.publicTask(map, getLoginUserId()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:wave:update')") |
| | | @ApiOperation("选择明细下发任务") |
| | | @PostMapping("/wave/selects/task") |
| | | public R waveToTask(@RequestBody Map<String, Object> map) { |
| | | if (Cools.isEmpty(map) || Cools.isEmpty(map.get("ids"))) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return waveService.waveToTask(map, getLoginUserId()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:wave:list')") |
| | | @ApiOperation("波次出库任务预览") |
| | | @PostMapping("/wave/locs/preview/page") |
| | | public R mergeWavePreview(@RequestBody Map<String, Object> map) { |
| | | if (Cools.isEmpty(map.get("wave")) || StringUtils.isBlank(map.get("wave").toString())) { |
| | | if (Cools.isEmpty(map.get("waveId")) || StringUtils.isBlank(map.get("waveId").toString())) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | Long waveId = Long.parseLong(map.get("waveId").toString()); |
| | |
| | | return R.ok().add(pageResult); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:waveItem:update')") |
| | | @ApiOperation("暂停下发任务") |
| | | @PostMapping("/wave/pause/pub/{id}") |
| | | public R pausePublicTask(@PathVariable Long id) { |
| | | waveService.update(new LambdaUpdateWrapper<Wave>() |
| | | .eq(Wave::getId, id) |
| | | .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_PAUSE.val)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:waveItem:update')") |
| | | @ApiOperation("继续下发任务") |
| | | @PostMapping("/wave/continue/pub/{id}") |
| | | public R continuePublicTask(@PathVariable Long id) { |
| | | waveService.update(new LambdaUpdateWrapper<Wave>() |
| | | .eq(Wave::getId, id) |
| | | .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |