This commit is contained in:
2023-03-24 13:54:43 +08:00
6 changed files with 218 additions and 104 deletions

View File

@@ -29,6 +29,8 @@ public class ItemProtocol {
public static String item_barcode_length = "barcode_length"; public static String item_barcode_length = "barcode_length";
//条码 //条码
public static String item_barcode = "barcode"; public static String item_barcode = "barcode";
//重量
public static String item_weight = "weight";
//下发命令 //下发命令
@@ -66,6 +68,9 @@ public class ItemProtocol {
public int getMove() { public int getMove() {
return this.getOpcIntegerValue(item_move); return this.getOpcIntegerValue(item_move);
} }
public int getWeight() {
return this.getOpcIntegerValue(item_weight);
}
public int getCarrier_direction() { public int getCarrier_direction() {
return this.getOpcIntegerValue(item_carrier_direction); return this.getOpcIntegerValue(item_carrier_direction);
@@ -126,6 +131,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_task, "任务号", "DB101.D260")); list.add(new ItemDto(item_task, "任务号", "DB101.D260"));
list.add(new ItemDto(item_barcode_length, "条码长度", "DB101.B800")); list.add(new ItemDto(item_barcode_length, "条码长度", "DB101.B800"));
list.add(new ItemDto(item_barcode, "条码", "DB101.STRING802.50")); list.add(new ItemDto(item_barcode, "条码", "DB101.STRING802.50"));
list.add(new ItemDto(item_weight, "重量", "DB101.D702"));
return list; return list;
} }

View File

