add: 标准检测站点驱动 mode = 3 取消货位绑定信息

This commit is contained in:
zhaoyf
2026-04-30 09:57:22 +08:00
parent d3788b219b
commit 93e3a89d11
7 changed files with 102 additions and 1 deletions

View File

@@ -47,6 +47,11 @@
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version> <!-- 使用存在的版本 -->
</dependency>
<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.core</artifactId>

View File

@@ -191,6 +191,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
case 1:
log.debug("设备运转模式:等待工作");
break;
case 3:
//载具解绑
if(!requireSucess && task != 0){
System.out.println("触发载具解绑" + task + mode + device_code);
this.vehicleUnbind();
}
case 5:
// 优先出窑位任务
if (!requireSucess && task != 0) {
@@ -292,6 +298,36 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
/**
* 载具解绑
* @return
*/
public synchronized boolean vehicleUnbind() {
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 param = new JSONObject();
param.put("device_code",device_code);
param.put("vehicle_code", task);
HttpResponse result = acsToWmsService.vehicleUnbind(param);
if (ObjectUtil.isNotEmpty(result)) {
if (result.getStatus() == HttpStatus.OK.value()) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
// Map<String, Object> map = new LinkedHashMap<>();
// map.put("to_command",5);
this.writing(this.mode);
this.setRequireSucess(true);
}
}
}
return true;
}
}
/**
* 多个信号一起下发电气
*

View File

@@ -63,6 +63,13 @@ public interface AcsToWmsService {
*/
HttpResponse outKiln(JSONObject json);
/**
* 载具解绑
* @param json
* @return
*/
HttpResponse vehicleUnbind(JSONObject json);
/**
* 排产单确认
*/

View File

@@ -23,7 +23,6 @@ import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
@@ -421,6 +420,34 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.remove(log_file_type);
}
}
@Override
public HttpResponse vehicleUnbind(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("vehicleUnbind");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
log.info("vehicleUnbind - 请求参数 {}", json.toString());
HttpResponse result = null;
try {
result = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(json))
.execute();
System.out.println(result);
log.info("vehicleUnbind - 响应参数 {}", result.body());
} catch (Exception e) {
System.out.println(e.getMessage());
}
return result;
} finally {
MDC.remove(log_file_type);
}
}
@Override