# Conflicts:
#	acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java
#	acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java
This commit is contained in:
ludj
2023-02-02 22:05:23 +08:00
8 changed files with 46 additions and 38 deletions

View File

@@ -164,7 +164,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
inst1.setInstruction_status("1"); inst1.setInstruction_status("1");
inst1.setExecute_device_code(this.device_code); inst1.setExecute_device_code(this.device_code);
instructionService.update(inst1); instructionService.update(inst1);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); // TaskDto tas未反馈电气信号原因kDto = taskserver.findByCodeFromCache(inst1.getTask_code());
// if (ObjectUtil.isNotEmpty(taskDto)) { // if (ObjectUtil.isNotEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { // if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray(); // JSONArray array = new JSONArray();
@@ -408,15 +408,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} catch (Exception var17) { } catch (Exception var17) {
feedMessage = var17.getMessage(); feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
return;
} }
if (!this.itemProtocol.getIsonline()) { // if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false); // this.setIsonline(false);
this.setIserror(true); // this.setIserror(true);
message = "信号量同步异常"; // message = "信号量同步异常";
//未联机 // //未联机
} else if (mode == 0) { // } else
if (mode == 0) {
this.setIsonline(false); this.setIsonline(false);
this.setIserror(true); this.setIserror(true);
message = "未联机"; message = "未联机";

View File

@@ -216,7 +216,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} catch (Exception var17) { } catch (Exception var17) {
inst_message = var17.getMessage(); inst_message = var17.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
return;
} }
// if (!this.itemProtocol.getIsonline()) { // if (!this.itemProtocol.getIsonline()) {
@@ -553,10 +552,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
map3.put("value", "1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
// if (task != Integer.parseInt(inst.getInstruction_code())) { if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list); this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// } }
message = "下发电气任务号成功"; message = "下发电气任务号成功";
requireSucess = true; requireSucess = true;
return true; return true;
@@ -659,10 +658,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
map3.put("value", "1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
// if (task != Integer.parseInt(inst.getInstruction_code())) { if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list); this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// } }
} else { } else {
//如果不存在则直接找对应指令 //如果不存在则直接找对应指令
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
@@ -690,10 +689,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
map3.put("value", "1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
// if (task != Integer.parseInt(inst.getInstruction_code())) { if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list); this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// } }
} }
return true; return true;
} }

View File

@@ -213,7 +213,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
} catch (Exception var17) { } catch (Exception var17) {
inst_message = var17.getMessage(); inst_message = var17.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
return; // return;
} }
// if (!this.itemProtocol.getIsonline()) { // if (!this.itemProtocol.getIsonline()) {
@@ -620,7 +620,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("指令创建失败!",e.getMessage()); log.error("指令创建异常!");
return false; return false;
} }
// 创建指令后修改任务状态 // 创建指令后修改任务状态

View File

@@ -673,15 +673,16 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} catch (Exception var17) { } catch (Exception var17) {
feedMessage = var17.getMessage(); feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage()); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage());
return; // return;
} }
if (!this.itemProtocol.getIsonline()) { // if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false); // this.setIsonline(false);
this.setIserror(true); // this.setIserror(true);
message = "信号量同步异常"; // message = "信号量同步异常";
//未联机 // //未联机
} else if (mode == 0) { // } else
if (mode == 0) {
this.setIsonline(false); this.setIsonline(false);
this.setIserror(true); this.setIserror(true);
message = "未联机"; message = "未联机";

View File

@@ -729,7 +729,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
requireSucess = true; requireSucess = true;
applySucess = false; applySucess = false;
} else { } else {
requireSucess = false;
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();
@@ -746,6 +745,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
message = "申请任务失败下发退回,"+message; message = "申请任务失败下发退回,"+message;
requireSucess = true;
} }
} }

View File

@@ -1,11 +1,14 @@
package org.nl.acs.device_driver.driver; package org.nl.acs.device_driver.driver;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.ext.wms.data.JsonUtl; import org.nl.acs.ext.wms.data.JsonUtl;
import org.nl.acs.opc.OpcConfig; import org.nl.acs.opc.OpcConfig;
import org.nl.acs.opc.OpcServerService; import org.nl.acs.opc.OpcServerService;
import org.nl.acs.opc.OpcServerServiceImpl; import org.nl.acs.opc.OpcServerServiceImpl;
import org.nl.acs.opc.WcsConfig;
import org.nl.acs.udw.UnifiedDataAccessor; import org.nl.acs.udw.UnifiedDataAccessor;
import org.nl.acs.udw.UnifiedDataAccessorFactory; import org.nl.acs.udw.UnifiedDataAccessorFactory;
import org.nl.acs.udw.UnifiedDataAppService;
import org.nl.modules.wql.exception.WDKException; import org.nl.modules.wql.exception.WDKException;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
@@ -37,19 +40,21 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
ItemValue p2[]; ItemValue p2[];
p2 = new ItemValue[itemValues.size()]; p2 = new ItemValue[itemValues.size()];
int i = 0; int i=0;
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next(); Map.Entry<String, Object> entry = it.next();
System.out.println(entry.getKey() + ":" + entry.getValue()); System.out.println(entry.getKey() + ":" + entry.getValue());
p2[i] = new ItemValue(); p2[i] = new ItemValue();
p2[i].setItem_code(entry.getKey()); p2[i].setItem_code(entry.getKey());
p2[i].setItem_value( entry.getValue()); p2[i].setItem_value(entry.getValue());
i++; i++;
} }
return this.control(p2); return this.control(p2);
} }
public boolean control(ItemValue[] itemValues) { public boolean control(ItemValue[] itemValues) {
if (itemValues != null && itemValues.length != 0) { if (itemValues != null && itemValues.length != 0) {
String this_items = JsonUtl.parseWithoutException(itemValues); String this_items = JsonUtl.parseWithoutException(itemValues);
@@ -67,9 +72,9 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
sb.append(":"); sb.append(":");
sb.append(JsonUtl.parseWithoutException(udw_value)); sb.append(JsonUtl.parseWithoutException(udw_value));
sb.append(";"); sb.append(";");
// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { // if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
// need_write = true; // need_write = true;
// } // }
} }
need_write = true; need_write = true;

View File

@@ -219,6 +219,8 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
} }
} else if(StrUtil.equals(type,"2")){ } else if(StrUtil.equals(type,"2")){
siemensConveyorDeviceDriver.writing("to_command","3"); siemensConveyorDeviceDriver.writing("to_command","3");
siemensConveyorDeviceDriver.writing("to_command","3");
result.put("result", "true"); result.put("result", "true");
result.put("comment", ""); result.put("comment", "");
} }

View File

@@ -267,7 +267,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
@Override @Override
public void create(Instruction dto) throws Exception { public void create(Instruction dto) {
dto = foramte(dto); dto = foramte(dto);
String task_code = dto.getTask_code(); String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code); TaskDto task = taskService.findByCodeFromCache(task_code);
@@ -369,6 +369,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} catch (Exception e) { } catch (Exception e) {
dto.setSend_status("2"); dto.setSend_status("2");
e.printStackTrace(); e.printStackTrace();
log.error("");
} }
WQLObject wo = WQLObject.getWQLObject("acs_instruction"); WQLObject wo = WQLObject.getWQLObject("acs_instruction");