Browse Source

修改反馈wms点位状态

master
龚宝雄 3 weeks ago
parent
commit
8c0a9a3da3
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ItemProtocol.java
  2. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/ItemProtocol.java
  3. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
  4. 25
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  5. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/fold_disc_site/ItemProtocol.java
  6. 9
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  7. 6
      acs/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java
  8. 6
      acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java

2
acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/standard_inspect/ItemProtocol.java

@ -34,7 +34,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
log.error("读取错误!");
log.error(this.driver.getDevice().getDevice_code()+"信号读取错误!");
} else {
return value;
}

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/ItemProtocol.java

@ -45,7 +45,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
log.error("读取错误!");
log.error(this.driver.getDevicecode()+"信号读取错误!");
} else {
return value;
}

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java

@ -74,7 +74,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
//log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);

25
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -2,14 +2,11 @@ package org.nl.acs.device_driver.basedriver.standard_inspect_site;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
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;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
@ -20,8 +17,6 @@ import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.WcsConfig;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
@ -32,7 +27,6 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.HashMap;
@ -139,11 +133,17 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
if (devicecode.contains("F2TBJ")) {
if (move != last_move) {
log.info(this.devicecode + ",检测到货位信号的值由" + last_move + "->" + move);
}
if (mode != last_mode) {
log.info(this.devicecode + ",检测到货位工作模式的值由" + last_mode + "->" + mode);
}
}
if (move != last_move) {
this.requireSucess = false;
}
} catch (Exception var17) {
return;
}
@ -178,6 +178,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
JSONObject param = new JSONObject();
param.put("device_code", this.devicecode);
param.put("is_have", this.move);
log.info(this.devicecode + "检测到货位光电信号变动,开始反馈WMS");
this.shipDeviceUpdate(param);
}
}
@ -338,11 +339,11 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
} else {
this.instruction_require_time = date;
JSONObject response = acsToWmsService.shipDeviceUpdate(param);
// if (20000 == response.getIntValue("code")) {
this.requireSucess = true;
// }
// if (20000 == response.getIntValue("code")) {
this.requireSucess = true;
log.info(this.devicecode + "检测到货位光电信号变动,反馈WMS成功!");
// }
}
}

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/fold_disc_site/ItemProtocol.java

@ -76,7 +76,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
//log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);

9
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -24,8 +24,6 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@ -536,22 +534,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String password=paramService.findByCode(AcsConfig.PASSWORD).getValue();
String password = paramService.findByCode(AcsConfig.PASSWORD).getValue();
AddressDto addressDto = addressService.findByCode("shipDeviceUpdate");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
log.info("shipDeviceUpdate - 请求参数 {}", param);
JSONArray ja = new JSONArray();
ja.add(param);
HttpResponse result=HttpRequest.post(url)
HttpResponse result = HttpRequest.post(url)
.body(ja.toString())
.basicAuth("INFOR",password)
.basicAuth("INFOR", password)
.execute();
log.info("shipDeviceUpdate - 返回参数 {}", result.body());
return JSONObject.parseObject(result.body());
}
} catch (Throwable ignored) {
} finally {
MDC.remove(log_file_type);
}

6
acs/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java

@ -14,11 +14,11 @@ public class ParamDto implements Serializable {
private String id;
private String code;
private String code="";
private String name;
private String name="";
private String value;
private String value="";
private String remark;

6
acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java

@ -5,6 +5,7 @@ package org.nl.modules.system.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@ -67,7 +68,10 @@ public class ParamServiceImpl implements ParamService {
public ParamDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final ParamDto obj = json.toJavaObject(ParamDto.class);;
if (ObjectUtil.isEmpty(json)) {
return new ParamDto();
}
final ParamDto obj = json.toJavaObject(ParamDto.class);
return obj;
}

Loading…
Cancel
Save