Commit 9ce41b7f 孙克
2 个父辈 f4f1beb5 d17f8be5
......@@ -6,12 +6,16 @@ import lombok.Data;
public class MachineStatusDto {
/**
* 温度
* 温度/回温温度
*/
private String temperature = "";
/**
* 冷藏温度
*/
private String codeTemperature = "";
/**
* 湿度
* 湿度
*/
private String humidity = "";
}
......@@ -6,13 +6,25 @@ import lombok.Data;
public class StorageCapacityDto {
/**
*容量
*百分比容量(SP:冷藏区使用百分比)
*/
private int capacity;
/**
* 百分比容量
* 百分比容量(SP:冷藏区总容量)
*/
private int perCapacity;
/**
* SP:回温区使用百分比
*/
private int warmCapacity;
/**
* SP:回温区总容量
*/
private int warmPerCapacity;
}
package com.neotel.smfcore.core.dashboard.bean.dto.sp;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class SpBoxStatusDto implements Serializable {
@ApiModelProperty("单台BOX状态,0=离线,1=正常运行中, 2=急停,3=故障,4=警告,5=调试中,6入库执行中,7入仓位完成,8入库失败, 9出库执行中,10出仓位完成,11出库失败,12移栽出库,13 重置中,14 扫码入库失败 ")
private int status=0;
@ApiModelProperty("出库队列数量 ")
private int outJobCount=0;
}
......@@ -4,10 +4,12 @@ import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.agv.bean.AgvInfo;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.dashboard.bean.dto.second.MachineStatusDto;
import com.neotel.smfcore.core.dashboard.bean.dto.second.StorageCapacityDto;
import com.neotel.smfcore.core.dashboard.bean.dto.second.UpcomingExpirationsDto;
import com.neotel.smfcore.core.dashboard.bean.dto.sp.SpBoxStatusDto;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
......@@ -24,6 +26,8 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -64,6 +68,7 @@ public class SecondDashboardController {
for (BoxStatusBean boxStatusBean : boxStatusBeans) {
dto.setHumidity(boxStatusBean.getHumidity());
dto.setTemperature(boxStatusBean.getTemperature());
dto.setCodeTemperature(boxStatusBean.getCodeAirTemp());
}
}
}
......@@ -86,6 +91,29 @@ public class SecondDashboardController {
int emptySlots = storage.getEmptySlots();
int capacity = totalSlots - emptySlots;
int perCapacity = (capacity * 100 )/ totalSlots ;
int warmCapacity=0;
int warmPerCapacity=0;
if(storage.isSolderPaste()) {
warmPerCapacity = dataCache.getSpUsePosCount(storage.getCid(), DataCache.warmPosCount);
perCapacity = dataCache.getSpUsePosCount(storage.getCid(), DataCache.coldingPosCount);
Integer warmUseCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.warmPosUseCount);
Integer coldingUseCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.coldingPosUseCount);
if(coldingUseCount<=0||perCapacity<=0){
perCapacity=0;
}else {
perCapacity = (coldingUseCount * 100) / perCapacity;
}
if(warmUseCount<=0||warmPerCapacity<=0){
warmCapacity=0;
}else{
warmCapacity = (warmUseCount * 100) / warmPerCapacity;
}
}
dto.setWarmPerCapacity(warmPerCapacity);
dto.setWarmCapacity(warmCapacity);
dto.setCapacity(capacity);
dto.setPerCapacity(perCapacity);
}
......@@ -157,4 +185,34 @@ public class SecondDashboardController {
}
return ResultBean.newOkResult(agvCacheList);
}
@ApiOperation("sp看板状态")
@RequestMapping("/spInfo")
@AnonymousAccess
public ResultBean spInfo(@RequestParam("storageId") String storageId) {
SpBoxStatusDto dto = new SpBoxStatusDto();
Storage storage = dataCache.getStorageById(storageId);
if (storage != null) {
StatusBean statusBean = DevicesStatusUtil.getStatusBean(storage.getCid());
if (statusBean != null) {
if (statusBean.timeOut()) {
dto.setStatus(0);
} else {
dto.setStatus(statusBean.getStatus());
}
}
if (storage.isSolderPaste()) {
Criteria c = Criteria.where("storageId").is(storageId)
.and("enabled").is(true)
.and("used").is(true)
.and("barcode.solderStatus").nin(null, "", SOLDER_STATUS.NONE.name(), SOLDER_STATUS.UNDER_REFRIGERATION.name(), SOLDER_STATUS.RETREAT_STORAGE.name());
List<StoragePos> taskPosList = storagePosManager.findByQuery(new Query(c));
dto.setOutJobCount(taskPosList.size());
}
}
return ResultBean.newOkResult(dto);
}
}
......@@ -188,6 +188,10 @@ public class NLMShelfHandler extends BaseDeviceHandler {
return;
}
String allLightOnStr = "";
for (final String posName : posNameList) {
DevicesStatusUtil.clearOp(cid, "close", posName);
}
for (final String posName : posNameList) {
String lightOnStr = posName + "=" + color;
DevicesStatusUtil.appendOp(cid, "open", lightOnStr);
......@@ -200,14 +204,33 @@ public class NLMShelfHandler extends BaseDeviceHandler {
@Override
public void run() {
try {
final List<String> myPos=new ArrayList<>(posNameList);
Thread.sleep(delayCloseTime);
String allCloseStr = "";
for (final String posName : posNameList) {
Thread.sleep(delayCloseTime);
for (final String posName : myPos) {
// log.info(storage.getName() + "[" + cid + "]库位[" + posName + "]灭灯");
DevicesStatusUtil.appendOp(cid, "close", posName);
allCloseStr += posName + ",";
boolean hasOut=false;
//如果有出库任务,不灭灯
List<DataLog> logs= taskService.getAllTasks();
for (DataLog log :
logs) {
if (log.getPosName().equals(posName) && log.isCheckOutTask()) {
hasOut = true;
break;
}
}
if (hasOut){
log.info(storage.getName() + "[" + cid + "]库位[" + posName + "]有出库任务,不需要自动灭灯");
}else{
DevicesStatusUtil.appendOp(cid, "close", posName);
allCloseStr += posName + ",";
}
}
if(!ObjectUtil.isEmpty(allCloseStr)){
log.info(storage.getName() + "[" + cid + "]库位[" + allCloseStr + "]自动灭灯");
}
log.info(storage.getName() + "[" + cid + "]库位[" + allCloseStr + "]灭灯");
} catch (Exception e) {
}
......
......@@ -110,8 +110,12 @@ public class NLSMShelfHandler extends BaseDeviceHandler{
// log.info("操作合并库位["+pos.getPosName()+"]" + opKey);
}
for(String posName : relatedPosNames){
if(opKey=="open"){
DevicesStatusUtil.clearOp(task.getCid(), "close", posName);
}
statusBean.addData(opKey,posName+"="+color);
}
}
return statusBean;
......
......@@ -18,10 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -278,6 +275,36 @@ public class DevicesStatusUtil {
opMap.put(opKey, value);
storageOpMap.put(cid, opMap);
}
public static void clearOp(String cid, String opKey, String opValue) {
try {
Map<String, String> opMap = storageOpMap.get(cid);
if (opMap == null) {
return;
}
String value = opMap.get(opKey);
if (ObjectUtil.isEmpty(value)) {
return;
} else if (!value.contains(opValue)) {
return;
}
else if(value.equals(opValue)){
opMap.remove(opKey);
}else {
String t1 = "|" + opValue;
String t2 = opValue + "|";
if (opValue.contains(t1)) {
opValue = opValue.replace(t1, "");
}
if (opValue.contains(t2)) {
opValue = opValue.replace(t2, "");
}
opMap.put(opKey, opValue);
}
storageOpMap.put(cid, opMap);
} catch (Exception exception) {
log.error("出错:" + exception.toString());
}
}
public static Map<String,String> getAndRemoveOp(String cid){
Map<String, String> opMap = storageOpMap.get(cid);
......
......@@ -532,7 +532,14 @@ public class TaskService {
statusBean.setOp(OP.CHECKOUT);
String posName = task.getPosName();
Barcode codeObj = barcodeManager.findByBarcode(task.getBarcode());
Barcode codeObj = null;
StoragePos storagePos = storagePosManager.getByBarcode(task.getBarcode());
if (storagePos != null){
codeObj = storagePos.getBarcode();
}
if (codeObj == null) {
codeObj = barcodeManager.findByBarcode(task.getBarcode());
}
int plateW = 0;
int plateH = 0;
//是否是单盘出库,批量上下料使用
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!