From 1a686516357ec1da8dd011b3f0799a305a3af4fc Mon Sep 17 00:00:00 2001
From: lgh0010 <1746689524@qq.com>
Date: Fri, 19 Nov 2021 22:22:40 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E6=89=A7=E8=A1=8C=E4=BB=BB?=
=?UTF-8?q?=E5=8A=A1=E5=88=B0=E7=BC=93=E5=AD=98=E5=8C=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/mt/wms/core/MyGenerator.java | 2 +-
.../mt/wms/core/dal/entity/InStockInfo.java | 12 +-
.../com/mt/wms/core/dal/entity/RunTask.java | 125 ++++++++++++++++++
.../core/dal/mapper/InStockInfoMapper.java | 4 +-
.../mt/wms/core/dal/mapper/RunTaskMapper.java | 16 +++
.../mt/wms/core/dal/mapper/RunTaskMapper.xml | 25 ++++
.../dal/service/InStockInfoServiceBiz.java | 4 +-
.../core/dal/service/RunTaskServiceBiz.java | 16 +++
.../impl/InStockInfoServiceBizImpl.java | 4 +-
.../service/impl/RunTaskServiceBizImpl.java | 20 +++
.../mt/wms/empty/config/ExecutorConfig.java | 38 ++++++
.../mt/wms/empty/task/AsynRunTaskService.java | 103 +++++++++++++++
.../java/com/mt/wms/empty/task/RunTask.java | 26 ----
.../com/mt/wms/empty/task/RunTaskUtils.java | 96 ++++++++++++++
14 files changed, 452 insertions(+), 39 deletions(-)
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/RunTask.java
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.java
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.xml
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/RunTaskServiceBiz.java
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/RunTaskServiceBizImpl.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/config/ExecutorConfig.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
delete mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTask.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/MyGenerator.java b/6.program/wms-core/src/main/java/com/mt/wms/core/MyGenerator.java
index ddfd7f6..501f9cc 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/MyGenerator.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/MyGenerator.java
@@ -106,7 +106,7 @@ public class MyGenerator {
@Test
public void generateCodeWithInjectConfigForAllTable() {
- generateByTablesWithInjectConfig(new String[]{"t_[a-zA-Z0-9_]*"});
+ generateByTablesWithInjectConfig(new String[]{"t_in_stock_info"});
}
public static void main(String[] args) {
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/InStockInfo.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/InStockInfo.java
index 321d457..48f9a67 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/InStockInfo.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/InStockInfo.java
@@ -15,11 +15,11 @@ import lombok.experimental.Accessors;
/**
*
- * 缓存表存储情况
+ * 缓存区存储情况
*
*
* @author mt
- * @since 2021-11-18
+ * @since 2021-11-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@@ -89,16 +89,16 @@ public class InStockInfo extends Model {
private String taskCode;
/**
- * 历史任务id,关联当前任务表:t_task_his
+ * 任务id,关联当前任务表:currTask
*/
@TableField("task_id")
- private Integer taskId;
+ private Long taskId;
/**
* 窑炉id ,if(status == 0){从窑炉出来等待库存} else if(status == 1){到目标窑炉前缓存到库位}关联设备窑炉表:t_kiln_info
*/
@TableField("kiln_id")
- private Integer kilnId;
+ private Long kilnId;
/**
* 窑炉名称
@@ -110,7 +110,7 @@ public class InStockInfo extends Model {
* 库位id,关联库位表:t_location
*/
@TableField("location_id")
- private Integer locationId;
+ private Long locationId;
/**
* 库位名称
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/RunTask.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/RunTask.java
new file mode 100644
index 0000000..47b2b66
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/RunTask.java
@@ -0,0 +1,125 @@
+package com.mt.wms.core.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ *
+ * 执行任务信息表
+ *
+ *
+ * @author mt
+ * @since 2021-11-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("t_run_task")
+public class RunTask extends Model {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 删除标志,是否有效:1 可用 0不可用
+ */
+ @TableField("valid")
+ @TableLogic
+ private Integer valid;
+
+ /**
+ * 添加时间
+ */
+ @TableField("create_time")
+ private LocalDateTime createTime;
+
+ /**
+ * 创建人id
+ */
+ @TableField("creator_id")
+ private Integer creatorId;
+
+ /**
+ * 更新人id
+ */
+ @TableField("updater_id")
+ private Integer updaterId;
+
+ /**
+ * 修改时间
+ */
+ @TableField("update_time")
+ private LocalDateTime updateTime;
+
+ /**
+ * 版本号 默认为 1
+ */
+ @TableField("version")
+ @Version
+ private String version;
+
+ /**
+ * 任务id,关联wcs_task表
+ */
+ @TableField("task_id")
+ private Long taskId;
+
+ /**
+ * 开始位置
+ */
+ @TableField("start_position")
+ private String startPosition;
+
+ /**
+ * 结束位置
+ */
+ @TableField("end_position")
+ private String endPosition;
+
+ /**
+ * 状态,0:未执行,1:正在执行,2:执行成功,3:执行失败
+ */
+ @TableField("status")
+ private Integer status;
+
+
+ public static final String ID = "id";
+
+ public static final String VALID = "valid";
+
+ public static final String CREATE_TIME = "create_time";
+
+ public static final String CREATOR_ID = "creator_id";
+
+ public static final String UPDATER_ID = "updater_id";
+
+ public static final String UPDATE_TIME = "update_time";
+
+ public static final String VERSION = "version";
+
+ public static final String TASK_ID = "task_id";
+
+ public static final String START_POSITION = "start_position";
+
+ public static final String END_POSITION = "end_position";
+
+ public static final String STATUS = "status";
+
+ @Override
+ protected Serializable pkVal() {
+ return this.id;
+ }
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/InStockInfoMapper.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/InStockInfoMapper.java
index d21ef77..5d8d637 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/InStockInfoMapper.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/InStockInfoMapper.java
@@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
*
- * 缓存表存储情况 Mapper 接口
+ * 缓存区存储情况 Mapper 接口
*
*
* @author mt
- * @since 2021-11-18
+ * @since 2021-11-19
*/
public interface InStockInfoMapper extends BaseMapper {
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.java
new file mode 100644
index 0000000..aa9af35
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.java
@@ -0,0 +1,16 @@
+package com.mt.wms.core.dal.mapper;
+
+import com.mt.wms.core.dal.entity.RunTask;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 执行任务信息表 Mapper 接口
+ *
+ *
+ * @author mt
+ * @since 2021-11-19
+ */
+public interface RunTaskMapper extends BaseMapper {
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.xml
new file mode 100644
index 0000000..c39505f
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/RunTaskMapper.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, valid, create_time, creator_id, updater_id, update_time, version, task_id, start_position, end_position, status
+
+
+
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/InStockInfoServiceBiz.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/InStockInfoServiceBiz.java
index 3481cbc..1aca368 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/InStockInfoServiceBiz.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/InStockInfoServiceBiz.java
@@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
*
- * 缓存表存储情况 服务类
+ * 缓存区存储情况 服务类
*
*
* @author mt
- * @since 2021-11-18
+ * @since 2021-11-19
*/
public interface InStockInfoServiceBiz extends IService {
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/RunTaskServiceBiz.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/RunTaskServiceBiz.java
new file mode 100644
index 0000000..2e2f6ae
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/RunTaskServiceBiz.java
@@ -0,0 +1,16 @@
+package com.mt.wms.core.dal.service;
+
+import com.mt.wms.core.dal.entity.RunTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 执行任务信息表 服务类
+ *
+ *
+ * @author mt
+ * @since 2021-11-19
+ */
+public interface RunTaskServiceBiz extends IService {
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/InStockInfoServiceBizImpl.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/InStockInfoServiceBizImpl.java
index b604ca0..12842ac 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/InStockInfoServiceBizImpl.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/InStockInfoServiceBizImpl.java
@@ -8,11 +8,11 @@ import org.springframework.stereotype.Service;
/**
*
- * 缓存表存储情况 服务实现类
+ * 缓存区存储情况 服务实现类
*
*
* @author mt
- * @since 2021-11-18
+ * @since 2021-11-19
*/
@Service
public class InStockInfoServiceBizImpl extends ServiceImpl implements InStockInfoServiceBiz {
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/RunTaskServiceBizImpl.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/RunTaskServiceBizImpl.java
new file mode 100644
index 0000000..d95a742
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/RunTaskServiceBizImpl.java
@@ -0,0 +1,20 @@
+package com.mt.wms.core.dal.service.impl;
+
+import com.mt.wms.core.dal.entity.RunTask;
+import com.mt.wms.core.dal.mapper.RunTaskMapper;
+import com.mt.wms.core.dal.service.RunTaskServiceBiz;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 执行任务信息表 服务实现类
+ *
+ *
+ * @author mt
+ * @since 2021-11-19
+ */
+@Service
+public class RunTaskServiceBizImpl extends ServiceImpl implements RunTaskServiceBiz {
+
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/config/ExecutorConfig.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/config/ExecutorConfig.java
new file mode 100644
index 0000000..86b64dc
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/config/ExecutorConfig.java
@@ -0,0 +1,38 @@
+package com.mt.wms.empty.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * @Author: liguanghao
+ * @Date: 2021/11/18 20:09
+ * @Version 1.0
+ */
+@Configuration
+@EnableAsync
+public class ExecutorConfig {
+
+ @Bean
+ public ThreadPoolTaskExecutor asyncServiceExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ //配置核心线程数
+ executor.setCorePoolSize(5);
+ //配置最大线程数
+ executor.setMaxPoolSize(5);
+ //配置队列大小
+ executor.setQueueCapacity(10);
+ //配置线程池中的线程的名称前缀
+ executor.setThreadNamePrefix("async-service-");
+
+ // rejection-policy:当pool已经达到max size的时候,如何处理新任务
+ // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
+ executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+ //执行初始化
+ executor.initialize();
+ return executor;
+ }
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
new file mode 100644
index 0000000..8c8d0f1
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
@@ -0,0 +1,103 @@
+package com.mt.wms.empty.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mt.wms.core.dal.entity.*;
+import com.mt.wms.core.dal.service.*;
+import com.mt.wms.core.utils.IDGenerator;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+
+/**
+ * @Author: liguanghao
+ * @Date: 2021/11/18 20:27
+ * @Version 1.0
+ */
+@Service
+@Transactional
+public class AsynRunTaskService {
+
+ @Resource
+ private CurrTaskServiceBiz currTaskServiceBiz;
+ @Resource
+ private RunTaskServiceBiz runTaskServiceBiz;
+ @Resource
+ private LocationServiceBiz locationServiceBiz;
+ @Resource
+ private InStockInfoServiceBiz inStockInfoServiceBiz;
+
+ //窑炉可用未满的情况下,调用车辆起点为提升台终点为窑炉
+ @Async("asyncServiceExecutor")
+ public void asynRunTask(CurrTask currTask){
+ //新建一条执行任务的关系表存放任务执行信息
+ RunTask runTask=new RunTask();
+ runTask.setCreateTime(LocalDateTime.now());
+ runTask.setTaskId(currTask.getId());
+ runTask.setStartPosition(currTask.getStartPosition());
+ runTask.setEndPosition(currTask.getTargetPosition());
+ runTaskServiceBiz.save(runTask);
+ //调用车辆填入起终点
+
+ //得到车辆执行结果
+ //车辆执行不成功,记录日志,推送消息到前端提醒?
+
+ //执行成功,托盘进炉(存疑,进入窑炉不算任务完成的话,窑炉怎么给出是哪条任务加工完成了)
+ if (true){
+ //更新关系表状态为完成
+ runTask.setUpdateTime(LocalDateTime.now());
+ runTask.setStatus(2);
+ runTaskServiceBiz.updateById(runTask);
+ //更新currTask表状态为完成
+ currTask.setStatus(2);
+ currTask.setUpdateTime(LocalDateTime.now());
+ }
+ }
+ //窑炉已满,调用车辆起点为提升台,终点为缓存区
+ @Async("asyncServiceExecutor")
+ public void asynRunTaskToWarehouse(CurrTask currTask){
+ Location location = locationServiceBiz.list(new QueryWrapper()
+ .eq(Location.STATUS, 1)
+ .eq(Location.VALID, 1)).get(0);
+ //新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
+ RunTask runTask=new RunTask();
+ runTask.setCreateTime(LocalDateTime.now());
+ runTask.setTaskId(currTask.getId());
+ runTask.setStartPosition(currTask.getStartPosition());
+ runTask.setEndPosition(location.getCode());
+ runTaskServiceBiz.save(runTask);
+ //更新 location 表对应库位状态为占用
+ location.setStatus(1);
+ location.setUpdateTime(LocalDateTime.now());
+ locationServiceBiz.updateById(location);
+ //添加一条库位详情到in_stock_info表
+ InStockInfo inStockInfo=new InStockInfo();
+ inStockInfo.setCreateTime(LocalDateTime.now());
+ inStockInfo.setStatus(1);
+ inStockInfo.setInterCode(IDGenerator.gen("HCT", "yyyyMMddHHmm", 2, "WAREHOUSE_CODE"));
+ inStockInfo.setTaskId(currTask.getId());
+ inStockInfo.setTaskCode(currTask.getTaskCode());
+ inStockInfo.setKilnId(currTask.getKilnId());
+ inStockInfo.setKilnName(currTask.getKilnName());
+ inStockInfo.setLocationId(location.getId());
+ inStockInfo.setLocationName(location.getLocationNameAlias());
+ inStockInfo.setPalletCode(currTask.getPalletCode());
+ inStockInfoServiceBiz.save(inStockInfo);
+ //修改currTask的是否缓存,库位id,库位名称
+ currTask.setIsCache(1);
+ currTask.setLocationId(location.getId());
+ currTask.setLocationName(location.getLocationNameAlias());
+ currTaskServiceBiz.updateById(currTask);
+ //调用车辆
+
+ //车辆执行不成功,记录日志,推送消息到前端提醒?
+
+ //车辆执行执行成功后加入窑炉的缓存区任务队列
+
+ }
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTask.java
deleted file mode 100644
index 958ab66..0000000
--- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTask.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.mt.wms.empty.task;
-
-import com.mt.wms.core.vo.R;
-
-/**
- * @Author: liguanghao
- * @Date: 2021/11/15 21:55
- * @Version 1.0
- */
-public class RunTask {
-
- public R runTask() {
- //传入任务id,起始点,若终点是窑炉,获取窑炉状态
- int kilnStatus = 0;
- if (kilnStatus == 0) {//窑炉状态为不可用
- return R.failed("目标窑炉不可用!");
- }
- if (kilnStatus==1){//窑炉可用未满
-
- }
- if (kilnStatus==2){//窑炉已满
-
- }
- return null;
- }
-}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java
new file mode 100644
index 0000000..d95e94e
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java
@@ -0,0 +1,96 @@
+package com.mt.wms.empty.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mt.wms.core.dal.entity.*;
+import com.mt.wms.core.dal.service.*;
+import com.mt.wms.core.vo.R;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Author: liguanghao
+ * @Date: 2021/11/15 21:55
+ * @Version 1.0
+ */
+@Transactional
+public class RunTaskUtils {
+ @Resource
+ private CurrTaskServiceBiz currTaskServiceBiz;
+ @Resource
+ private RunTaskServiceBiz runTaskServiceBiz;
+ @Resource
+ private LocationServiceBiz locationServiceBiz;
+ @Resource
+ private AsynRunTaskService asynRunTaskService;
+ @Resource
+ private VehicleInfoServiceBiz vehicleInfoServiceBiz;
+
+
+ public R runTask(Integer wcsTaskId) throws InterruptedException {
+ CurrTask currTask = currTaskServiceBiz.getById(wcsTaskId);
+ //传入任务id,起始点,若终点是窑炉,获取窑炉状态
+ int kilnStatus = 1;
+
+ //窑炉状态为不可用
+ if (kilnStatus == 0) {
+ return R.failed("目标窑炉不可用!");
+ }
+ //窑炉可用未满
+ if (kilnStatus==1){
+ //更改任务状态为执行中
+ currTask.setStatus(1);
+ currTask.setUpdateTime(LocalDateTime.now());
+ currTaskServiceBiz.updateById(currTask);
+ //查询是否有空闲车辆,若有。占用车辆,若无,返回暂无可用车辆
+ List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper()
+ .eq(VehicleInfo.STATUS, 0)
+ .eq(VehicleInfo.VALID, 1));
+ if (vehicleInfoList.size()>0){
+ VehicleInfo vehicleInfo = vehicleInfoList.get(0);
+ vehicleInfo.setStatus(1);
+ vehicleInfo.setUpdateTime(LocalDateTime.now());
+ vehicleInfoServiceBiz.updateById(vehicleInfo);
+ }else {
+ return R.failed("暂无可用车辆!请稍后重试!");
+ }
+ //异步调用车辆
+ asynRunTaskService.asynRunTask(currTask);
+ return R.ok("操作成功");
+ }
+ //窑炉已满
+ if (kilnStatus==2){
+ //查询缓存区库位是否已满
+ int count = locationServiceBiz.count(new QueryWrapper()
+ .eq(Location.STATUS, 0)
+ .eq(Location.VALID, 1));
+ //缓存区未满
+ if (count >0) {
+ //更改任务状态为执行中
+ currTask.setStatus(1);
+ currTask.setUpdateTime(LocalDateTime.now());
+ currTaskServiceBiz.updateById(currTask);
+ //查询是否有空闲车辆,若有。占用车辆,若无,返回暂无可用车辆
+ List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper()
+ .eq(VehicleInfo.STATUS, 0)
+ .eq(VehicleInfo.VALID, 1));
+ if (vehicleInfoList.size()>0){
+ VehicleInfo vehicleInfo = vehicleInfoList.get(0);
+ vehicleInfo.setStatus(1);
+ vehicleInfo.setUpdateTime(LocalDateTime.now());
+ vehicleInfoServiceBiz.updateById(vehicleInfo);
+ }else {
+ return R.failed("暂无可用车辆!请稍后重试!");
+ }
+ //异步调用车辆
+ asynRunTaskService.asynRunTaskToWarehouse(currTask);
+ return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。");
+ }
+ return R.failed("当前目标窑炉已满!缓存区已满!请稍后重试!");
+ }
+ return null;
+ }
+}