|
@@ -27,11 +27,16 @@ import com.gzlh.utils.WordHandlerUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class PLCService {
|
|
|
private static final TimedCache<String, Integer> CACHE_MAP = CacheUtil.newTimedCache(10000);
|
|
|
|
|
|
+ @Resource
|
|
|
+ private EventBus eventBus;
|
|
|
+
|
|
|
/**
|
|
|
* 试榜单
|
|
|
*/
|
|
@@ -53,10 +58,16 @@ public class PLCService {
|
|
|
try (HttpResponse response = HttpUtil.createPost(api).body(WordHandlerUtils.AESEncrypt(bodyParams)).execute()) {
|
|
|
log.info("提交港内地磅数据-返回结果:{}", response.body());
|
|
|
if (response.getStatus() == 200) {
|
|
|
+ JSONObject result = JSONUtil.parseObj(response.body());
|
|
|
+ String msg = result.getStr("msg");
|
|
|
+ Integer code = result.getInt("code");
|
|
|
+ if (code == 200) {
|
|
|
+ eventBus.startEvent(ModuleEnum.PLC_MODULE.getModuleEn() + "." + PLCEvent.RAILING_RISE);
|
|
|
+ }
|
|
|
LedOptions options = new LedOptions().setLine("04").setShowType("00");
|
|
|
options.setColor("01");
|
|
|
SystemObject.ledFactory.handler(SysConfig.serialSetting.getLed().getBrand())
|
|
|
- .sendMsg("请驶离地磅", options);
|
|
|
+ .sendMsg(msg, options);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -88,6 +99,9 @@ public class PLCService {
|
|
|
CommandBO commandBO = JSONUtil.toBean(data, CommandBO.class);
|
|
|
LedOptions options = new LedOptions().setLine("04").setShowType("00");
|
|
|
int code = jsonObject.getInt("code");
|
|
|
+ if (code == 200) {
|
|
|
+ eventBus.startEvent(ModuleEnum.PLC_MODULE.getModuleEn() + "." + PLCEvent.RAILING_RISE);
|
|
|
+ }
|
|
|
options.setColor(code == 200 ? "02" : "01");
|
|
|
SystemObject.ledFactory.handler(SysConfig.serialSetting.getLed().getBrand())
|
|
|
.sendMsg(commandBO.getCommand().getExtra(), options);
|
|
@@ -115,7 +129,7 @@ public class PLCService {
|
|
|
* @param event
|
|
|
*/
|
|
|
public void startPlcEvent(String event) {
|
|
|
- if (StrUtil.equalsIgnoreCase(event,PLCEvent.IDLE)&& CommonWeighbridgeHandler.hsCar){
|
|
|
+ if (StrUtil.equalsIgnoreCase(event, PLCEvent.IDLE) && CommonWeighbridgeHandler.hsCar) {
|
|
|
return;
|
|
|
}
|
|
|
event = event.toUpperCase();
|