| | |
| | | <artifactId>rsf</artifactId> |
| | | <version>1.0.0</version> |
| | | </parent> |
| | | |
| | | <artifactId>rsf-open-api</artifactId> |
| | | |
| | | <packaging>jar</packaging> |
| | | <properties> |
| | | <maven.compiler.source>17</maven.compiler.source> |
| | | <maven.compiler.target>17</maven.compiler.target> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.vincent</groupId> |
| | |
| | | <version>1.0.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | <build> |
| | | <finalName>rsf-open-api</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>UTF-8</encoding> |
| | | <nonFilteredFileExtensions> |
| | | <nonFilteredFileExtension>xls</nonFilteredFileExtension> |
| | | <nonFilteredFileExtension>xlsx</nonFilteredFileExtension> |
| | | <nonFilteredFileExtension>zip</nonFilteredFileExtension> |
| | | </nonFilteredFileExtensions> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) |
| | | if (!taskService.update(new LambdaUpdateWrapper<Task>() |
| | | .lt(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id) |
| | | .eq(Task::getTaskCode, task.getTaskCode()) |
| | | .set(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | |
| | | if (!basStationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getOrgSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | if (!Objects.isNull(task.getOrgSite())) { |
| | | if (!basStationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getOrgSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) { |
| | | if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) |
| | | .lt(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id) |
| | | .set(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode),false); |
| | | List<Loc> list = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getAreaId, loc.getAreaId()) |
| | | .eq(Loc::getChannel,loc.getChannel()) |
| | | .eq(!Objects.isNull(loc.getChannel()), Loc::getChannel,loc.getChannel()) |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | ); |
| | | List<String> list1 = list.stream().map(obj -> obj.getCode()).collect(Collectors.toList()); |
| | |
| | | @Scheduled(cron = "0/35 * * * * ?") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void autoCheckComplete() { |
| | | Boolean autoRunArea = configService.getVal("AUTO_RUN_CHECK_ORDERS", Boolean.class); |
| | | if (!autoRunArea) { |
| | | return; |
| | | } |
| | | // Boolean autoRunArea = configService.getVal("AUTO_RUN_CHECK_ORDERS", Boolean.class); |
| | | // if (!autoRunArea) { |
| | | // return; |
| | | // } |
| | | //获取任务列表中,为盘点出库的任务 |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_CHECK_IN.type))); |
| | |
| | | if (!stationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getTargSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | log.error("站点状态修改完成失败,当前任务状态:", task.getTaskStatus()); |
| | | // throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | try { |
| | | taskService.pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); |
| | |
| | | if (!stationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getTargSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | log.error("站点状态修改完成失败,当前任务状态:", task.getTaskStatus()); |
| | | // throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("error====>", e); |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Scheduled(cron = "0/25 * * * * ?") |
| | | // @Scheduled(cron = "0 0/05 * * * ? ") |
| | | public void genRun() { |
| | | Boolean flagAuto = configService.getVal("AUTO_RUN_CHECK_ORDERS", Boolean.class); |
| | | if (!flagAuto) { |
| | |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import com.vincent.rsf.server.system.utils.SystemAuthUtils; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service("taskService") |
| | | public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService { |
| | | |
| | |
| | | */ |
| | | @Synchronized |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void complateInTask(List<Task> tasks) throws Exception { |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | for (Task task : tasks) { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) { |
| | | //1.入库 |
| | | complateInstock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | //53.拣料再入库 |
| | | //57.盘点再入库 |
| | | pickComplateInStock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | //移库 |
| | | moveInStock(task, loginUserId); |
| | | try { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) { |
| | | //1.入库 |
| | | complateInstock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | //53.拣料再入库 |
| | | //57.盘点再入库 |
| | | pickComplateInStock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | //移库 |
| | | moveInStock(task, loginUserId); |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Synchronized |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void completeTask(List<Task> tasks) { |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | for (Task task : tasks) { |
| | |
| | | try { |
| | | complateOutStock(task, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | log.error(e.getMessage(), e); |
| | | // throw new CoolException(e.getMessage()); |
| | | } |
| | | } |
| | | } |