Commit c5ea52a5 zshaohui

Merge remote-tracking branch 'origin/1057' into 1057

2 个父辈 3a6aba26 4428addc
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.system.service.po.AlarmInfo;
import lombok.Data;
......@@ -511,18 +512,56 @@ public class StatusBean {
return doorReelSignal;
}
public String getShowMsg(Locale locale){
public String getShowMsg(Locale locale) {
if(ObjectUtil.isEmpty(this.msg)){
return "";
}
//从收到数据中查找
String lan = locale.toLanguageTag();
if (lan.equals(MessageUtils.EN_US) && ObjectUtil.isNotEmpty(getMsgEn())) {
String resultMsg= getMsgEn().replace("A=","").replace("I=","").replace("W=","");
return resultMsg;
}
//提示信息国际化
if(ObjectUtil.isEmpty(getMsgCode())||ObjectUtil.isEmpty(getMsgEn()) ){
return this.msg;
}else {
String code=this.msgCode;
if(!code.startsWith(MessageUtils.smfcore)){
code=MessageUtils.smfcore+"."+this.msgCode;
}
String newMsg = MessageUtils.getText(code, getMsgParam(), locale, getMsg());
if (ObjectUtil.isEmpty(getMsgCode())) {
return this.msg.replace("A=","").replace("I=","").replace("W=","");
} else {
String code = this.msgCode;
if (!code.startsWith(MessageUtils.smfcore)) {
code = MessageUtils.smfcore + "." + this.msgCode;
}
String newMsg=this.msg.replace("A=","").replace("I=","").replace("W=","");
newMsg = MessageUtils.getText(code, getMsgParam(), locale, newMsg);
return newMsg;
}
}
public String getErrorMsg(Locale locale) {
if(ObjectUtil.isEmpty(this.msg)){
return "";
}
//判断是否有换行
String[] msgArray=this.msg.split("\r\n");
if(msgArray.length>0) {
for (String msg :
msgArray) {
String msgType = MessageType.ERROR.name();
if (msg.startsWith("A=")) {
msgType = MessageType.ERROR.name();
msg = msg.substring(2);
} else if (msg.startsWith("I=")) {
msgType = MessageType.INFO.name();
msg = msg.substring(2);
} else if (msg.startsWith("W=")) {
msgType = MessageType.WARNING.name();
msg = msg.substring(2);
}
if(msgType.equals(MessageType.ERROR.name())){
return msg;
}
}
}
return "";
}
}
......@@ -290,6 +290,7 @@ public class DeviceController {
DeviceMessageUtil.updateLineMsg(lineMsg,code,cids,"","",null );
} else {
lineMsg = okMsg;
DeviceMessageUtil.lastLineMsg = null;
}
return resultMap;
}
......
......@@ -492,7 +492,7 @@ public class BoxKanbanController {
boxDto.setHumidity(humidity);
boxDto.setTemperature(temperature);
boxDto.setStatus(bean.getStatus());
boxDto.setMsg(bean.getShowMsg(locale));
boxDto.setMsg(bean.getErrorMsg(locale));
boxDto.setBarcode(bean.getCode());
boxDto.setPosName(bean.getPosId());
boxDto.setData(bean.getData());
......
......@@ -337,14 +337,14 @@ public class TaskService {
}
return false;
}
/**
* 为 box 分配出库任务
*/
private DataLog findCheckoutBoxTask(Storage storage) {
String cid = storage.getCid();
int checkoutSize = 0;
Collection<DataLog> allTasks = taskMap.values();
//当前出库任务的posName
String currPosName = "";
for (DataLog task : allTasks) {
if (!task.isCheckOutTask()) {
continue;
......@@ -355,9 +355,11 @@ public class TaskService {
log.error("cid[" + cid + "]已有入库任务,不可再分配出库任务");
return null;
} else if (task.needReSendToClient() && task.isCheckOutTask()) {//超过30秒仍未完成的出库再次发送到客户端
log.error("cid[" + cid + "]的出库任务[" + task.getPosName() + "]超过60秒仍未完成,重新发送到客户端!");
log.error("cid[" + cid + "]的出库任务[" + task.getPosName() + "]" + task.getBarcode() + "超过60秒仍未完成,重新发送到客户端!");
task.setUpdateDate(new Date());
return task;
} else if (task.isCheckOutTask()) {
currPosName = task.getPosName();
}
//只能同时有两个正在执行的出库任务,如果超过两个不再分配了
......@@ -370,6 +372,52 @@ public class TaskService {
}
}
}
String currPosType = "";
try {
//先查找对面的
//04AA02130411
//04BB08070210
if (ObjectUtil.isNotEmpty(currPosName)) {
if (currPosName.contains("AA")) {
currPosType = "AA";
} else if (currPosName.contains("BB")) {
currPosType = "BB";
}
}
if(ObjectUtil.isNotEmpty(currPosType)) {
DataLog singleOutTask = null;
DataLog outTask = null;
for (DataLog task : allTasks) {//优先分配单盘任务和没有工单的任务
if (cid.equals(task.getCid()) && task.isCheckOutTask() && task.isWait()) {
String posName = task.getPosName();
if (!Strings.isNullOrEmpty(posName) && (!posName.contains(currPosType))) {//有库位号
if (task.isSingleOut()) {
//单盘优先出库
if (singleOutTask == null || task.getCreateDate().before(singleOutTask.getCreateDate())) {
singleOutTask = task;
}
} else {
if (outTask == null || task.getCreateDate().before(outTask.getCreateDate())) {
outTask = task;
}
}
}
}
}
if (singleOutTask != null) {
log.info("当前出库库位号:" + currPosName + ",type=" + currPosType + "分配优先(单盘或无工单)的对向出库任务" + singleOutTask.getBarcode() + "[" + singleOutTask.getPosName() + "]到 " + cid);
return singleOutTask;
}
if (outTask != null) {
log.info("当前出库库位号:" + currPosName + ",type=" + currPosType + "分配对向出库任务" + outTask.getBarcode() + "[" + outTask.getPosName() + "]到 " + cid);
return outTask;
}
}
} catch (Exception exception) {
log.error("findCheckoutBoxTask 当前出库库位号:" + currPosName + ",type=" + currPosType + ",查找对向库位时出错:" + exception.toString());
}
//指定紧急单盘出库的优先出库,否则按批量出库处理
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!