Commit cc3a9e06 LN

20388 agv与客户端通信 :增加X16转发,msg增加国际化处理

1 个父辈 1b725840
......@@ -5,8 +5,10 @@ import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.custom.djk20388.bean.AgvLogInfo;
import com.neotel.smfcore.custom.djk20388.bean.AgvViewDto;
import com.neotel.smfcore.custom.djk20388.bean.LabelingStatus;
import com.neotel.smfcore.custom.djk20388.util.AgvDataUtil;
......@@ -19,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@Slf4j
......@@ -40,6 +45,23 @@ public class DJK20388AGVController {
labelingStatus.setMimoCid(getMimoCid());
}
labelingStatus = AgvDataUtil.process(labelingStatus);
//锡膏料仓data中的X16需要返回给贴标机
String mimoCid=labelingStatus.getMimoCid() ;
if(ObjectUtil.isEmpty(mimoCid)){
mimoCid=getMimoCid();
}
if (ObjectUtil.isNotEmpty(mimoCid)) {
StatusBean bean = DevicesStatusUtil.getStatusBean(mimoCid);
if (bean != null && bean.getBoxStatus() != null && (bean.timeOut() == false)) {
String X16=bean.getFromData("X16");
Map<String,String> x16Data=new HashMap<>();
x16Data.put("X16",X16);
labelingStatus.addOp(x16Data);
}
}
} catch (Exception e) {
log.error("", e);
}
......@@ -64,7 +86,16 @@ public class DJK20388AGVController {
agvViewDto.setMimoData(bean.getData());
}
}
agvViewDto.setLogList(AgvDataUtil.getLastLogs(10));
Locale locale= servletRequest.getLocale();
//国际化
List<AgvLogInfo> logs=AgvDataUtil.getLastLogs(10);
for (int i=0;i<=logs.size();i++){
if(ObjectUtil.isNotEmpty(logs.get(i).getMsgCode())){
String msg=MessageUtils.getText(logs.get(i).getMsgCode(),logs.get(i).getMsgParams(),locale,logs.get(i).getMsg());
logs.get(i).setMsg(msg);
}
}
agvViewDto.setLogList(logs);
return agvViewDto;
}
private String getMimoCid() {
......
......@@ -71,11 +71,16 @@ public class LabelingStatus implements Serializable {
* 添加一些服务器的操作发送到客户端(批量入库)
* @param opMap
*/
public void addOp(Map<String, String> opMap){
if(opMap != null && !opMap.isEmpty()){
public void addOp(Map<String, String> opMap) {
if (opMap != null && !opMap.isEmpty()) {
for (Map.Entry<String, String> op : opMap.entrySet()) {
addData(op.getKey(), op.getValue());
log.info("LabelingStatus addOp ["+op.getKey()+"]=["+op.getValue()+"]");
// addData(op.getKey(), op.getValue());
data.put(op.getKey(), op.getValue());
if (op.getKey().equals("X16")) {
log.debug("LabelingStatus addOp [" + op.getKey() + "]=[" + op.getValue() + "]");
} else {
log.info("LabelingStatus addOp [" + op.getKey() + "]=[" + op.getValue() + "]");
}
}
}
}
......@@ -88,14 +93,14 @@ public class LabelingStatus implements Serializable {
mimoOpMap.put(cid, opMap);
}
}
private void addData(String key, String value){
String oldValue = data.get(key);
String valueStr = value;
if(!Strings.isNullOrEmpty(oldValue)){
valueStr = valueStr + "|" + oldValue;
}
data.put(key, valueStr);
}
// private void addData(String key, String value){
// String oldValue = data.get(key);
// String valueStr = value;
// if(!Strings.isNullOrEmpty(oldValue)){
// valueStr = valueStr + "|" + oldValue;
// }
// data.put(key, valueStr);
// }
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!