巷道内移库给堆垛机下发任务

main
judy 1 year ago
parent 180487501e
commit d5e9f8bd39
  1. 17
      shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java
  2. 17
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java

@ -1584,6 +1584,9 @@ public class ScheduledTasks {
else if (taskType.equals(TaskTypeEnum.seat_adjustment.getValue())){
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId());
moveTask(businDataTask);
}else if (taskType.equals(TaskTypeEnum.relocation_out.getValue())){
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId());
Result<Boolean> taskResult = outTask(businDataTask);
}
log.info("任务号" + businDataTaskVo.getId() + "任务状态" + businDataTaskVo.getTaskStatus() + "点位信息" + businDataTaskVo.getPoints());
//统一提交任务数据
@ -1673,6 +1676,7 @@ public class ScheduledTasks {
//请求出库 给堆垛机下命令判断是否 加锁 加锁则返回
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()))
&& redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()).toString().equals("true")) {
log.info("出库时下发时,堆垛机加锁中"+businDataTask.getId());
return Result.err();
} else {
redisTemplate.opsForValue().set("stackerLock:" + businDataTask.getTunnel(), "true");
@ -1701,12 +1705,8 @@ public class ScheduledTasks {
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite();
if (plcReadAndWrite.execWrite(stkOperate, JsonUtil.toJSONString(allMap))) {
//解锁
//redisTemplate.opsForValue().set("stackerLock", "false");
return Result.ok();
} else {
//解锁
//redisTemplate.opsForValue().set("stackerLock", "false");
return Result.err();
}
} else {
@ -1766,6 +1766,15 @@ public class ScheduledTasks {
PLCReadAndWrite plcReadAndWriteD = new PLCReadAndWrite();
Map<String, Object> pointDMap = plcReadAndWriteD.readPlcData(stkOperate, plcConnect.getPointTables());
if (pointDMap.containsKey(readNullPoint)&&Boolean.valueOf(pointDMap.get(readNullPoint).toString())&&pointDMap.get(overonaddress).equals("0")) {
//请求出库 给堆垛机下命令判断是否 加锁 加锁则返回
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()))
&& redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()).toString().equals("true")) {
log.info("移库任务下发时,堆垛机加锁中"+businDataTask.getId());
return Result.err();
} else {
redisTemplate.opsForValue().set("stackerLock:" + businDataTask.getTunnel(), "true");
}
//给堆垛机写命令
Map<String, Object> allMap = new HashMap<>(1);
Map<String, Object> plcTaskIdMap = new HashMap<>(1);

@ -286,8 +286,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
List<String> dbTableColumnNames = pointDeviceout.stream().map(BasePointDeviceVo::getPointNo).collect(Collectors.toList());
String urgencyBefore = null;
String urgencyAfter = null;
for (String str : dbTableColumnNames
) {
for (String str : dbTableColumnNames) {
// TODO 中科 测试 需要还原
if (str.equals(ParameterConstants.ParameterSystem.assemble_point_after)) {
urgencyAfter = str;
@ -329,8 +328,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
task.setTraverseDate(DateUtils.parseDate(baseBarcodesOut.getTraverseDate()));
task.setTaskPath(urgencyBefore);
task.setTaskStatus("0");
// TODO 测试注释 要打开
// task.setDistinction("2");
if (proportionStatus) {
task.setDistinction("1");
} else {
@ -381,8 +379,6 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
businDataTask.setCreateTime(DateUtils.getNowDate());
businDataTask.setTraverseDate(DateUtils.parseDate(baseBarcodesOut.getTraverseDate()));
businDataTask.setTaskPath(urgencyAfter);
// TODO 测试注释 要打开
// task.setDistinction("1");
if (proportionStatus) {
businDataTask.setDistinction("1");
} else {
@ -1063,9 +1059,8 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
//排序后的巷道货位数(降序)
Map<String, Integer> tunnelLocQtyDicSort = new LinkedHashMap<>();
tunnelLocQtyDic.entrySet().stream().sorted(Map.Entry.<String, Long>comparingByValue().reversed()).forEachOrdered(e -> tunnelLocQtyDicSort.put(e.getKey(), e.getValue().intValue()));
//log.info("查询到的保险杠所在的货位信息:"+JsonUtil.toJSONString(tunnelVo));
List<String> tunnelall = tunnelVo.stream().map(e -> e.getTunnel()).collect(Collectors.toList());
// log.info("查询到保险杠所在的巷道:"+JsonUtil.toJSONString(tunnelall));
//拿到任务数最少的巷道并且库存量是最大的
String tunnelone = this.quickSortTaskQty(tunnelLocQtyDicSort);
log.info("任务数最少的巷道:" + tunnelone);
@ -1158,15 +1153,11 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
.eq(BusinDataTaskGoods::getTaskCode, id));
//根据货位查询物料信息
// SysStockDetailQueryBo stockDetailQueryBo = new SysStockDetailQueryBo();
// stockDetailQueryBo.setLocationId(baseLocationVo.getId());
// stockDetailQueryBo.setQty(new BigDecimal("1"));
List<SysStockDetail> sysStockDetailList = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>()
.eq(SysStockDetail::getLocationId, baseLocationVo.getId())
.eq(SysStockDetail::getQty, 1)
.isNull(SysStockDetail::getOutQty));
// List<SysStockDetail> sysStockDetailList = iSysStockDetailService.queryList(stockDetailQueryBo);
// System.out.println("是否相等"+sysStockDetailList.get(0).getGoodsNo().equals(businDataTaskGoodsList.get(0).getGoodsNo()));
for (SysStockDetail stockDetail : sysStockDetailList) {
businDataTaskGoodsList.stream().forEach(
e -> {

Loading…
Cancel
Save