Commit ad74ca3e 孙克
2 个父辈 f90a593e ffe0c4b6
正在显示 72 个修改的文件 包含 2034 行增加227 行删除
......@@ -16,7 +16,7 @@
<description>SMF project for Spring Boot</description>
<properties>
<maven.build.timestamp.format>M.ddHHmm</maven.build.timestamp.format>
<main.version>3.${maven.build.timestamp}</main.version>
<main.version>4.${maven.build.timestamp}</main.version>
<app.version>${main.version}</app.version>
<java.version>1.8</java.version>
<jjwt.version>0.11.1</jjwt.version>
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
......@@ -90,6 +91,15 @@ public class GlobalExceptionHandler {
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
}
@ExceptionHandler(value = InternalAuthenticationServiceException.class)
public ResponseEntity<ApiError> internalAuthenticationServiceException(HttpServletRequest servlet,ValidateException e){
// String language= servlet.getLocale().getLanguage();
// 打印堆栈信息
//log.error(ThrowableUtil.getStackTrace(e));
String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),servlet.getLocale() ,e.getDefaultMsg());
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
}
/**
* 处理所有接口数据验证异常
*/
......
......@@ -89,7 +89,7 @@ public class DataInitManager {
operator = roleManager.save(operator);
log.info("创建默认角色:" + operator.toString());
admin = new User(userName, "admin@qq.com", "zh-CN", role.getId(), "$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa", true, true, new Date(), groupIds, "");
admin = new User(userName, "admin@neotel.tech", "zh-CN", role.getId(), "$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa", true, true, new Date(), groupIds, "");
admin = userManager.save(admin);
log.info("创建默认用户:" + admin.toString());
......
......@@ -41,7 +41,12 @@ public class MenuInit {
/**
* 锡膏料仓展示菜单
*/
private static String SP_SHOW_MENU = "sp";
public static String SP_SHOW_MENU = "sp";
/**
* 料架展示菜单,包括nl,nlp,nlm,nls
*/
public static String NL_SHOW_MENU = "nl";
private static Map<String, Menu> allMenuMap = new HashMap<>();
......@@ -115,7 +120,7 @@ public class MenuInit {
addDefaultFunctionMenu(-1,null,"Neo Ai","neoai","neoai/index","neoai");
//Mimo临时看板
//Mimo看板
addDefaultFunctionMenu(0,null,"SMD BOX MIMO","SMDBOXMIMO", "smdBoxMimo/index","smdMimo");
Menu boardMap = Menu.CreatePMenu("仪表盘", 0, "dashBoard", "kanban", null);
......@@ -127,7 +132,7 @@ public class MenuInit {
addDefaultFunctionMenu(1, boardMap, "仪表盘2", "eleckanban", "eleckanban/index", "kanban");
//设备看板
addDefaultFunctionMenu(1,null,"设备看板","lockMaterial", "lockMaterial/material/index","kanban",DEFAULT_SHOW_MENU);
addDefaultFunctionMenu(1,null,"设备互联","lockMaterial", "lockMaterial/material/index","kanban",DEFAULT_SHOW_MENU);
//设备互联
addDefaultFunctionMenu(2,null,"设备互联","equipmentView", "neolight/equipmentView/index","sKanban");
......@@ -148,13 +153,13 @@ public class MenuInit {
addDefaultFunctionMenu(9, poutOut, "入库单", "inList", "system/inList/index", "headIcon");
addDefaultFunctionMenu(10, poutOut, "物料入库", "putIn", "system/putIn/index", "headIcon");
addDefaultFunctionMenu(11, poutOut, "转储入库", "dumpWarehousing", "system/dumpWarehousing/index", "headIcon");
addDefaultFunctionMenu(12, poutOut, "单盘入库", "singleDiskWarehousing", "system/singleDiskWarehousing/index", "headIcon");
// addDefaultFunctionMenu(11, poutOut, "转储入库", "dumpWarehousing", "system/dumpWarehousing/index", "headIcon");
// addDefaultFunctionMenu(12, poutOut, "单盘入库", "singleDiskWarehousing", "system/singleDiskWarehousing/index", "headIcon");
addDefaultFunctionMenu(13, poutOut, "呆滞物料", "sluggishMaterials", "system/sluggishMaterials/index", "sMaterial");
addDefaultFunctionMenu(14,poutOut, "安全库存", "safetyInventory", "system/safetyInventory/index", "safeInventory");
addDefaultFunctionMenu(15, poutOut,"过期物料", "expireMaterials", "system/expireMaterials/index", "sMaterial");
addDefaultFunctionMenu(16, poutOut,"生成工单", "createOrder", "system/createOrder/index", "createOrder");
addDefaultFunctionMenu(91,poutOut, "共享文件夹", "orderSetting", "system/orderSetting/index", "sysSet");
addDefaultFunctionMenu(91,poutOut, "共享文件夹", "orderSetting", "system/orderSetting/index", "sysSet",DEFAULT_SHOW_MENU);
//MSD管理:MSD库存.MSD追溯性.MSD设置
......@@ -185,7 +190,7 @@ public class MenuInit {
//日志管理:物料日志
Menu pMenuLog = Menu.CreatePMenu("日志管理", 8, "log","log",null);
addDefaultFunctionMenu(61, pMenuLog, "物料日志", "taskLog", "neolight/taskLog/index", "education",DEFAULT_SHOW_MENU);
addDefaultFunctionMenu(62, pMenuLog, "消息查询", "message", "neolight/message/index", "messagefind");
addDefaultFunctionMenu(62, pMenuLog, "消息查询", "message", "neolight/message/index", "messagefind",DEFAULT_SHOW_MENU);
addDefaultFunctionMenu(63, pMenuLog, "接口异常", "interfaceException", "neolight/interfaceException/index", "messagefind");
//报表:出入库、库存
......@@ -193,7 +198,7 @@ public class MenuInit {
addDefaultFunctionMenu(70, pMenuReport, "锁定物料", "lockMaterials", "system/lockMaterials/index", "lockMaterials");
addDefaultFunctionMenu(71, pMenuReport, "出入库", "inOutData", "neolight/inOutData/index", "outPut");
//新的出入库报表
addDefaultFunctionMenu(71, pMenuReport, "出入库", "inOutDataCount", "neolight/inOutDataCount/index", "outPut");
addDefaultFunctionMenu(71, pMenuReport, "出入库", "inOutDataCount", "neolight/inOutDataCount/index", "outPut",DEFAULT_SHOW_MENU);
addDefaultFunctionMenu(72, pMenuReport,"库存", "inventory", "neolight/inventory/index", "inventory");
addDefaultFunctionMenu(73, pMenuReport,"温湿度", "humiture", "humiture/humitureReport/index", "humiture");
addDefaultFunctionMenu(73, pMenuReport,"温湿度", "spHumiture", "humiture/spHumitureReport/index", "humiture");
......@@ -203,7 +208,7 @@ public class MenuInit {
addDefaultFunctionMenu(81,guanceMenu, "物料追踪", "materialChart", "neolight/materialChart/index", "maChart");
//物联网:共享文件夹
Menu pMenuWulian = Menu.CreatePMenu("物联网", 11, "internet", "interMenu",null);
//Menu pMenuWulian = Menu.CreatePMenu("物联网", 11, "internet", "interMenu",null);
//设置:料仓管理,菜单管理
......@@ -213,10 +218,10 @@ public class MenuInit {
addDefaultFunctionMenu(103, poutSet, "菜单管理", "menu", "system/menu/index", "menu");
// Menu sysSetting = new Menu(, "barcode", "条码设置", "barcodeSetting", "system/barcodeSetting/index", "database");
// Menu outSet = new Menu(, "outSetting", "出库策略", "outSetting", "system/outSetting/index", "outSet");
addDefaultFunctionMenu(104,poutSet, "系统设置", "sysSetting", "system/sysSetting/index", "sysSet");
addDefaultFunctionMenu(104,poutSet, "系统设置", "sysSetting", "system/sysSetting/index", "sysSet",DEFAULT_SHOW_MENU);
addDefaultFunctionMenu(105,poutSet, "资源翻译", "translation", "system/translation/index", "translation");
// Menu orderSet = new Menu(, "orderSetting", "工单设置", "orderSetting", "system/orderSetting/index", "sysSet");
addDefaultFunctionMenu(106,poutSet, "料架设置", "shelfSetting", "system/shelfSetting/index", "translation");
addDefaultFunctionMenu(106,poutSet, "料架设置", "shelfSetting", "system/shelfSetting/index", "translation",NL_SHOW_MENU);
//用户管理:用户管理,角色管理
......
......@@ -148,26 +148,30 @@ public class HttpHelper {
}
public static String postJsonWithAuth(String url, Object params, String auth) throws ApiException {
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
if (auth != null && !auth.isEmpty()) {
httpPost.addHeader("Authorization", auth);
}
String requestBody = "";
// 设置请求参数
if (params != null) {
try {
ObjectMapper mapper = new ObjectMapper();
String requestBody = mapper.writeValueAsString(params);
httpPost.setEntity(new StringEntity(requestBody, CONTENT_CHARSET));
requestBody = mapper.writeValueAsString(params);
} catch (JsonProcessingException e) {
throw new ApiException("Request params to [" + url + "] Json failed:" + e.getMessage());
} catch (Exception e) {
throw new ApiException("Request params to [" + url + "] json exception:" + e.getMessage());
}
}
HttpPost httpPost = null;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
if (auth != null && !auth.isEmpty()) {
httpPost.addHeader("Authorization", auth);
}
httpPost.setEntity(new StringEntity(requestBody, CONTENT_CHARSET));
httpClient = HttpClients.createDefault();
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
......@@ -188,6 +192,9 @@ public class HttpHelper {
} catch (IOException e) {
e.printStackTrace();
}
if (httpPost != null) {
httpPost.releaseConnection();
}
}
}
......@@ -211,11 +218,12 @@ public class HttpHelper {
// 设置请求参数
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
HttpPost httpPost = null;
try {
List<NameValuePair> params = toNameValuePair(paramMap);
URI uri = new URIBuilder(url).setParameters(params).build();
log.info("执行请求:" + uri.toString());
HttpPost httpPost = new HttpPost(uri);
httpPost = new HttpPost(uri);
httpPost.addHeader("Content-Type", contentType);
// httpPost.setEntity(new UrlEncodedFormEntity(params, CONTENT_CHARSET));
httpClient = HttpClients.createDefault();
......@@ -238,6 +246,9 @@ public class HttpHelper {
} catch (IOException e) {
e.printStackTrace();
}
if (httpPost != null){
httpPost.releaseConnection();
}
}
}
......
package com.neotel.smfcore.common.utils;
import com.google.common.collect.Lists;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.*;
......@@ -25,15 +25,15 @@ public class ReelLockPosUtil {
/**
* 料盘锁定库位信息,用于包装料分配到其他料仓
*/
private static Map<String, ReelLockPosInfo> reelLocKPosMap;
private static Map<String, ReelLockPosInfo> reelLocKPosMap = Maps.newConcurrentMap();
@PostConstruct
public void init() {
dataCache = autodataCache;
reelLocKPosMap=dataCache.getCache(REEL_LOCK_POS_MAP_KEY);
if(reelLocKPosMap==null){
reelLocKPosMap=new HashMap<String,ReelLockPosInfo>(){};
Map<String, ReelLockPosInfo> cacheReelLocKPosMap = dataCache.getCache(REEL_LOCK_POS_MAP_KEY);
if (cacheReelLocKPosMap != null) {
reelLocKPosMap.putAll(cacheReelLocKPosMap);
}
}
......@@ -43,26 +43,33 @@ public class ReelLockPosUtil {
* @param reelLockPosInfo
*/
public static synchronized ReelLockPosInfo addReelLockPosInfo(ReelLockPosInfo reelLockPosInfo , List<String> cidList) {
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "]");
ReelLockPosInfo oldLocInfo = reelLocKPosMap.get(reelLockPosInfo.getBarcode());
if (oldLocInfo != null && oldLocInfo.getLockPosName() != null) {
if(cidList.contains(oldLocInfo.getCid())){
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],返回之前锁定的库位");
return oldLocInfo;
}else{
//锁定库位不在cid列表中
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],Cid["+oldLocInfo.getCid()+"]不在["+String.join(",",cidList)+"]中,清理原有锁定库位");
reelLocKPosMap.remove(reelLockPosInfo.getBarcode());
String key = processBarcode(reelLockPosInfo.getBarcode());
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "],key=[" + key + "]");
ReelLockPosInfo oldLocInfo = reelLocKPosMap.get(key);
try {
if (oldLocInfo != null && oldLocInfo.getLockPosName() != null) {
if (cidList.contains(oldLocInfo.getCid())) {
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],返回之前锁定的库位");
return oldLocInfo;
} else {
//锁定库位不在cid列表中
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],Cid[" + oldLocInfo.getCid() + "]不在[" + String.join(",", cidList) + "]中,清理原有锁定库位");
reelLocKPosMap.remove(key);
}
}
}
for (ReelLockPosInfo locInfo : reelLocKPosMap.values()) {
if (locInfo.getLockPosId().equals(reelLockPosInfo.getLockPosId()) && !locInfo.getBarcode().equals(reelLockPosInfo.getBarcode())) {
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "]时,库位已被[" + locInfo.getBarcode() + "]锁定");
return null;
for (ReelLockPosInfo locInfo : reelLocKPosMap.values()) {
if (locInfo.getLockPosId().equals(reelLockPosInfo.getLockPosId()) && !locInfo.getBarcode().equals(key)) {
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "]时,库位已被[" + locInfo.getBarcode() + "]锁定");
return null;
}
}
reelLocKPosMap.put(key, reelLockPosInfo);
dataCache.updateCache(REEL_LOCK_POS_MAP_KEY, reelLocKPosMap);
} catch (Exception exception) {
log.error("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "],key=[" + key + "]出错:"+exception.toString());
}
reelLocKPosMap.put(reelLockPosInfo.getBarcode(), reelLockPosInfo);
dataCache.updateCache(REEL_LOCK_POS_MAP_KEY, reelLocKPosMap);
return reelLockPosInfo;
}
......@@ -73,7 +80,7 @@ public class ReelLockPosUtil {
String lockBarcode = reelLockPosInfo.getBarcode();
if (org.apache.logging.log4j.util.Strings.isNotBlank(lockBarcode)) {
if (lockBarcode.equals(barcode)) {
if (lockBarcode.equals(processBarcode(barcode) )) {
return reelLockPosInfo;
}
}
......@@ -88,7 +95,7 @@ public class ReelLockPosUtil {
* 清理条码锁定库位信息
*/
public static void removeReelLockPosInfo(String barcode) {
reelLocKPosMap.remove(barcode);
reelLocKPosMap.remove(processBarcode(barcode));
dataCache.updateCache(REEL_LOCK_POS_MAP_KEY, reelLocKPosMap);
}
......@@ -99,7 +106,7 @@ public class ReelLockPosUtil {
* @return
*/
public static String getReelLockPosId(String barcode) {
ReelLockPosInfo lockPosInfo = reelLocKPosMap.get(barcode);
ReelLockPosInfo lockPosInfo = reelLocKPosMap.get(processBarcode(barcode));
if (lockPosInfo != null) {
return lockPosInfo.getLockPosId();
}
......@@ -116,4 +123,18 @@ public class ReelLockPosUtil {
}
return lockPosIds;
}
private static String processBarcode(String str) {
if (ObjectUtil.isEmpty(str)) {
return str;
}
if (str.contains(".")) {
String res = str.replace(".", "__");
return res;
} else {
return str;
}
}
}
......@@ -38,13 +38,19 @@ public class CodeResolve {
private Integer defaultExpiresDay=0;
private boolean useSizeConfirm = true;
public void updateBarcodeRuleList(List<String> ruleList){
barcodeRuleList = Lists.newArrayList();
for(String codeRule : ruleList){
if(!Strings.isNullOrEmpty(codeRule)){
barcodeRuleList.add(BarcodeRule.newRule(codeRule));
public void updateBarcodeRuleList(List<String> ruleList) {
try {
barcodeRuleList = Lists.newArrayList();
for (String codeRule : ruleList) {
if (!Strings.isNullOrEmpty(codeRule)) {
barcodeRuleList.add(BarcodeRule.newRule(codeRule));
}
}
} catch (Exception ex) {
log.error("updateBarcodeRuleList出错:" + ex.toString());
}
}
......@@ -56,6 +62,10 @@ public class CodeResolve {
defaultExpiresDay=expiresDay;
}
public void updateUseSizeConfirm(boolean confirm) {
useSizeConfirm = confirm;
}
public CodeBean resolveSingleCode(String barcodeItemStr ){
return resolveSingleCode(barcodeItemStr, COMPONENT_TYPE.COMPONENT);
......@@ -132,7 +142,7 @@ public class CodeResolve {
codeBeanFromRule.setShowImg(component.getShowImg());
//如果已经确认尺寸,使用确认的尺寸
if (component.isSizeConfirmed() || ((component.hasSizeInfo()) && (!codeBeanFromRule.hasReelSizeInfo()))) {
if ((component.isSizeConfirmed() && useSizeConfirm) || ((component.hasSizeInfo()) && (!codeBeanFromRule.hasReelSizeInfo()))) {
codeBeanFromRule.setReelWidth(component.getPlateSize());
codeBeanFromRule.setReelHeight(component.getHeight());
......@@ -269,7 +279,7 @@ public class CodeResolve {
}else{
//如果已经确认尺寸,使用确认的尺寸
if(component.isSizeConfirmed() || ((component.hasSizeInfo())&&(!codeBeanFromRule.hasReelSizeInfo()))){
if((component.isSizeConfirmed() && useSizeConfirm) || ((component.hasSizeInfo())&&(!codeBeanFromRule.hasReelSizeInfo()))){
codeBeanFromRule.setReelWidth(component.getPlateSize());
codeBeanFromRule.setReelHeight(component.getHeight());
}
......@@ -294,7 +304,7 @@ public class CodeResolve {
log.info("档案["+barcodeFromRule.getPartNumber()+"]不存在");
// throw new ValidateException("component.error.notExist",new String[]{barcodeFromRule.getPartNumber()});
throw new ValidateException("smfcore.valueNotExist","{0}[{1}]不存在",new String[]{"component",barcodeFromRule.getPartNumber()});
}else if(component.isSizeConfirmed() || ((component.hasSizeInfo())&&(!codeBeanFromRule.hasReelSizeInfo()))){
}else if((component.isSizeConfirmed() && useSizeConfirm) || ((component.hasSizeInfo())&&(!codeBeanFromRule.hasReelSizeInfo()))){
//如果已经确认尺寸,使用确认的尺寸
codeBeanFromRule.setReelWidth(component.getPlateSize());
codeBeanFromRule.setReelHeight(component.getHeight());
......
package com.neotel.smfcore.core.dashboard.bean.dto.box;
import cn.hutool.core.date.DateTime;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MesInfoDto implements Serializable
{
private String status="OK";
private DateTime time;
private String request="";
private String response="";
}
package com.neotel.smfcore.core.dashboard.bean.dto.first;
import com.neotel.smfcore.core.storage.bean.UsageItem;
import com.neotel.smfcore.core.system.service.po.DataLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class ElecKanbanBoxStatusDto {
private String id;
private String cid;
/**
* 设备名称
*/
......@@ -44,4 +55,26 @@ public class ElecKanbanBoxStatusDto {
* 湿度
*/
public String humidity = "";
private List<DataLog> taskList = new ArrayList<>();
@ApiModelProperty("消息")
public String msg="";
@ApiModelProperty("最低温度")
private float minTemperature = 22.0F;
@ApiModelProperty("最高温度")
private float maxTemperature = 38.0F;
@ApiModelProperty("最低湿度值")
private float minHumidity = 0.0F;
@ApiModelProperty("最大湿度值")
private float maxHumidity = 100.0F;
@ApiModelProperty("客户端上传数据,closeLock为enable时此按钮状态为可用,openLock为enable时,此按钮状态为可用" +
"客户端收到服务器openLock为doit时,执行打开门锁动作,closeLock为doit时,执行关闭门锁" )
private Map<String, String> data = null;
@ApiModelProperty("使用情况")
private Map<String, UsageItem> usageMap = null;
}
package com.neotel.smfcore.core.dashboard.box;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.core.dashboard.bean.dto.first.ElecKanbanBoxStatusDto;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inout.service.manager.IInOutDataManager;
import com.neotel.smfcore.core.inout.service.po.InOutData;
import com.neotel.smfcore.core.message.rest.bean.mapstruct.MessageMapper;
import com.neotel.smfcore.core.message.service.manager.IMessageManager;
import com.neotel.smfcore.core.msd.bean.MSDSettiings;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/smdBox")
public class SmdBoxController {
@Autowired
DataCache dataCache;
@Autowired
IInOutDataManager inOutDataManager;
@Autowired
IMessageManager messageManager;
@Autowired
MessageMapper messageMapper;
@Autowired
TaskService taskService;
private Storage storage;
private Storage getDefaultBox() {
if (storage != null) {
return storage;
}
for (Storage stor : dataCache.getAllStorage().values()) {
if (stor.isBatchStorage()||stor.isMimoG2()) {
storage = stor;
return storage;
}
}
return null;
}
@ApiOperation("设备状态")
@RequestMapping("/boxStatus")
@AnonymousAccess
public List<ElecKanbanBoxStatusDto> getElecKanbanBoxStatusDto(String cid, HttpServletRequest servletRequest) throws ParseException {
List<ElecKanbanBoxStatusDto> resultList = new ArrayList<>();
if (StringUtils.isBlank(cid)) {
Storage storage = getDefaultBox();
if (storage != null) {
cid = storage.getCid();
}
}
MSDSettiings msdSettiings = dataCache.getCache(Constants.CACHE_msdSetting);
if (msdSettiings == null) {
msdSettiings = new MSDSettiings();
}
List<String> cids=new ArrayList<>();
if(StringUtils.isNotBlank(cid)){
Storage storage=dataCache.getStorage(cid);
if(storage!=null){
cids.add(cid);
if(ObjectUtil.isNotEmpty(storage.getAppendCid())){
cids.add(storage.getAppendCid());
}
}
}
Collections.sort(cids);
for (String theCid :
cids) {
Date currentDate = com.neotel.smfcore.common.utils.DateUtil.getCurrentDate("yyyy-MM-dd");
List<InOutData> inOutDataList = inOutDataManager.findByDate(currentDate, com.neotel.smfcore.common.utils.DateUtil.addDays(currentDate, 1), null);
ElecKanbanBoxStatusDto dto = new ElecKanbanBoxStatusDto();
StatusBean statusBean = DevicesStatusUtil.getStatusBean(theCid);
if (statusBean != null) {
//dto.setStatus(statusBean.getStatus());
Collection<BoxStatusBean> boxStatusBeans = statusBean.getBoxStatus().values();
if (boxStatusBeans != null && !boxStatusBeans.isEmpty()) {
for (BoxStatusBean boxStatusBean : boxStatusBeans) {
dto.setHumidity(boxStatusBean.getHumidity());
dto.setTemperature(boxStatusBean.getTemperature());
dto.setStatus(boxStatusBean.getStatus());
dto.setMsg(statusBean.getShowMsg(servletRequest.getLocale()));
dto.setData(statusBean.getData());
}
}
}
Storage storage = dataCache.getStorage(theCid);
if (storage.isNLShelf() || storage.isNLPShelf() || storage.isNLMShelf() || storage.isShelf()) {
dto.setType(0);
} else {
dto.setType(1);
}
int usage = (storage.getTotalSlots() - storage.getEmptySlots()) * 100 / storage.getTotalSlots();
dto.setUsage(usage);
int inCount = getTodayInOutCount(storage.getId(), inOutDataList, true);
int outCount = getTodayInOutCount(storage.getId(), inOutDataList, false);
dto.setTodayInCount(inCount);
dto.setTodayOutCount(outCount);
dto.setName(storage.getName());
dto.setId(storage.getId());
dto.setCid(storage.getCid());
Collection<DataLog> queueTasks = taskService.getQueueTasks(theCid);
if (queueTasks != null){
dto.setTaskList((List<DataLog>) queueTasks);
} else {
dto.setTaskList(new ArrayList<>());
}
dto.setMinHumidity(msdSettiings.getMinHumidity());
dto.setMaxHumidity(msdSettiings.getMaxHumidity());
dto.setMinTemperature(msdSettiings.getMinTemperature());
dto.setMaxTemperature(msdSettiings.getMaxTemperature());
dto.setUsageMap(storage.getUsageMap());
MesInfoDto mesInfoDto=DevicesStatusUtil.getLastAgvInfo(cid);
if(mesInfoDto!=null){
dto.getData().put("AGV", JsonUtil.toJsonStr(mesInfoDto));
}
resultList.add(dto);
}
return resultList;
}
private int getTodayInOutCount(String storageId, List<InOutData> inOutDataList, boolean isInCount) {
if (inOutDataList == null || inOutDataList.isEmpty()){
return 0;
}
if (isInCount){
return inOutDataList.stream().filter(inOutData -> inOutData.getStorageId().equals(storageId)).collect(Collectors.summingInt(InOutData :: getInCount)).intValue();
} else {
return inOutDataList.stream().filter(inOutData -> inOutData.getStorageId().equals(storageId)).collect(Collectors.summingInt(InOutData :: getOutCount)).intValue();
}
}
}
......@@ -198,7 +198,7 @@ public class SmdBoxMimoController {
@ApiOperation("设备状态")
@RequestMapping("/getBoxStatusDto")
@AnonymousAccess
public List<ElecKanbanBoxStatusDto> getElecKanbanBoxStatusDto(String cid) throws ParseException {
public List<ElecKanbanBoxStatusDto> getElecKanbanBoxStatusDto(String cid,HttpServletRequest servletRequest) throws ParseException {
List<ElecKanbanBoxStatusDto> resultList = new ArrayList<>();
if (StringUtils.isBlank(cid)) {
Storage storage = getDefaultBox();
......@@ -219,6 +219,8 @@ public class SmdBoxMimoController {
dto.setHumidity(boxStatusBean.getHumidity());
dto.setTemperature(boxStatusBean.getTemperature());
dto.setStatus(boxStatusBean.getStatus());
dto.setMsg(statusBean.getShowMsg(servletRequest.getLocale()));
dto.setData(statusBean.getData());
}
}
}
......@@ -236,6 +238,13 @@ public class SmdBoxMimoController {
dto.setTodayInCount(inCount);
dto.setTodayOutCount(outCount);
dto.setName(storage.getName());
dto.setId(storage.getId());
Collection<DataLog> queueTasks = taskService.getQueueTasks(cid);
if (queueTasks != null){
dto.setTaskList((List<DataLog>) queueTasks);
} else {
dto.setTaskList(new ArrayList<>());
}
resultList.add(dto);
}
return resultList;
......@@ -298,7 +307,7 @@ public class SmdBoxMimoController {
return storage;
}
for (Storage stor : dataCache.getAllStorage().values()) {
if (stor.isBatchStorage()) {
if (stor.isBatchStorage()||stor.isMimoG2()) {
storage = stor;
return storage;
}
......
......@@ -41,6 +41,10 @@ public class StatusBean {
*客户端IP
*/
private String clientIp;
/**
* 附属CID
*/
private String appendCid;
/// <summary>
/// 操作相关数据,
/// op=1时,客户端发送 code 二维码给服务器,服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度
......@@ -49,6 +53,16 @@ public class StatusBean {
//数据还放入data那个map里面,客户端收到服务器openLock为doit时,执行打开门锁动作;startBatchIn为doit时,执行开始批量入库动作;closeLock为doit时,执行关闭门锁;takeOutReel为doit时,执行取出出库料盘动作;confirmReelOut为doit时,执行门口料盘已取出;
//当服务器收到客户端:doorStatus为门锁状态(如开门中,或关闭中);openLock为enable时,此按钮状态为可用;startBatchIn为enable时此按钮状态为可用;closeLock为enable时此按钮状态为可用;takeOutReel为enable时此按钮状态为可用;confirmReelOut为enable时此按钮状态为可用;
//服务器默认这些按钮都为不可用状态,只有收到对应的enable时,按钮才可以进行点击
// 多料仓 doorStatus open/close
// shelfStatus ,表示料串状态:
// IDLE=空闲;
// LOADING=入库中;
// UNLOADING=出库中;
// NEED_EMPTY=需要空料串出库;
// EMPTY_OUT=空料串需要取走
// FULL_OUT=满料串需要取走
//料串类型 shelfType smallReel, bigReel, tray
//需求单号:hSerial 出库中需要上传工单号
private Map<String, String> data = new HashMap<>();
/**
......@@ -118,6 +132,12 @@ public class StatusBean {
* 消息集合
*/
public List<MsgInfo> msgList;
/**
* 消息合并
*/
public List<MsgInfo> mergeMsgList;
/**
* 料仓类型
*/
......@@ -242,10 +262,18 @@ public class StatusBean {
data.put("temp",String.valueOf(temperature));
}
public void setMinTemperature(float minTemperature) {
data.put("minTemp",String.valueOf(minTemperature));
}
public void setHumidity(float humidity) {
data.put("humi", String.valueOf(humidity));
}
public void setMinHumidity(float minHumidity) {
data.put("minHumi", String.valueOf(minHumidity));
}
public List<AlarmInfo> getAlarmList() {
return alarmList;
}
......@@ -286,7 +314,7 @@ public class StatusBean {
addPosInfo(barcode,posId,plateW,plateH,isSingleOut,false,0);
}
public void addPosInfo(String barcode, String posId, int plateW, int plateH, boolean isSingleOut,boolean isNgReel,int usedCount) {
addPosInfo(barcode, posId, plateW, plateH, isSingleOut, isNgReel, "", usedCount);
addPosInfo(barcode, posId, plateW, plateH, isSingleOut, isNgReel, "", usedCount,"");
}
/**
* 获取客户端发送上来的条码信息
......@@ -297,7 +325,7 @@ public class StatusBean {
/**
* 入库时添加仓位及料盘大小信息(posId库位编号,plateW:料盘宽度,plateH:料盘高度,singleOut:是否出库到料仓门口)
*/
public void addPosInfo(String barcode, String posId, int plateW, int plateH, boolean isSingleOut,boolean isNgReel,String ngMsg,int usedCount) {
public void addPosInfo(String barcode, String posId, int plateW, int plateH, boolean isSingleOut,boolean isNgReel,String ngMsg,int usedCount,String hSerial) {
String originalPosId = data.get("posId");
String originalPlateW = data.get("plateW");
String originalPlateH = data.get("plateH");
......@@ -334,6 +362,7 @@ public class StatusBean {
data.put("ngMsg", "Repeat Inbound");
}
data.put("usedCount", usedCount + "");
data.put("hSerial",hSerial);
}
/**
......@@ -656,12 +685,12 @@ public class StatusBean {
}
public String getShowMsg(Locale locale) {
if (ObjectUtil.isEmpty(this.msgList)) {
if (ObjectUtil.isEmpty(this.mergeMsgList)) {
return "";
}
String returnMsg = "";
for (MsgInfo msg :
msgList) {
mergeMsgList) {
String mMsg = GetMsgStr(msg,locale);
if (ObjectUtil.isEmpty(returnMsg)) {
returnMsg = mMsg;
......@@ -701,13 +730,15 @@ public class StatusBean {
}
public void MsgDataProcess() {
//消息格式处理
if( getMsgList()==null&& ObjectUtil.isNotEmpty(msg)){
msgList=new ArrayList<>();
public List<MsgInfo> MsgDataProcess() {
List<MsgInfo> mergeMsgList = new ArrayList<>();
if (msgList != null && !msgList.isEmpty()) {
mergeMsgList.addAll(msgList);
}
if (ObjectUtil.isNotEmpty(msg)) {
//判断是否有换行
String[] msgArray=this.msg.split("\r\n");
if(msgArray.length>0) {
String[] msgArray = this.msg.split("\r\n");
if (msgArray.length > 0) {
for (String msg :
msgArray) {
if (ObjectUtil.isEmpty(msg)) {
......@@ -726,13 +757,15 @@ public class StatusBean {
}
if (msgArray.length == 1) {
msgList.add(new MsgInfo(msg, msgType,msgEn,msgJp,msgCode,msgParam,"",""));
mergeMsgList.add(new MsgInfo(msg, msgType, msgEn, msgJp, msgCode, msgParam, "", ""));
} else {
msgList.add(new MsgInfo(msg, msgType));
mergeMsgList.add(new MsgInfo(msg, msgType));
}
}
}
}
setMergeMsgList(mergeMsgList);
return mergeMsgList;
}
public void setRMsg(String msgKey, String[] msgParam, String message) {
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
......@@ -37,7 +38,7 @@ public class AccShelfHandler extends BaseDeviceHandler{
ORDER_COLOR color = ORDER_COLOR.fromRgb(rgb);
if (color == null) {
if (queueTask.isPutInTask()) {
color = ORDER_COLOR.DARKGREEN;
color = ORDER_COLOR.FORESTGREEN;
} else {
if (openZhiYin && ObjectUtil.isNotEmpty(queueTask.getSourceId())) {
List<DataLog> dataLogList = outMap.get(queueTask.getSourceId());
......@@ -55,10 +56,15 @@ public class AccShelfHandler extends BaseDeviceHandler{
log.info("库位[" + queueTask.getPosName() + "]+亮灯:" + color.name());
}
}
List<DataLog> dataLogs = getLightGuideTask(outMap);
List<DataLog> dataLogs = getLightGuideTask(outMap,statusBean.getCid());
for (DataLog task :
dataLogs) {
statusBean.addData("open", task.getPosName() + "=" + ORDER_COLOR.fromRgb(task.getLightColor()).name());
if (StringUtils.isBlank(task.getLightColor())){
task.setLightColor(ORDER_COLOR.BLUE.getRgb());
}
String colorName = ORDER_COLOR.fromRgb(task.getLightColor()).name();
statusBean.addData("open", task.getPosName() + "=" + colorName);
log.info("库位[" + task.getPosName() + "][" + task.getType() + "]+亮灯:" + colorName);
}
return statusBean;
......
......@@ -17,6 +17,7 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.MsgInfo;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
......@@ -127,6 +128,13 @@ public class BaseDeviceHandler implements IDeviceHandler {
log.info("获取温湿度报警值 maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
statusBean.setTemperature(maxTemperature);
statusBean.setHumidity(maxHumidity);
float minTemperature = msdSettiings.getMinTemperature();
float minHumidity = msdSettiings.getMinHumidity();
log.info("获取温湿度报警值 minTemperature["+minTemperature+"]minHumidity["+minHumidity+"]");
statusBean.setMinTemperature(minTemperature);
statusBean.setMinHumidity(minHumidity);
return statusBean;
} else if (dataCache.needUpdateHumidiy(statusBean.getCid())) {
MSDSettiings msdSettiings = dataCache.getCache(Constants.CACHE_msdSetting);
......@@ -361,7 +369,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
Collection<String> operatingPosIds =taskService.excludePosIds();
// 是否有出库任务
if (storage.isSmdDuo() || storage.isBatchStorage()) {
if (storage.isSmdDuo() || storage.isBatchStorage()||storage.isMimoG2()) {
//DUO料仓和MIMO客户端缓存出库任务,入库优先
log.info("从" + storage.getName() + " 中为" + barcode.getBarcode() + "寻找空的仓位");
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
......@@ -802,20 +810,20 @@ public class BaseDeviceHandler implements IDeviceHandler {
return;
}
barcode = barcodeManager.get(barcode.getId());
if (barcode != null) {
Barcode barcodeDB = barcodeManager.get(barcode.getId());
if (barcodeDB != null) {
//二维码状态
barcode.setUsed(true);
barcodeDB.setUsed(true);
barcode.setUsedDate(new Date());
barcodeDB.setUsedDate(new Date());
//仓位状态
barcode.setCheckOutDate(new Date(), task.getOperator());
barcode.setPosName("");
barcodeManager.save(barcode);
task.setBatchInfo(barcode.getBatch());
barcodeDB.setCheckOutDate(new Date(), task.getOperator());
barcodeDB.setPosName("");
barcodeManager.save(barcodeDB);
task.setBatchInfo(barcodeDB.getBatch());
//记录在库时长
task.setInStoreTime(barcode.getInStoreMiniute());
task.setInStoreTime(barcodeDB.getInStoreMiniute());
}
storagePos.setBarcode(null);
......@@ -844,7 +852,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
try {
//转换为新格式
statusBean.MsgDataProcess();
List<MsgInfo> mergeMsgList = statusBean.MsgDataProcess();
//判断是否刚刚上线
StatusBean bean = DevicesStatusUtil.getStatusBean(statusBean.getCid());
if (bean == null || bean.getBoxStatus() == null) {
......@@ -854,8 +862,8 @@ public class BaseDeviceHandler implements IDeviceHandler {
DeviceMessageUtil.addOnlineMessage(statusBean.getCid(), "",statusBean.getClientIp());
DevicesStatusUtil.updateClientMsg(statusBean.getCid(), new ArrayList<>());
}
if(ObjectUtil.isNotEmpty(statusBean.msgList)&& statusBean.msgList.size()>0) {
DevicesStatusUtil.updateClientMsg(statusBean.getCid(), statusBean.msgList);
if(ObjectUtil.isNotEmpty(mergeMsgList)&& mergeMsgList.size()>0) {
DevicesStatusUtil.updateClientMsg(statusBean.getCid(), mergeMsgList);
}
// //判断是否刚刚上线
// StatusBean bean = DevicesStatusUtil.getStatusBean(statusBean.getCid());
......@@ -908,6 +916,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
statusBean.setOp(statusBeanToSave.getOp());
statusBean.setSeq(statusBeanToSave.getSeq());
statusBean.setClientIp(statusBeanToSave.getClientIp());
statusBean.setMergeMsgList(statusBeanToSave.getMergeMsgList());
/**
* 已解除的报警信息存到数据库中
......@@ -951,14 +960,76 @@ public class BaseDeviceHandler implements IDeviceHandler {
return statusBean;
}
protected List<DataLog> getLightGuideTask(Map<String,List<DataLog>> outMap) {
protected List<DataLog> getLightGuideTask(Map<String,List<DataLog>> outMap,String cid) {
List<DataLog> dataLogs = Lists.newArrayList();
if (outMap.size() <= 0) {
return dataLogs;
}
//先查找正在执行中的发过去
for (String sourceId : outMap.keySet()) {
List<DataLog> dataLogList = outMap.get(sourceId);
//1.获取当前工单,所有的任务
List<DataLog> dataLogList = new ArrayList<>();
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isWait() || dataLog.isExecuting()){
if (sourceId.equals(dataLog.getSourceId())){
dataLogList.add(dataLog);
}
}
}
//2.判断有没有正在执行的任务
boolean hasExecuting = false;
for (DataLog dataLog : dataLogList) {
if (dataLog.isExecuting()){
hasExecuting = true;
if (cid.equals(dataLog.getCid())){
dataLogs.add(dataLog);
}
}
}
//3.判断工单是否存在
if (!hasExecuting) {
LiteOrder order = liteOrderCache.getOrderSortItems(sourceId);
if (order == null) {
log.error("ACCSHELF: sourceId=" + sourceId + "的工单号未找到");
continue;
}
//3.获取到站位信息对应的任务
DataLog needSendLog = null;
for (LiteOrderItem orderItem : order.getOrderItems()) {
for (DataLog dataLog : dataLogList) {
if (orderItem.getId().equals(dataLog.getSubSourceId())) {
needSendLog = dataLog;
break;
}
}
if (needSendLog != null) {
break;
}
}
//4.处理任务
if (needSendLog != null) {
if (cid.equals(needSendLog.getCid())) {
if (needSendLog.isWait()) {
needSendLog.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(needSendLog);
dataLogs.add(needSendLog);
log.info("ACCSHELF: sourceId=" + sourceId + "的工单[" + order.getOrderNo() + "]开始执行任务:[" + needSendLog.getPosName() + "][" + needSendLog.getPartNumber() + "][" + needSendLog.getBarcode() + "]");
}
}
}
}
/*List<DataLog> dataLogList = outMap.get(sourceId);
boolean isFind = false;
for (DataLog dataLog : dataLogList) {
......@@ -996,7 +1067,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (isFind) {
break;
}
}
}*/
}
return dataLogs;
}
......@@ -1047,6 +1118,14 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
}
protected String replaceSpecial(String code){
code = code.replace("[RS]","$");
code = code.replace("[GS]","$");
code = code.replace("[EOT]","$");
return code;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.DEFAULT;
......
package com.neotel.smfcore.core.device.handler.impl;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "DUO料仓")
@RestController
@Slf4j
public class DUOBoxHandler extends XLRBoxHandler{
@Override
public DeviceType getDeviceType() {
return DeviceType.SMD_DUO;
}
}
package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.custom.djk20388.util.AgvDataUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.Map;
@Api(tags = "MIMOG2: 批量料仓")
@Service
@Slf4j
public class MimoG2BoxHandler extends BaseDeviceHandler {
@Override
public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) {
String cid = statusBean.getCid();
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
return null;
}
statusBean.setClientIp(request.getRemoteHost());
handleMsg(statusBean);
// if(ObjectUtil.isNotEmpty(statusBean.getMsg())){
// log.info("cid["+cid+"],msgCode["+statusBean.getMsgCode()+"],msg["+statusBean.getMsg()+"]");
// }
statusBean = saveAlarmAndHumidity(statusBean);
statusBean = handleInOutFinished(statusBean);
StatusBean humidityResult = handleHumidity(statusBean);
statusBean=handleSelfAudit(statusBean);
if (humidityResult != null) {
return humidityResult;
}
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//先查找紧急出库的物料
StatusBean outSingleTaskResult = outSingleOutTask(storage, statusBean);
if(outSingleTaskResult != null){
statusBean = outSingleTaskResult;
}else{
//查看是否有要出库的操作
statusBean =taskService.checkOut(storage, statusBean);
}
}
//获取操作
Map<String, String> opMap = DevicesStatusUtil.getAndRemoveOp(cid);
statusBean.putOp(opMap);
//agv附加操作
Map<String, String> agvToMimoOpMap = AgvDataUtil.getAndRemoveToMimoOp(cid);
statusBean.putOp(agvToMimoOpMap);
return statusBean;
}
@Override
protected StatusBean handleInOutFinished(StatusBean statusBean) {
Map<String, BoxStatusBean> statusOfBoxes = statusBean.getBoxStatus();
if (statusOfBoxes != null) {
for (BoxStatusBean boxStatus : statusOfBoxes.values()) {
try {
//出库入库完成处理
int status = boxStatus.getStatus();
String posName = boxStatus.getPosId();
String barcode = boxStatus.getBarcode();
int executeTime = boxStatus.getExecuteTime();
if ((!Strings.isNullOrEmpty(posName)) || (!Strings.isNullOrEmpty(barcode))) {//客户端发一次完成之后,会发空的 posName,不需要处理
if (BOX_STATUS.IN_FINISHED == status) {//入仓完成
finishedPutIn(statusBean.getCid(), posName, barcode, executeTime);
} else if (BOX_STATUS.IN_FAILED == status) {//入库失败
//暂不处理
} else if (BOX_STATUS.OUT_FINISHED == status) {//出仓完成
finishedOutPos(statusBean.getCid(), posName,barcode,executeTime, OP_STATUS.OUT_BOX);
} else if (BOX_STATUS.OUT_END == status) {//出库完成(放到仓门口
endOutTask(statusBean.getCid(), posName, barcode);
}
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
}
}
}
return statusBean;
}
/**
* 出库紧急物料
*/
public StatusBean outSingleOutTask(Storage storage, StatusBean statusBean) {
try {
//准备更新暂停出入库
if (dataCache.getCache(Constants.CACHE_StopOut)) {
return statusBean;
}
String cid = storage.getCid();
//紧急出库任务不论是否有入库任务都发到客户端,由客户端在入库间隙进行出库
Collection<DataLog> queueTasks = taskService.getQueueTasks();
int excuttingOutTaskNum = 0;
DataLog singleOutTask = null;
for (DataLog queueTask : queueTasks) {
if(queueTask.isCheckOutTask()){
if (cid.equals(queueTask.getCid())) {
if(queueTask.isExecuting()){
excuttingOutTaskNum ++;
}
if (queueTask.isSingleOut() && queueTask.isWait()) {
//单盘优先出库
if (singleOutTask == null || queueTask.getCreateDate().before(singleOutTask.getCreateDate())) {
singleOutTask = queueTask;
}
}
}
}
}
//已经有2个出库任务在执行,不再发了
if(excuttingOutTaskNum < 2){
if (singleOutTask != null) {
log.info("MIMO料仓优先分配紧急出库任务" + singleOutTask.getBarcode() + "[" + singleOutTask.getPosName() + "]到 " + cid);
singleOutTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(singleOutTask);
statusBean.setOp(OP.CHECKOUT);
String posName = singleOutTask.getPosName();
Barcode codeObj = barcodeManager.findByBarcode(singleOutTask.getBarcode());
int plateW = 0;
int plateH = 0;
if (codeObj != null) {
plateW = codeObj.getPlateSize();
plateH = codeObj.getHeight();
} else {
log.warn("MIMO紧急出库无料仓位" + storage.getName() + "[" + posName + "]");
StoragePos pos=storagePosManager.getByPosName(posName);
plateW = pos.getW();
plateH = pos.getH();
}
statusBean.addPosInfo(singleOutTask.getBarcode(), posName, plateW, plateH, true);
log.info("出库紧急物料" + storage.getName() + "[" + posName + "]物料[" + singleOutTask.getBarcode() + "]" + "发送到客户端" + cid);
return statusBean;
}
}
} catch (Exception e) {
log.error("出库紧急物料出错", e);
}
return null;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.SMD_MIMO_G2;
}
}
......@@ -104,6 +104,8 @@ public class NLLShelfHandler extends BaseDeviceHandler {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
}
code = replaceSpecial(code);
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.noValidCode", "条码无效");
......@@ -185,6 +187,10 @@ public class NLLShelfHandler extends BaseDeviceHandler {
String posName = paramMap.get("posName");
String code = paramMap.get("code");
if (StringUtils.isNotEmpty(code)){
code = replaceSpecial(code);
}
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.noValidCode", "条码无效");
......
......@@ -6,8 +6,10 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.inList.util.InListCache;
......@@ -103,10 +105,13 @@ public class NLMShelfHandler extends BaseDeviceHandler {
}
}
List<DataLog> dataLogs = getLightGuideTask(outMap);
List<DataLog> dataLogs = getLightGuideTask(outMap,statusBean.getCid());
for (DataLog task :
dataLogs) {
// statusBean.addData("open", task.getPosName() + "=" + ORDER_COLOR.fromRgb(task.getLightColor()).name());
if (StringUtils.isBlank(task.getLightColor())){
task.setLightColor(ORDER_COLOR.BLUE.getRgb());
}
String color = ORDER_COLOR.fromRgb(task.getLightColor()).name();
addMergeData(statusBean, task, "open", color);
}
......@@ -217,6 +222,9 @@ public class NLMShelfHandler extends BaseDeviceHandler {
if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
}
code = replaceSpecial(code);
if (groupId == null && storageId == null) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"group"});
}
......@@ -240,6 +248,31 @@ public class NLMShelfHandler extends BaseDeviceHandler {
if (!Strings.isNullOrEmpty(code)) {
code = code.replace("。", ".");
}
String w = mapValues.get("w");
String h = mapValues.get("h");
if (StringUtils.isEmpty(w) || StringUtils.isEmpty(h)) {
w = "1";
h = "1";
Barcode noSizeBarcode = codeResolve.resolveCode(code);
if (noSizeBarcode == null){
noSizeBarcode = barcodeManager.findByBarcode(code);
}
if (noSizeBarcode != null) {
Component component = componentManager.findByPartNumberAndProvider(noSizeBarcode.getPartNumber(), noSizeBarcode.getProvider());
if (component != null) {
w = component.getPlateSize() + "";
h = component.getHeight() + "";
}
}
}
if (w.equals("1") || h.equals("1")){
return ResultBean.newErrorResult(101,"smfcore.error.barcode.errorSize","条码未设置尺寸");
}
code = "="+w+"x"+h+"="+code;
CodeBean codeBean = codeResolve.resolveSingleCode(code);
if (!codeBean.isValid()) {
throw new ValidateException("smfcore.error.barcode.invalid", "未找到有效的条码");
......@@ -250,10 +283,10 @@ public class NLMShelfHandler extends BaseDeviceHandler {
if (expireDate != null && System.currentTimeMillis() > expireDate.getTime()) {
throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
}
if (barcode.getPlateSize() <= 1) {
/* if (barcode.getPlateSize() <= 1) {
//长宽为1的需要弹框设置尺寸
return ResultBean.newErrorResult(101,"smfcore.error.barcode.errorSize","条码未设置尺寸");
}
}*/
try {
StoragePos inPos = storagePosManager.getByBarcodeId(barcode.getId());
if (inPos != null) {
......
......@@ -64,6 +64,9 @@ public class NLPShelfHandler extends BaseDeviceHandler {
if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
}
code = replaceSpecial(code);
if (groupId == null && storageId == null) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"group"});
}
......@@ -244,9 +247,14 @@ public class NLPShelfHandler extends BaseDeviceHandler {
}
}
List<DataLog> dataLogs = getLightGuideTask(outMap);
List<DataLog> dataLogs = getLightGuideTask(outMap,statusBean.getCid());
for (DataLog task : dataLogs) {
statusBean.addData("open", task.getPosName() + "=" + ORDER_COLOR.fromRgb(task.getLightColor()).name());
if (StringUtils.isBlank(task.getLightColor())){
task.setLightColor(ORDER_COLOR.BLUE.getRgb());
}
String colorName = ORDER_COLOR.fromRgb(task.getLightColor()).name();
statusBean.addData("open", task.getPosName() + "=" + colorName);
log.info("库位[" + task.getPosName() + "][" + task.getType() + "]+亮灯:" + colorName);
}
return statusBean;
......
......@@ -95,7 +95,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
ORDER_COLOR color = ORDER_COLOR.fromRgb(rgb);
if (color == null) {
if (queueTask.isPutInTask()) {
color = ORDER_COLOR.DARKGREEN;
color = ORDER_COLOR.FORESTGREEN;
} else {
color = ORDER_COLOR.BLUE;
}
......@@ -117,8 +117,11 @@ public class NLShelfHandler extends BaseDeviceHandler {
}
}
List<DataLog> dataLogs = getLightGuideTask(outMap);
List<DataLog> dataLogs = getLightGuideTask(outMap,statusBean.getCid());
for (DataLog task : dataLogs) {
if (StringUtils.isBlank(task.getLightColor())){
task.setLightColor(ORDER_COLOR.BLUE.getRgb());
}
String colorName = ORDER_COLOR.fromRgb(task.getLightColor()).name();
statusBean.addData("open", task.getPosName() + "=" + colorName);
log.info("库位[" + task.getPosName() + "][" + task.getType() + "]+亮灯:" + colorName);
......@@ -267,6 +270,9 @@ public class NLShelfHandler extends BaseDeviceHandler {
if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
}
code = replaceSpecial(code);
if (groupId == null && storageId == null) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"group"});
}
......@@ -374,7 +380,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
if (liteOrder != null && liteOrder.isTaskFinished()) {
//工单任务已完成
String orderNo = liteOrder.getOrderNo();
String orderFinishedTxt = MessageUtils.getText("smfcore.order.finished", new String[]{orderNo}, request.getLocale(), "工单["+orderNo+"]的任务已全部完成");
String orderFinishedTxt = MessageUtils.getText("smfcore.order.finished", new String[]{orderNo}, request.getLocale(), "工单[{0}]的任务已全部完成");
dataMap.put("orderFinishedTxt",orderFinishedTxt);
log.info("工单完成,返回 orderFinishedTxt, "+orderFinishedTxt);
}
......
......@@ -10,6 +10,7 @@ import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -49,7 +50,9 @@ public class XLRBoxHandler extends BaseDeviceHandler {
//查看是否有要出库的操作
statusBean =taskService.checkOut(storage, statusBean);
}
//获取操作
Map<String, String> opMap = DevicesStatusUtil.getAndRemoveOp(cid);
statusBean.putOp(opMap);
return statusBean;
}
......
......@@ -15,15 +15,19 @@ import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.bean.PosInfo;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao;
......@@ -69,6 +73,9 @@ public class DeviceController {
private IStoragePosManager storagePosManager;
@Autowired
private IStorageManager storageManager;
@Autowired
private IComponentManager componentManager;
@Autowired
......@@ -101,6 +108,31 @@ public class DeviceController {
log.error("料仓cid: [" + cid + "]不存在");
return null;
}
try {
String appendCid=statusBean.getFromData("appendCid");
if(ObjectUtil.isNotEmpty(appendCid)){
statusBean.setAppendCid(appendCid);
}
//判断是否需要更改附属CID
if(ObjectUtil.isNotEmpty(statusBean.getAppendCid())){
boolean needsave=false;
if(ObjectUtil.isEmpty(storage.getAppendCid()) ){
needsave=true;
log.info("料仓["+cid+"] 更改 appendCid ="+statusBean.getAppendCid());
}
else if( !(storage.getAppendCid().equals(statusBean.getAppendCid()))){
needsave=true;
log.info("料仓["+cid+"] 更改 appendCid ="+statusBean.getAppendCid()+", 原来 appendCid ="+storage.getAppendCid());
}
if(needsave) {
storage.setAppendCid(statusBean.getAppendCid());
storageManager.save(storage);
dataCache.reloadStorage(storage, storage.getCid());
}
}
}catch (Exception ex){
log.error("更改cid=的appendId出错:"+ex.toString());
}
synchronized (storage) {
String deviceType = storage.getType();
IDeviceHandler deviceHandler = handlerMap.get(deviceType);
......@@ -315,7 +347,7 @@ public class DeviceController {
errorMsg = ve.getMessage();
log.info("查找空库位失败:" + errorMsg);
resultMap.put("result", "105");
resultMap.put("msg", errorMsg);
resultMap.put("msg", MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),request.getLocale(),ve.getDefaultMsg()));
} catch (Exception e) {
errorMsg = e.getMessage();
log.info("查找空库位失败,", e);
......@@ -649,16 +681,20 @@ public class DeviceController {
public ResultBean getHeightandWidthByCode(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("code");
if (StringUtils.isNotBlank(code)) {
Barcode barcode = codeResolve.resolveCode(code);
if (barcode != null) {
String partNumber = barcode.getPartNumber();
Component component = componentManager.findOneByPN(partNumber);
if (component != null) {
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("partNumber",partNumber);
resultMap.put("plateSize",component.getPlateSize());
resultMap.put("height",component.getHeight());
return ResultBean.newOkResult(resultMap);
String[] barcodeItemStrs = code.split("##");
for (String barcodeItemStr : barcodeItemStrs) {
log.info("开始解析:"+barcodeItemStr);
Barcode barcode = codeResolve.resolveCode(barcodeItemStr);
if (barcode != null) {
String partNumber = barcode.getPartNumber();
Component component = componentManager.findOneByPN(partNumber);
if (component != null) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("partNumber", partNumber);
resultMap.put("plateSize", component.getPlateSize());
resultMap.put("height", component.getHeight());
return ResultBean.newOkResult(resultMap);
}
}
}
}
......@@ -709,7 +745,6 @@ public class DeviceController {
}
@ApiOperation("移动物料到另外一个库位")
@RequestMapping("/service/store/moveToOtherPos")
@ResponseBody
......@@ -726,17 +761,57 @@ public class DeviceController {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{needMovePosName, "barcode"});
}
//生成一条出库任务
taskService.addTaskToFinished(needMovePos, barcode, "admin-move");
//判断目标库位是否存在
StoragePos targetPos = storagePosManager.getByPosName(targetPosName);
if (targetPos == null) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"posName", targetPosName});
}
taskService.addTaskToFinished(targetPos, barcode, "admin-move");
//把外侧相同的任务给改成内侧的
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask()) {
if (!dataLog.isFinished() && !dataLog.isCancel()) {
if (dataLog.getPosId().equals(needMovePos.getId())) {
dataLog.setPosId(targetPos.getId());
dataLog.setPosName(targetPos.getPosName());
taskService.updateQueueTask(dataLog);
log.info(dataLog.getBarcode()+":外测有任务,原始库位为:"+dataLog.getPosName()+"更改后的库位为:"+targetPos.getPosName());
break;
}
}
}
}
//生成一条出库任务
Storage storage = dataCache.getStorageById(needMovePos.getStorageId());
DataLog needMovePosTask = new DataLog(storage, barcode, needMovePos);
needMovePosTask.setOperator("admin-move");
needMovePosTask.setType(OP.CHECKOUT);
needMovePosTask.setStatus(OP_STATUS.FINISHED.name());
taskService.updateFinishedTask(needMovePosTask);
needMovePos.setBarcode(null);
needMovePos.setUsed(false);
storagePosManager.save(needMovePos);
log.info(barcode.getBarcode() + "转移库位,清空仓位: " + needMovePos.getId() + "[" + needMovePos.getPosName() + "]");
dataCache.updateInventory(needMovePos, barcode);
//生成一条入库任务
DataLog targetPosTask = new DataLog(storage, barcode, targetPos);
targetPosTask.setOperator("admin-move");
targetPosTask.setType(OP.PUT_IN);
targetPosTask.setStatus(OP_STATUS.FINISHED.name());
taskService.updateFinishedTask(targetPosTask);
targetPos.setBarcode(barcode);
targetPos.setUsed(true);
targetPos.setCanCheckOutTime(System.currentTimeMillis());
storagePosManager.save(targetPos);
log.info(barcode.getBarcode() + "转移库位,入库库位: " + needMovePos.getId() + "[" + needMovePos.getPosName() + "]");
dataCache.updateInventory(targetPos, barcode);
//解除库位绑定
ReelLockPosUtil.removeReelLockPosInfo(barcode.getBarcode());
return ResultBean.newOkResult("");
......
package com.neotel.smfcore.core.device.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
@Slf4j
@RestController
@Api(tags = "视频控制")
public class VideoController {
@ApiOperation("图片上传接口,客户端调用")
@PostMapping(value = "/service/video/upload")
@ResponseBody
@AnonymousAccess
public ResultBean upload(@RequestBody Map<String, String> params) {
try {
String cid = params.get("cid");
String img = params.get("img");
updateVideo(cid,img);
} catch (Exception e) {
log.error("出错:", e);
return ResultBean.newErrorResult(-1, "", "");
}
return ResultBean.newOkResult("ok");
}
@ApiOperation("图片获取接口,smf调用")
@PostMapping(value = "/service/video/downloading")
@ResponseBody
@AnonymousAccess
public ResultBean downloading(@RequestBody Map<String, String> params) {
try {
String cid = params.get("cid");
String value = getVideo(cid);
return ResultBean.newOkResult(value);
} catch (Exception e) {
log.error("出错:", e);
return ResultBean.newErrorResult(-1, "", "");
}
}
public static String getVideo(String cid) {
String value = videoMap.getOrDefault(cid, "");
if (ObjectUtil.isEmpty(value) && videoMap.size() > 0) {
//默认查找cid_1的视频
String nCid=cid+"_1";
value = videoMap.getOrDefault(nCid, "");
// List<String> keylist = new ArrayList<>(videoMap.keySet());
// Collections.sort(keylist);
// for (String key :
// keylist) {
// if (key.startsWith(cid)) {
// value = videoMap.getOrDefault(key, "");
// }
// }
}
return value;
}
public static void updateVideo(String cid, String img) {
if (videoMap.containsKey(cid)) {
videoMap.remove(cid);
}
videoMap.put(cid, img);
}
public static Map<String, String> videoMap = new HashMap<>();
}
......@@ -123,6 +123,9 @@ public class DataCache {
initCacheItem();
Integer expireDay = getCache(Constants.CACHE_ExpiresDay);
codeResolve.updateExpiresDay(expireDay);
String apiName = getCache("api.name");
codeResolve.updateUseSizeConfirm("kbd".equals(apiName) ? false : true);
}
private void initCacheItem() {
......@@ -662,13 +665,14 @@ public class DataCache {
* @param amount
* @return
*/
public int updateInventoryAmount(String cid, String partNumber, int amount) {
public int updateInventoryAmount(String cid, String partNumber, int amount,String barcode) {
if (amount != 0) {
InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid, partNumber);
if (inventoryItem == null) {
inventoryItem = new InventoryItem();
inventoryItem.setPartNumber(partNumber);
}
log.info("修改barcode为:"+barcode+",partNumber为:"+ partNumber+"的缓存信息,数量为:"+amount+",盘数+1");
inventoryItem.updateInventory(amount);
updateStorageInventory(cid, inventoryItem);
return inventoryItem.getStockReel();
......@@ -705,7 +709,7 @@ public class DataCache {
updateInOutData(cid, storage.getId(), 1);
}
allStorage.put(cid, storage);
return updateInventoryAmount(cid, partNumber, amount);
return updateInventoryAmount(cid, partNumber, amount,barcode.getBarcode());
}
private void updateStorageInventory(String cid, InventoryItem inventoryItem) {
......
......@@ -45,10 +45,30 @@ public class EquipStatusBean implements Serializable {
/**
* 仅显示的日志消息集合
*/
private List<EquipMsg> showLogs = new ArrayList<>();
/**
* 发上来的数据
*
* NS200定义:
* key=tPCount,value=今天已打印数量
* key=tNGCount,value=今天NG数量
* key=MES,value=MES最后一次对接信息:格式参考NsMesInfo
*
* key=inShelfStatus ,value=入口料串状态:
* key=outShelfStatus ,value=出口料串状态:
*/
private Map<String, Object> data = new HashMap<>();
// 料串状态定义 IDLE=空闲;
// LOADING=入库中;
// UNLOADING=出库中;
// NEED_EMPTY=需要空料串出库;
// EMPTY_OUT=空料串需要取走
// FULL_OUT=满料串需要取走
/**
* 离线时间,用于判断是否已经处理过离线
*/
......@@ -114,5 +134,17 @@ public class EquipStatusBean implements Serializable {
return null;
}
public String getShowMsg(Locale locale){
MessageType[] types=new MessageType[]{MessageType.ERROR,MessageType.WARNING,MessageType.INFO,MessageType.SHOW };
for (MessageType type :
types) {
EquipMsg showMsg= getMsgByType(type.name());
if(showMsg!=null){
return showMsg.getShowMsg(locale);
}
}
return "";
}
}
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.equipment.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.core.agv.util.AgvCache;
import com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.equipment.enums.EquipmentType;
......@@ -73,6 +74,18 @@ public class BaseEquipHandler implements IEquipmentHandler {
}
}
}
if(statusBean.getData().containsKey("MES")) {
try {
MesInfoDto mesInfo = (MesInfoDto) statusBean.getData().get("MES");
if(mesInfo!=null){
EquipStatusUtil.updateNsMesInfo(statusBean.getCid(),mesInfo);
}
} catch (Exception ex) {
log.error(""+ex);
}
}
EquipStatusUtil.updateStatusBean(statusBean);
} catch (Exception e) {
......
package com.neotel.smfcore.core.equipment.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.equipment.enums.EquipmentType;
import com.neotel.smfcore.core.equipment.handler.IEquipmentHandler;
......@@ -53,10 +54,19 @@ public class EquipCommunicationController {
return null;
}
} else {
if (StringUtils.isNotBlank(name)){
if (!name.equals(equipment.getName())){
if (StringUtils.isNotBlank(name)) {
if (!name.equals(equipment.getName())) {
log.info("自动修改设备 cid[" + equipment.getCid() + "] name[" + equipment.getName() + "] 的名字为=" + name);
equipment.setName(name);
equipment = equipmentCache.reloadEquipment(equipment,equipment.getCid());
equipment = equipmentCache.reloadEquipment(equipment, equipment.getCid());
}
}
String type = statusBean.getType();
if (ObjectUtil.isNotEmpty(type)) {
if (!type.equals(equipment.getType())) {
log.info("自动修改设备 cid[" + equipment.getCid() + "] type [" + equipment.getType() + "] 的类型为=" + type);
equipment.setType(type);
equipment = equipmentCache.reloadEquipment(equipment, equipment.getCid());
}
}
}
......
package com.neotel.smfcore.core.equipment.rest;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.device.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.rest.dto.NsViewDto;
import com.neotel.smfcore.core.equipment.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.equipment.bean.EquipStatusDto;
import com.neotel.smfcore.core.equipment.service.po.Equipment; ;
import com.neotel.smfcore.core.equipment.rest.dto.EquipStatusDto;
import com.neotel.smfcore.core.equipment.service.po.Equipment;
import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.message.service.po.Message;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
......@@ -58,23 +60,7 @@ public class EquipViewController {
}else{
dto.setOnLine(true);
dto.setStatus(bean.getStatus());
EquipMsg showMsg= bean.getMsgByType(MessageType.ERROR.name());
if(showMsg==null){
showMsg=bean.getMsgByType(MessageType.WARNING.name());
}
if(showMsg==null){
showMsg=bean.getMsgByType(MessageType.INFO.name());
}
if(showMsg!=null){
dto.setMsg(showMsg.getShowMsg(locale));
}
// if(bean.getMsgList()!=null){
// for (EquipMsg msg : bean.getMsgList()){
// if(msg.getType().equals(MessageType.ERROR.name())){
// dto.setMsg(msg.getShowMsg(locale));
// }
// }
// }
dto.setMsg(bean.getShowMsg(locale));
}
}
......@@ -99,4 +85,50 @@ public class EquipViewController {
}
return resultList;
}
@ApiOperation("获取NS看板数据")
@GetMapping("nsView")
@PreAuthorize("@el.check('equipmentView:info')")
public NsViewDto nsView(String cid, HttpServletRequest servletRequest){
Equipment equip = equipmentCache.getEquipment(cid);
if (equip == null ||(!equip.isNEOSCAN())) {
throw new ValidateException("smfcore.equip.notExist","设备不存在");
}
NsViewDto dto=new NsViewDto();
dto.setCid(cid);
dto.setName(equip.getName());
EquipStatusBean bean= EquipStatusUtil.getStatusBean(equip.getCid());
if(bean!=null){
if(bean.timeOut()){
dto.setStatus(0);
}else{
dto.setStatus(bean.getStatus());
dto.setMsg(bean.getShowMsg(servletRequest.getLocale()));
dto.setData(bean.getData());
dto.setShowLogs(bean.getShowLogs());
MesInfoDto mesInfo=EquipStatusUtil.getNsMesInfo(cid);
if(mesInfo!=null){
dto.setMesInfo(mesInfo);
}
}
}
// if(dto.getShowLogs().size()<=0){
// EquipMsg msg=new EquipMsg();
// msg.setModule("module1");
// msg.setMsg("msg1111111111111111111");
// dto.getShowLogs().add(msg);
// }
if(dto.getMesInfo()==null){
MesInfoDto mesInfoDto=EquipStatusUtil.getLastAgvInfo(cid);
if(mesInfoDto!=null){
dto.setAgvInfo(mesInfoDto);
}
}
return dto;
}
}
package com.neotel.smfcore.core.equipment.bean;
package com.neotel.smfcore.core.equipment.rest.dto;
import com.neotel.smfcore.core.equipment.enums.EquipmentType;
import io.swagger.annotations.ApiModelProperty;
......
package com.neotel.smfcore.core.equipment.rest.dto;
import com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class NsViewDto implements Serializable {
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("CID")
private String cid;
@ApiModelProperty("设备状态,0=离线,1=正常运行中, 2=急停")
private int status=0;
@ApiModelProperty("文字显示")
private String msg = "";
@ApiModelProperty("Mes信息")
private MesInfoDto mesInfo = null;
@ApiModelProperty("agv通信信息")
private MesInfoDto agvInfo = null;
@ApiModelProperty("仅显示的日志消息集合")
private List<EquipMsg> showLogs = new ArrayList<>();
/**
* 发上来的数据
*
* NS200定义:
* key=tPCount,value=今天已打印数量
* key=tNGCount,value=今天NG数量
* key=MES,value=MES最后一次对接信息:格式参考NsMesInfo
*/
private Map<String, Object> data = new HashMap<>();
}
......@@ -26,4 +26,8 @@ public class Equipment extends BasePo implements Serializable {
* 是否可用
*/
private boolean available = true;
public boolean isNEOSCAN() {
return EquipmentType.NEOSCAN.name().equals(type);
}
}
package com.neotel.smfcore.core.device.util;
package com.neotel.smfcore.core.equipment.util;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.exception.ValidateException;
......@@ -87,7 +87,7 @@ public class EquipmentCache {
}
}
public Equipment autoCreateEquip(String name,String cid, String type) {
public synchronized Equipment autoCreateEquip(String name,String cid, String type) {
//判断cid存在
Equipment equipment = null;
equipment = getEquipment(cid);
......
......@@ -48,6 +48,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Slf4j
......@@ -91,6 +92,7 @@ public class BoxKanbanController {
for (Group group : groupList) {
List<BoxStatusDto> boxStatusDtos = new ArrayList<>();
List<String> cidList =dataCache. getCidsByGroupId(group.getId(), false);
Collections.sort(cidList);
int groupType=0;
for (String cid : cidList) {
Storage storage=dataCache.getStorage(cid);
......@@ -105,6 +107,7 @@ public class BoxKanbanController {
}
}
if(boxStatusDtos.size()>0){
boxStatusDtos = boxStatusDtos.stream().sorted(Comparator.comparing(BoxStatusDto :: getName)).collect(Collectors.toList());
GroupStatusDto groupStatusDto = new GroupStatusDto(group.getId(),group.getGroupName(),boxStatusDtos,groupType);
groupStatusDtos.add(groupStatusDto);
}
......@@ -420,8 +423,8 @@ public class BoxKanbanController {
// }
int allCount = inTask + outTask;
BoxStatusDto boxDto = new BoxStatusDto(storage.getId(), storage.getName(), storage.getCid(), false, 0,
"0", "0","0", "", allCount, inTask, outTask,
0, "", "", "", "", "",storage.getType(),storage.getUsageMap(),new HashMap<>(),storage.getInListName());
"0", "0", "0", "", allCount, inTask, outTask,
0, "", "", "", "", "", storage.getType(), storage.getUsageMap(), new HashMap<>(), storage.getInListName());
//获取设备状态,设置状态和当前任务信息
StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid());
......@@ -429,7 +432,7 @@ public class BoxKanbanController {
boxDto.setOnLine(false);
//如果是虚拟仓,默认在线
if(storage.isVirtual()){
if (storage.isVirtual()) {
boxDto.setOnLine(true);
boxDto.setStatus(1);
}
......@@ -482,16 +485,16 @@ public class BoxKanbanController {
}
}
//如果是锡膏料仓,需要把回温区物料数量,冷藏区物料数量显示
if(storage.isSolderPaste()){
Integer warmUseCount=dataCache.getSpUsePosCount(storage.getCid(),DataCache.warmPosUseCount);
Integer coldingUseCount=dataCache.getSpUsePosCount(storage.getCid(),DataCache.coldingPosUseCount);
boxDto.getData().put(DataCache.warmPosUseCount,warmUseCount.toString());
boxDto.getData().put(DataCache.coldingPosUseCount,coldingUseCount.toString());
Integer warmCount=dataCache.getSpUsePosCount(storage.getCid(),DataCache.warmPosCount);
Integer coldingCount=dataCache.getSpUsePosCount(storage.getCid(),DataCache.coldingPosCount);
boxDto.getData().put(DataCache.warmPosCount,warmCount.toString());
boxDto.getData().put(DataCache.coldingPosCount,coldingCount.toString());
if (storage.isSolderPaste()) {
Integer warmUseCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.warmPosUseCount);
Integer coldingUseCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.coldingPosUseCount);
boxDto.getData().put(DataCache.warmPosUseCount, warmUseCount.toString());
boxDto.getData().put(DataCache.coldingPosUseCount, coldingUseCount.toString());
Integer warmCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.warmPosCount);
Integer coldingCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.coldingPosCount);
boxDto.getData().put(DataCache.warmPosCount, warmCount.toString());
boxDto.getData().put(DataCache.coldingPosCount, coldingCount.toString());
}
return boxDto;
}
......
......@@ -360,6 +360,9 @@ public class LanguageMsgService {
}
if (isUpdate) {
if (isNeedUpdate) {
oldMsg.setEdited(true);
}
updateLanguageList.add(oldMsg);
languageMsgManager.save(oldMsg);
MessageUtils.updateMsg(oldMsg);
......
......@@ -21,4 +21,8 @@ public enum MessageType {
* 3 设备操作数据
*/
DATA,
/**
* 4 显示数据,仅显示不保存
*/
SHOW,
}
......@@ -3,7 +3,7 @@ package com.neotel.smfcore.core.message.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.device.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.service.po.Equipment;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.enums.MessageType;
......@@ -14,8 +14,6 @@ import com.neotel.smfcore.core.message.util.bean.DeviceInfo;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
......
package com.neotel.smfcore.core.msd.rest;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
......@@ -87,6 +88,12 @@ public class MSDController {
@GetMapping("/settings")
@PreAuthorize("@el.check('msd')")
public MSDSettiingsDto getSysSettings() {
MSDSettiings msdSettiings=getSetting();
MSDSettiingsDto dto = msdSettingsMapper.toDto(msdSettiings);
return dto;
}
private MSDSettiings getSetting(){
MSDSettiings msdSettiings = dataCache.getCache(Constants.CACHE_msdSetting);
if(msdSettiings==null){
msdSettiings=new MSDSettiings() ;
......@@ -105,8 +112,7 @@ public class MSDController {
dataCache.updateCache(Constants.CACHE_msdSetting, msdSettiings);
log.info("默认MSD:CACHE_msdSetting=" + msdSettiings.toString());
}
MSDSettiingsDto dto = msdSettingsMapper.toDto(msdSettiings);
return dto;
return msdSettiings;
}
@ApiOperation("修改MSD设置信息")
......@@ -116,11 +122,11 @@ public class MSDController {
MSDSettiings settiings = msdSettingsMapper.toEntity(msdSettiingsDto);
if (settiings.getMaxHumidity() <= settiings.getMinHumidity()) {
throw new ValidateException("smfcore.humidityValueError", "温度范围数据错误");
throw new ValidateException("smfcore.temperatureValueError", "湿度范围数据错误");
}
if (settiings.getMaxTemperature() <= settiings.getMinTemperature()) {
throw new ValidateException("smfcore.temperatureValueError", "湿度范围数据错误");
throw new ValidateException("smfcore.humidityValueError", "温度范围数据错误");
}
dataCache.updateCache(Constants.CACHE_msdSetting, settiings);
log.info("更改MSD:CACHE_msdSetting=" + settiings.toString());
......@@ -128,6 +134,47 @@ public class MSDController {
}
@ApiOperation("修改MSD设置预警湿度信息")
@PutMapping("/settings/maxHumidity")
@PreAuthorize("@el.check('msd')")
public ResultBean updateMaxHumidity(String maxHumidityStr) {
float maxHumidity=0;
try{
maxHumidity= Convert.toFloat(maxHumidityStr);
}catch (Exception ex){
throw new ValidateException("smfcore.temperatureValueError", "湿度范围数据错误");
}
MSDSettiings settiings =getSetting();
settiings.setMaxHumidity(maxHumidity);
if (settiings.getMaxHumidity() <= settiings.getMinHumidity()) {
throw new ValidateException("smfcore.temperatureValueError", "湿度范围数据错误");
}
dataCache.updateCache(Constants.CACHE_msdSetting, settiings);
log.info("更改MSD maxHumidity:CACHE_msdSetting=" + settiings.toString());
return ResultBean.newOkResult("保存成功");
}
@ApiOperation("修改MSD设置预警溫度信息")
@PutMapping("/settings/maxTemperature")
@PreAuthorize("@el.check('msd')")
public ResultBean updateMaxTemperature(String maxTemperatureStr) {
float maxTemperature=0;
try{
maxTemperature= Convert.toFloat(maxTemperatureStr);
}catch (Exception ex){
throw new ValidateException("smfcore.temperatureValueError", "湿度范围数据错误");
}
MSDSettiings settiings =getSetting();
settiings.setMaxTemperature(maxTemperature);
if (settiings.getMaxTemperature() <= settiings.getMinTemperature()) {
throw new ValidateException("smfcore.humidityValueError", "温度范围数据错误");
}
dataCache.updateCache(Constants.CACHE_msdSetting, settiings);
log.info("更改MSD maxTemperature:CACHE_msdSetting=" + settiings.toString());
return ResultBean.newOkResult("保存成功");
}
@ApiOperation("MSD库存数据查询")
@GetMapping("/query")
@PreAuthorize("@el.check('msd')")
......
......@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* Created by sunke on 2021/7/12.
......@@ -70,9 +71,11 @@ public class LiteOrderCache {
List<LiteOrder> unEndOutInfoList = liteOrderManager.findUnEndOrdersList();
long now = System.currentTimeMillis();
for (LiteOrder order : unEndOutInfoList) {
if (now - order.getCreateDate().getTime() > 7 * 24 * 60 * 60 * 1000) {
long v1=now - order.getCreateDate().getTime();
long v2= 30 * 24 * 60 * 60 * 1000L;
if (now - order.getCreateDate().getTime() > v2) {
//7天前的需求单,关闭,并解绑
log.info("需求单 =[" + order.getOrderNo() + "]为7天前,关闭并解绑工单");
log.info("需求单 =[" + order.getOrderNo() + "],创建日期:["+order.getCreateDate().toString()+"]为30天前,关闭并解绑工单");
closeOrder(order.getOrderNo());
} else {
......@@ -488,7 +491,7 @@ public class LiteOrderCache {
int remainReelCount = orderItem.getNeedReelCount() - orderItem.getTotalOutReelCount();
//此PN未完成
if (remainNum > 0) {
if (remainNum > 0 || remainReelCount > 0) {
if (outBom) {
//套料出库,设置剩余数量为1,这样就只会出一盘
remainNum = 1;
......@@ -712,8 +715,8 @@ public class LiteOrderCache {
LiteOrder order = liteOrderManager.get(sourceId);
if (order != null && order.getOrderItems().size() > 0) {
List<LiteOrderItem> list = order.getOrderItems();
//根据站位号排序
Collections.sort(list);
//根据站位号和id排序
list = list.stream().sorted(Comparator.comparing(LiteOrderItem::getSlotNum).thenComparing(LiteOrderItem::getId)).collect(Collectors.toList());
order.setOrderItems(list);
return order;
}
......
......@@ -31,12 +31,12 @@ public enum ORDER_COLOR {
// 'magenta':[17,125,125,0]
BLUE("0000FF"),
//MAGENTA("FF00FF"),
//CYAN("00FFFF"),
CYAN("00FFFF"),
FIREBRICK("B22222"),
PURPLE("A020F0"),
//SKYBLUE("6CA6CD"),
//PINK("FF1493"),
//FORESTGREEN("228B22"),
FORESTGREEN("228B22"),
//LIGHTBLUE("8470FF"),
//INDIANRED("8B3A3A"),
DARKGREEN("556B2F"),
......@@ -73,7 +73,7 @@ public enum ORDER_COLOR {
public static ORDER_COLOR nextColor(Collection<String> excludeColors){
excludeColors.add(ORDER_COLOR.BLUE.getRgb());//手动出库
excludeColors.add(ORDER_COLOR.DARKGREEN.getRgb());//入库
excludeColors.add(ORDER_COLOR.FORESTGREEN.getRgb());//入库
ORDER_COLOR[] allColors = values();
if (excludeColors.size() >= allColors.length){
......
......@@ -84,8 +84,8 @@ public class DefaultOrderFileListener implements IOrderFileListener {
liteOrderCache.addOrderToMap(liteOrder);
//resultFile = new File(localDir+File.separator + "sucess",backupFileName);
return true;
}
return true;
}
}catch (Exception e){
log.error("read order from file ["+orderFile.getAbsolutePath()+"] :",e);
......
......@@ -572,14 +572,14 @@ public class OrderController {
findItem.setTotalOutNum(findItem.getTotalOutNum() + num);
findItem.setOutReelCount(findItem.getOutReelCount() + 1);
findItem.setTotalOutReelCount(findItem.getTotalOutReelCount() + 1);
findItem.setNeedReelCount(findItem.getNeedReelCount() + 1);
//findItem.setNeedReelCount(findItem.getNeedReelCount() + 1);
liteOrderItemManager.save(findItem);
liteOrder.updateOrderItems(findItem);
//工单未关闭的话,检查状态,全部都出完进行关闭
boolean closed = true;
for (LiteOrderItem liteOrderItem : liteOrder.getOrderItems()) {
if (!liteOrderItem.isOutFinished()) {
if (!liteOrderItem.isOutFinished() || !liteOrderItem.isOutReelFinished()) {
closed = false;
break;
}
......@@ -670,10 +670,16 @@ public class OrderController {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
LiteOrder liteOrder = smfApi.fetchOrder(orderNo, SecurityUtils.getCurrentUsername());
//判断工单是否存在
LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo);
if (liteOrder != null){
throw new ValidateException("smfcore.order.ameExists", "工单名称[{0}]已存在",new String[]{orderNo});
}
//从api获取
liteOrder = smfApi.fetchOrder(orderNo, SecurityUtils.getCurrentUsername());
if (liteOrder == null) {
throw new ValidateException("smfcore.api.noUrl", "未配置API地址");
throw new ValidateException("smfcore.order.out.notFound", "工单未找到");
}
OrderDto dto = orderMapper.toDto(liteOrder);
......
......@@ -65,7 +65,9 @@ public class OrderItemDto {
*/
private int inventoryReelCount = 0;
private int totalOutNum = 0;
private int totalOutReelCount = 0;
// Inventory Quantity
// Inventory Reel / Bundle count
......
......@@ -337,14 +337,15 @@ public class SpBoxHandler extends BaseDeviceHandler {
//回温取料任务
statusBean.setOp(OP.REWARM_TAKING);
statusBean.addData("posId", task.getPosName());
statusBean.addData("plateW", task.getW()+"");
statusBean.addData("plateH", task.getH()+"");
DataLog rewarmPuttingTask = findRewarmPuttingTask(task);
if (rewarmPuttingTask == null) {
log.error("[" + cid + "]回温取料任务[" + task.getBarcode() + "][" + task.getPosName() + "]未找到回温放料任务");
} else {
statusBean.addData("secondPosId", rewarmPuttingTask.getPosName());
log.info(task.getBarcode() + "回温移库信息发送到客户端[" + task.getPosName() + "]=>" + rewarmPuttingTask.getPosName());
log.info(task.getBarcode() + "回温移库信息发送到客户端[" + task.getPosName() + "]=>" + rewarmPuttingTask.getPosName()+",W:"+task.getW()+",H:"+task.getH());
rewarmPuttingTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(rewarmPuttingTask);
......
......@@ -19,12 +19,14 @@ import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.solder.rest.bean.dto.SpTaskDto;
import com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE;
import com.neotel.smfcore.core.storage.rest.dto.CheckOutDto;
import com.neotel.smfcore.core.storage.rest.dto.InventoryItemDto;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosDto;
import com.neotel.smfcore.core.storage.rest.mapstruct.StoragePosMapper;
import com.neotel.smfcore.core.storage.rest.query.StoragePosFindCriteria;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.manager.impl.StoragePosManagerImpl;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.rest.bean.query.TaskQueryCondition;
......@@ -71,6 +73,9 @@ public class SpBoxController {
private IComponentManager componentManager;
@Autowired
private StoragePosManagerImpl posManager;
@ApiOperation("锡膏UID出库")
@GetMapping("/uidList")
@PreAuthorize("@el.check('checkOut')")
......@@ -252,8 +257,10 @@ public class SpBoxController {
}
Query q = new Query(c);
q.limit(num);
CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType();
Sort sort =storagePosManager.getSortByCheckOutType(checkoutType);
//优先使用二次入库的
q.with(Sort.by(Sort.Direction.ASC, "barcode.solderStatus").and(Sort.by(Sort.Direction.ASC, "barcode.putInTime")));
q.with(Sort.by(Sort.Direction.ASC, "barcode.solderStatus").and(sort));
return storagePosManager.findByQuery(q);
}
......@@ -262,8 +269,11 @@ public class SpBoxController {
public List<SpTaskDto> filterTask(TaskQueryCondition criteria, HttpServletRequest request) {
String storageId = criteria.getStorageId();
if(ObjectUtil.isEmpty(storageId)){
return new ArrayList<>();
}
Storage storage = dataCache.getStorageById(storageId);
if (!storage.isSolderPaste()) {
if (storage==null|| !storage.isSolderPaste()) {
return new ArrayList<>();
}
Criteria c = Criteria.where("storageId").is(storageId)
......
......@@ -258,6 +258,8 @@ public class SolderBoxCache {
puttingTask.setType(OP.REWARM_PUTTING);
//puttingTask = dataLogDao.save(puttingTask);
taskService.addTaskToExecute(puttingTask);
}else{
log.error(barcode.getBarcode() + "创建回温移库任务失败:未找到回温库位");
}
} catch (ValidateException e) {
log.info(barcode.getBarcode() + "查找回温库位失败");
......
......@@ -137,7 +137,13 @@ public enum DeviceType {
/**
* 22 钢网料架 NLS
*/
NLS("storage.type.nls");
NLS("storage.type.nls"),
/**
* 23 SMD_MIMO_G2
*/
SMD_MIMO_G2("storage.type.smdMimoG2")
;
private String key;
......@@ -158,6 +164,6 @@ public enum DeviceType {
}
public static List<DeviceType> availableTypeList(){
return Lists.newArrayList(AUTO,LINE,BATCH,SOLDERPASTE,VERTICALBOX,SMD_XL,SMD_DUO,SMD_XLC,SMD_XLR,VIRTUAL,NL,NLP,NLM,NLL,NLS,SMDBOX_THIRD);
return Lists.newArrayList(AUTO,LINE,BATCH,SOLDERPASTE,VERTICALBOX,SMD_XL,SMD_DUO,SMD_XLC,SMD_XLR,VIRTUAL,NL,NLP,NLM,NLL,NLS,SMDBOX_THIRD,SMD_MIMO_G2);
}
}
......@@ -24,6 +24,7 @@ import com.neotel.smfcore.core.storage.service.po.Label;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.security.service.po.Group;
......@@ -364,6 +365,16 @@ public class MaterialController {
String opUser = SecurityUtils.getCurrentUsername();
log.info(opUser + "清理库位[" + storagePos.getPosName() + "],条码[" + code + "]中的库存" + barcode.getBarcode());
taskService.addTaskToFinished(storagePos, null, opUser + "-manual");
//如果是料架,库位灭灯
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
if (storage != null){
if (storage.isShelf() || storage.isNLShelf() || storage.isNLPShelf() || storage.isNLMShelf()){
String opKey = "close";
String opStr = storagePos.getPosName();
DevicesStatusUtil.appendOp(storage.getCid(), opKey , opStr);
log.info("操作库位["+storagePos.getPosName()+"]" + opKey + " : " + opStr);
}
}
} else {
log.info("清理库位[" + storagePos.getPosName() + "],条码[" + code + "],库位条码为空");
}
......
......@@ -336,8 +336,8 @@ public class MaterialStockController {
Map<String, Object> map = new LinkedHashMap<>();
map.put(partNumberStr, item.getPartNumber());
map.put(countStr, item.getStockCount());
map.put(lockReelStr, item.getLockReel());
map.put(stockReelStr, item.getSupplementReel());
map.put(stockReelStr, item.getStockReel());
map.put(lockReelStr, item.getSupplementReel());
map.put(storageNameStr, item.getAmount());
maps.add(map);
}
......
......@@ -476,6 +476,7 @@ public class StorageController {
int wIndex = csvRead.getCsvIndex("宽度","w");
int warmPosIndex = csvRead.getHasCsvIndex("回温库位","warmPos");//true表示回温区库位,
int areaIndex = csvRead.getHasCsvIndex("区域","area");
int posTypeIndex = csvRead.getHasCsvIndex("库位类型","posType");
int row = 1;
......@@ -493,6 +494,7 @@ public class StorageController {
Integer height =0;
Integer width =0;
String labelName="";
Integer posType=0;
try {
priority =Integer.parseInt(lineValues[priIndex]) ;
height = Integer.parseInt(lineValues[hIndex]);
......@@ -505,6 +507,9 @@ public class StorageController {
String areaStr=lineValues[areaIndex];
labelName=areaStr.trim();
}
if(posTypeIndex>=0){
posType=Integer.parseInt(lineValues[posTypeIndex]);
}
}catch (Exception ex){
log.warn("第"+row+"行中有空白内容,此行忽略");
continue;
......@@ -514,6 +519,15 @@ public class StorageController {
log.warn("第"+row+"行中有空白内容,此行忽略");
continue;
}
if(storage.isSolderPaste()&&posType>0){
if(posType>=3){
log.warn("锡膏料仓["+storage.getCid()+"-"+storage.getName()+"]上传库位号,第"+row+"行,库位号["+posName+"]类型="+posType+",此库位忽略");
continue;
}
else if(posType==2){
isWarmPos=true;
}
}
// StoragePos posInfo = storagePosManager.getByPosName(posName);
StoragePos posInfo =findFormList(storagePosList,posName);
......
......@@ -29,6 +29,7 @@ import com.neotel.smfcore.core.storage.rest.query.StoragePosQueryCriteria;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.siemens.SiemensApi;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
......@@ -205,8 +206,17 @@ public class StoragePosController {
taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
dataCache.reloadStorage(storage,"");
}
//如果是料架,库位灭灯
if (storage != null){
if (storage.isShelf() || storage.isNLShelf() || storage.isNLPShelf() || storage.isNLMShelf()){
String opKey = "close";
String opStr = storagePos.getPosName();
DevicesStatusUtil.appendOp(storage.getCid(), opKey , opStr);
log.info("操作库位["+storagePos.getPosName()+"]" + opKey + " : " + opStr);
}
}
}
return ResultBean.newOkResult("");
} catch (Exception e) {
// return e.getMessage();
......
......@@ -18,4 +18,10 @@ public class StorageSearchDto implements Serializable {
@ApiModelProperty("分组ID")
private String groupId = "";
@ApiModelProperty("分组名称")
private String groupName = "";
@ApiModelProperty("料仓类型")
private String type = "";
}
......@@ -9,6 +9,7 @@ import com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Query;
import javax.servlet.http.HttpServletResponse;
......@@ -93,4 +94,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos findByStorageName(String code);
StoragePos findOne(Query query);
Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType);
}
......@@ -332,22 +332,24 @@ public class StoragePosManagerImpl implements IStoragePosManager {
/**
* 根据出库方式获取不同的 Sort
*/
@Override
public Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType){
Sort sort = null;
if(CHECKOUT_TYPE.EXPIRE_FIRST.equals(checkoutType)){//先过期先出
sort = Sort.by(Sort.Direction.ASC, "barcode.expTime","barcode.expireDate","canCheckOutTime");
sort = Sort.by(Sort.Direction.ASC, "barcode.expTime","barcode.expireDate","barcode.putInDate");
}else if(CHECKOUT_TYPE.FIFO.equals(checkoutType)){//严格的先进先出
sort = Sort.by(Sort.Direction.ASC, "canCheckOutTime", "barcode.usedCount");
sort = Sort.by(Sort.Direction.ASC, "barcode.putInDate", "barcode.usedCount");
}else if(CHECKOUT_TYPE.USED_FIRST.equals(checkoutType)){//尾料优先
sort = Sort.by(Sort.Direction.ASC, "barcode.amount", "canCheckOutTime");
sort = Sort.by(Sort.Direction.ASC, "barcode.amount", "barcode.putInDate");
}else if(CHECKOUT_TYPE.PRODUCE_DATE.equals(checkoutType)){
//先生产先出
sort = Sort.by(Sort.Direction.ASC, "barcode.amount","barcode.produceDate", "canCheckOutTime");
sort = Sort.by(Sort.Direction.ASC, "barcode.produceDate","barcode.amount", "barcode.putInDate");
}else if(CHECKOUT_TYPE.BATCH_FIRST.equals(checkoutType)){
//批次优先
sort = Sort.by(Sort.Direction.ASC, "barcode.batch","barcode.produceDate", "canCheckOutTime");
sort = Sort.by(Sort.Direction.ASC, "barcode.batch","barcode.produceDate","barcode.amount", "barcode.putInDate");
}else{//效率优先
sort = Sort.by(Sort.Direction.ASC, "canCheckOutTime", "createDate");
sort = Sort.by(Sort.Direction.ASC, "barcode.putInDate", "createDate");
}
return sort;
}
......
......@@ -24,6 +24,10 @@ public class Storage extends BasePo implements Serializable {
*/
private String sourcePath;
private String cid;
/**
* 附属CID
*/
private String appendCid;
private int totalSlots;
private int emptySlots;
......@@ -62,6 +66,11 @@ public class Storage extends BasePo implements Serializable {
private String groupId = "";
/**
* 分组名称
*/
private String groupName = "";
/**
* 当前绑定的入库单名称
*/
private String inListName="";
......@@ -89,6 +98,13 @@ public class Storage extends BasePo implements Serializable {
}
/**
* 是否是MimoG2
* @return
*/
public boolean isMimoG2(){
return DeviceType.SMD_MIMO_G2.name().equals(type);
}
/**
* 是否是单台自动仓
*/
public boolean isAuto(){
......@@ -264,6 +280,9 @@ public class Storage extends BasePo implements Serializable {
this.emptySlots = this.emptySlots + 1;
int usedCount = usageItem.getUsedCount();
usageItem.setUsedCount(usedCount - 1);
if(usageItem.getUsedCount()<0){
usageItem.setUsedCount(0);
}
usageMap.put(sizeStr, usageItem);
}
}
......
......@@ -37,6 +37,8 @@ public class DataLog extends BasePo implements Serializable ,Comparable<DataLog>
setProviderNumber(barcode.getProviderNumber());
setBatchInfo(barcode.getBatch());
setPutInDate(barcode.getPutInDate());
setW(barcode.getPlateSize());
setH(barcode.getHeight());
msdAppendInfo = new MSDAppendInfo();
msdAppendInfo.setMsl(barcode.getMsl());
......
package com.neotel.smfcore.core.system.util;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.init.MenuInit;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.core.device.bean.MsgInfo;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.storage.service.po.Storage;
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.concurrent.ConcurrentHashMap;
......@@ -18,8 +27,24 @@ import java.util.concurrent.ConcurrentHashMap;
* Created by sunke on 2021/8/4.
*/
@Slf4j
@Service
public class DevicesStatusUtil {
private static DataCache dataCache;
@Autowired
private void setDataCache(DataCache cache) {
this.dataCache = cache;
}
private static MenuInit menuInit;
@Autowired
private void setMenuInit(MenuInit init) {
DevicesStatusUtil.menuInit = init;
}
/**
* 状态 map,key为 cid value 为状态 Bean
*/
......@@ -55,6 +80,21 @@ public class DevicesStatusUtil {
* 更新设备状态信息
*/
public static void updateStatusBean(StatusBean statusBean) {
String cid = statusBean.getCid();
if (statusMap.get(cid) == null) {
Storage storage = dataCache.getStorage(cid);
if (storage != null) {
String menuClient = "";
if (storage.isNLShelf() || storage.isShelf() || storage.isNLMShelf() || storage.isNLPShelf()) {
menuClient = MenuInit.NL_SHOW_MENU;
} else if (storage.isSolderPaste()) {
menuClient = MenuInit.SP_SHOW_MENU;
}
if (StringUtils.isNotBlank(menuClient)) {
menuInit.showMenu(menuClient);
}
}
}
statusMap.put(statusBean.getCid(), statusBean);
}
//
......@@ -158,7 +198,7 @@ public class DevicesStatusUtil {
StatusBean statusBean = new StatusBean();
statusBean.setCid(cid);
statusBean.setTime(System.currentTimeMillis());
statusBean.setMsgList(msgs);
//statusBean.setMsgList(msgs);
clientMsgs.put(cid, statusBean);
return statusBean;
}
......@@ -259,4 +299,26 @@ public class DevicesStatusUtil {
log.error("设备状态定时器执行出错:", ex);
}
}
private static Map<String, MesInfoDto> lastAgvMesMap =new HashMap<>();
public static void UpdateAgvInfo(String key, String request, String response, String status){
MesInfoDto mesInfo=new MesInfoDto(status, DateTime.now(),request,response );
if(ObjectUtil.isEmpty(key)){
key="";
}
lastAgvMesMap.put(key,mesInfo);
}
public static MesInfoDto getLastAgvInfo(String key) {
if (lastAgvMesMap.containsKey(key)) {
return lastAgvMesMap.get(key);
}
return lastAgvMesMap.get("");
}
}
package com.neotel.smfcore.core.system.util;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.*;
@Slf4j
public class EquipStatusUtil {
......@@ -18,9 +18,9 @@ public class EquipStatusUtil {
protected static Map<String, EquipStatusBean> statusMap = Maps.newConcurrentMap();
/**
* CID的设备故障消息(key 为 cid)
* NS设备最后一次MES通信信息(key 为 cid,value是最后一次MesInfo)
*/
private static Map<String, EquipStatusBean> clientMsgs = Maps.newConcurrentMap();
private static Map<String, MesInfoDto> NsMesInfoMap = Maps.newConcurrentMap();
/**
......@@ -38,6 +38,22 @@ public class EquipStatusUtil {
statusMap.put(statusBean.getCid(), statusBean);
}
public static void updateNsMesInfo(String cid,MesInfoDto nsMesInfo) {
if(nsMesInfo==null){
return;
}
if(nsMesInfo.getTime()==null){
nsMesInfo.setTime(DateTime.now());
}
NsMesInfoMap.put(cid, nsMesInfo);
}
public static MesInfoDto getNsMesInfo(String cid){
MesInfoDto mesInfo= NsMesInfoMap.get(cid);
return mesInfo;
}
/**
* 获取所有的设备信息
* @return
......@@ -66,4 +82,24 @@ public class EquipStatusUtil {
log.error("设备状态定时器执行出错:", ex);
}
}
private static Map<String, MesInfoDto> lastAgvMesMap =new HashMap<>();
public static void UpdateAgvInfo(String key, String request, String response, String status){
MesInfoDto mesInfo=new MesInfoDto(status, DateTime.now(),request,response );
if(ObjectUtil.isEmpty(key)){
key="";
}
lastAgvMesMap.put(key,mesInfo);
}
public static MesInfoDto getLastAgvInfo(String key) {
if (lastAgvMesMap.containsKey(key)) {
return lastAgvMesMap.get(key);
}
return lastAgvMesMap.get("");
}
}
......@@ -99,6 +99,11 @@ public class TaskService {
return task;
}
public synchronized String checkout(Storage storage, StoragePos pos, boolean isSingleOut,boolean ngReel, String opUserName,String outType) throws ValidateException{
return checkout(storage,pos,isSingleOut,ngReel,opUserName,outType,"");
}
/**
* 库位出库
*
......@@ -108,7 +113,7 @@ public class TaskService {
* @return
* @throws ValidateException
*/
public synchronized String checkout(Storage storage, StoragePos pos, boolean isSingleOut,boolean ngReel, String opUserName,String outType) throws ValidateException {
public synchronized String checkout(Storage storage, StoragePos pos, boolean isSingleOut,boolean ngReel, String opUserName,String outType,String ngMsg) throws ValidateException {
if (pos.getBarcode() == null) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg);
......@@ -123,6 +128,9 @@ public class TaskService {
task.setSingleOut(isSingleOut);
task.setNgReel(ngReel);
task.setOperator(opUserName);
if (StringUtils.isNotBlank(ngMsg)){
task.updateAppendData("ngMsg",ngMsg);
}
addTaskToExecute(task);
return "";
}
......@@ -542,13 +550,12 @@ public class TaskService {
plateW = pos.getW();
plateH = pos.getH();
}
statusBean.addData("hSerial",task.getSourceName());
String NgMsg=task.getAppendData("ngMsg");
boolean isNg=false;
if(ObjectUtil.isNotEmpty(NgMsg)){
isNg=true;
}
statusBean.addPosInfo(task.getBarcode(), posName, plateW, plateH, isSingleOut,isNg,NgMsg,0);
statusBean.addPosInfo(task.getBarcode(), posName, plateW, plateH, isSingleOut,isNg,NgMsg,0,task.getSourceName());
log.info("出库" + storage.getName() + "[" + posName + "]物料[" + task.getBarcode() + "]" + isSingleOut + "["+NgMsg+"]发送到客户端" + cid);
}
}
......@@ -853,8 +860,8 @@ public class TaskService {
//如果已在库位中,那么自动将该库位的物料出库
log.info("出库已在库位中的物料[" + barcodeSave.getBarcode() + "]");
Storage storage = dataCache.getStorageById(pos.getStorageId());
checkout(storage, pos, true, "");
//checkout(storage, pos, true, "");
checkout(storage,pos,true,true,"","",barcodeSave.getBarcode()+"已存在库位:"+pos.getPosName());
throw new ValidateException("smfcore.error.barcode.exist", "[{0}}]已在{1}}[{2}}]中", new String[]{barcodeSave.getBarcode(), storage.getName(), pos.getPosName()});
}
......
package com.neotel.smfcore.custom.deif20861;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.equipment.service.po.Equipment;
import com.neotel.smfcore.core.equipment.util.EquipmentCache;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
@Slf4j
@RestController
@RequestMapping("/rest/api")
public class DEIF20861Controller {
@Autowired
private DataCache dataCache;
@Autowired
private EquipmentCache equipmentCache;
@ApiOperation("S001 MES或AGV系统获取料仓状态信息")
@RequestMapping("/boxDoorInfo")
@AnonymousAccess
public ResultBean boxDoorInfo( @RequestBody Map<String, Object> paramMap) {
Collection<Storage> storageList = Lists.newArrayList();
storageList.addAll(dataCache.getAllStorage().values());
List<Map<String, Object>> results = Lists.newArrayList();
for (Storage storage : storageList) {
if(!storage.isSmdDuo()){
continue;
}
StatusBean statusBean = DevicesStatusUtil.getStatusBean(storage.getCid());
if (statusBean == null) {
statusBean = new StatusBean();
}
Map<String, BoxStatusBean> boxStatusMap = statusBean.getBoxStatus();
int status = -1;
String shelfS = statusBean.getData().getOrDefault("shelfState", "OFFLINE");
String hserial = statusBean.getData().getOrDefault("hSerial", "");
String shelfType = statusBean.getData().getOrDefault("shelfType", "");
if (boxStatusMap != null) {
BoxStatusBean boxStatusBean = boxStatusMap.get("1");
if (boxStatusBean != null) {
status = boxStatusBean.getStatus();
}
}
if (status == StorageConstants.STATUS.OFFLINE || statusBean.timeOut()) {
//离线
shelfS = "OFFLINE";
}
Map<String, Object> itemMap = new HashMap<>();
itemMap.put("cid", storage.getCid());
String reelSize = shelfType.replace("smallReel", "7").replace("bigReel", "15");
String s = StringUtil.join(reelSize);
itemMap.put("reelSize", s);
itemMap.put("status", shelfS);
itemMap.put("hSerial", hserial);
results.add(itemMap);
}
ResultBean<Object> bean= ResultBean.newOkResult(results);
DevicesStatusUtil.UpdateAgvInfo("",JsonUtil.toJsonStr(paramMap), JsonUtil.toJsonStr(bean),"OK");
return bean;
}
@ApiOperation("S002 MES或AGV系统操作料仓门打开或关闭")
@RequestMapping("/boxDoorOp")
@AnonymousAccess
public ResultBean boxDoorOp(@RequestBody Map<String, Object> paramList) {
// 请求参数参数名参数描述类型是否必填备注
// cid料仓编号String是
// op操作String是OPEN=开门,CLOSE=关门
// 参数示例{"cid":"001","op":"OPEN"}
// 返回结果参数名参数描述类型是否必填备注
// code状态码。Integer是0为正常。其他为异常。
// msg提示消息String是
// data
//
// 返回示例{ "code": 0, "msg": "ok", "data": ""}
log.info("{}收到数据为:{}", "boxDoorOp", JsonUtil.toJsonStr(paramList));
String cid = paramList.get("cid").toString();
String op = paramList.get("op").toString();
StatusBean statusBean = DevicesStatusUtil.getStatusBean(cid);
if (statusBean == null || statusBean.timeOut()) {
return ResultBean.newErrorResult(1, "smfcore.duo.offline", "设备{0}离线", new String[]{cid});
}
// closeLock 为enable时此按钮状态为可用,openLock 为enable时,此按钮状态为可用已读
// 客户端收到服务器openLock为doit时,执行打开门锁动作,closeLock为doit时,执行关闭门锁
String opKey = "";
if (op.equals("OPEN")) {
opKey = "openLock";
}
if (op.equals("CLOSE")) {
opKey = "closeLock";
}
if (ObjectUtil.isNotEmpty(opKey)) {
String openLock = statusBean.getData().getOrDefault(opKey, "");
if (openLock.equals("enable")) {
String opValue = "doit";
log.info("boxDoorOp:cid=" + cid + "," + opKey + "=" + opValue);
DevicesStatusUtil.addOp(cid, opKey, opValue);
return ResultBean.newOkResult("smfcore.msg.ok", "操作成功");
}
}
return ResultBean.newErrorResult(2,"smfcore.msg.op.fail","操作失败");
}
@ApiOperation("S003 NS200设备状态查询")
@RequestMapping("/nsShelfInfo")
@AnonymousAccess
public ResultBean nsShelfInfo( @RequestBody Map<String, Object> paramMap) {
Collection<Equipment> storageList = Lists.newArrayList();
storageList.addAll(equipmentCache.getAllEquipment().values());
List<Map<String, Object>> results = Lists.newArrayList();
for (Equipment equipment : storageList) {
if(!equipment.isNEOSCAN()){
continue;
}
StatusBean statusBean = DevicesStatusUtil.getStatusBean(equipment.getCid());
if (statusBean == null) {
statusBean = new StatusBean();
}
Map<String, BoxStatusBean> boxStatusMap = statusBean.getBoxStatus();
int status = -1;
String outShelfStatus = statusBean.getData().getOrDefault("outShelfStatus ", "OFFLINE");
String inShelfStatus = statusBean.getData().getOrDefault("inShelfStatus ", "OFFLINE");
if (boxStatusMap != null) {
BoxStatusBean boxStatusBean = boxStatusMap.get("1");
if (boxStatusBean != null) {
status = boxStatusBean.getStatus();
}
}
if (status == StorageConstants.STATUS.OFFLINE || statusBean.timeOut()) {
//离线
outShelfStatus = "OFFLINE";
inShelfStatus="OFFLINE";
}
Map<String, Object> itemMap = new HashMap<>();
itemMap.put("cid", equipment.getCid());
itemMap.put("reelSize", "7,15");
itemMap.put("inShelfStatus", inShelfStatus);
itemMap.put("outShelfStatus", outShelfStatus);
results.add(itemMap);
}
ResultBean<Object> bean= ResultBean.newOkResult(results);
EquipStatusUtil.UpdateAgvInfo("",JsonUtil.toJsonStr(paramMap), JsonUtil.toJsonStr(bean),"OK");
return bean;
}
}
......@@ -106,7 +106,7 @@ public class DJK20388AGVController {
Map<String, Storage> storages = dataCache.getAllStorage();
for (Storage storage :
storages.values()) {
if (storage.isBatchStorage()) {
if (storage.isBatchStorage()||storage.isMimoG2()) {
cid = storage.getCid();
break;
}
......
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
......@@ -135,8 +136,12 @@ public class IriichiApi extends BaseSmfApiListener {
return "";
}
private LiteOrder getOrderByResult(String orderNo, String result) {
JSONObject resultObj = JSONObject.parseObject(result);
if (resultObj.get("Items") == null){
throw new ValidateException("mes.api.orderError",result);
}
List<List<Map<String, String>>> itemArr = resultObj.getObject("Items", List.class);
List<LiteOrderItem> itemList = new ArrayList<>();
for (List<Map<String, String>> mapList : itemArr) {
......
package com.neotel.smfcore.custom.keboda1335;
import com.neotel.smfcore.common.init.MenuInit;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.security.service.po.Menu;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* @author sunke
* @date 2022/12/14 4:01 PM
*/
@Component
public class Keboda1335Menu {
@Autowired
MenuInit menuInit;
@Autowired
SmfApi smfApi;
@PostConstruct
public void init(){
String menuLabel = "kbd";
MenuInit.addMenu(menuLabel,null, -1, "看板", "kebodaKanban", "kebodakanban/index","kanbanMenu");
MenuInit.addMenu(menuLabel,null, -1, "库存", "kebodaInventory", "neolight/kebodaInventory/index","inventory");
String apiName = smfApi.getApiName();
if(Strings.isNotBlank(apiName) && apiName.equals(menuLabel)){
menuInit.showMenu(apiName);
}
}
}
package com.neotel.smfcore.custom.keboda1335;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao;
import com.neotel.smfcore.core.system.service.po.AlarmInfo;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/keboda")
public class KebodaController {
@Autowired
private DataCache dataCache;
@Autowired
private TaskService taskService;
@Autowired
private IAlarmInfoDao alarmInfoDao;
@Autowired
private SmfApi smfApi;
@Autowired
private CodeResolve codeResolve;
@Autowired
private IStoragePosManager storagePosManager;
/**
* 流水线提示消息
*/
private static String lineMsg = "";
/**
* 流水线入库查找空的料格
*/
@ApiOperation("环行线扫码获取库位号")
@PostMapping(value = "/service/store/emptyPosForPutin")
@ResponseBody
@AnonymousAccess
public synchronized Map<String, Object> emptyPosForPutin(HttpServletRequest request) {
String code = request.getParameter("code");
String cids = request.getParameter("cids");
String rfid = request.getParameter("rfid");
String rfidLoc = request.getParameter("rfidLoc");
String lastPosId = request.getParameter("lastPosId");
lineMsg = "";
log.info("流水线[" + cids + "]获取[" + rfid + "][" + code + "]的入库库位");
Map<String, Object> resultMap = Maps.newHashMap();
if (dataCache.getCache(Constants.CACHE_StopOut)) {
lineMsg = "系统更新中,暂停出入库";
DeviceMessageUtil.updateLineMsg(lineMsg, code, cids, "", "smfcore.linemsg.update", null);
resultMap.put("result", "100");
resultMap.put("msg", lineMsg);
return resultMap;
}
String okMsg = "";
String errorMsg = "";
List<String> needRemoveReelLockPosIdList = new ArrayList<>();
if (Strings.isNullOrEmpty(cids)) {
resultMap.put("result", "101");
resultMap.put("msg", "未指定料仓 cids ");
} else {
List<Storage> storageList = Lists.newArrayList();
List<String> cidList = Lists.newArrayList();
for (String cid : cids.split(",")) {
String notIntoCids = dataCache.getSettings().getNotIntoCids();
if (notIntoCids != null) {
if (notIntoCids.contains(cid)) {
log.info("料仓[" + cid + "]已被屏蔽入库");
continue;
}
}
Storage storage = dataCache.getStorage(cid);
if (storage != null) {
storageList.add(storage);
cidList.add(cid);
}
}
if (storageList.isEmpty()) {
resultMap.put("result", "99");
errorMsg = "无可用的料仓";
resultMap.put("msg", errorMsg);
} else {
try {
CodeValidateParam params = new CodeValidateParam("", "", "", code, "");
params.setStorageList(storageList);
Barcode barcode = resolveBarcodeFromApi(params);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.invalid", "未找到有效的条码");
}
for (DataLog dataLog : taskService.getQueueTasks()) {
// if(!dataLog.isPackageReel()){
//已经在任务当中,返回对应的信息
if (dataLog.getBarcode().equals(barcode.getBarcode())) {
if (dataLog.isPutInTask()) {
//已有入库任务
errorMsg = "物料[" + dataLog.getBarcode() + "]已有入库任务,需继续执行入库动作";
resultMap.put("pos", dataLog.getPosName());
resultMap.put("barcode", barcode.getBarcode());
resultMap.put("cid", dataLog.getCid());
return resultMap;
} else {
//已有出库任务
errorMsg = "物料[" + dataLog.getBarcode() + "]已有出库任务,需继续执行出库动作";
resultMap.put("result", "98");
resultMap.put("msg", errorMsg);
resultMap.put("posId", dataLog.getPosName());
resultMap.put("plateW", barcode.getPlateSize());
resultMap.put("plateH", barcode.getHeight());
resultMap.put("singleOut", dataLog.isSingleOut() + "");
//紧急料
resultMap.put("urgentReel", dataLog.isUrgentReel() + "");
//需要分盘,进入分盘料
resultMap.put("cutReel", dataLog.isCutReel() + "");
resultMap.put("rfid", "");
resultMap.put("realRfid", "");
resultMap.put("rfidLoc", "");
// resultMap.put("rfid", dataLog.getTempRfid());
// resultMap.put("realRfid",dataLog.getAppendInfo().getRfid());
// resultMap.put("rfidLoc", dataLog.getAppendInfo().getRfidLoc() + "");
resultMap.put("barcode", dataLog.getBarcode());
boolean smallReel = barcode.isSmallReel();
resultMap.put("smallReel", smallReel + "");
return resultMap;
}
// }
}
}
StoragePos pos = null;
while (pos == null){
pos = taskService.findEmptyPosForPutIn(storageList, barcode, rfid, lastPosId);
if (pos == null){
break;
}
//如果是以S结尾的,则判断不带S的有没有料
String posName = pos.getPosName();
if (posName.endsWith("S") || posName.endsWith("s")){
log.info(posName+"以S结尾,需要判断外层有没有物料");
posName = posName.substring(0,posName.length()-1);
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null){
if (storagePos.getBarcode() != null){
log.info(posName+"有物料信息,重新查找库位");
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(pos.getId());
reelLocInfo.setCid(dataCache.getStorageById(pos.getStorageId()).getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
ReelLockPosUtil.addReelLockPosInfo(reelLocInfo,cidList);
needRemoveReelLockPosIdList.add(pos.getId());
pos = null;
}
}
}
}
if (pos != null) {
// Storage storage = dataCache.getStorageById(pos.getStorageId());
// if(!storage.isPackage()){
// //不是包装仓,如果所在料仓有出库任务,暂停入库
// Collection<DataLog> tasks = taskService.getQueueTasks();
// for (DataLog task : tasks) {
// if(task.isCheckOutTask() && task.getStorageId().equals(pos.getStorageId())){
// errorMsg = "库位["+ pos.getPosName() + "]所在料仓有出库任务,暂停入库";
// lineMsg = errorMsg;
// resultMap.put("result","99");
// resultMap.put("msg",errorMsg);
// return resultMap;
// }
// }
// }
Storage theStorage = dataCache.getStorageById(pos.getStorageId());
resultMap.put("result", "0");
resultMap.put("msg", "");
okMsg = "[" + rfid + "][" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "]优先级[" + pos.getPriority() + "] 上个库位号[" + lastPosId + "]";
ReelLockPosInfo oldLockInfo = ReelLockPosUtil.getLockPosInfoByCode(barcode.getBarcode());
if (oldLockInfo != null) {
if (!oldLockInfo.getLockPosId().equals(pos.getId())) {
String result = "-1";
okMsg = rfid + "[" + rfidLoc + "][" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "],清理旧有锁定信息";
resultMap.put("result", result);
resultMap.put("msg", okMsg);
//已经锁定过库位,但不是同一个条码,需要把对应位置的锁定信息清理掉
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
}
}
log.info(okMsg + oldLockInfo);
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(barcode.getBarcode());
reelLocInfo.setCid(theStorage.getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
if (reelLocInfo == null) {
errorMsg = "[" + barcode.getBarcode() + "]库位[" + reelLocInfo.getLockPosName() + "]已被锁定,暂停入库";
lineMsg = errorMsg;
DeviceMessageUtil.updateLineMsg(lineMsg, code, cids, reelLocInfo.getLockPosName(), "smfcore.linemsg.posLock", new String[]{barcode.getBarcode(), reelLocInfo.getLockPosName()});
resultMap.put("result", "99");
resultMap.put("msg", errorMsg);
return resultMap;
} else {
resultMap.put("pos", pos.getPosName());
resultMap.put("barcode", barcode.getBarcode());
resultMap.put("cid", theStorage.getCid());
}
} else {
resultMap.put("result", "104");
errorMsg = "[" + barcode.getBarcode() + "]未找到可用的[" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]仓位";
resultMap.put("msg", errorMsg);
}
} catch (ValidateException ve) {
errorMsg = ve.getMessage();
log.info("查找空库位失败:" + errorMsg);
resultMap.put("result", "105");
resultMap.put("msg", MessageUtils.getText(ve.getMsgKey(), ve.getMsgParam(), request.getLocale(), ve.getDefaultMsg()));
} catch (Exception e) {
errorMsg = e.getMessage();
log.info("查找空库位失败,", e);
resultMap.put("result", "105");
resultMap.put("msg", errorMsg);
}
}
}
//没入成功
if (!errorMsg.isEmpty()) {
//有错误,记录日志
AlarmInfo alarmInfo = new AlarmInfo();
alarmInfo.setBoxId("0");
alarmInfo.setStorageName("流水线");
alarmInfo.setInOutStatus("1");
alarmInfo.setAlarmType("入库");
Date date = new Date();
alarmInfo.setStartTime(date);
alarmInfo.setEndTime(date);
String msg = "[" + code + "]" + errorMsg;
alarmInfo.setAlarmMsg(msg);
alarmInfoDao.save(alarmInfo);
lineMsg = errorMsg;
DeviceMessageUtil.updateLineMsg(lineMsg, code, cids, "", "", null);
} else {
lineMsg = okMsg;
DeviceMessageUtil.lastLineMsg = null;
}
if (needRemoveReelLockPosIdList != null && !needRemoveReelLockPosIdList.isEmpty()) {
for (String posId : needRemoveReelLockPosIdList) {
ReelLockPosUtil.removeReelLockPosInfo(posId);
}
}
return resultMap;
}
public Barcode resolveBarcodeFromApi(CodeValidateParam params) {
Barcode barcodeSave = smfApi.canPutInBeforeResolve(params);
if (barcodeSave == null) {
barcodeSave = codeResolve.resolveOneValideBarcode(params.getCode());
}
//从API验证
Barcode barcodeFromApi = smfApi.canPutInAfterResolve(params, barcodeSave);
if (barcodeFromApi != null) {
barcodeSave = barcodeFromApi;
}
return barcodeSave;
}
}
......@@ -16,6 +16,8 @@ import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
......@@ -45,6 +47,8 @@ public class PanaApiController extends BaseSmfApiListener {
protected TaskService taskService;
@Autowired
protected IStoragePosManager storagePosManager;
@Autowired
protected LiteOrderCache liteOrderCache;
protected static DataCache dataCache;
......@@ -136,6 +140,13 @@ public class PanaApiController extends BaseSmfApiListener {
String JobID = panaMaterial.getJobID();
List<String> ReelBarcodes = panaMaterial.getReelBarcodes();//["ABC123","BCD345","LL13212"]
log.info("收到 PanaCIM 的deliverMaterial 命令:ReelBarcodes="+ StringUtils.join(ReelBarcodes,","));
//获取亮灯颜色
ORDER_COLOR nextColor = liteOrderCache.getNextColor();
if (nextColor == null){
nextColor = ORDER_COLOR.BLUE;
}
List<String> ReelBarcodesDelivered = Lists.newArrayList();
List<String> ReelBarcodesNonExisting = Lists.newArrayList();
for (String barcode : ReelBarcodes){//加入到出库列表
......@@ -147,7 +158,7 @@ public class PanaApiController extends BaseSmfApiListener {
continue;
}
log.info("出库["+barcode+"]位置仓位【"+pos.getPosName()+"】");
taskService.checkout(pos,false,null,false);
taskService.checkout(pos,false,null,false,nextColor.getRgb());
ReelBarcodesDelivered.add(barcode);
}catch (Exception e){
ReelBarcodesNonExisting.add(barcode);
......@@ -323,6 +334,13 @@ public class PanaApiController extends BaseSmfApiListener {
result.put("ErrorCode","401");
result.put("ErrorMessage","JobID["+JobID+"]未包含物料");
}else{
//获取亮灯颜色
ORDER_COLOR nextColor = liteOrderCache.getNextColor();
if (nextColor == null){
nextColor = ORDER_COLOR.BLUE;
}
List<DataLog> tasks = Lists.newArrayList();
for (StoragePos pos :lockPoses){
//已经加过的就不再加了
......@@ -355,6 +373,8 @@ public class PanaApiController extends BaseSmfApiListener {
task.setPosId(pos.getId());
task.setPosName(pos.getPosName());
task.setLightColor(nextColor.getRgb());
tasks.add(task);
}
......
......@@ -250,8 +250,12 @@ public class MesApiController {
return "Error: RI 为必须项";
}
//rgbCode为空时,默认是蓝色
if (StringUtils.isBlank(rgbCode)){
rgbCode = "0000FF";
}
//判断亮灯颜色是否在这20种内
if (StringUtils.isBlank(colorMap.get(rgbCode)) || StringUtils.isBlank(rgbCode)){
if (StringUtils.isBlank(rgbCode) || StringUtils.isBlank(colorMap.get(rgbCode))) {
return "Error :rgbCode不在指定范围内";
//return "Error: rgbCode 不在颜色范围内";
}
......
......@@ -17,6 +17,8 @@ package com.neotel.smfcore.security.service;
import com.neotel.smfcore.common.exception.EntityNotFoundException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.Md5Utls;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.security.rest.bean.dto.JwtUserDto;
......@@ -57,21 +59,21 @@ public class UserDetailsServiceImpl implements UserDetailsService {
if (user == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"username", username});
} else {
// if(user.getEnabled()==null){
// throw new ValidateException("smfcore.notActivated","账号未激活");
// }
// if (!user.getEnabled()) {
// throw new ValidateException("smfcore.notActivated","账号未激活");
// }
// if(user.getUsername().equals(Constants.SUPER_USERNAME)){
//
// }else {
// //判断激活码是否正确
// String code = Md5Utls.getMd5(user.getId(), user.getCreateDate());
// if (!code.equals(user.getCheckCode())) {
// throw new ValidateException("smfcore.notActivated","账号未激活");
// }
// }
if(user.getEnabled()==null){
throw new ValidateException("smfcore.notActivated","账号未激活");
}
if (!user.getEnabled()) {
throw new ValidateException("smfcore.notActivated","账号未激活");
}
if(user.getUsername().equals(Constants.SUPER_USERNAME)){
}else {
//判断激活码是否正确
String code = Md5Utls.getMd5(user.getId(), user.getCreateDate());
if (!code.equals(user.getCheckCode())) {
throw new ValidateException("smfcore.notActivated","账号未激活");
}
}
List<Long> dataScopes = new ArrayList<>();
jwtUserDto = new JwtUserDto(
user,
......
......@@ -2,7 +2,7 @@
# 登录相关配置
login:
single-login: false
single-login: true
#配置数据源
spring:
......@@ -12,6 +12,10 @@ spring:
host: localhost # 主机地址
port: 27017 # 端口
database: smf # 数据库
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
#jwt
jwt:
......
......@@ -380,4 +380,8 @@ smfcore.agv.dispatch=\u8D27\u7269\u5DF2\u7ECF\u53D1\u9001\u5230\u5B58\u50A8\u7CF
smfcore.agv.awaitingInstruction=\u7B49\u5F85\u6307\u793A
smfcore.agv.operation=AGV\u5728\u8FD0\u884C\u4E2D
smfcore.boxmimokanban=\u4E91\u6599\u4ED3\u770B\u677F
smfcore.neoai=Neo Ai
\ No newline at end of file
smfcore.neoai=Neo Ai
smfcore.duo.offline=\u8BBE\u5907{0}\u79BB\u7EBF
smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
smfcore.equip.notExist=\u8BBE\u5907\u4E0D\u5B58\u5728
smfcore.order.finished=\u5DE5\u5355[{0}]\u7684\u4EFB\u52A1\u5DF2\u5168\u90E8\u5B8C\u6210
\ No newline at end of file
......@@ -371,4 +371,8 @@ smfcore.agv.dispatch=Goods dispatched to storage system
smfcore.agv.awaitingInstruction=Awaiting instruction
smfcore.agv.operation=AGV is in operation
smfcore.boxmimokanban=SMD BOX KANBAN
smfcore.neoai=Neo Ai
\ No newline at end of file
smfcore.neoai=Neo Ai
smfcore.duo.offline=Equipment {0} offline
smfcore.msg.op.fail=failure of an operation
smfcore.equip.notExist=Device does not exist
smfcore.order.finished=workorder[{0}] has completed all of its tasks
\ No newline at end of file
......@@ -367,4 +367,8 @@ smfcore.agv.awaitingInstruction=\u6307\u793A\u5F85\u3061
smfcore.agv.operation=AGV\u52D5\u4F5C\u4E2D\u3067\u3059
smfcore.boxmimokanban=\u30AF\u30E9\u30A6\u30C9\u5009\u5EAB\u30AB\u30F3\u30D0\u30F3
smfcore.neoai=Neo Ai
\ No newline at end of file
smfcore.neoai=Neo Ai
smfcore.duo.offline=\u8BBE\u5907{0}\u79BB\u7EBF
smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
smfcore.equip.notExist=\u8BBE\u5907\u4E0D\u5B58\u5728
smfcore.order.finished=\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC[{0}]\u306E\u30BF\u30B9\u30AF\u306F\u3059\u3079\u3066\u5B8C\u4E86\u3057\u307E\u3057\u305F
\ No newline at end of file
......@@ -367,4 +367,8 @@ smfcore.agv.awaitingInstruction=\u7B49\u5F85\u6307\u793A
smfcore.agv.operation=AGV\u5728\u8FD0\u884C\u4E2D
smfcore.boxmimokanban=\u4E91\u6599\u4ED3\u770B\u677F
smfcore.neoai=Neo Ai
\ No newline at end of file
smfcore.neoai=Neo Ai
smfcore.duo.offline=\u8BBE\u5907{0}\u79BB\u7EBF
smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
smfcore.equip.notExist=\u8BBE\u5907\u4E0D\u5B58\u5728
smfcore.order.finished=\u5DE5\u5355[{0}]\u7684\u4EFB\u52A1\u5DF2\u5168\u90E8\u5B8C\u6210
\ No newline at end of file
......@@ -367,4 +367,8 @@ smfcore.agv.awaitingInstruction=\u7B49\u5F85\u6307\u793A
smfcore.agv.operation=AGV\u6B63\u5728\u904B\u884C
smfcore.boxmimokanban=\u96F2\u6599\u5009\u770B\u677F
smfcore.neoai=Neo Ai
\ No newline at end of file
smfcore.neoai=Neo Ai
smfcore.duo.offline=\u8A2D\u5099{0}\u96E2\u7DDA
smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u6557
smfcore.equip.notExist=\u8A2D\u5099\u4E0D\u5B58\u5728
smfcore.order.finished=\u5DE5\u55AE[{0}]\u7684\u4EFB\u52D9\u5DF2\u5168\u90E8\u5B8C\u6210
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!