@@ -18,6 +18,8 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver;
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.data.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
@@ -72,6 +74,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
protected String barcode = null; protected String barcode = null;
protected String formatcode = null; protected String formatcode = null;
private Date require_apply_labeling_time = new Date();
private Date instruction_require_time = new Date(); private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date(); private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date(); private Date instruction_apply_time = new Date();
@@ -84,6 +87,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
int action = 0; int action = 0;
int error = 0; int error = 0;
int task = 0; int task = 0;
int weight = 0;
int to_task = 0; int to_task = 0;
String plcbarcode = null; String plcbarcode = null;
String last_plcbarcode = null; String last_plcbarcode = null;
@@ -101,6 +105,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
int last_move = 0; int last_move = 0;
int last_error = 0; int last_error = 0;
int last_task = 0; int last_task = 0;
int last_weight = 0;
String last_container; String last_container;
String inst_message; String inst_message;
String device_code; String device_code;
@@ -143,7 +148,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
scanner.cleanBarcode(); scanner.cleanBarcode();
logServer.deviceExecuteLog(this.device_code, "", "", "清理条码"); logServer.deviceExecuteLog(this.device_code, "", "", "清理条码");
} }
public synchronized boolean finish_instruction(){
public synchronized boolean finish_instruction() {
try { try {
instructionService.finish(inst); instructionService.finish(inst);
} catch (Exception e) { } catch (Exception e) {
@@ -184,7 +190,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
@Override @Override
public void execute(){ public void execute() {
try { try {
device_code = this.getDeviceCode(); device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getHeartbeat(); heartbeat = this.itemProtocol.getHeartbeat();
@@ -192,12 +198,13 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
move = this.itemProtocol.getMove(); move = this.itemProtocol.getMove();
error = this.itemProtocol.getError(); error = this.itemProtocol.getError();
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
plcbarcode = this.itemProtocol.getplcBarCode(); plcbarcode = this.itemProtocol.getplcBarCode();
plcbarcode_length = this.itemProtocol.getBarCode_length(); plcbarcode_length = this.itemProtocol.getBarCode_length();
to_task = this.itemProtocol.getTotTask(); to_task = this.itemProtocol.getTotTask();
weight = this.itemProtocol.getWeight();
if (mode != last_mode) { if (mode != last_mode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode +"复位请求标记"); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
if(mode == 2){ if (mode == 2) {
this.setRequireSucess(false); this.setRequireSucess(false);
this.setApplySucess(false); this.setApplySucess(false);
message = null; message = null;
@@ -218,12 +225,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (plcbarcode_length != last_plcbarcode_length) { if (plcbarcode_length != last_plcbarcode_length) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号plcbarcode_length" + last_plcbarcode_length + "->" + plcbarcode_length); logServer.deviceExecuteLog(this.device_code, "", "", "信号plcbarcode_length" + last_plcbarcode_length + "->" + plcbarcode_length);
} }
if (!StrUtil.equals(plcbarcode,last_plcbarcode) ) { if (!StrUtil.equals(plcbarcode, last_plcbarcode)) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号plcbarcode" + last_plcbarcode + "->" + plcbarcode); logServer.deviceExecuteLog(this.device_code, "", "", "信号plcbarcode" + last_plcbarcode + "->" + plcbarcode);
} }
if (task != last_task) { if (task != last_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task+ "->" + task); logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (weight != last_weight) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight" + last_weight + "->" + weight);
} }
if (mode == 2 && move != 0 && task > 0) { if (mode == 2 && move != 0 && task > 0) {
//inst_message //inst_message
@@ -257,7 +267,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
} else { } else {
this.setIsonline(true); this.setIsonline(true);
this.setIserror(false); this.setIserror(false);
if(error>0){ if (error > 0) {
this.setIserror(true); this.setIserror(true);
} }
Instruction instruction = null; Instruction instruction = null;
@@ -270,11 +280,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
//申请任务 //申请任务
String newBarcode = null; String newBarcode = null;
if(!StrUtil.isEmpty(barcode())){ if (!StrUtil.isEmpty(barcode())) {
newBarcode = barcode(); newBarcode = barcode();
} else { } else {
// //
if(plcbarcode_length>2){ if (plcbarcode_length > 2) {
newBarcode = plcbarcode; newBarcode = plcbarcode;
} else { } else {
break; break;
@@ -287,6 +297,25 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) { if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) {
instruction_apply(newBarcode.trim()); instruction_apply(newBarcode.trim());
} }
break;
case 5:
String newBarcodes = null;
//申请任务
if (!StrUtil.isEmpty(barcode())) {
newBarcodes = barcode();
} else {
//
if (plcbarcode_length > 2) {
newBarcodes = plcbarcode;
} else {
break;
}
}
// 申请贴标
if (move > 0 && !StrUtil.isEmpty(newBarcodes) && !requireSucess) {
applyLabeling(newBarcodes);
}
break;
} }
switch (flag) { switch (flag) {
//取货完成 //取货完成
@@ -306,6 +335,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
last_task = task; last_task = task;
last_plcbarcode_length = plcbarcode_length; last_plcbarcode_length = plcbarcode_length;
last_plcbarcode = plcbarcode; last_plcbarcode = plcbarcode;
last_weight = weight;
} }
public boolean exe_error() { public boolean exe_error() {
@@ -326,33 +356,17 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
this.set_last_container(container); this.set_last_container(container);
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","0"); map.put("value", "0");
list.add(map); list.add(map);
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code","to_task"); map2.put("code", "to_task");
map2.put("value","0"); map2.put("value", "0");
list.add(map2); list.add(map2);
Map map3 = new HashMap(); Map map3 = new HashMap();
map3.put("code","to_command"); map3.put("code", "to_command");
map3.put("value","0"); map3.put("value", "0");
list.add(map3); list.add(map3);
Map map4 = new HashMap();
map4.put("code","to_strap_times");
map4.put("value","0");
list.add(map4);
Map map5 = new HashMap();
map5.put("code","to_length");
map5.put("value","0");
list.add(map5);
Map map6 = new HashMap();
map6.put("code","to_weight");
map6.put("value","0");
list.add(map6);
Map map7 = new HashMap();
map7.put("code","to_height");
map7.put("value","0");
list.add(map7);
this.writing(list); this.writing(list);
message = null; message = null;
} }
@@ -426,7 +440,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
return instruction_require(container_code, WcsConfig.task_container_type_default_desc); return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
} }
public synchronized boolean instruction_apply(String container_code) { public synchronized boolean instruction_apply(String container_code) {
Date date = new Date(); Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
@@ -435,44 +449,45 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
this.instruction_apply_time = date; this.instruction_apply_time = date;
//container_code //container_code
TaskDto task = taskserver.findByContainer(container_code); TaskDto task = taskserver.findByContainer(container_code);
logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(task));
if (!ObjectUtil.isEmpty(task)) { if (!ObjectUtil.isEmpty(task)) {
Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code()); Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code());
if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){ if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) {
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
// this.setIserror(true); // this.setIserror(true);
return false; return false;
} }
if(ObjectUtil.isNotEmpty(instdto)){ if (ObjectUtil.isNotEmpty(instdto)) {
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
if(StrUtil.isNotEmpty(task.getTo_z())){ if (StrUtil.isNotEmpty(task.getTo_z())) {
if(StrUtil.equals(task.getTo_z(),"01")){ if (StrUtil.equals(task.getTo_z(), "01")) {
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","102"); map.put("value", "102");
} else if(StrUtil.equals(task.getTo_z(),"02")){ } else if (StrUtil.equals(task.getTo_z(), "02")) {
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","201"); map.put("value", "201");
} else if(StrUtil.equals(task.getTo_z(),"03")){ } else if (StrUtil.equals(task.getTo_z(), "03")) {
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","301"); map.put("value", "301");
} }
} }
list.add(map); list.add(map);
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code","to_task"); map2.put("code", "to_task");
map2.put("value",instdto.getInstruction_code()); map2.put("value", instdto.getInstruction_code());
list.add(map2); list.add(map2);
Map map3 = new HashMap(); Map map3 = new HashMap();
map3.put("code","to_command"); map3.put("code", "to_command");
map3.put("value","1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
message = "下发电气任务号成功"; message = "下发电气任务号成功";
requireSucess = true; requireSucess = true;
applySucess = true; applySucess = true;
} else { } else {
message = "任务号:"+ task.getTask_code()+"未找到指令"; message = "任务号:" + task.getTask_code() + "未找到指令";
} }
} else { } else {
@@ -485,6 +500,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
/** /**
* 请求指令 * 请求指令
* 定点任务时请求这里 * 定点任务时请求这里
*
* @param container_code * @param container_code
* @param container_type * @param container_type
*/ */
@@ -497,15 +513,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
this.instruction_require_time = date; this.instruction_require_time = date;
//container_code //container_code
TaskDto taskdto = taskserver.findByContainer(container_code); TaskDto taskdto = taskserver.findByContainer(container_code);
logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(taskdto));
if (!ObjectUtil.isEmpty(taskdto)) { if (!ObjectUtil.isEmpty(taskdto)) {
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code
+"已存在对应任务,不再请求"); + "已存在对应任务,不再请求");
Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code());
if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){ if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) {
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务" logServer.deviceExecuteLog(this.device_code, "", "", "申请任务"
+"当前载具号"+container_code+"查找对应指令起点与当前设备不符"); + "当前载具号" + container_code + "查找对应指令起点与当前设备不符");
return false; return false;
} }
this.setIserror(false); this.setIserror(false);
@@ -536,8 +553,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
message = "下发电气任务号成功"; message = "下发电气任务号成功";
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code
+"已存在对应任务,下发电气信号"); + "已存在对应任务,下发电气信号");
requireSucess = true; requireSucess = true;
applySucess = true; applySucess = true;
} else { } else {
@@ -546,10 +563,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
return true; return true;
} else { } else {
//需要判断指令中的指令 再次请求不能生成 //需要判断指令中的指令 再次请求不能生成
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) { if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1"))) {
{ {
Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"); Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1");
if(to_task != Integer.parseInt(instdto.getInstruction_code())){ if (to_task != Integer.parseInt(instdto.getInstruction_code())) {
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
if (StrUtil.isNotEmpty(taskdto.getTo_z())) { if (StrUtil.isNotEmpty(taskdto.getTo_z())) {
@@ -640,8 +657,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
next_point_code = next_device_code; next_point_code = next_device_code;
} }
if(!StrUtil.equals(taskdto.getStart_device_code(),this.device_code)){ if (!StrUtil.equals(taskdto.getStart_device_code(), this.device_code)) {
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
// List list = new ArrayList(); // List list = new ArrayList();
// Map map = new HashMap(); // Map map = new HashMap();
// map.put("code","to_target"); // map.put("code","to_target");
@@ -682,8 +699,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("指令创建失败!",e.getMessage()); log.error("指令创建失败!", e.getMessage());
return false; return false;
} }
//创建指令后修改任务状态 //创建指令后修改任务状态
taskdto.setTask_status("1"); taskdto.setTask_status("1");
@@ -693,26 +710,26 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
if(StrUtil.isNotEmpty(taskdto.getTo_z())){ if (StrUtil.isNotEmpty(taskdto.getTo_z())) {
if(StrUtil.equals(taskdto.getTo_z(),"01")){ if (StrUtil.equals(taskdto.getTo_z(), "01")) {
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","102"); map.put("value", "102");
} else if(StrUtil.equals(taskdto.getTo_z(),"02")){ } else if (StrUtil.equals(taskdto.getTo_z(), "02")) {
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","201"); map.put("value", "201");
} else if(StrUtil.equals(taskdto.getTo_z(),"03")){ } else if (StrUtil.equals(taskdto.getTo_z(), "03")) {
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","301"); map.put("value", "301");
} }
} }
list.add(map); list.add(map);
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code","to_task"); map2.put("code", "to_task");
map2.put("value",instdto.getInstruction_code()); map2.put("value", instdto.getInstruction_code());
list.add(map2); list.add(map2);
Map map3 = new HashMap(); Map map3 = new HashMap();
map3.put("code","to_command"); map3.put("code", "to_command");
map3.put("value","1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
// if(task != Integer.parseInt(instdto.getInstruction_code()) ){ // if(task != Integer.parseInt(instdto.getInstruction_code()) ){
@@ -727,24 +744,24 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
JSONObject apply = new JSONObject(); JSONObject apply = new JSONObject();
apply.put("vehicle_code", container_code); apply.put("vehicle_code", container_code);
apply.put("device_code", device_code); apply.put("device_code", device_code);
apply.put("type","1"); apply.put("type", "1");
logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:"+apply.toString()); logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:" + apply.toString());
String str = acsToWmsService.applyTaskToWms(apply); String str = acsToWmsService.applyTaskToWms(apply);
JSONObject jo = JSON.parseObject(str); JSONObject jo = JSON.parseObject(str);
logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:"+jo.toString()); logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:" + jo.toString());
if (ObjectUtil.isEmpty(jo)) { if (ObjectUtil.isEmpty(jo)) {
message = "接口不通"; message = "接口不通";
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","1011"); map.put("value", "1011");
list.add(map); list.add(map);
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code","to_command"); map2.put("code", "to_command");
map2.put("value","1"); map2.put("value", "1");
Map map3 = new HashMap(); Map map3 = new HashMap();
map3.put("code","to_task"); map3.put("code", "to_task");
map3.put("value","0"); map3.put("value", "0");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
requireSucess = true; requireSucess = true;
@@ -756,25 +773,25 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
requireSucess = true; requireSucess = true;
applySucess = false; applySucess = false;
} else { } else {
if (jo.get("message")!=null){ if (jo.get("message") != null) {
message = jo.get("message").toString(); message = jo.get("message").toString();
} }
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","1011"); map.put("value", "1011");
list.add(map); list.add(map);
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code","to_command"); map2.put("code", "to_command");
map2.put("value","1"); map2.put("value", "1");
list.add(map2); list.add(map2);
Map map3 = new HashMap(); Map map3 = new HashMap();
map3.put("code","to_task"); map3.put("code", "to_task");
map3.put("value","0"); map3.put("value", "0");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
message = "申请任务失败下发退回,"+message; message = "申请任务失败下发退回," + message;
requireSucess = true; requireSucess = true;
} }
@@ -798,6 +815,78 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
} }
// 申请贴标
public synchronized void applyLabeling(String newBarcodes) {
Date date = new Date();
if (date.getTime() - this.require_apply_labeling_time.getTime()
< (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
this.require_apply_labeling_time = date;
// String vehicle_code = "";
if (weight == 0) {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备重量:" + weight + "异常");
message = "申请贴标电气设备重量:" + weight + "异常";
throw new RuntimeException("重量为空!");
}
// if (task > 0) {
// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
// if (ObjectUtil.isEmpty(instruction)) {
// instruction = instructionService.findByCode(String.valueOf(task));
// }
// vehicle_code = instruction.getVehicle_code();
// } else {
// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常");
// message = "申请贴标电气设备任务号:" + task + "异常";
// throw new RuntimeException("任务号为空!");
// }
if (StrUtil.isEmpty(newBarcodes)) {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!");
message = "申请贴标电气设备载具号为空";
throw new RuntimeException("载具号为空!");
}
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
new ApplyLabelingAndBindingRequest();
JSONObject device_json =
WQLObject.getWQLObject("acs_storage_cell")
.query("storage_code ='" + this.device_code + "'")
.uniqueResult(0);
String start_point_code = null;
if (!ObjectUtil.isEmpty(device_json)) {
start_point_code =
(String) device_json.get("parent_storage_code") == null
? this.device_code
: (String) device_json.get("parent_storage_code");
}
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
applyLabelingAndBindingRequest.setType("1");
applyLabelingAndBindingRequest.setVehicle_code(newBarcodes);
applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100));
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse =
acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest));
if (applyLabelingAndBindingResponse.getstatus() == 200) {
message = "申请贴标成功";
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", "5");
list.add(map);
this.writing(list);
this.writing(list);
message = "申请贴标下发电气信号成功";
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
requireSucess = true;
} else {
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
}
}
}
public void writing(List list) { public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {

View File

@@ -19,6 +19,8 @@ import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
import org.nl.system.service.role.ISysRoleService; import org.nl.system.service.role.ISysRoleService;
import org.nl.system.service.role.dao.SysRole; import org.nl.system.service.role.dao.SysRole;
import org.nl.system.service.role.dao.mapper.SysRoleMapper; import org.nl.system.service.role.dao.mapper.SysRoleMapper;
import org.nl.system.service.user.dao.SysUser;
import org.nl.system.service.user.dao.mapper.SysUserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@@ -39,6 +41,7 @@ import java.util.*;
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService { public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
private final SysRoleMapper roleMapper; private final SysRoleMapper roleMapper;
private final SysUserMapper userMapper;
private final SysMenuMapper sysMenuMapper; private final SysMenuMapper sysMenuMapper;
@@ -130,7 +133,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
public List<String> getPermissionList(JSONObject userDto) { public List<String> getPermissionList(JSONObject userDto) {
List<String> permission = new LinkedList<>(); List<String> permission = new LinkedList<>();
// 查看是否为管理员 // 查看是否为管理员
permission.add("admin"); String currentUserId = SecurityUtils.getCurrentUserId();
SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, currentUserId));
if ( ObjectUtil.isNotEmpty(sysUser.getIsAdmin()) && sysUser.getIsAdmin()) permission.add("admin");
permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId"))); permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId")));
return permission; return permission;
} }

