Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.agv.server;
|
||||
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.Manipulator
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
@@ -57,6 +60,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
TwoAgvPhase twoAgvPhase = new TwoAgvPhase();
|
||||
@@ -70,6 +74,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int phase = 0;
|
||||
int region = 0;
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
private Instruction instruction;
|
||||
String message = null;
|
||||
int x = 0; //x坐标
|
||||
@@ -218,10 +223,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
|
||||
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
|
||||
&& StrUtil.equals(task.getTask_type(), "1")) {
|
||||
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
|
||||
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
|
||||
log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code);
|
||||
if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) {
|
||||
log.info("等待LMS系统进行确认允许取货,设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
|
||||
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
}else {
|
||||
log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey);
|
||||
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
||||
}
|
||||
}else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
@@ -340,10 +362,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait"))
|
||||
&& StrUtil.equals("true", this.device.getExtraValue().get("wait").toString())
|
||||
&& StrUtil.equals(task.getTask_type(), "1")) {
|
||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
this.setPhase(phase);
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
@@ -455,10 +482,30 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
|
||||
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
|
||||
&& StrUtil.equals(task.getTask_type(), "1")) {
|
||||
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(0);
|
||||
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
|
||||
log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code);
|
||||
if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) {
|
||||
log.info("等待LMS系统进行确认允许取货,设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
|
||||
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else {
|
||||
log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey);
|
||||
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code());
|
||||
|
||||
}
|
||||
}else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
@@ -568,6 +615,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
|
||||
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
|
||||
&& StrUtil.equals(task.getTask_type(), "1")) {
|
||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||
}else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
@@ -651,6 +705,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
weight = agvaddr;
|
||||
inst.setWeight(String.valueOf(weight));
|
||||
instructionService.update(inst);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(task)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight);
|
||||
message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey;
|
||||
task.setWeight(String.valueOf(weight));
|
||||
task.setCarno(this.device_code);
|
||||
taskService.update(task);
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
@@ -817,9 +879,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
// }
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
this.setPhase(phase);
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
@@ -929,9 +989,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
// }
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
this.setPhase(phase);
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
@@ -1037,9 +1095,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
// }
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
this.setPhase(phase);
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
@@ -1130,32 +1186,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
last_status = status;
|
||||
} //进入区域(phase值)
|
||||
else if (phase == 0x50) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
region = agvaddr;
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
|
||||
}
|
||||
//离开区域(phase值)
|
||||
else if (phase == 0x51) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
region = agvaddr;
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
|
||||
}
|
||||
//上报异常信息
|
||||
@@ -1170,11 +1204,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String info = error.get("info");
|
||||
this.setErrorInfo(ikey, code, info);
|
||||
}
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
if (error != last_error) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(this.getDevice().getDevice_code());
|
||||
dto.setError_code(String.valueOf(error_code));
|
||||
dto.setError_info(error_message);
|
||||
deviceErrorLogService.create(dto);
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", this.device_code);
|
||||
param.put("error", error);
|
||||
param.put("error_msg", error == 0 ? "" : this.getError_message());
|
||||
param.put("device_name", this.getDevice().getDevice_name());
|
||||
param.put("device_type", "4");
|
||||
param.put("product_area", ISysParamService.findByCode("productArea").getValue());
|
||||
acsToWmsService.sendDeviceStatus(param);
|
||||
}
|
||||
last_error = error;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -1183,11 +1229,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
// if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
|
||||
TwoNDCSocketConnectionAutoRun.write(data);
|
||||
// TwoNDCSocketConnectionAutoRun.write(data);
|
||||
// }
|
||||
// else if (StrUtil.equals(inst.getAgv_system_type(), "3")) {
|
||||
// TwoNDC2SocketConnectionAutoRun.write(data);
|
||||
// }
|
||||
if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
|
||||
TwoNDCSocketConnectionAutoRun.write(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemProtocol {
|
||||
/**
|
||||
*木箱宽度
|
||||
*/
|
||||
public static String item_to_weight = "to_weight";
|
||||
public static String item_to_weight = "to_width";
|
||||
/**
|
||||
*木箱高度
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.device_driver.conveyor.standard_ordinary_site;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -61,6 +62,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
Boolean iserror = false;
|
||||
Boolean islock = false;
|
||||
|
||||
// 1 上位系统允许进入 2 上位系统允许离开
|
||||
int option = 0;
|
||||
|
||||
int branchProtocol = 0;
|
||||
int last_branchProtocol = 0;
|
||||
/**
|
||||
@@ -223,6 +227,14 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String move = "";
|
||||
String option = "";
|
||||
if(this.getOption() == 0){
|
||||
option ="禁止进出";
|
||||
} else if(this.getOption() == 1){
|
||||
option ="允许进入";
|
||||
} else if(this.getOption() == 2){
|
||||
option ="允许离开";
|
||||
}
|
||||
if (this.getMode() == 0) {
|
||||
mode = LangProcess.msg("universal_off-line");
|
||||
} else if (this.getMode() == 1) {
|
||||
@@ -252,13 +264,18 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
jo.put("isOnline", true);
|
||||
jo.put("error", this.getError());
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("option", option);
|
||||
jo.put("is_click", true);
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
String flag = data.getString("option");
|
||||
if(StrUtil.isNotEmpty(flag)){
|
||||
option = Integer.parseInt(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class InteractionJsonDTO {
|
||||
/**
|
||||
*木箱宽度
|
||||
*/
|
||||
private String weight;
|
||||
private String width;
|
||||
/**
|
||||
*木箱高度
|
||||
*/
|
||||
|
||||
@@ -378,15 +378,15 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
|
||||
//存在托盘才可以申请任务
|
||||
//存在托盘才可以申请任务 不需要这个逻辑,先下发行架任务后送空盘
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (beltConveyorDeviceDriver.getMove() != 1) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage2";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
// beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
// if (beltConveyorDeviceDriver.getMove() != 1) {
|
||||
// notCreateInstMessage = "universal_notCreateInstMessage2";
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
String taskid = taskDto.getTask_id();
|
||||
String taskcode = taskDto.getTask_code();
|
||||
String start_point_code = taskDto.getStart_point_code();
|
||||
@@ -454,9 +454,9 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
map4.put("value", task);
|
||||
list.add(map4);
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
|
||||
map5.put("code", "to_weight");
|
||||
map5.put("value", interactionJsonDTO.getWeight());
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWidth())) {
|
||||
map5.put("code", "to_width");
|
||||
map5.put("value", interactionJsonDTO.getWidth());
|
||||
list.add(map5);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
|
||||
|
||||
@@ -483,10 +483,16 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
list.add(map10);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsBinding())) {
|
||||
map10.put("code", "to_material");
|
||||
map10.put("value", interactionJsonDTO.getBarcode());
|
||||
map11.put("code", "to_material");
|
||||
map11.put("value", interactionJsonDTO.getBarcode());
|
||||
list.add(map11);
|
||||
}
|
||||
Map<String, Object> map12 = new HashMap<>();
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBindingTimes())) {
|
||||
map12.put("code", "to_binding_times");
|
||||
map12.put("value", interactionJsonDTO.getBindingTimes());
|
||||
list.add(map12);
|
||||
}
|
||||
}
|
||||
|
||||
this.writing(list);
|
||||
|
||||
@@ -54,6 +54,13 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateTask")
|
||||
@Log(value = "WMS更新任务点位状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> updateTask(@RequestBody String whereJson){
|
||||
return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/areaControl")
|
||||
@Log(value = "区域控制")
|
||||
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
|
||||
|
||||
@@ -25,6 +25,14 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
CreateTaskResponse crateTask(List<CreateTaskRequest> reqs);
|
||||
|
||||
/**
|
||||
* 更新任务点位状态
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> updateTask(String whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
|
||||
@@ -15,7 +15,9 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
|
||||
@@ -34,6 +36,7 @@ import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
@@ -68,6 +71,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
private AcsToLiKuService acsToLiKuService;
|
||||
|
||||
@@ -387,6 +393,74 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> updateTask(String whereJson) {
|
||||
JSONArray datas = JSONArray.parseArray(whereJson);
|
||||
log.info("updateTask--------------:输入参数" + datas.toString());
|
||||
JSONArray errArr = new JSONArray();
|
||||
if (datas.size() > 0) {
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject jsonObject = datas.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
String task_code = jsonObject.getString("task_code");
|
||||
//1-允许取放; 2-允许离开
|
||||
String option = jsonObject.getString("option");
|
||||
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("message", "未找到对应任务");
|
||||
errArr.add(jo);
|
||||
continue;
|
||||
} else {
|
||||
String carNo = inst.getCarno();
|
||||
if (ObjectUtil.isEmpty(carNo)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("message", "未找到任务对应车号");
|
||||
errArr.add(jo);
|
||||
continue;
|
||||
} else {
|
||||
Device device = deviceAppService.findDeviceByCode(carNo);
|
||||
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
||||
int phase = agvNdcTwoDeviceDriver.getPhase();
|
||||
if (phase == 0x03 || phase == 0x05 || phase == 0x08) {
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(device_code);
|
||||
if (deviceByCode.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) deviceByCode.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
standardOrdinarySiteDeviceDriver.setTask_code(task_code);
|
||||
}
|
||||
} else {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("message", "AGV未就绪无法设置");
|
||||
errArr.add(jo);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
} else {
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "操作失败");
|
||||
if (ObjectUtil.isNotEmpty(errArr)) {
|
||||
resultJson.put("errArr", errArr);
|
||||
}
|
||||
}
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List<org.nl.acs.ext.wms.data.one.CancelTaskRequest> reqs) throws Exception {
|
||||
return null;
|
||||
|
||||
@@ -54,6 +54,11 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String task_status;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String carno;
|
||||
|
||||
/**
|
||||
* 复合任务
|
||||
*/
|
||||
|
||||
@@ -1007,6 +1007,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
map.put("路由方案编码", acsTask.getRoute_plan_code());
|
||||
map.put("是否需要反馈上位系统", acsTask.getIs_needfeedback());
|
||||
map.put("备注", acsTask.getRemark());
|
||||
map.put("agv车号", acsTask.getCarno());
|
||||
map.put("是否启用", acsTask.getIs_active());
|
||||
map.put("是否删除", acsTask.getIs_delete());
|
||||
map.put("创建者", acsTask.getCreate_by());
|
||||
@@ -1597,6 +1598,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
feed_jo.put("task_id", entity.getExt_task_id());
|
||||
feed_jo.put("task_code", entity.getTask_code());
|
||||
feed_jo.put("task_status", entity.getTask_status());
|
||||
if (ObjectUtil.isNotEmpty(entity.getWeight())) {
|
||||
feed_jo.put("weight", entity.getWeight());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(entity.getCarno())) {
|
||||
feed_jo.put("car_no", entity.getCarno());
|
||||
}
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.add(feed_jo);
|
||||
//TODO 有需要根据上位系统反馈的信息再做进一步处理
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -46,7 +47,7 @@ public class ReadUtil {
|
||||
// 连接信息
|
||||
ConnectionInformation ci = new ConnectionInformation();
|
||||
ci.setHost(opc.getOpc_host());
|
||||
ci.setDomain(opc.getDomain());
|
||||
ci.setDomain(StrUtil.isEmpty(opc.getDomain()) ? " " : opc.getDomain());
|
||||
ci.setUser(opc.getUser());
|
||||
ci.setPassword(opc.getPassword());
|
||||
ci.setClsid(opc.getCls_id());
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.hand.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/15 13:59
|
||||
*/
|
||||
@Data
|
||||
public class B2HeadDto implements Serializable {
|
||||
/**
|
||||
* 起始设备编码1
|
||||
*/
|
||||
private String start_device_code1;
|
||||
|
||||
/**
|
||||
* 目标设备编码1
|
||||
*/
|
||||
private String next_device_code1;
|
||||
|
||||
/**
|
||||
* 起始设备编码2
|
||||
*/
|
||||
private String start_device_code2;
|
||||
|
||||
/**
|
||||
* 目标设备编码2
|
||||
*/
|
||||
private String next_device_code2;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String task_type;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.hand.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/15 15:04
|
||||
*/
|
||||
@Data
|
||||
public class HeadDeviceDto implements Serializable {
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
* 0-禁止进出;
|
||||
* 1-允许取放
|
||||
* 2-允许离开
|
||||
*
|
||||
*/
|
||||
private String option;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.nl.hand.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.hand.dto.B2HeadDto;
|
||||
import org.nl.hand.dto.HeadDeviceDto;
|
||||
import org.nl.hand.dto.RegionDto;
|
||||
import org.nl.hand.service.B2HandService;
|
||||
import org.nl.hand.service.HandService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/15 13:50
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持接口")
|
||||
@RequestMapping("api/hands")
|
||||
@Slf4j
|
||||
public class B2HandController {
|
||||
@Autowired
|
||||
private B2HandService b2HandService;
|
||||
|
||||
@Autowired
|
||||
private HandService handService;
|
||||
|
||||
@PostMapping("/queryArea")
|
||||
@Log("查询区域")
|
||||
@ApiOperation("查询区域")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryArea() {
|
||||
return new ResponseEntity<>(handService.queryArea(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPointByArea")
|
||||
@Log("根据区域编码查点位")
|
||||
@ApiOperation("根据区域编码查点位")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryPointByArea(@RequestBody RegionDto dto) {
|
||||
String region_code = dto.getRegion_code();
|
||||
return new ResponseEntity<>(handService.queryPointByArea(region_code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/callTask")
|
||||
@Log("手持创建任务")
|
||||
@ApiOperation("手持创建任务")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> callTask(@RequestBody B2HeadDto dto) {
|
||||
return new ResponseEntity<>(b2HandService.callTask(dto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryDevices")
|
||||
@Log("查询所有设备")
|
||||
@ApiOperation("查询所有设备")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryDevices() {
|
||||
return new ResponseEntity<>(b2HandService.queryDevices(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateDeviceStatus")
|
||||
@Log("更新设备状态")
|
||||
@ApiOperation("更新设备状态")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> updateDeviceStatus(@RequestBody HeadDeviceDto dto) {
|
||||
return new ResponseEntity<>(b2HandService.updateDeviceStatus(dto), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.hand.service;
|
||||
|
||||
import org.nl.hand.dto.B2HeadDto;
|
||||
import org.nl.hand.dto.HeadDeviceDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/15 13:52
|
||||
*/
|
||||
public interface B2HandService {
|
||||
|
||||
/**
|
||||
* 手持创建任务
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> callTask(B2HeadDto dto);
|
||||
|
||||
Map<String, Object> queryDevices();
|
||||
|
||||
Map<String, Object> updateDeviceStatus(HeadDeviceDto dto);
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.hand.dto.B2HeadDto;
|
||||
import org.nl.hand.dto.HeadDeviceDto;
|
||||
import org.nl.hand.service.B2HandService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/15 13:52
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class B2HandServiceImpl implements B2HandService {
|
||||
@Autowired
|
||||
private TaskService taskserver;
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> callTask(B2HeadDto dto) {
|
||||
JSONArray errArr = new JSONArray();
|
||||
String start_device_code = dto.getStart_device_code1();
|
||||
String next_device_code = dto.getNext_device_code1();
|
||||
String start_device_code2 = dto.getStart_device_code2();
|
||||
String next_device_code2 = dto.getNext_device_code2();
|
||||
String task_type = dto.getTask_type();
|
||||
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "起点1不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "终点1不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
if (StrUtil.isEmpty(task_type)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "任务类型不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
} else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
}
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_point_code", start_device_code);
|
||||
jo.put("next_point_code", next_device_code);
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
jo.put("task_type", task_type);
|
||||
jo.put("agv_system_type", "2");
|
||||
jo.put("priority", "1");
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
taskserver.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
}
|
||||
JSONArray data = new JSONArray();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
} else {
|
||||
resultJson.put("message", "操作失败");
|
||||
resultJson.put("data", data);
|
||||
}
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevices() {
|
||||
JSONArray data = new JSONArray();
|
||||
//查询所有生箔区的设备
|
||||
List<Device> list = deviceService.lambdaQuery()
|
||||
.eq(Device::getRegion, "2")
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("未查到该区域的设备!");
|
||||
}
|
||||
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
Device device = list.get(i);
|
||||
String device_id = device.getDevice_id();
|
||||
String device_code = device.getDevice_code();
|
||||
Device deviceCode = deviceAppService.findDeviceByCode(device_code);
|
||||
int option = 0;
|
||||
if (deviceCode.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) deviceCode.getDeviceDriver();
|
||||
option = standardOrdinarySiteDeviceDriver.getOption();
|
||||
}
|
||||
String device_name = device.getDevice_name();
|
||||
BigDecimal seq_num = device.getSeq_num();
|
||||
jo.put("device_id", device_id);
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("device_name", device_name);
|
||||
jo.put("seq_num", seq_num);
|
||||
jo.put("option", option);
|
||||
data.add(jo);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> updateDeviceStatus(HeadDeviceDto dto) {
|
||||
JSONArray errArr = new JSONArray();
|
||||
String device_code = dto.getDevice_code();
|
||||
String option = dto.getOption();
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "设备号不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
if (StrUtil.isEmpty(option)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "操作不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
if (device_code.contains("M")&&(!"1".equals(option))){
|
||||
throw new BadRequestException("该设备为满轴位,不能进行该操作");
|
||||
}
|
||||
if (device_code.contains("K")&&(!"2".equals(option))){
|
||||
throw new BadRequestException("该设备为空轴位,不能进行该操作");
|
||||
}
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
JSONArray data = new JSONArray();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
} else {
|
||||
resultJson.put("message", "操作失败");
|
||||
resultJson.put("data", data);
|
||||
}
|
||||
return resultJson;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
@@ -67,8 +68,6 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
private JSONObject struct_jo = null;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
@@ -1381,6 +1380,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
String col_num = whereJson.getString("layer_num"); // 转库时用
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("子卷包装关系不存在或已出库,请检查!");
|
||||
@@ -1743,8 +1744,389 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
// 主存区类型更改成中转区类型:找一排主存区的更改中转区、把一排中转区的更改成主存区(只允许调用一次)
|
||||
updateStructSect(col_num);
|
||||
autoDisMove(whereJson);
|
||||
SpringContextHolder.getBean(RawAssistIStorServiceImpl.class).updateStructSect(col_num);
|
||||
struct_jo = autoDisMove2(whereJson);
|
||||
}
|
||||
return struct_jo;
|
||||
}
|
||||
|
||||
public JSONObject autoDisMove2(JSONObject whereJson) {
|
||||
/*
|
||||
* 分配逻辑:
|
||||
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
||||
* a、存在的话,优先放在这一块这一排中(遍历)
|
||||
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
||||
* 1)存在空巷道
|
||||
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
||||
* */
|
||||
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
|
||||
String sect_id = whereJson.getString("sect_id");
|
||||
|
||||
String col_num = whereJson.getString("layer_num"); // 转库时用
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("子卷包装关系不存在或已出库,请检查!");
|
||||
}
|
||||
|
||||
String material_code = sub_jo.getString("product_name");
|
||||
|
||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||
|
||||
double box_high = sub_jo.getDoubleValue("box_high");
|
||||
|
||||
HashMap<String, String> row_map = new HashMap<>();
|
||||
row_map.put("material_code", material_code);
|
||||
row_map.put("sale_order_name", sale_order_name);
|
||||
row_map.put("col_num", col_num);
|
||||
row_map.put("sect_id", sect_id);
|
||||
row_map.put("flag", "11");
|
||||
|
||||
//查询到当前可用的巷道
|
||||
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
JSONObject row_jo = rowArr.getJSONObject(i);
|
||||
|
||||
String block_num = row_jo.getString("block_num");
|
||||
String row_num = row_jo.getString("row_num");
|
||||
String placement_type = row_jo.getString("placement_type");
|
||||
|
||||
// 判断此排是否有除:入库锁、移入锁以外的锁
|
||||
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(isLock)) {
|
||||
if ("02".equals(placement_type)) {
|
||||
// 左通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else if ("03".equals(placement_type)) {
|
||||
// 右通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 双通
|
||||
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDescStruct = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox)) {
|
||||
String out_order_seq = jsonDescBox.getString("out_order_seq");
|
||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
||||
struct_jo = jsonDescStruct;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
|
||||
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
} else {
|
||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
||||
struct_jo = jsonAscStruct;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 说明这排有任务在执行,新开一排
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num2 = empty_row.getString("block_num");
|
||||
String row_num2 = empty_row.getString("row_num");
|
||||
String placement_type2 = empty_row.getString("placement_type");
|
||||
|
||||
if ("02".equals(placement_type)) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
||||
|
||||
for (int j = 0; j < haveArr.size(); j++) {
|
||||
JSONObject have_row = haveArr.getJSONObject(j);
|
||||
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(isLock2)) {
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDescStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
||||
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
||||
struct_jo = jsonDescStruct2;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
||||
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
} else {
|
||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
||||
struct_jo = jsonAscStruct2;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
|
||||
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
|
||||
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR")
|
||||
.addParam("col_num", col_num)
|
||||
.addParam("sect_id", sect_id)
|
||||
.addParam("box_height", String.valueOf(box_high))
|
||||
.addParam("flag", "13")
|
||||
.addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num")
|
||||
.process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if ("02".equals(placement_type)) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
||||
for (int j = 0; j < haveArr.size(); j++) {
|
||||
JSONObject have_row = haveArr.getJSONObject(j);
|
||||
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(isLock2)) {
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDescStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
||||
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
||||
struct_jo = jsonDescStruct2;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
||||
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
} else {
|
||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
||||
struct_jo = jsonAscStruct2;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return struct_jo;
|
||||
}
|
||||
@@ -2132,7 +2514,11 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
dtl_wql.update(map, "iostorinv_id = '" + mst_row.get("iostorinv_id") + "'");
|
||||
}
|
||||
|
||||
private void updateStructSect(String layer_num) {
|
||||
/**
|
||||
* 新开事务,把当前事务挂起,(新开事务不回滚)
|
||||
*/
|
||||
@Transactional(propagation=Propagation.REQUIRES_NEW)
|
||||
public void updateStructSect(String layer_num) {
|
||||
WQLObject attr = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
WQLObject point = WQLObject.getWQLObject("sch_base_point");
|
||||
/*
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
sa.is_delete = '0'
|
||||
AND sa.is_used = '1'
|
||||
AND sa.sect_code = 'ZC01'
|
||||
AND sa.placement_type = '01'
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
@@ -79,6 +80,7 @@
|
||||
AND sa2.is_delete = '0'
|
||||
AND sa2.sect_code = 'ZC01'
|
||||
AND IFNULL( sa2.storagevehicle_code, '' ) = ''
|
||||
AND sa2.placement_type = '01'
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa2.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
@@ -113,6 +115,7 @@
|
||||
AND sa.is_used = '1'
|
||||
AND sa.lock_type = '1'
|
||||
AND sa.sect_code = 'ZC01'
|
||||
AND sa.placement_type = '01'
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
@@ -137,6 +140,7 @@
|
||||
AND sa2.is_used = '1'
|
||||
AND sa2.is_delete = '0'
|
||||
AND sa2.sect_code = 'ZC01'
|
||||
AND sa2.placement_type = '01'
|
||||
AND IFNULL( sa2.storagevehicle_code, '' ) = ''
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa2.layer_num = 输入.layer_num
|
||||
|
||||
Reference in New Issue
Block a user