rev:修改
This commit is contained in:
@@ -3,6 +3,7 @@ package org.nl.wms.sch_manage.service.util.tasks;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.CodeUtil;
|
import org.nl.common.utils.CodeUtil;
|
||||||
@@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缠绕机下料
|
* 缠绕机下料
|
||||||
@@ -41,20 +43,36 @@ public class WrappingDownTask extends AbstractTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private IMdPbGroupplateService groupplateService;
|
private IMdPbGroupplateService groupplateService;
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public String create(JSONObject json) {
|
public String create(JSONObject json) {
|
||||||
// 查找空闲的成品区
|
// 查找空闲的成品区
|
||||||
List<SchBasePoint> list = pointService.getNoTaskPointByRegionAndTypeCp("CPQ01", "1", "1");
|
List<SchBasePoint> list = pointService.getNoTaskPointByRegionAndTypeCp("CPQ01", "1", "1");
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
throw new BadRequestException("成品区没有空闲点位!");
|
throw new BadRequestException("成品区没有空闲点位!");
|
||||||
}
|
}
|
||||||
SchBasePoint basePoint = list.get(0);
|
SchBasePoint basePoint = null;
|
||||||
/* SchBasePoint parentPoint = pointService.getById(json.getString("device_code"));
|
for (SchBasePoint point : list) {
|
||||||
SchBasePoint point = pointService.getById(parentPoint.getParent_point_code());
|
// 判断此列是否有任务
|
||||||
List<JSONObject> palletViewByVehicleCode = groupplateService.getPalletViewByVehicleCode(point.getVehicle_code(), Collections.singletonList("1"));
|
List<String> collect = pointService.list(
|
||||||
if (palletViewByVehicleCode.size() == 0) {
|
new QueryWrapper<SchBasePoint>().lambda()
|
||||||
throw new BadRequestException("托盘信息不存在!");
|
.eq(SchBasePoint::getBlock_num, point.getBlock_num())
|
||||||
|
).stream()
|
||||||
|
.map(SchBasePoint::getPoint_code)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<SchBaseTask> taskList = taskService.list(
|
||||||
|
new QueryWrapper<SchBaseTask>().lambda()
|
||||||
|
.in(SchBaseTask::getPoint_code1, collect)
|
||||||
|
.eq(SchBaseTask::getIs_delete, IOSConstant.ZERO)
|
||||||
|
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isEmpty(taskList)) {
|
||||||
|
basePoint = point;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(basePoint)) {
|
||||||
|
throw new BadRequestException("成品区没有空闲点位!");
|
||||||
}
|
}
|
||||||
JSONObject jsonObject = palletViewByVehicleCode.get(0);*/
|
|
||||||
SchBaseTask task = new SchBaseTask();
|
SchBaseTask task = new SchBaseTask();
|
||||||
task.setTask_id(IdUtil.getStringId());
|
task.setTask_id(IdUtil.getStringId());
|
||||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||||
@@ -62,11 +80,6 @@ public class WrappingDownTask extends AbstractTask {
|
|||||||
task.setConfig_code(WrappingDownTask.class.getSimpleName());
|
task.setConfig_code(WrappingDownTask.class.getSimpleName());
|
||||||
task.setPoint_code1(json.getString("device_code"));
|
task.setPoint_code1(json.getString("device_code"));
|
||||||
task.setPoint_code2(basePoint.getPoint_code());
|
task.setPoint_code2(basePoint.getPoint_code());
|
||||||
// task.setPoint_code3(parentPoint.getPoint_code());
|
|
||||||
// task.setVehicle_code(point.getVehicle_code());
|
|
||||||
// task.setMaterial_id(jsonObject.getString("material_id"));
|
|
||||||
// task.setMaterial_qty(jsonObject.getBigDecimal("qty"));
|
|
||||||
// task.setGroup_id(jsonObject.getString("group_id"));
|
|
||||||
task.setRequest_param(json.toString());
|
task.setRequest_param(json.toString());
|
||||||
task.setPriority(json.getString("Priority"));
|
task.setPriority(json.getString("Priority"));
|
||||||
task.setIs_wait(json.getString("is_wait"));
|
task.setIs_wait(json.getString("is_wait"));
|
||||||
|
|||||||
Reference in New Issue
Block a user