View File

@@ -162,11 +162,24 @@ public class ProductInstorServiceImpl implements ProductInstorService {
// 木箱尺寸长度低于950的不入立体库长度大于1385的立体库无法入库 // 木箱尺寸长度低于950的不入立体库长度大于1385的立体库无法入库
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue(); String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue();
String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue(); String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue();
Double box_length_up = Double.valueOf(length_up); String with_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_with_up").getValue();
Double box_length_down = Double.valueOf(length_down); String high_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_high_up").getValue();
Double box_length_up = Double.valueOf(length_up); // 木箱长度上限
Double box_length_down = Double.valueOf(length_down); // 木箱长度下限
Double box_with_up = Double.valueOf(with_up); // 木箱宽度上限
Double box_high_up = Double.valueOf(high_up); // 木箱高度上限
if (!(box_length_down <= box_length && box_length <= box_length_up)) { if (!(box_length_down <= box_length && box_length <= box_length_up)) {
throw new BadRequestException("无法入立体,木箱长度为:"+box_length); throw new BadRequestException("无法入立体库,木箱超长;当前木箱长度为:"+box_length);
}
if (!(box_width <= box_with_up)) {
throw new BadRequestException("无法入立体库,木箱超宽;当前木箱宽度为:"+box_width);
}
if (!(box_high <= box_high_up)) {
throw new BadRequestException("无法入立体库,木箱超高;当前木箱高度为:"+box_high);
} }
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0); JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);

