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.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
@@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 缠绕机下料
|
||||
@@ -41,20 +43,36 @@ public class WrappingDownTask extends AbstractTask {
|
||||
@Resource
|
||||
private IMdPbGroupplateService groupplateService;
|
||||
@Override
|
||||
@Transactional
|
||||
public String create(JSONObject json) {
|
||||
// 查找空闲的成品区
|
||||
List<SchBasePoint> list = pointService.getNoTaskPointByRegionAndTypeCp("CPQ01", "1", "1");
|
||||
if (list.size() == 0) {
|
||||
throw new BadRequestException("成品区没有空闲点位!");
|
||||
}
|
||||
SchBasePoint basePoint = list.get(0);
|
||||
/* SchBasePoint parentPoint = pointService.getById(json.getString("device_code"));
|
||||
SchBasePoint point = pointService.getById(parentPoint.getParent_point_code());
|
||||
List<JSONObject> palletViewByVehicleCode = groupplateService.getPalletViewByVehicleCode(point.getVehicle_code(), Collections.singletonList("1"));
|
||||
if (palletViewByVehicleCode.size() == 0) {
|
||||
throw new BadRequestException("托盘信息不存在!");
|
||||
SchBasePoint basePoint = null;
|
||||
for (SchBasePoint point : list) {
|
||||
// 判断此列是否有任务
|
||||
List<String> collect = pointService.list(
|
||||
new QueryWrapper<SchBasePoint>().lambda()
|
||||
.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();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
@@ -62,11 +80,6 @@ public class WrappingDownTask extends AbstractTask {
|
||||
task.setConfig_code(WrappingDownTask.class.getSimpleName());
|
||||
task.setPoint_code1(json.getString("device_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.setPriority(json.getString("Priority"));
|
||||
task.setIs_wait(json.getString("is_wait"));
|
||||
|
||||
Reference in New Issue
Block a user