|
|
@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; |
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
|
import org.nl.acs.instruction.service.InstructionService; |
|
|
|
import org.nl.acs.log.service.LogServer; |
|
|
|
import org.nl.acs.opc.Device; |
|
|
|
import org.nl.acs.route.service.RouteLineService; |
|
|
|
import org.nl.acs.task.service.TaskService; |
|
|
@ -45,6 +46,8 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); |
|
|
|
@Autowired |
|
|
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); |
|
|
|
@Autowired |
|
|
|
LogServer logServer = SpringContextHolder.getBean("logServerImpl"); |
|
|
|
//放货准备锁
|
|
|
|
String putReadyLock = null; |
|
|
|
//有货标记
|
|
|
@ -102,7 +105,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void execute() { |
|
|
|
public void execute() throws Exception { |
|
|
|
String message = null; |
|
|
|
try { |
|
|
|
String device_code = this.getDeviceCode(); |
|
|
@ -275,7 +278,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public synchronized boolean enter(JSONObject json) { |
|
|
|
public synchronized boolean enter(JSONObject json) throws Exception { |
|
|
|
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); |
|
|
@ -287,11 +290,15 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
JSONObject jsonObject = JSONObject.fromObject(result.body()); |
|
|
|
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) { |
|
|
|
// Thread.sleep(300L);
|
|
|
|
// this.writing(0);
|
|
|
|
this.writing(this.mode); |
|
|
|
} else { |
|
|
|
// Thread.sleep(300L);
|
|
|
|
this.writing(99); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// Thread.sleep(300L);
|
|
|
|
this.writing(99); |
|
|
|
} |
|
|
|
this.setRequireSucess(true); |
|
|
@ -311,6 +318,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
itemMap.put(to_param, value); |
|
|
|
// itemMap.put(to_param, Integer.parseInt(value));
|
|
|
|
ReadUtil.write(itemMap, server); |
|
|
|
// logServer.log("","称重机","",device_code + "," + param + "," + value,"","","","");
|
|
|
|
} |
|
|
|
|
|
|
|
public void executing(Server server, Map<String, Object> itemMap) { |
|
|
@ -326,7 +334,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
Map<String, Object> itemMap = new HashMap<String, Object>(); |
|
|
|
itemMap.put(to_command, command); |
|
|
|
ReadUtil.write(itemMap, server); |
|
|
|
|
|
|
|
// logServer.log("","称重机","",this.getDevice().getDevice_code() + ",to_command," + String.valueOf(command),"","","","");
|
|
|
|
} |
|
|
|
|
|
|
|
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { |
|
|
|