|
|
@ -1,5 +1,7 @@ |
|
|
|
package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.Data; |
|
|
@ -70,7 +72,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
|
private Date instruction_require_time = new Date(); |
|
|
|
private Date instruction_finished_time = new Date(); |
|
|
|
|
|
|
|
private int instruction_require_time_out; |
|
|
|
private int instruction_require_time_out = 3000; |
|
|
|
private int instruction_finished_time_out; |
|
|
|
|
|
|
|
String message; |
|
|
@ -143,6 +145,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
|
logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); |
|
|
|
} |
|
|
|
if (container_qty != last_container_qty) { |
|
|
|
this.setRequireSucess(false); |
|
|
|
logServer.deviceItemValue(this.device_code,"container_qty" ,String.valueOf(container_qty)); |
|
|
|
logServer.deviceExecuteLog(this.device_code,"","","信号container_qty:" + last_container_qty + "->" + container_qty); |
|
|
|
} |
|
|
@ -181,7 +184,11 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
|
log.debug("设备运转模式:等待工作"); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
|
|
|
|
int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString()); |
|
|
|
//当前数量等于最大数量,则生成搬运任务
|
|
|
|
if (!requireSucess && container_qty == max_emptypalletnum) { |
|
|
|
putStorage(); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
if (!requireSucess) { |
|
|
@ -259,4 +266,32 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 申请入库 |
|
|
|
* |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean putStorage() { |
|
|
|
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; |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code",this.device_code); |
|
|
|
json.put("qty", container_qty); |
|
|
|
json.put("type","3"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"),"200")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|