任务管理及现场代码优化

main
Comair 1 year ago
parent 7534f24953
commit 6203ed7ed5
  1. 2
      shkj-wms/src/main/java/com/shkj/wms/bo/AGVTaskBo.java
  2. 5
      shkj-wms/src/main/java/com/shkj/wms/bo/BusinTaskManageQueryBo.java
  3. 2
      shkj-wms/src/main/java/com/shkj/wms/controller/business/BusinDataTaskController.java
  4. 8
      shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java
  5. 2
      shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java
  6. 9
      shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java
  7. 41
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java
  8. 5
      shkj-wms/src/main/java/com/shkj/wms/third/dps/DpsCallUtil.java
  9. 8
      shkj-wms/src/main/resources/mapper/wms/BusinDataTaskMapper.xml

@ -44,7 +44,7 @@ public class AGVTaskBo implements Serializable {
/**
* 任务编号
*/
private Long taskId;
private String taskId;
/**
* AGV进入巷道号 KW5 KW7 KW9

@ -37,4 +37,9 @@ public class BusinTaskManageQueryBo implements Serializable {
private String createTimeS;
private String createTimeE;
private String vehicheModel;
private String color;
}

@ -104,7 +104,7 @@ public class BusinDataTaskController extends BaseController {
@PostMapping("/activeTask")
@RepeatSubmit
public Result<Boolean> activeTask(BusinTaskManageDistributeBo bo){
return businDataTaskService.pauseTask(bo);
return businDataTaskService.activeTask(bo);
}

@ -136,7 +136,7 @@ public class PlcEventTask {
private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(8);
@Scheduled(fixedRate = 200)
//@Scheduled(fixedRate = 200)
public void init() {
//查询需要连接的PLC,初始化连接对象
List<WcsPlcConnectVo> plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1"));
@ -219,7 +219,7 @@ public class PlcEventTask {
}
}
@Scheduled(fixedRate = 200)
//@Scheduled(fixedRate = 200)
public void init1() {
//查询需要连接的PLC,初始化连接对象
List<WcsPlcConnectVo> plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1"));
@ -237,7 +237,7 @@ public class PlcEventTask {
}
}
@Scheduled(fixedRate = 200)
// @Scheduled(fixedRate = 200)
public void init2() {
//查询需要连接的PLC,初始化连接对象
List<WcsPlcConnectVo> plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1"));
@ -255,7 +255,7 @@ public class PlcEventTask {
}
}
@Scheduled(fixedDelay = 6000)
// @Scheduled(fixedDelay = 6000)
public void writePlcheartbeat() {
//根据连接的plcId获取属性
PlcOperate plcOperate = plcInit.getPlcOperate_41();

@ -42,7 +42,7 @@ public class PlcInit {
RedisTemplate redisTemplate;
private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
@PostConstruct
//@PostConstruct
public void init(){
log.info("初始化连接对象");
executorService.scheduleWithFixedDelay(

@ -51,6 +51,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Slf4j
@Component
@ -178,7 +179,7 @@ public class ScheduledTasks {
}
@Scheduled(fixedRate = 200)
// @Scheduled(fixedRate = 200)
public void task() {
// log.info("开始获取需要执行的任务");
//获取待下发任务数据
@ -239,7 +240,8 @@ public class ScheduledTasks {
taskQueryBo.setTaskType("25");
List<BusinDataTaskVo> businDataTaskVo25 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo);
businDataTaskVos.addAll(businDataTaskVo25);
// log.info("要执行的任务信息:"+JsonUtil.toJSONString(businDataTaskVos));
//按照优先级降序排序,优先级高的优先执行
businDataTaskVos = businDataTaskVos.stream().sorted(Comparator.comparing(BusinDataTaskVo::getIsTop,Comparator.reverseOrder())).collect(Collectors.toList());
for (BusinDataTaskVo businDataTaskVo : businDataTaskVos) {
doTask(businDataTaskVo);
}
@ -1807,8 +1809,9 @@ public class ScheduledTasks {
log.info("巷道内移库任务给堆垛机下发失败!"+businDataTask.getId());
return Result.err().msg("巷道内移库任务给堆垛机下发失败");
}
}else{
return Result.err();
}
return Result.ok();
}

@ -1311,11 +1311,13 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
LambdaQueryWrapper<BusinDataTask> wrapper = new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getId, bo.getTaskId()).last("limit 1");
BusinDataTask businDataTask = getOne(wrapper);
if (!businDataTask.getTaskStatus().equals("0") && !businDataTask.getTaskStatus().equals("1")) {
String taskStatus = businDataTask.getTaskStatus();
if (!taskStatus.equals("0") && !taskStatus.equals("1")) {
return Result.err().msg("此任务不可取消");
}
businDataTask.setTaskStatus("3");
Long locationId = businDataTask.getLocationId();
BaseLocation baseLocation = iBaseLocationService.getById(locationId);
//入库时需要释放货位状态
String taskType = businDataTask.getTaskType();
if (taskType.equals(TaskTypeEnum.byhand_in.getValue())
@ -1323,13 +1325,29 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
||taskType.equals(TaskTypeEnum.empty_in.getValue())
|| taskType.equals(TaskTypeEnum.emptyCon.getValue())
){
Long locationId = businDataTask.getLocationId();
BaseLocation baseLocation = iBaseLocationService.getById(locationId);
if (baseLocation != null){
baseLocation.setLocationStatus("0");
iBaseLocationService.updateById(baseLocation);
}
}
if (taskStatus.equals("0")){
if(taskType.equals(TaskTypeEnum.normal_out.getValue())
|| taskType.equals(TaskTypeEnum.urgent_out.getValue())
){
baseLocation.setLocationStatus("1");
}
//空治具出库时,取消时改状态为2
if (taskType.equals(TaskTypeEnum.emptyContainer_out.getValue())){
baseLocation.setLocationStatus("2");
}
}
if (baseLocation != null){
iBaseLocationService.updateById(baseLocation);
}
return this.updateById(businDataTask) ? Result.ok() : Result.err();
@ -1373,11 +1391,11 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
LambdaQueryWrapper<BusinDataTask> wrapper = new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getId, bo.getTaskId()).last("limit 1");
BusinDataTask businDataTask = getOne(wrapper);
if (!businDataTask.getTaskStatus().equals("0")) {
if (!"0".equals(businDataTask.getTaskStatus())) {
return Result.err().msg("此任务不可提升优先级");
}
//提升优先级
businDataTask.setPriority("1");
businDataTask.setIsTop("1");
return this.updateById(businDataTask) ? Result.ok() : Result.err();
}
@ -1983,6 +2001,13 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
String layer = inBaseLocation.getLayer();
String locationRow = inBaseLocation.getLocationRow();
String tunnel = inBaseLocation.getTunnel();
booleanResult = checkIsSleep(inBaseLocation);
if (!Result.isOk(booleanResult)){
return booleanResult;
}
if ("2".equals(locationRow) && "3".equals(locationRow) && "14".equals(locationRow)){
//获取双深位的货位信息
if (locationRow.equals("2")){
@ -2188,7 +2213,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
if (Result.isOk(stockListResult)) {
sysStockDetailVoList = stockListResult.getData();
if (sysStockDetailVoList != null && sysStockDetailVoList.size() != 0) {
return Result.err().msg("指定出库货位是双深位,单深位有货,不可出库" + baseLocationVo.getLocationCode());
return Result.err().msg("出库货位是双深位,单深位有货,不可出库" + baseLocationVo.getLocationCode());
}
}
}

@ -81,7 +81,7 @@ public class DpsCallUtil {
//获取仓库ID
BaseConsignor baseConsignor = result.getData();
Long taskId = bo.getTaskId();
String taskId = bo.getTaskId();
//立库输送线也需要询问是否可以进入
if (StringUtils.isNotEmpty(bo.getStation()) && !"".equals(bo.getStation())){
WcsPlcConnect conn1 = iWcsPlcConnectService.selectWcsPlcConnectById(39L);
@ -146,6 +146,9 @@ public class DpsCallUtil {
}else {
//根据任务编号找到PLC信息
BusinDataTask businDataTask = iBusinDataTaskService.getById(taskId);
if (businDataTask ==null){
return Result.err().msg("非wcs任务号");
}
Long plcId = businDataTask.getPlcId();
WcsPlcConnect conn = iWcsPlcConnectService.selectWcsPlcConnectById(plcId);
String address="" ;

@ -245,7 +245,6 @@
group by task_code) taskGoods
on task.id=taskGoods.task_code
left join base_goods_data goodsData on goodsData.goods_no =taskGoods.goods_no
-- left join base_derive derive on derive.color=goodsData.color and derive.vehiche_model=goodsData.vehiche_model
<where>
<if test="createTimeS !=null and createTimeS !=''">
@ -280,6 +279,13 @@
and task_status !='-1'
</if>
<if test="vehicheModel !=null and vehicheModel!='' ">
and goodsData.vehiche_model =#{vehicheModel}
</if>
<if test="color !=null and color !=''">
and goodsData.color =#{color}
</if>
</where>
order by task.id desc
</select>

Loading…
Cancel
Save