opt: 优化定时任务创建堆垛机出库指令
This commit is contained in:
@@ -394,19 +394,19 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
} else if (error != 0) {
|
} else if (error != 0) {
|
||||||
message = "有报警";
|
message = "有报警";
|
||||||
//指定库位满入
|
//指定库位满入
|
||||||
if(error == 5){
|
if (error == 5) {
|
||||||
|
|
||||||
}
|
}
|
||||||
//空出
|
//空出
|
||||||
if(error == 6){
|
if (error == 6) {
|
||||||
|
|
||||||
}
|
}
|
||||||
//浅货位有货
|
//浅货位有货
|
||||||
if(error == 16){
|
if (error == 16) {
|
||||||
//放货
|
//放货
|
||||||
if(cargoMove==1){
|
if (cargoMove == 1) {
|
||||||
|
|
||||||
}else if(cargoMove==0){
|
} else if (cargoMove == 0) {
|
||||||
//取货
|
//取货
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,9 +416,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
HashMap map = new HashMap();
|
HashMap map = new HashMap();
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 0:
|
case 0:
|
||||||
if (task == 0) {
|
applyTask();
|
||||||
applyTask();
|
|
||||||
}
|
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -432,13 +430,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||||
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, next_device_code));
|
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, next_device_code));
|
||||||
for (DeviceExtra deviceExtra : list) {
|
for (DeviceExtra deviceExtra : list) {
|
||||||
if("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
if ("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||||
map.put("to_x", deviceExtra.getExtra_value());
|
map.put("to_x", deviceExtra.getExtra_value());
|
||||||
}
|
}
|
||||||
if("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
if ("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||||
map.put("to_z", deviceExtra.getExtra_value());
|
map.put("to_z", deviceExtra.getExtra_value());
|
||||||
}
|
}
|
||||||
if("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
if ("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||||
map.put("to_y", deviceExtra.getExtra_value());
|
map.put("to_y", deviceExtra.getExtra_value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,7 +566,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
//输入:指令类型多种\ 指令状态多种\
|
//输入:指令类型多种\ 指令状态多种\
|
||||||
Instruction instruction1 = new Instruction();
|
Instruction instruction1 = new Instruction();
|
||||||
instruction1.setInstruction_status("0");
|
instruction1.setInstruction_status("0");
|
||||||
List<Instruction> instructions = instructionService.findByDeviceCodes(instruction1);
|
List<Instruction> instructions = instructionService.findByDeviceCodes(instruction1, false);
|
||||||
if (CollUtil.isEmpty(instructions) || instructions.size() < 1) {
|
if (CollUtil.isEmpty(instructions) || instructions.size() < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -625,26 +623,26 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||||
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, start_device_code));
|
List<DeviceExtra> list = deviceExtraService.list(Wrappers.lambdaQuery(DeviceExtra.class).eq(DeviceExtra::getDevice_code, start_device_code));
|
||||||
for (DeviceExtra deviceExtra : list) {
|
for (DeviceExtra deviceExtra : list) {
|
||||||
if("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
if ("x".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||||
map.put("to_x", deviceExtra.getExtra_value());
|
map.put("to_x", deviceExtra.getExtra_value());
|
||||||
}
|
}
|
||||||
if("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
if ("z".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||||
map.put("to_z", deviceExtra.getExtra_value());
|
map.put("to_z", deviceExtra.getExtra_value());
|
||||||
}
|
}
|
||||||
if("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())){
|
if ("y".equals(deviceExtra.getExtra_code()) && StrUtil.isNotEmpty(deviceExtra.getExtra_value())) {
|
||||||
map.put("to_y", deviceExtra.getExtra_value());
|
map.put("to_y", deviceExtra.getExtra_value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
|
||||||
map.put("to_z", inst.getFrom_z());
|
map.put("to_y", inst.getFrom_z());
|
||||||
if (inst.getFrom_x().length() > 1) {
|
if (inst.getFrom_x().length() > 1) {
|
||||||
String substring = inst.getFrom_x().substring(1);
|
String substring = inst.getFrom_x().substring(1);
|
||||||
map.put("to_x", substring);
|
map.put("to_z", substring);
|
||||||
} else {
|
} else {
|
||||||
map.put("to_x", inst.getFrom_x());
|
map.put("to_z", inst.getFrom_x());
|
||||||
}
|
}
|
||||||
map.put("to_y", inst.getFrom_y());
|
map.put("to_x", inst.getFrom_y());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writing(map);
|
this.writing(map);
|
||||||
|
|||||||
@@ -321,5 +321,5 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
* @param instruction1
|
* @param instruction1
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Instruction> findByDeviceCodes(Instruction instruction1);
|
List<Instruction> findByDeviceCodes(Instruction instruction1,Boolean flay);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jiaolm
|
* @author jiaolm
|
||||||
* @date 2023-05-09
|
* @date 2023-05-09
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
// @CacheConfig(cacheNames = InstructionService.CACHE_KEY)
|
// @CacheConfig(cacheNames = InstructionService.CACHE_KEY)
|
||||||
@@ -93,7 +93,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
@Autowired
|
@Autowired
|
||||||
TaskMapper taskMapper;
|
TaskMapper taskMapper;
|
||||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||||
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceAppService deviceAppService;
|
DeviceAppService deviceAppService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -115,7 +115,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InstructionDto> queryAll(InstructionQueryParam query){
|
public List<InstructionDto> queryAll(InstructionQueryParam query) {
|
||||||
return ConvertUtil.convertList(instructionMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), InstructionDto.class);
|
return ConvertUtil.convertList(instructionMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), InstructionDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateById(InstructionDto resources){
|
public int updateById(InstructionDto resources) {
|
||||||
InstructionMybatis entity = ConvertUtil.convert(resources, InstructionMybatis.class);
|
InstructionMybatis entity = ConvertUtil.convert(resources, InstructionMybatis.class);
|
||||||
int ret = instructionMapper.updateById(entity);
|
int ret = instructionMapper.updateById(entity);
|
||||||
// delCaches(resources.id);
|
// delCaches(resources.id);
|
||||||
@@ -141,14 +141,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int removeByIds(Set<String> ids){
|
public int removeByIds(Set<String> ids) {
|
||||||
// delCaches(ids);
|
// delCaches(ids);
|
||||||
return instructionMapper.deleteBatchIds(ids);
|
return instructionMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int removeById(String id){
|
public int removeById(String id) {
|
||||||
Set<String> set = new HashSet<>(1);
|
Set<String> set = new HashSet<>(1);
|
||||||
set.add(id);
|
set.add(id);
|
||||||
return this.removeByIds(set);
|
return this.removeByIds(set);
|
||||||
@@ -180,7 +180,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
.eq(InstructionMybatis::getIs_delete, "0")
|
.eq(InstructionMybatis::getIs_delete, "0")
|
||||||
.list();
|
.list();
|
||||||
// List list = this.queryAll("instruction_status <2 and is_delete =0");
|
// List list = this.queryAll("instruction_status <2 and is_delete =0");
|
||||||
this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list,Instruction.class));
|
this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list, Instruction.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,13 +196,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
IPage<InstructionMybatis> queryPage = PageUtil.toMybatisPage(page);
|
IPage<InstructionMybatis> queryPage = PageUtil.toMybatisPage(page);
|
||||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
// wrapper.eq(InstructionMybatis::getIs_delete,0);
|
// wrapper.eq(InstructionMybatis::getIs_delete,0);
|
||||||
wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code));
|
wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code));
|
||||||
wrapper.like(StringUtils.isNotBlank(vehicle_code),InstructionMybatis::getVehicle_code,vehicle_code);
|
wrapper.like(StringUtils.isNotBlank(vehicle_code), InstructionMybatis::getVehicle_code, vehicle_code);
|
||||||
wrapper.eq(StringUtils.isNotBlank(material_type),InstructionMybatis::getMaterial,material_type);
|
wrapper.eq(StringUtils.isNotBlank(material_type), InstructionMybatis::getMaterial, material_type);
|
||||||
wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status);
|
wrapper.eq(StringUtils.isNotBlank(status), InstructionMybatis::getInstruction_status, status);
|
||||||
wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
wrapper.and(StringUtils.isNotBlank(point_code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code));
|
||||||
wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type);
|
wrapper.eq(StringUtils.isNotBlank(instruction_type), InstructionMybatis::getInstruction_type, instruction_type);
|
||||||
wrapper.le(InstructionMybatis::getInstruction_status,1);
|
wrapper.le(InstructionMybatis::getInstruction_status, 1);
|
||||||
if (!StrUtil.isEmpty(is_over)) {
|
if (!StrUtil.isEmpty(is_over)) {
|
||||||
if (StrUtil.equals(is_over, "1")) {
|
if (StrUtil.equals(is_over, "1")) {
|
||||||
wrapper.ge(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
wrapper.ge(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
||||||
@@ -210,7 +210,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
wrapper.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
wrapper.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage, wrapper);
|
||||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@@ -229,31 +229,31 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
// wrapper.eq(InstructionMybatis::getIs_delete,"0");
|
// wrapper.eq(InstructionMybatis::getIs_delete,"0");
|
||||||
if (!StrUtil.isEmpty(code)) {
|
if (!StrUtil.isEmpty(code)) {
|
||||||
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code));
|
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code));
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
wrapper.like(InstructionMybatis::getVehicle_code,vehicle_code);
|
wrapper.like(InstructionMybatis::getVehicle_code, vehicle_code);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(material_type)) {
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
wrapper.eq(InstructionMybatis::getMaterial,material_type);
|
wrapper.eq(InstructionMybatis::getMaterial, material_type);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(status)) {
|
if (!StrUtil.isEmpty(status)) {
|
||||||
wrapper.eq(InstructionMybatis::getInstruction_status,status);
|
wrapper.eq(InstructionMybatis::getInstruction_status, status);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(point_code)) {
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code));
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||||
wrapper.between(InstructionMybatis::getCreate_time,create_time,end_time);
|
wrapper.between(InstructionMybatis::getCreate_time, create_time, end_time);
|
||||||
}
|
}
|
||||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage, wrapper);
|
||||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getByTaskId(String id) {
|
public Map<String, Object> getByTaskId(String id) {
|
||||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.eq(InstructionMybatis::getTask_id, id)
|
.eq(InstructionMybatis::getTask_id, id)
|
||||||
.list();
|
.list();
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
@@ -279,9 +279,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Instruction> queryAll(Map whereJson) {
|
public List<Instruction> queryAll(Map whereJson) {
|
||||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(insList,Instruction.class);
|
return ConvertUtil.convertList(insList, Instruction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -292,7 +292,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(insList,Instruction.class);
|
return ConvertUtil.convertList(insList, Instruction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -306,13 +306,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||||
// return obj;
|
// return obj;
|
||||||
|
|
||||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.eq(InstructionMybatis::getInstruction_code, code)
|
.eq(InstructionMybatis::getInstruction_code, code)
|
||||||
.one();
|
.one();
|
||||||
if(ObjectUtil.isEmpty(ins)){
|
if (ObjectUtil.isEmpty(ins)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ConvertUtil.convert(ins,Instruction.class);
|
return ConvertUtil.convert(ins, Instruction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -321,13 +321,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||||
// return obj;
|
// return obj;
|
||||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.eq(InstructionMybatis::getTask_code, code)
|
.eq(InstructionMybatis::getTask_code, code)
|
||||||
.one();
|
.one();
|
||||||
if(ObjectUtil.isEmpty(ins)){
|
if (ObjectUtil.isEmpty(ins)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ConvertUtil.convert(ins,Instruction.class);
|
return ConvertUtil.convert(ins, Instruction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -356,11 +356,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// return null;
|
// return null;
|
||||||
|
|
||||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(InstructionMybatis::getTask_id,id);
|
wrapper.eq(InstructionMybatis::getTask_id, id);
|
||||||
wrapper.apply(StringUtils.isNotBlank(wherecaluse),wherecaluse);
|
wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse);
|
||||||
InstructionMybatis ins = instructionMapper.selectOne(wrapper);
|
InstructionMybatis ins = instructionMapper.selectOne(wrapper);
|
||||||
if (ObjectUtil.isNotEmpty(ins)) {
|
if (ObjectUtil.isNotEmpty(ins)) {
|
||||||
return ConvertUtil.convert(ins,Instruction.class);
|
return ConvertUtil.convert(ins, Instruction.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
dto.setIs_send(task.getLink_num());
|
dto.setIs_send(task.getLink_num());
|
||||||
}
|
}
|
||||||
// if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
|
// if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
|
||||||
dto.setInstruction_type(task.getTask_type());
|
dto.setInstruction_type(task.getTask_type());
|
||||||
// } else if (false) {
|
// } else if (false) {
|
||||||
//
|
//
|
||||||
// } else {
|
// } else {
|
||||||
@@ -416,8 +416,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
|
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
|
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
dto.setStart_parent_code(task.getStart_parent_code());
|
dto.setStart_parent_code(task.getStart_parent_code());
|
||||||
@@ -810,7 +810,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||||
|
|
||||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id,insttaskid)
|
.eq(Task::getTask_id, insttaskid)
|
||||||
.one();
|
.one();
|
||||||
// =0 则不用再次请求
|
// =0 则不用再次请求
|
||||||
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
||||||
@@ -845,7 +845,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||||
|
|
||||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id,insttaskid)
|
.eq(Task::getTask_id, insttaskid)
|
||||||
.one();
|
.one();
|
||||||
// =0 则不用再次请求
|
// =0 则不用再次请求
|
||||||
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
||||||
@@ -899,7 +899,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
// JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
|
// JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
|
||||||
// TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
|
// TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
|
||||||
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id,dto.getTask_id())
|
.eq(Task::getTask_id, dto.getTask_id())
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||||
@@ -916,7 +916,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
for (int m = 0; m < pathlist.size(); m++) {
|
for (int m = 0; m < pathlist.size(); m++) {
|
||||||
if (pathlist.get(m).equals(dto.getNext_device_code())) {
|
if (pathlist.get(m).equals(dto.getNext_device_code())) {
|
||||||
index = m + 1;
|
index = m + 1;
|
||||||
if(StrUtil.equals(deviceAppService.findDeviceTypeByCode(pathlist.get(index)), DeviceType.stacker.name())) {
|
if (StrUtil.equals(deviceAppService.findDeviceTypeByCode(pathlist.get(index)), DeviceType.stacker.name())) {
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1000,7 +1000,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||||
// NDC agv指令不当场取消指令,需要等agv上报
|
// NDC agv指令不当场取消指令,需要等agv上报
|
||||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||||
ndcAgvService.deleteAgvInstToNDC((Instruction)entity);
|
ndcAgvService.deleteAgvInstToNDC((Instruction) entity);
|
||||||
} else {
|
} else {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
@@ -1306,7 +1306,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
|
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
|
||||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||||
String start_device =
|
String start_device =
|
||||||
deviceDriverDefination
|
deviceDriverDefination
|
||||||
.getFitDeviceTypes()
|
.getFitDeviceTypes()
|
||||||
.get(0)
|
.get(0)
|
||||||
.name();
|
.name();
|
||||||
@@ -1332,7 +1332,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_device_code).getDeviceDriverDefination();
|
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_device_code).getDeviceDriverDefination();
|
||||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||||
String next_device =
|
String next_device =
|
||||||
deviceDriverDefination
|
deviceDriverDefination
|
||||||
.getFitDeviceTypes()
|
.getFitDeviceTypes()
|
||||||
.get(0)
|
.get(0)
|
||||||
.name();
|
.name();
|
||||||
@@ -1538,7 +1538,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(String id) {
|
public void init(String id) {
|
||||||
InstructionDto inst = this.findById(id);
|
InstructionDto inst = this.findById(id);
|
||||||
if (inst == null) {
|
if (inst == null) {
|
||||||
throw new BadRequestException("指令不存在或已删除");
|
throw new BadRequestException("指令不存在或已删除");
|
||||||
}
|
}
|
||||||
@@ -1569,14 +1569,18 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Instruction> findByDeviceCodes(Instruction instruction1) {
|
public List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay) {
|
||||||
if(ObjectUtil.isNull(instruction1)){
|
if (ObjectUtil.isNull(instruction1)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(StrUtil.isNotBlank(instruction1.getInstruction_status()),InstructionMybatis::getInstruction_status,instruction1.getInstruction_status());
|
if (flay) {
|
||||||
wrapper.eq(StrUtil.isNotBlank(instruction1.getStart_device_code()),InstructionMybatis::getStart_device_code,instruction1.getStart_device_code());
|
wrapper.le(StrUtil.isNotBlank(instruction1.getInstruction_status()), InstructionMybatis::getInstruction_status, instruction1.getInstruction_status());
|
||||||
wrapper.eq(StrUtil.isNotBlank(instruction1.getNext_device_code()),InstructionMybatis::getNext_device_code,instruction1.getNext_device_code());
|
} else {
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(instruction1.getInstruction_status()), InstructionMybatis::getInstruction_status, instruction1.getInstruction_status());
|
||||||
|
}
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(instruction1.getStart_device_code()), InstructionMybatis::getStart_device_code, instruction1.getStart_device_code());
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(instruction1.getNext_device_code()), InstructionMybatis::getNext_device_code, instruction1.getNext_device_code());
|
||||||
List<InstructionMybatis> instructionMybatis = instructionMapper.selectList(wrapper);
|
List<InstructionMybatis> instructionMybatis = instructionMapper.selectList(wrapper);
|
||||||
List<Instruction> instructions = ConvertUtil.convertList(instructionMybatis, Instruction.class);
|
List<Instruction> instructions = ConvertUtil.convertList(instructionMybatis, Instruction.class);
|
||||||
return instructions;
|
return instructions;
|
||||||
|
|||||||
@@ -225,5 +225,10 @@ public interface RouteLineService extends CommonService<RouteLine> {
|
|||||||
|
|
||||||
public JSONArray getActivePathLine(String device_code, String next_device_code, String plan_code);
|
public JSONArray getActivePathLine(String device_code, String next_device_code, String plan_code);
|
||||||
|
|
||||||
List<RouteLineDto> selectDeviceCodeList(String start_device_code);
|
/**
|
||||||
|
* 根据设备编码查询路由
|
||||||
|
* @param device_code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RouteLineDto> selectDeviceCodeList(String device_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jiaolm
|
* @author jiaolm
|
||||||
* @date 2023-05-09
|
* @date 2023-05-09
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
// @CacheConfig(cacheNames = TaskService.CACHE_KEY)
|
// @CacheConfig(cacheNames = TaskService.CACHE_KEY)
|
||||||
@@ -124,7 +124,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TaskDto> queryAll(TaskQueryParam query){
|
public List<TaskDto> queryAll(TaskQueryParam query) {
|
||||||
return ConvertUtil.convertList(taskMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), TaskDto.class);
|
return ConvertUtil.convertList(taskMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateById(TaskDto resources){
|
public int updateById(TaskDto resources) {
|
||||||
Task entity = ConvertUtil.convert(resources, Task.class);
|
Task entity = ConvertUtil.convert(resources, Task.class);
|
||||||
int ret = taskMapper.updateById(entity);
|
int ret = taskMapper.updateById(entity);
|
||||||
// delCaches(resources.id);
|
// delCaches(resources.id);
|
||||||
@@ -157,14 +157,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int removeByIds(Set<String> ids){
|
public int removeByIds(Set<String> ids) {
|
||||||
// delCaches(ids);
|
// delCaches(ids);
|
||||||
return taskMapper.deleteBatchIds(ids);
|
return taskMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int removeById(String id){
|
public int removeById(String id) {
|
||||||
Set<String> set = new HashSet<>(1);
|
Set<String> set = new HashSet<>(1);
|
||||||
set.add(id);
|
set.add(id);
|
||||||
return this.removeByIds(set);
|
return this.removeByIds(set);
|
||||||
@@ -254,6 +254,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取未完成任务
|
* 获取未完成任务
|
||||||
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -272,21 +273,21 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List queryAll(String whereJson) {
|
public List queryAll(String whereJson) {
|
||||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex())
|
.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex())
|
||||||
.eq(Task::getIs_delete,"0")
|
.eq(Task::getIs_delete, "0")
|
||||||
.orderByDesc(Task::getCreate_time)
|
.orderByDesc(Task::getCreate_time)
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TaskDto> queryAllByStatus(String task_status) {
|
public List<TaskDto> queryAllByStatus(String task_status) {
|
||||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_status, task_status)
|
.eq(Task::getTask_status, task_status)
|
||||||
.eq(Task::getIs_delete,"0")
|
.eq(Task::getIs_delete, "0")
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -302,29 +303,29 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
IPage<Task> queryPage = PageUtil.toMybatisPage(page);
|
IPage<Task> queryPage = PageUtil.toMybatisPage(page);
|
||||||
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
||||||
if (!StrUtil.isEmpty(task_code)) {
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
wrapper.eq(Task::getTask_code,task_code);
|
wrapper.eq(Task::getTask_code, task_code);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
wrapper.eq(Task::getVehicle_code,vehicle_code);
|
wrapper.eq(Task::getVehicle_code, vehicle_code);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(material_type)) {
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
wrapper.eq(Task::getMaterial,material_type);
|
wrapper.eq(Task::getMaterial, material_type);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(status)) {
|
if (!StrUtil.isEmpty(status)) {
|
||||||
wrapper.eq(Task::getTask_status,status);
|
wrapper.eq(Task::getTask_status, status);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(point_code)) {
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
wrapper.and(task -> task.like(Task::getStart_point_code,point_code).or().like(Task::getNext_point_code,point_code));
|
wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code));
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(is_over)) {
|
if (!StrUtil.isEmpty(is_over)) {
|
||||||
if (StrUtil.equals(is_over,"1")){
|
if (StrUtil.equals(is_over, "1")) {
|
||||||
wrapper.ge(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex());
|
wrapper.ge(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex());
|
||||||
}else{
|
} else {
|
||||||
wrapper.lt(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex());
|
wrapper.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrapper.le(Task::getTask_status,1);
|
wrapper.le(Task::getTask_status, 1);
|
||||||
IPage<Task> taskPage = taskMapper.selectPage(queryPage,wrapper);
|
IPage<Task> taskPage = taskMapper.selectPage(queryPage, wrapper);
|
||||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
|
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@@ -414,24 +415,24 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
||||||
// wrapper.eq(InstructionMybatis::getIs_delete,"0");
|
// wrapper.eq(InstructionMybatis::getIs_delete,"0");
|
||||||
if (!StrUtil.isEmpty(task_code)) {
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
wrapper.eq(Task::getTask_code,task_code);
|
wrapper.eq(Task::getTask_code, task_code);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
wrapper.like(Task::getVehicle_code,vehicle_code);
|
wrapper.like(Task::getVehicle_code, vehicle_code);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(material_type)) {
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
wrapper.eq(Task::getMaterial,material_type);
|
wrapper.eq(Task::getMaterial, material_type);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(status)) {
|
if (!StrUtil.isEmpty(status)) {
|
||||||
wrapper.eq(Task::getTask_status,status);
|
wrapper.eq(Task::getTask_status, status);
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(point_code)) {
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
wrapper.and(task -> task.like(Task::getStart_point_code,point_code).or().like(Task::getNext_point_code,point_code));
|
wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code));
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||||
wrapper.between(Task::getCreate_time,create_time,end_time);
|
wrapper.between(Task::getCreate_time, create_time, end_time);
|
||||||
}
|
}
|
||||||
IPage<Task> taskPage = taskMapper.selectPage(queryPage,wrapper);
|
IPage<Task> taskPage = taskMapper.selectPage(queryPage, wrapper);
|
||||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
|
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
|
||||||
JSONArray array = json.getJSONArray("content");
|
JSONArray array = json.getJSONArray("content");
|
||||||
int totalElements = (int) json.getLongValue("totalElements");
|
int totalElements = (int) json.getLongValue("totalElements");
|
||||||
@@ -450,9 +451,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
@Override
|
@Override
|
||||||
public List<TaskDto> queryAll(Map whereJson) {
|
public List<TaskDto> queryAll(Map whereJson) {
|
||||||
|
|
||||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
@@ -469,10 +470,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
// JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0);
|
// JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0);
|
||||||
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||||
// return list;
|
// return list;
|
||||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.lt(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex())
|
.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex())
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -481,10 +482,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||||
// final TaskDto obj = json.toJavaObject(TaskDto.class);
|
// final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||||
// return obj;
|
// return obj;
|
||||||
Task task= new LambdaQueryChainWrapper<>(taskMapper)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_code,code)
|
.eq(Task::getTask_code, code)
|
||||||
.one();
|
.one();
|
||||||
return ConvertUtil.convert(task,TaskDto.class);
|
return ConvertUtil.convert(task, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -603,10 +604,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
// JSONArray arr = wo.query("task_status = '" + status + "'").getResultJSONArray(0);
|
// JSONArray arr = wo.query("task_status = '" + status + "'").getResultJSONArray(0);
|
||||||
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||||
// return list;
|
// return list;
|
||||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_status,status)
|
.eq(Task::getTask_status, status)
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -664,9 +665,18 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
Device nextdevice = appService.findDeviceByCode(next_device_code);
|
Device nextdevice = appService.findDeviceByCode(next_device_code);
|
||||||
Device startdevice = appService.findDeviceByCode(start_device_code);
|
Device startdevice = appService.findDeviceByCode(start_device_code);
|
||||||
dto.setMaterial(startdevice.getMaterial_type());
|
dto.setMaterial(startdevice.getMaterial_type());
|
||||||
|
if (StrUtil.equals(DeviceType.storage.toString(), startDeviceType)) {
|
||||||
|
start_point_code = start_device_code + "-" + dto.getFrom_y() + "-" + dto.getFrom_z();
|
||||||
|
dto.setStart_point_code(start_point_code);
|
||||||
|
}
|
||||||
|
if (StrUtil.equals(DeviceType.storage.toString(), nextDeviceType)) {
|
||||||
|
next_point_code = next_device_code + "-" + dto.getTo_y() + "-" + dto.getTo_z();
|
||||||
|
dto.setNext_point_code(next_point_code);
|
||||||
|
}
|
||||||
if (StrUtil.equals(createTaskCheck, "1")) {
|
if (StrUtil.equals(createTaskCheck, "1")) {
|
||||||
// 判断起点为输送设备
|
// 判断起点为输送设备
|
||||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||||
@@ -1495,8 +1505,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
} else {
|
} else {
|
||||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
|
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
|
||||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||||
String start_device=
|
String start_device =
|
||||||
deviceDriverDefination
|
deviceDriverDefination
|
||||||
.getFitDeviceTypes()
|
.getFitDeviceTypes()
|
||||||
.get(0)
|
.get(0)
|
||||||
.name();
|
.name();
|
||||||
@@ -1527,8 +1537,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
task.setStart_point_code(start_point_code + "-" + from_y + "-" + from_z);
|
task.setStart_point_code(start_point_code + "-" + from_y + "-" + from_z);
|
||||||
task.setStart_device_code(start_point_code);
|
task.setStart_device_code(start_point_code);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
task.setStart_device_code(start_point_code);
|
task.setStart_device_code(start_point_code);
|
||||||
task.setStart_device_code(start_point_code);
|
task.setStart_device_code(start_point_code);
|
||||||
}
|
}
|
||||||
@@ -1560,37 +1569,37 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
} else {
|
} else {
|
||||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_point_code).getDeviceDriverDefination();
|
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_point_code).getDeviceDriverDefination();
|
||||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||||
String next_device =
|
String next_device =
|
||||||
deviceDriverDefination
|
deviceDriverDefination
|
||||||
.getFitDeviceTypes()
|
.getFitDeviceTypes()
|
||||||
.get(0)
|
.get(0)
|
||||||
.name();
|
.name();
|
||||||
if (StrUtil.equals("storage", next_device)) {
|
if (StrUtil.equals("storage", next_device)) {
|
||||||
if (StrUtil.isEmpty(task.getTo_x())) {
|
if (StrUtil.isEmpty(task.getTo_x())) {
|
||||||
throw new BadRequestException("货位信息终点需要包含列信息");
|
throw new BadRequestException("货位信息终点需要包含列信息");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(task.getTo_y())) {
|
||||||
|
throw new BadRequestException("货位信息终点需要包含层信息");
|
||||||
|
}
|
||||||
|
if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) {
|
||||||
|
to_y = "0" + task.getTo_y();
|
||||||
|
task.setTo_y(to_y);
|
||||||
|
} else {
|
||||||
|
to_y = task.getTo_y();
|
||||||
|
}
|
||||||
|
if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) {
|
||||||
|
to_z = "0" + task.getTo_z();
|
||||||
|
task.setTo_z(to_z);
|
||||||
|
} else if (task.getTo_z().length() == 2) {
|
||||||
|
to_z = task.getTo_z();
|
||||||
|
task.setTo_z(to_z);
|
||||||
|
} else {
|
||||||
|
to_z = task.getTo_z();
|
||||||
|
}
|
||||||
|
task.setTo_x(next_point_code);
|
||||||
|
task.setNext_point_code(next_point_code + "-" + to_y + "-" + to_z);
|
||||||
|
task.setNext_device_code(next_point_code);
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(task.getTo_y())) {
|
|
||||||
throw new BadRequestException("货位信息终点需要包含层信息");
|
|
||||||
}
|
|
||||||
if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) {
|
|
||||||
to_y = "0" + task.getTo_y();
|
|
||||||
task.setTo_y(to_y);
|
|
||||||
} else {
|
|
||||||
to_y = task.getTo_y();
|
|
||||||
}
|
|
||||||
if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) {
|
|
||||||
to_z = "0" + task.getTo_z();
|
|
||||||
task.setTo_z(to_z);
|
|
||||||
} else if (task.getTo_z().length() == 2) {
|
|
||||||
to_z = task.getTo_z();
|
|
||||||
task.setTo_z(to_z);
|
|
||||||
} else {
|
|
||||||
to_z = task.getTo_z();
|
|
||||||
}
|
|
||||||
task.setTo_x(next_point_code);
|
|
||||||
task.setNext_point_code(next_point_code + "-" + to_y + "-" + to_z);
|
|
||||||
task.setNext_device_code(next_point_code);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
task.setNext_device_code(next_point_code);
|
task.setNext_device_code(next_point_code);
|
||||||
task.setNext_device_code(next_point_code);
|
task.setNext_device_code(next_point_code);
|
||||||
|
|||||||
@@ -1,10 +1,19 @@
|
|||||||
package org.nl.system.service.quartz.task;
|
package org.nl.system.service.quartz.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.domain.DeviceExtra;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
|
import org.nl.acs.device_driver.basedriver.belt_conveyor.BeltConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_stacker.StandardStackerDeviceDriver;
|
||||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
@@ -12,13 +21,17 @@ import org.nl.acs.opc.DeviceAppService;
|
|||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
|
import org.nl.acs.task.domain.Task;
|
||||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +179,7 @@ public class AutoCreateInst {
|
|||||||
} else if (StrUtil.equals(task_type, "8")) {
|
} else if (StrUtil.equals(task_type, "8")) {
|
||||||
instdto.setAgv_inst_type("2");
|
instdto.setAgv_inst_type("2");
|
||||||
} else {
|
} else {
|
||||||
log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()) ;
|
log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,352 @@
|
|||||||
|
package org.nl.system.service.quartz.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.domain.DeviceExtra;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
|
import org.nl.acs.device_driver.basedriver.belt_conveyor.BeltConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_stacker.StandardStackerDeviceDriver;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CreateDDJInst {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时查询堆垛机任务
|
||||||
|
*/
|
||||||
|
public void run() {
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||||
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||||
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
DeviceExtraService deviceExtra = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||||
|
List<TaskDto> taskDtos = taskserver.queryByStauts("0");
|
||||||
|
List<TaskDto> taskDtoList = new ArrayList<>();
|
||||||
|
if (CollUtil.isEmpty(taskDtos) || taskDtos.size() < 1) {
|
||||||
|
} else {
|
||||||
|
for (TaskDto taskDto : taskDtos) {
|
||||||
|
String start_device_code = taskDto.getStart_device_code();
|
||||||
|
Device startDevice = appService.findDeviceByCode(start_device_code);
|
||||||
|
String next_device_code = taskDto.getNext_device_code();
|
||||||
|
Device nextDevice = appService.findDeviceByCode(next_device_code);
|
||||||
|
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
|
||||||
|
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) {
|
||||||
|
taskDtoList.add(taskDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(taskDtoList)) {
|
||||||
|
taskDtoList = sortInst(taskDtoList);
|
||||||
|
for (TaskDto taskDto : taskDtoList) {
|
||||||
|
List<RouteLineDto> list =
|
||||||
|
routeLineService.getShortPathLines(
|
||||||
|
taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code());
|
||||||
|
if (ObjectUtils.isEmpty(list)) {
|
||||||
|
throw new BadRequestException("路由不通");
|
||||||
|
}
|
||||||
|
RouteLineDto routeLineDto = (RouteLineDto) list.get(0);
|
||||||
|
String[] path = routeLineDto.getPath().split("->");
|
||||||
|
List<String> pathlist = Arrays.asList(path);
|
||||||
|
if (pathlist.size() < 3 || pathlist.get(1).equals(DeviceType.stacker.name())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Device deviceByCode = appService.findDeviceByCode(pathlist.get(1));
|
||||||
|
if (ObjectUtils.isEmpty(deviceByCode)) {
|
||||||
|
log.error("没有找到DDJ设备");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
StandardStackerDeviceDriver standardStackerDeviceDriver;
|
||||||
|
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
|
||||||
|
standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver();
|
||||||
|
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getMove() == 1 || standardStackerDeviceDriver.getCommand() != 0) {
|
||||||
|
log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String next_device_code = taskDto.getNext_device_code();
|
||||||
|
Device nextDevice = appService.findDeviceByCode(next_device_code);
|
||||||
|
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||||
|
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) {
|
||||||
|
log.error("输送机,{}未联机或执行中", next_device_code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String taskid = taskDto.getTask_id();
|
||||||
|
String taskcode = taskDto.getTask_code();
|
||||||
|
String task_type = taskDto.getTask_type();
|
||||||
|
String vehiclecode = taskDto.getVehicle_code();
|
||||||
|
String storage_task_type = taskDto.getStorage_task_type();
|
||||||
|
String priority = taskDto.getPriority();
|
||||||
|
String is_send = taskDto.getIs_send();
|
||||||
|
|
||||||
|
String start_device_code = taskDto.getStart_device_code();
|
||||||
|
Device startDevice = appService.findDeviceByCode(start_device_code);
|
||||||
|
String start_point_code = taskDto.getStart_point_code();
|
||||||
|
|
||||||
|
String put_device_code = taskDto.getPut_device_code();
|
||||||
|
String put_point_code = taskDto.getPut_point_code();
|
||||||
|
|
||||||
|
String next_point_code = taskDto.getNext_point_code();
|
||||||
|
|
||||||
|
String start_point_code2 = taskDto.getStart_point_code2();
|
||||||
|
String start_device_code2 = taskDto.getStart_device_code2();
|
||||||
|
|
||||||
|
String next_point_code2 = taskDto.getNext_point_code2();
|
||||||
|
String next_device_code2 = taskDto.getNext_device_code2();
|
||||||
|
|
||||||
|
String route_plan_code = taskDto.getRoute_plan_code();
|
||||||
|
String vehicleType = taskDto.getVehicle_type();
|
||||||
|
String agv_system_type = taskDto.getAgv_system_type();
|
||||||
|
|
||||||
|
String start_height = taskDto.getStart_height();
|
||||||
|
String next_height = taskDto.getNext_height();
|
||||||
|
//单台堆垛机最多只能创建固定数量指令
|
||||||
|
Instruction instruction = new Instruction();
|
||||||
|
instruction.setInstruction_status("1");
|
||||||
|
List<Instruction> byDeviceCodes = instructionService.findByDeviceCodes(instruction, true);
|
||||||
|
Instruction instdto = new Instruction();
|
||||||
|
if (CollUtil.isEmpty(byDeviceCodes)) {
|
||||||
|
instdto.setInstruction_type(task_type);
|
||||||
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
|
instdto.setRemark(taskDto.getRemark());
|
||||||
|
instdto.setMaterial(taskDto.getMaterial());
|
||||||
|
instdto.setQuantity(taskDto.getQuantity());
|
||||||
|
instdto.setTask_id(taskid);
|
||||||
|
instdto.setTask_code(taskcode);
|
||||||
|
instdto.setVehicle_code(vehiclecode);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
instdto.setCreate_time(now);
|
||||||
|
instdto.setCreate_by("auto");
|
||||||
|
|
||||||
|
instdto.setStart_device_code(start_device_code);
|
||||||
|
instdto.setStart_point_code(start_point_code);
|
||||||
|
instdto.setPut_device_code(put_device_code);
|
||||||
|
instdto.setPut_point_code(put_point_code);
|
||||||
|
instdto.setNext_device_code(next_device_code);
|
||||||
|
instdto.setNext_point_code(next_point_code);
|
||||||
|
|
||||||
|
instdto.setStart_point_code2(start_point_code2);
|
||||||
|
instdto.setStart_device_code2(start_device_code2);
|
||||||
|
instdto.setNext_point_code2(next_point_code2);
|
||||||
|
instdto.setNext_device_code2(next_device_code2);
|
||||||
|
|
||||||
|
instdto.setPriority(priority);
|
||||||
|
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||||
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
instdto.setVehicle_type(vehicleType);
|
||||||
|
instdto.setAgv_system_type(agv_system_type);
|
||||||
|
instdto.setStart_height(start_height);
|
||||||
|
instdto.setNext_height(next_height);
|
||||||
|
if (startDevice.getDevice_type().equals(DeviceType.storage.name())) {
|
||||||
|
instdto.setFrom_x(taskDto.getFrom_x());
|
||||||
|
instdto.setFrom_z(taskDto.getFrom_z());
|
||||||
|
instdto.setFrom_y(taskDto.getFrom_y());
|
||||||
|
}
|
||||||
|
if (nextDevice.getDevice_type().equals(DeviceType.storage.name())) {
|
||||||
|
instdto.setTo_x(taskDto.getTo_x());
|
||||||
|
instdto.setTo_z(taskDto.getTo_z());
|
||||||
|
instdto.setTo_y(taskDto.getTo_y());
|
||||||
|
}
|
||||||
|
//判断agv系统
|
||||||
|
//1、1楼叉车系统
|
||||||
|
//2、2楼1区域AGV系统
|
||||||
|
//3、2楼2区域AGV系统 -已废弃
|
||||||
|
if (!StrUtil.equals(agv_system_type, "1")) {
|
||||||
|
// task_type
|
||||||
|
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||||
|
//2、分切 Itype=3取满、取空、放满、放空;
|
||||||
|
//3、普通任务 Itype=2:取货、放货;
|
||||||
|
//4、叉车任务
|
||||||
|
//5、输送任务
|
||||||
|
//6、行架
|
||||||
|
//7、立库
|
||||||
|
if (StrUtil.equals(task_type, "1")) {
|
||||||
|
instdto.setAgv_inst_type("1");
|
||||||
|
} else if (StrUtil.equals(task_type, "3")) {
|
||||||
|
instdto.setAgv_inst_type("2");
|
||||||
|
} else if (StrUtil.equals(task_type, "2")) {
|
||||||
|
instdto.setAgv_inst_type("3");
|
||||||
|
} else if (StrUtil.equals(task_type, "8")) {
|
||||||
|
instdto.setAgv_inst_type("2");
|
||||||
|
} else {
|
||||||
|
log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
instdto.setAgv_inst_type("4");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
instructionService.create(instdto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
taskDto.setRemark(e.getMessage());
|
||||||
|
taskserver.updateByCodeFromCache(taskDto);
|
||||||
|
}
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||||
|
taskserver.update(taskDto);
|
||||||
|
} else {
|
||||||
|
List<Instruction> insts = new ArrayList<>();
|
||||||
|
for (Instruction byDeviceCode : byDeviceCodes) {
|
||||||
|
String nextDeviceCode = byDeviceCode.getNext_device_code();
|
||||||
|
Device nextdevice = appService.findDeviceByCode(nextDeviceCode);
|
||||||
|
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
|
||||||
|
(nextdevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextdevice.getDevice_type().equals(DeviceType.storage.name()))) {
|
||||||
|
insts.add(byDeviceCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int max = 0;
|
||||||
|
for (Instruction inst : insts) {
|
||||||
|
List<RouteLineDto> shortPathLines = routeLineService.getShortPathLines(inst.getStart_device_code(), inst.getNext_device_code(),
|
||||||
|
inst.getRoute_plan_code());
|
||||||
|
if (CollUtil.isEmpty(shortPathLines) || shortPathLines.size() < 1) {
|
||||||
|
log.error("没有此路由");
|
||||||
|
throw new BadRequestException("路由不通");
|
||||||
|
}
|
||||||
|
RouteLineDto routeLineDto1 = (RouteLineDto) shortPathLines.get(0);
|
||||||
|
String[] path1 = routeLineDto1.getPath().split("->");
|
||||||
|
List<String> pathlist1 = Arrays.asList(path1);
|
||||||
|
if (pathlist1.size() < 3 || pathlist1.get(1).equals(DeviceType.stacker.name())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pathlist1.get(1).equals(pathlist.get(1))) {
|
||||||
|
max++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<DeviceExtra> deviceExtras = deviceExtra.list(Wrappers.lambdaQuery(DeviceExtra.class).
|
||||||
|
eq(DeviceExtra::getDevice_code, pathlist.get(1)).orderByDesc(DeviceExtra::getCreate_time));
|
||||||
|
for (DeviceExtra extra : deviceExtras) {
|
||||||
|
if (extra.getExtra_code().equals("count")) {
|
||||||
|
if (max <= Integer.parseInt(extra.getExtra_value())) {
|
||||||
|
instdto.setInstruction_type(task_type);
|
||||||
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
|
instdto.setRemark(taskDto.getRemark());
|
||||||
|
instdto.setMaterial(taskDto.getMaterial());
|
||||||
|
instdto.setQuantity(taskDto.getQuantity());
|
||||||
|
instdto.setTask_id(taskid);
|
||||||
|
instdto.setTask_code(taskcode);
|
||||||
|
instdto.setVehicle_code(vehiclecode);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
instdto.setCreate_time(now);
|
||||||
|
instdto.setCreate_by("auto");
|
||||||
|
|
||||||
|
instdto.setStart_device_code(start_device_code);
|
||||||
|
instdto.setStart_point_code(start_point_code);
|
||||||
|
instdto.setPut_device_code(put_device_code);
|
||||||
|
instdto.setPut_point_code(put_point_code);
|
||||||
|
instdto.setNext_device_code(next_device_code);
|
||||||
|
instdto.setNext_point_code(next_point_code);
|
||||||
|
|
||||||
|
instdto.setStart_point_code2(start_point_code2);
|
||||||
|
instdto.setStart_device_code2(start_device_code2);
|
||||||
|
instdto.setNext_point_code2(next_point_code2);
|
||||||
|
instdto.setNext_device_code2(next_device_code2);
|
||||||
|
|
||||||
|
instdto.setPriority(priority);
|
||||||
|
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||||
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
instdto.setVehicle_type(vehicleType);
|
||||||
|
instdto.setAgv_system_type(agv_system_type);
|
||||||
|
instdto.setStart_height(start_height);
|
||||||
|
instdto.setNext_height(next_height);
|
||||||
|
if (startDevice.getDevice_type().equals(DeviceType.storage.name())) {
|
||||||
|
instdto.setFrom_x(taskDto.getFrom_x());
|
||||||
|
instdto.setFrom_z(taskDto.getFrom_z());
|
||||||
|
instdto.setFrom_y(taskDto.getFrom_y());
|
||||||
|
}
|
||||||
|
if (nextDevice.getDevice_type().equals(DeviceType.storage.name())) {
|
||||||
|
instdto.setTo_x(taskDto.getTo_x());
|
||||||
|
instdto.setTo_z(taskDto.getTo_z());
|
||||||
|
instdto.setTo_y(taskDto.getTo_y());
|
||||||
|
}
|
||||||
|
//判断agv系统
|
||||||
|
//1、1楼叉车系统
|
||||||
|
//2、2楼1区域AGV系统
|
||||||
|
//3、2楼2区域AGV系统 -已废弃
|
||||||
|
if (!StrUtil.equals(agv_system_type, "1")) {
|
||||||
|
// task_type
|
||||||
|
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||||
|
//2、分切 Itype=3取满、取空、放满、放空;
|
||||||
|
//3、普通任务 Itype=2:取货、放货;
|
||||||
|
//4、叉车任务
|
||||||
|
//5、输送任务
|
||||||
|
//6、行架
|
||||||
|
//7、立库
|
||||||
|
if (StrUtil.equals(task_type, "1")) {
|
||||||
|
instdto.setAgv_inst_type("1");
|
||||||
|
} else if (StrUtil.equals(task_type, "3")) {
|
||||||
|
instdto.setAgv_inst_type("2");
|
||||||
|
} else if (StrUtil.equals(task_type, "2")) {
|
||||||
|
instdto.setAgv_inst_type("3");
|
||||||
|
} else if (StrUtil.equals(task_type, "8")) {
|
||||||
|
instdto.setAgv_inst_type("2");
|
||||||
|
} else {
|
||||||
|
log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
instdto.setAgv_inst_type("4");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
instructionService.create(instdto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
taskDto.setRemark(e.getMessage());
|
||||||
|
taskserver.updateByCodeFromCache(taskDto);
|
||||||
|
}
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||||
|
taskserver.update(taskDto);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//单台堆垛机只能出四五
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TaskDto> sortInst(List<TaskDto> taskDtos) {
|
||||||
|
Collections.sort(taskDtos, (t1, t2) -> {
|
||||||
|
//优先级从大到小
|
||||||
|
int i = t2.getPriority().compareTo(t1.getPriority());
|
||||||
|
//如果优先级相等
|
||||||
|
if (i == 0) {
|
||||||
|
//时间从早到晚
|
||||||
|
i = t1.getCreate_time().compareTo(t2.getCreate_time());
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
});
|
||||||
|
return taskDtos;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -96,6 +96,11 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="指令上限:" label-width="150px" prop="count">
|
||||||
|
<el-input v-model.number="form.count" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|||||||
Reference in New Issue
Block a user