View File

@@ -1,7 +1,7 @@
import store from '@/store' import store from '@/store'
export default { export default {
inserted(el, binding, vnode) { inserted(el, binding) {
const { value } = binding const { value } = binding
const roles = store.getters && store.getters.roles const roles = store.getters && store.getters.roles
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
@@ -15,7 +15,7 @@ export default {
el.parentNode && el.parentNode.removeChild(el) el.parentNode && el.parentNode.removeChild(el)
} }
} else { } else {
// throw new Error(`使用方式: v-permission="['admin','editor']"`) throw new Error(`使用方式: v-permission="['admin','editor']"`)
} }
} }
} }

View File

@@ -147,6 +147,7 @@
<el-table-column prop="box_no" label="箱号" align="center" width="250px" show-overflow-tooltip /> <el-table-column prop="box_no" label="箱号" align="center" width="250px" show-overflow-tooltip />
<el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" /> <el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" />
<el-table-column prop="struct_code" label="仓位" align="center" show-overflow-tooltip /> <el-table-column prop="struct_code" label="仓位" align="center" show-overflow-tooltip />
<el-table-column prop="sect_name" label="区域" align="center" show-overflow-tooltip />
<!-- <el-table-column prop="next_point_code" label="目的位置" align="center" />--> <!-- <el-table-column prop="next_point_code" label="目的位置" align="center" />-->
<!-- <el-table-column prop="task_code" label="任务号" align="center" />--> <!-- <el-table-column prop="task_code" label="任务号" align="center" />-->
<!-- <el-table-column prop="task_type" label="任务类型" align="center" width="150px" :formatter="taskdtl_typeFormat" />--> <!-- <el-table-column prop="task_type" label="任务类型" align="center" width="150px" :formatter="taskdtl_typeFormat" />-->