Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -11,7 +11,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 豪凯自动对接线
|
* 烘箱设备对接位
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
|
public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
|
|||||||
@@ -65,12 +65,37 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
private Date instruction_apply_time = new Date();
|
private Date instruction_apply_time = new Date();
|
||||||
private int instruction_require_time_out = 3000;
|
private int instruction_require_time_out = 3000;
|
||||||
|
|
||||||
int heartbeat = 0;
|
public int heartbeat = 0;
|
||||||
int mode = 0;
|
public int mode = 0;
|
||||||
int move = 0;
|
public int move = 0;
|
||||||
int action = 0;
|
public int action = 0;
|
||||||
int error = 0;
|
public int error = 0;
|
||||||
int task = 0;
|
public int door = 0;
|
||||||
|
public int temperature = 0;
|
||||||
|
public int countdown = 0;
|
||||||
|
public int finish = 0;
|
||||||
|
public int task = 0;
|
||||||
|
public int error1 = 0;
|
||||||
|
public int material = 0;
|
||||||
|
public int consumption = 0;
|
||||||
|
public int voltage = 0;
|
||||||
|
public int current = 0;
|
||||||
|
|
||||||
|
public int last_heartbeat = 0;
|
||||||
|
public int last_mode = 0;
|
||||||
|
public int last_move = 0;
|
||||||
|
public int last_action = 0;
|
||||||
|
public int last_error = 0;
|
||||||
|
public int last_door = 0;
|
||||||
|
public int last_temperature = 0;
|
||||||
|
public int last_countdown = 0;
|
||||||
|
public int last_finish = 0;
|
||||||
|
public int last_task = 0;
|
||||||
|
public int last_error1 = 0;
|
||||||
|
public int last_material = 0;
|
||||||
|
public int last_consumption = 0;
|
||||||
|
public int last_voltage = 0;
|
||||||
|
public int last_current = 0;
|
||||||
|
|
||||||
Boolean isonline = true;
|
Boolean isonline = true;
|
||||||
|
|
||||||
@@ -79,10 +104,6 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
//1-执行任务;2-取货完成;3-放货完成;
|
//1-执行任务;2-取货完成;3-放货完成;
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
int last_mode = 0;
|
|
||||||
int last_move = 0;
|
|
||||||
int last_error = 0;
|
|
||||||
|
|
||||||
String device_code;
|
String device_code;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -100,11 +121,19 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
device_code = this.getDeviceCode();
|
device_code = this.getDeviceCode();
|
||||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||||
mode = this.itemProtocol.getItem_mode();
|
mode = this.itemProtocol.getItem_mode();
|
||||||
move = this.itemProtocol.getItem_mode();
|
move = this.itemProtocol.getItem_move();
|
||||||
error = this.itemProtocol.getItem_error();
|
|
||||||
task = this.itemProtocol.getItem_task();
|
|
||||||
action = this.itemProtocol.getItem_action();
|
action = this.itemProtocol.getItem_action();
|
||||||
|
error = this.itemProtocol.getItem_error();
|
||||||
|
door = this.itemProtocol.getItem_door();
|
||||||
|
temperature = this.itemProtocol.getItem_temperature();
|
||||||
|
countdown = this.itemProtocol.getItem_countdown();
|
||||||
|
finish = this.itemProtocol.getItem_finish();
|
||||||
|
task = this.itemProtocol.getItem_task();
|
||||||
|
error1 = this.itemProtocol.getItem_error1();
|
||||||
|
material = this.itemProtocol.getItem_material();
|
||||||
|
consumption = this.itemProtocol.getItem_consumption();
|
||||||
|
voltage = this.itemProtocol.getItem_voltage();
|
||||||
|
current = this.itemProtocol.getItem_current();
|
||||||
|
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
this.setRequireSucess(false);
|
this.setRequireSucess(false);
|
||||||
@@ -140,7 +169,18 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
|
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
last_move = move;
|
last_move = move;
|
||||||
|
last_action = action;
|
||||||
last_error = error;
|
last_error = error;
|
||||||
|
last_door = door;
|
||||||
|
last_temperature = temperature;
|
||||||
|
last_countdown = countdown;
|
||||||
|
last_finish = finish;
|
||||||
|
last_task = task;
|
||||||
|
last_error1 = error1;
|
||||||
|
last_material = material;
|
||||||
|
last_consumption = consumption;
|
||||||
|
last_voltage = voltage;
|
||||||
|
last_current = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +202,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
|
|
||||||
public void writing(int command) {
|
public void writing(int command) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command;
|
+ "." +ItemProtocol.item_to_command;
|
||||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
Server server = ReadUtil.getServer(opcservcerid);
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
@@ -170,6 +210,19 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
ReadUtil.write(itemMap, server);
|
ReadUtil.write(itemMap, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writing(String param, String value) {
|
||||||
|
|
||||||
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + param;
|
||||||
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
itemMap.put(to_param, value);
|
||||||
|
// itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
ReadUtil.write(itemMap, server);
|
||||||
|
}
|
||||||
|
|
||||||
public void writing(int type, int command) {
|
public void writing(int type, int command) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_command;
|
+ "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_command;
|
||||||
|
|||||||
@@ -43,29 +43,51 @@ public class ItemProtocol {
|
|||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItem_heartbeat() {
|
public int getItem_heartbeat(){
|
||||||
return this.getOpcIntegerValue(item_heartbeat);
|
return this.getOpcIntegerValue(item_heartbeat);
|
||||||
}
|
} ;
|
||||||
|
public int getItem_mode(){
|
||||||
public int getItem_mode() {
|
|
||||||
return this.getOpcIntegerValue(item_mode);
|
return this.getOpcIntegerValue(item_mode);
|
||||||
}
|
} ;
|
||||||
|
public int getItem_move(){
|
||||||
public int getItem_move() {
|
|
||||||
return this.getOpcIntegerValue(item_move);
|
return this.getOpcIntegerValue(item_move);
|
||||||
}
|
} ;
|
||||||
|
public int getItem_action(){
|
||||||
public int getItem_error() {
|
|
||||||
return this.getOpcIntegerValue(item_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItem_action() {
|
|
||||||
return this.getOpcIntegerValue(item_action);
|
return this.getOpcIntegerValue(item_action);
|
||||||
}
|
};
|
||||||
|
public int getItem_error(){
|
||||||
public int getItem_task() {
|
return this.getOpcIntegerValue(item_error);
|
||||||
|
} ;
|
||||||
|
public int getItem_door(){
|
||||||
|
return this.getOpcIntegerValue(item_door);
|
||||||
|
} ;
|
||||||
|
public int getItem_temperature(){
|
||||||
|
return this.getOpcIntegerValue(item_temperature);
|
||||||
|
} ;
|
||||||
|
public int getItem_countdown(){
|
||||||
|
return this.getOpcIntegerValue(item_countdown);
|
||||||
|
} ;
|
||||||
|
public int getItem_finish(){
|
||||||
|
return this.getOpcIntegerValue(item_finish);
|
||||||
|
} ;
|
||||||
|
public int getItem_task(){
|
||||||
return this.getOpcIntegerValue(item_task);
|
return this.getOpcIntegerValue(item_task);
|
||||||
}
|
} ;
|
||||||
|
public int getItem_error1(){
|
||||||
|
return this.getOpcIntegerValue(item_error1);
|
||||||
|
} ;
|
||||||
|
public int getItem_material(){
|
||||||
|
return this.getOpcIntegerValue(item_material);
|
||||||
|
} ;
|
||||||
|
public int getItem_consumption(){
|
||||||
|
return this.getOpcIntegerValue(item_consumption);
|
||||||
|
} ;
|
||||||
|
public int getItem_voltage(){
|
||||||
|
return this.getOpcIntegerValue(item_voltage);
|
||||||
|
} ;
|
||||||
|
public int getItem_current(){
|
||||||
|
return this.getOpcIntegerValue(item_current);
|
||||||
|
} ;
|
||||||
|
|
||||||
Boolean isonline;
|
Boolean isonline;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
|||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
@@ -25,6 +26,7 @@ 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.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -115,6 +117,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
error = this.itemProtocol.getError();
|
error = this.itemProtocol.getError();
|
||||||
task = this.itemProtocol.getTask();
|
task = this.itemProtocol.getTask();
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
|
if (mode == 2) {
|
||||||
|
this.setRequireSucess(false);
|
||||||
|
}
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||||
}
|
}
|
||||||
@@ -139,6 +144,99 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更改任务状态
|
||||||
|
if (task > 0) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
instructionService.update(inst1);
|
||||||
|
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
|
||||||
|
JSONArray array = new JSONArray();
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("task_id", taskDto.getExt_task_id());
|
||||||
|
map.put("task_status", "1");
|
||||||
|
array.add(map);
|
||||||
|
acsToWmsService.feedbackTaskStatusToWms(array);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//申请取货 判断取货位是否有货 有货就下发允许取货命令
|
||||||
|
if (mode == 3 && action == 1 && move == 0 && task > 0) {
|
||||||
|
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
if (ObjectUtil.isNotEmpty(inst2)) {
|
||||||
|
String start_device_code = inst2.getStart_device_code();
|
||||||
|
Device device = appService.findDeviceByCode(start_device_code);
|
||||||
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
|
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||||
|
hongXiangConveyorDeviceDriver.writing("to_door", "1");
|
||||||
|
if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) {
|
||||||
|
this.writing("to_command", "2");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.writing("to_command", "2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//申请放货
|
||||||
|
if (mode == 3 && action == 3 && move == 1 && task > 0) {
|
||||||
|
Instruction instructionDto = instructionService.findByCode(String.valueOf(task));
|
||||||
|
String next_device_code = instructionDto.getNext_device_code();
|
||||||
|
Device nextDevice = appService.findDeviceByCode(next_device_code);
|
||||||
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
hongXiangConveyorDeviceDriver.writing("to_door", "1");
|
||||||
|
if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) {
|
||||||
|
this.writing("to_command", "3");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.writing("to_command", "3");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//放货完成
|
||||||
|
if (mode == 3 && action == 4 && move == 0 && task > 0) {
|
||||||
|
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
if (inst2 != null) {
|
||||||
|
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
|
||||||
|
try {
|
||||||
|
finish_instruction(inst2);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
|
||||||
|
JSONArray array = new JSONArray();
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("task_id", taskDto.getTask_id());
|
||||||
|
map.put("task_status", "2");
|
||||||
|
array.add(map);
|
||||||
|
acsToWmsService.feedbackTaskStatusToWms(array);
|
||||||
|
String next_device_code = taskDto.getNext_device_code();
|
||||||
|
String start_device_code = taskDto.getStart_device_code();
|
||||||
|
Device startDevice = appService.findDeviceByCode(start_device_code);
|
||||||
|
Device nextDevice = appService.findDeviceByCode(next_device_code);
|
||||||
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
|
if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
hongXiangConveyorDeviceDriver.writing("to_door", "0");
|
||||||
|
}
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
hongXiangConveyorDeviceDriver.writing("to_door", "0");
|
||||||
|
}
|
||||||
|
this.writing("to_command", "0");
|
||||||
|
this.writing("to_onset", "0");
|
||||||
|
this.writing("to_target", "0");
|
||||||
|
this.writing("to_task", "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -165,6 +263,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
Instruction instruction = null;
|
Instruction instruction = null;
|
||||||
List toInstructions;
|
List toInstructions;
|
||||||
|
|
||||||
|
//行架机械手申请任务
|
||||||
|
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
|
||||||
|
applyTask();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
last_move = move;
|
last_move = move;
|
||||||
@@ -175,7 +278,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean exe_error() {
|
public boolean exe_error() {
|
||||||
if (this.error == 0) {
|
if (this.error == 0) {
|
||||||
return true;
|
return true;
|
||||||
@@ -185,6 +287,102 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请任务
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public synchronized boolean applyTask() {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.instruction_require_time = date;
|
||||||
|
//抓取工位
|
||||||
|
List<String> getDeviceCodeList = this.getExtraDeviceCodes("get_device_code");
|
||||||
|
//放货工位
|
||||||
|
List<String> putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
|
||||||
|
TaskDto task = null;
|
||||||
|
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||||
|
String startDeviceCode = getDeviceCodeList.get(i);
|
||||||
|
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||||
|
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||||
|
TaskDto taskDto = taskDtos.get(0);
|
||||||
|
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
|
||||||
|
instruction.setInstruction_status("1");
|
||||||
|
instruction.setUpdate_time(DateUtil.now());
|
||||||
|
instructionService.update(instruction);
|
||||||
|
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
|
||||||
|
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
|
||||||
|
writing("to_onset", String.valueOf(start_addrIndex));
|
||||||
|
writing("to_target", String.valueOf(next_addrIndex));
|
||||||
|
writing("to_task", instruction.getInstruction_code());
|
||||||
|
writing("to_command", "1");
|
||||||
|
this.setRequireSucess(true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||||
|
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||||
|
task = taskDtoList.get(0);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(task)) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
|
String taskid = task.getTask_id();
|
||||||
|
String taskcode = task.getTask_code();
|
||||||
|
String vehiclecode = task.getVehicle_code();
|
||||||
|
String priority = task.getPriority();
|
||||||
|
String start_point_code = task.getStart_point_code();
|
||||||
|
String start_device_code = task.getStart_device_code();
|
||||||
|
String route_plan_code = task.getRoute_plan_code();
|
||||||
|
String next_point_code = task.getNext_point_code();
|
||||||
|
String next_device_code = task.getNext_device_code();
|
||||||
|
|
||||||
|
Instruction instdto = new Instruction();
|
||||||
|
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
|
instdto.setRoute_plan_code(route_plan_code);
|
||||||
|
instdto.setRemark(task.getRemark());
|
||||||
|
instdto.setMaterial(task.getMaterial());
|
||||||
|
instdto.setQuantity(task.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.setNext_device_code(next_device_code);
|
||||||
|
instdto.setStart_point_code(start_point_code);
|
||||||
|
instdto.setNext_point_code(next_point_code);
|
||||||
|
instdto.setPriority(priority);
|
||||||
|
instdto.setInstruction_status("1");
|
||||||
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
|
||||||
|
try {
|
||||||
|
instructionService.create(instdto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//创建指令后修改任务状态
|
||||||
|
task.setTask_status("1");
|
||||||
|
task.setUpdate_time(DateUtil.now());
|
||||||
|
taskserver.update(task);
|
||||||
|
//根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置
|
||||||
|
int start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
|
||||||
|
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
|
||||||
|
writing("to_onset", String.valueOf(start_addrIndex));
|
||||||
|
writing("to_target", String.valueOf(next_addrIndex));
|
||||||
|
writing("to_task", instdto.getInstruction_code());
|
||||||
|
writing("to_command", "1");
|
||||||
|
this.setRequireSucess(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean exe_business() {
|
public boolean exe_business() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public interface InstructionService {
|
|||||||
*/
|
*/
|
||||||
Instruction findByTaskcode(String code);
|
Instruction findByTaskcode(String code);
|
||||||
|
|
||||||
|
Instruction findByTaskcodeAndStatus(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据任务id查询
|
* 根据任务id查询
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -224,6 +224,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instruction findByTaskcodeAndStatus(String code) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
|
JSONObject json = wo.query("task_code ='" + code + "' and instruction_status = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)){
|
||||||
|
final Instruction obj = json.toJavaObject(Instruction.class);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByTaskid(String id, String wherecaluse) {
|
public Instruction findByTaskid(String id, String wherecaluse) {
|
||||||
if (!StrUtil.isEmpty(wherecaluse)) {
|
if (!StrUtil.isEmpty(wherecaluse)) {
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ public interface TaskService {
|
|||||||
*/
|
*/
|
||||||
List<TaskDto> queryTaskByDeviceCode(String device_code);
|
List<TaskDto> queryTaskByDeviceCode(String device_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备号和任务状态查询
|
||||||
|
* @param device_code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据关联编号查询非立刻下发的关联任务
|
* 根据关联编号查询非立刻下发的关联任务
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -273,6 +273,22 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code) {
|
||||||
|
List<TaskDto> list = new ArrayList<>();
|
||||||
|
Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
TaskDto task = iterator.next();
|
||||||
|
if (task.getStart_device_code().equals(device_code) && StrUtil.equals(task.getTask_status(), "1")) {
|
||||||
|
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||||
|
if (ObjectUtil.isNotEmpty(instruction)){
|
||||||
|
list.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskDto queryTaskByLinkNum(String link_num) {
|
public TaskDto queryTaskByLinkNum(String link_num) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1401,12 +1401,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
for (int j = 0; j < rows.size(); j++) {
|
for (int j = 0; j < rows.size(); j++) {
|
||||||
JSONObject ivt = rows.getJSONObject(j);
|
JSONObject ivt = rows.getJSONObject(j);
|
||||||
|
|
||||||
double canuse_qty = ivt.getDoubleValue("plan_qty");
|
double canuse_qty = ivt.getDoubleValue("ivt_qty");
|
||||||
if (unassign_qty >= canuse_qty) {
|
if (unassign_qty >= canuse_qty) {
|
||||||
unassign_qty = unassign_qty - canuse_qty;
|
unassign_qty = unassign_qty - canuse_qty;
|
||||||
ivt.put("change_qty", canuse_qty + "");
|
ivt.put("change_qty", canuse_qty + "");
|
||||||
} else {
|
} else {
|
||||||
ivt.put("change_qty", unassign_qty + "");
|
ivt.put("change_qty", canuse_qty + "");
|
||||||
unassign_qty = 0;
|
unassign_qty = 0;
|
||||||
}
|
}
|
||||||
//更新库存
|
//更新库存
|
||||||
@@ -1634,6 +1634,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
from_start.put("lock_type", "1");
|
from_start.put("lock_type", "1");
|
||||||
from_start.put("storagevehicle_code", "");
|
from_start.put("storagevehicle_code", "");
|
||||||
storPublicService.updateStructAndPoint(from_start);
|
storPublicService.updateStructAndPoint(from_start);
|
||||||
|
|
||||||
|
// 更新子卷包装关系表 状态 - 3
|
||||||
|
JSONObject jsonSub = subTab.query("container_name = '" + dis.getString("pcsn") + "' and status = '2'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("此子卷不存在或不为入库状态:"+dis.getString("pcsn"));
|
||||||
|
jsonSub.put("status", "3");
|
||||||
|
subTab.update(jsonSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -179,16 +179,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleEdit(index, row) {
|
handleEdit(index, row) {
|
||||||
debugger
|
|
||||||
// 判断是否可以关闭编辑状态
|
// 判断是否可以关闭编辑状态
|
||||||
if (row.edit === undefined) {
|
if (row.edit === undefined) {
|
||||||
this.$set(row, 'edit', false)
|
this.$set(row, 'edit', false)
|
||||||
}
|
}
|
||||||
if (!row.edit) {
|
if (!row.edit) {
|
||||||
if (row.plan_qty > this.queryrow.unassign_qty) {
|
/* if (row.plan_qty > this.queryrow.unassign_qty) {
|
||||||
this.crud.notify('出库重量不能超过未分配数', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('出库重量不能超过未分配数', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return false
|
return false
|
||||||
}
|
}*/
|
||||||
if (row.plan_qty > row.canuse_qty) {
|
if (row.plan_qty > row.canuse_qty) {
|
||||||
this.crud.notify('出库重量不能超过库存可出重量', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('出库重量不能超过库存可出重量', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -158,13 +158,14 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
v-permission="['admin','checkoutbill:del','checkoutbill:edit']"
|
v-permission="['admin','checkoutbill:del','checkoutbill:edit']"
|
||||||
label="操作"
|
label="操作"
|
||||||
width="200"
|
width="250"
|
||||||
align="center"
|
align="center"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
:data="scope.row"
|
:data="scope.row"
|
||||||
|
style="display: inline"
|
||||||
:permission="permission"
|
:permission="permission"
|
||||||
:disabled-edit="canUd(scope.row)"
|
:disabled-edit="canUd(scope.row)"
|
||||||
:disabled-dle="canUd(scope.row)"
|
:disabled-dle="canUd(scope.row)"
|
||||||
@@ -178,7 +179,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-upload"
|
icon="el-icon-printer"
|
||||||
@click="print(scope.row)"
|
@click="print(scope.row)"
|
||||||
>
|
>
|
||||||
打印
|
打印
|
||||||
|
|||||||
Reference in New Issue
Block a user