Commit d1c67edd LN

增加设备通信接口:cidIsExists和uploadStoragePos

1 个父辈 76e4e688
package com.neotel.smfcore.core.device.bean;
import lombok.Data;
import java.io.Serializable;
@Data
public class PosInfo implements Serializable {
/**
* 库位号
*/
private String pos;
/**
* 优先级
*/
private Integer pri;
/**
* 高度
*/
private Integer h;
/**
* 宽度
*/
private Integer w;
}
......@@ -102,6 +102,8 @@ public class StatusBean {
*/
private long offlineTime=-1;
private List<PosInfo> posList=null;
/**
* 获取已经结束(缓存中存在,但新的报警列表不存在)的报警列表,同时将新的报警加入到缓存中
*/
......@@ -289,77 +291,6 @@ public class StatusBean {
return System.currentTimeMillis() - lastSaveTime >= 5 * 60 * 1000;
}
// public long getLastSaveTime() {
// return lastSaveTime;
// }
//
// public void setLastSaveTime(long lastSaveTime) {
// this.lastSaveTime = lastSaveTime;
// }
//
// public long getTime() {
// return time;
// }
//
// public void setTime(long time) {
// this.time = time;
// }
//
// public String getCid() {
// return cid;
// }
//
// public void setCid(String cid) {
// this.cid = cid;
// }
//
// public int getSeq() {
// return seq;
// }
//
// public void setSeq(int seq) {
// this.seq = seq;
// }
//
// public int getOp() {
// return op;
// }
//
// public void setOp(int op) {
// this.op = op;
// }
//
// public Map<String, String> getData() {
// return data;
// }
//
// public void setData(Map<String, String> data) {
// this.data = data;
// }
//
// public int getStatus() {
// return status;
// }
//
// public void setStatus(int status) {
// this.status = status;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public String getClientIp() {
// return clientIp;
// }
//
// public void setClientIp(String clientIp) {
// this.clientIp = clientIp;
// }
// public void setShowMsg(Locale local){
// String lang = local.getLanguage();
......@@ -374,13 +305,6 @@ public class StatusBean {
// this.msg = showMsg;
// }
//
// public Map<String, BoxStatusBean> getBoxStatus() {
// return boxStatus;
// }
//
// public void setBoxStatus(Map<String, BoxStatusBean> boxStatus) {
// this.boxStatus = boxStatus;
// }
public boolean isAvailable(){
if(!timeOut()){
......@@ -466,21 +390,7 @@ public class StatusBean {
// }
// }
// public String getMsgEn() {
// return msgEn;
// }
//
// public void setMsgEn(String msgEn) {
// this.msgEn = msgEn;
// }
//
// public Map<String, String> getMsgData() {
// return msgData;
// }
//
// public void setMsgData(Map<String, String> msgData) {
// this.msgData = msgData;
// }
public String getDoorReelSingnal() {
String doorReelSignal = getFromData("doorReelSignal");
......
......@@ -17,6 +17,8 @@ import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.storage.bean.InventoryItem;
import com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE;
import com.neotel.smfcore.core.storage.enums.COMPATIBLE_TYPE;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.service.dao.ICacheItemDao;
......@@ -343,6 +345,17 @@ public class DataCache {
}
return null;
}
/**
* 根据 料仓名称 Name 获取料仓信息
*/
public Storage getStorageByName(String storageName){
for(Storage storage : getAllStorage().values()){
if(storage.getName().equals(storageName)){
return storage;
}
}
return null;
}
public Storage reloadStorage(Storage storage,String oldCid) throws ValidateException {
......@@ -426,6 +439,9 @@ public class DataCache {
if (ObjectUtil.isNotEmpty(s)) {
for (String v :
valueArray) {
if(ObjectUtil.isEmpty(v)){
continue;
}
try {
Pattern pattern = Pattern.compile(QueryHelp.escapeExprSpecialWord(s), Pattern.CASE_INSENSITIVE);
Matcher m = pattern.matcher(v);
......@@ -643,4 +659,30 @@ public class DataCache {
return availableStorageIds;
}
public Storage AutoCreateStorage(String cid) {
//判断cid存在
Storage storage = null;
storage = getStorage(cid);
if (storage != null) {
return storage;
}
//判断cid是否和其他料仓名称重复,重复时无法自动创建
if (getStorageByName(cid) != null) {
return null;
}
storage = new Storage();
storage.setCid(cid);
storage.setType(DeviceType.AUTO.getName());
storage.setName(cid);
storage.setCompatibleType(COMPATIBLE_TYPE.EXACT_MATCH);
storage.setSourcePath("");
storage.setGroupId("");
storage = storageManager.save(storage);
reloadStorage(storage, "");
log.info("AutoCreateStorage :自动创建料仓完成:cid["+storage.getCid()+"]name["+storage.getName()+"]type["+storage.getCompatibleType().name()+"]");
return storage;
}
}
......@@ -2,8 +2,10 @@ package com.neotel.smfcore.core.storage.service.po;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.base.BasePo;
import com.neotel.smfcore.common.utils.PointUtil;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import lombok.Data;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexType;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
......@@ -14,6 +16,51 @@ import java.util.List;
@Data
@Document
public class StoragePos extends BasePo implements Serializable {
public StoragePos(){
}
public StoragePos(String storageId,String posName,int h,int w,int priority){
setStorageId(storageId);
setPosName(posName);
setH(h);
setW(w);
setPriority(priority);
Point point= PointUtil.getPosPoint(posName);
setCoordinate(new double[]{point.getX(),point.getY()});
}
public boolean updatePosInfo(String storageId,String posName,int h,int w,int priority){
boolean needUpdate=false;
if(!getPosName().equals(posName)){
needUpdate=true;
setPosName(posName);
}
if(!getStorageId().equals(storageId)){
needUpdate=true;
setStorageId(storageId);
}
if(getH()!=h){
needUpdate=true;
setH(h);
}
if(getW()!=w){
needUpdate=true;
setW(w);
}
if(getPriority()!=priority){
needUpdate=true;
setPriority(priority);
}
Point point= PointUtil.getPosPoint(getPosName());
if(getCoordinate()==null||getCoordinate().length!=2||
(getCoordinate()[0]!=point.getX()) ||(getCoordinate()[1]!=point.getY())){
needUpdate=true;
setCoordinate(new double[]{point.getX(),point.getY()});
}
return needUpdate;
}
private String storageId;
private Barcode barcode;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!