Commit e72be902 LN

增加英文日志EnLog

1 个父辈 dcf74fdf
正在显示 103 个修改的文件 包含 1001 行增加14 行删除
package com.neotel.smfcore.common.base;
import com.neotel.smfcore.common.config.mongodb.MongoDbConfig;
import com.neotel.smfcore.common.enlog.EnLog;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -36,17 +37,20 @@ public abstract class AbstractBaseDao implements IBaseDao {
if (bean.getId() == null || "".equals(bean.getId())) {
bean.setId(getNextId(getEntityClass().getName()));
log.debug("Bean is created with id: " + bean.getId());
EnLog.debug("Bean is created with id: " + bean.getId());
bean.setCreateDate(new Date(System.currentTimeMillis()));
}
bean.setUpdateDate(new Date(System.currentTimeMillis()));
getMongoTemplate().save(bean);
log.debug("Bean " + getEntityClass() + " is saved with id " + bean.getId());
EnLog.debug("Bean " + getEntityClass() + " is saved with id " + bean.getId());
try {
if (getBackUpMongoTemplate() != null) {
getBackUpMongoTemplate().save(bean);
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "save", e.getMessage());
EnLog.error("Backup DB operation failed [save]: " + e.getMessage());
}
return bean;
}
......@@ -66,6 +70,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "insertAll", e.getMessage());
EnLog.error("Backup DB operation failed [insertAll]: " + e.getMessage());
}
}
return beanList;
......@@ -143,6 +148,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "updateMulti", e.getMessage());
EnLog.error("Backup DB operation failed [updateMulti]: " + e.getMessage());
}
}
......@@ -155,6 +161,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "updateFirst", e.getMessage());
EnLog.error("Backup DB operation failed [updateFirst]: " + e.getMessage());
}
}
......@@ -209,6 +216,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "removeOneById", e.getMessage());
EnLog.error("Backup DB operation failed [removeOneById]: " + e.getMessage());
}
}
}
......@@ -223,6 +231,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "removeOne", e.getMessage());
EnLog.error("Backup DB operation failed [removeOne]: " + e.getMessage());
}
}
......@@ -244,6 +253,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "removeByQuery", e.getMessage());
EnLog.error("Backup DB operation failed [removeByQuery]: " + e.getMessage());
}
}
}
......@@ -261,6 +271,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "removeAll", e.getMessage());
EnLog.error("Backup DB operation failed [removeAll]: " + e.getMessage());
}
}
}
......@@ -288,6 +299,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
if (sequence == null) {
log.info("Seq bean is null, create new one with domain " + domain);
EnLog.info("Seq bean is null, create new one with domain " + domain);
sequence = new Sequence();
sequence.setId(domain);
sequence.setSeq(new Long(1));
......@@ -300,6 +312,7 @@ public abstract class AbstractBaseDao implements IBaseDao {
}
} catch (Exception e) {
log.error("{}备份库操作失败:{}", "getNextId", e.getMessage());
EnLog.error("Backup DB operation failed [getNextId]: " + e.getMessage());
}
return sequence.getSeq().toString();
}
......
......@@ -7,6 +7,7 @@ import com.mongodb.client.MongoClients;
import com.mongodb.connection.ClusterConnectionMode;
import com.mongodb.connection.ClusterType;
import com.neotel.smfcore.common.config.mongodb.bean.CustomMongoProperties;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.NetwrokUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
......@@ -62,8 +63,10 @@ public class MongoDbConfig {
mongoProperties.setPort(NO_PORT);
mongoProperties.setDatabase(NO_DATABASE);
log.warn("backUpMongoTemplate no Config");
EnLog.warn("backUpMongoTemplate no config");
} else if (ipList.contains(mongoProperties.getHost()) && mongoProperties.getDatabase().equals(baseDatabase)) {
log.warn("backUpMongoTemplate 不可用,配置的是本机: ip[" + mongoProperties.getHost() + "] db [" + mongoProperties.getDatabase() + "] baseDb[" + baseDatabase + "] ");
EnLog.warn("backUpMongoTemplate unavailable, configured as local: ip[" + mongoProperties.getHost() + "] db [" + mongoProperties.getDatabase() + "] baseDb[" + baseDatabase + "]");
mongoProperties.setHost(NO_HOST);
mongoProperties.setPort(NO_PORT);
mongoProperties.setDatabase(NO_DATABASE);
......@@ -71,11 +74,13 @@ public class MongoDbConfig {
//如果配置的IP 不通,也不需要备份
else if (!NetwrokUtils.pingIPAddress(mongoProperties.getHost())) {
log.warn("backUpMongoTemplate 不可用,地址ping不通 ip[" + mongoProperties.getHost() + "] ");
EnLog.warn("backUpMongoTemplate unavailable, host unreachable: ip[" + mongoProperties.getHost() + "]");
mongoProperties.setHost(NO_HOST);
mongoProperties.setPort(NO_PORT);
mongoProperties.setDatabase(NO_DATABASE);
} else {
log.info("backUpMongoTemplate 可用:ip[" + mongoProperties.getHost() + "] db [" + mongoProperties.getDatabase() + "] ");
EnLog.info("backUpMongoTemplate available: ip[" + mongoProperties.getHost() + "] db [" + mongoProperties.getDatabase() + "]");
}
return new MongoTemplate(mongoDbFactory(mongoProperties));
}
......
......@@ -21,6 +21,7 @@
package com.neotel.smfcore.common.csv;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import lombok.extern.slf4j.Slf4j;
......@@ -48,12 +49,14 @@ public class CsvReader {
if (headers.length > 0 && ObjectUtil.isNotEmpty(headers[0]) && isMessyCode(headers[0])) {
needReload = true;
log.info("文件[" + fileURL + "]有乱码,改为" + reloadEncodeing + "重新读取");
EnLog.info("File [" + fileURL + "] has garbled text, reread using " + reloadEncodeing);
}
else if (ObjectUtil.isNotEmpty(titleName) || ObjectUtil.isNotEmpty(titleNameEn)) {
int index = csvRead.getIndex(titleName, titleNameEn);
if (index == -1) {
needReload = true;
log.info("文件[" + fileURL + "]未包含列[" + titleName + "][" + titleNameEn + "],改为" + reloadEncodeing + "重新读取");
EnLog.info("File [" + fileURL + "] does not contain columns [" + titleName + "][" + titleNameEn + "], reread using " + reloadEncodeing);
}
}
//未找到列,重新读取
......@@ -317,6 +320,7 @@ public class CsvReader {
int index = getIndex(titleName,titleNameEn);
if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
EnLog.info("Missing column [" + titleName + "] or [" + titleNameEn + "]");
// throw new ValidateException("必须包含["+titleNameEn+"]列");
throw new ValidateException("smfcore.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
}
......@@ -326,6 +330,7 @@ public class CsvReader {
int index = getIndex(titleName,titleNameEn);
if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
EnLog.info("Missing column [" + titleName + "] or [" + titleNameEn + "]");
}
return index;
}
......@@ -1877,4 +1882,4 @@ public class CsvReader {
public static final int INITIAL_COLUMN_BUFFER_SIZE = 50;
}
}
\ No newline at end of file
}
......@@ -3,19 +3,68 @@ package com.neotel.smfcore.common.enlog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
import java.util.Arrays;
@Slf4j
@Service
public class EnLog {
public static void info(String msg) {
log.info(msg);
}
public static void info(String pattern, Object... args) {
log.info(format(pattern, args));
}
public static void debug(String msg) {
log.debug(msg);
}
public static void debug(String pattern, Object... args) {
log.debug(format(pattern, args));
}
public static void trace(String msg) {
log.trace(msg);
}
public static void trace(String pattern, Object... args) {
log.trace(format(pattern, args));
}
public static void error(String msg) {
log.error(msg);
}
public static void error(String pattern, Object... args) {
log.error(format(pattern, args));
}
public static void error(String msg, Exception e) {
log.error(msg, e);
}
public static void error(String pattern, Exception e, Object... args) {
log.error(format(pattern, args), e);
}
public static void warn(String msg) {
log.warn(msg);
}
public static void warn(String pattern, Object... args) {
log.warn(format(pattern, args));
}
private static String format(String pattern, Object... args) {
if (args == null || args.length == 0) {
return pattern;
}
try {
return MessageFormat.format(pattern, args);
} catch (Exception e) {
return pattern + " " + Arrays.toString(args);
}
}
}
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.common.excel;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
......@@ -55,6 +56,7 @@ public class ExcelReader {
if (headerMap.size() <= 2) {
if (headRowNumber <= 1) {
log.error("文件[" + fileName + "],当前读取表头数[" + headerData.size() + "],当前headRowNumber=[" + headRowNumber + "],设置headRowNumber=3重新读取");
EnLog.error("File [" + fileName + "], header count [" + headerData.size() + "], headRowNumber=[" + headRowNumber + "], set headRowNumber=3 and reread");
return readHeaderMap(fileName, 3);
} else {
return headerMap;
......
......@@ -5,6 +5,7 @@ import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.util.ConverterUtils;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
......@@ -28,6 +29,7 @@ public class NoModelDataListener extends AnalysisEventListener<Map<Integer, Str
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
log.info("所有数据解析完成,共"+cachedDataList.size()+"条数据!");
EnLog.info("All data parsed, total " + cachedDataList.size() + " rows");
}
public List<Map<Integer, String>> getData(){
......
......@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import com.neotel.smfcore.common.enlog.EnLog;
import javax.annotation.PostConstruct;
import java.util.*;
......@@ -74,6 +75,7 @@ public class DataInitManager {
public void DataInit() {
try {
log.info("smfcore Version:["+version+"], 初始化环境...");
EnLog.info("smfcore Version: ["+version+"], Initializing environment...");
startRunTime=new Date();
//查询admin的用户是否存在
String userName = Constants.SUPER_USERNAME;
......@@ -81,20 +83,25 @@ public class DataInitManager {
if (admin == null) {
log.info("开始创建默认用户...");
EnLog.info("Start creating default user...");
Set<String> groupIds = new HashSet<>();
Role role = new Role(new HashSet<>(), "admin", "admin");
role = roleManager.save(role);
log.info("创建默认角色:" + role.toString());
EnLog.info("Create default role: " + role.toString());
Role operator = new Role(new HashSet<>(), "operator", "operator");
operator = roleManager.save(operator);
log.info("创建默认角色:" + operator.toString());
EnLog.info("Create default role: " + operator.toString());
admin = new User(userName, "admin@qq.com", "zh-CN", role.getId(), "$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa", true, true, new Date(), groupIds, "");
admin = userManager.save(admin);
log.info("创建默认用户:" + admin.toString());
EnLog.info("Create default user: " + admin.toString());
} else {
log.info("初始化环境完成...");
EnLog.info("Environment initialization completed...");
}
menuInit.updateMenu(menuShowList,menuHideList);
......@@ -114,6 +121,7 @@ public class DataInitManager {
} catch (Exception exception) {
log.error("初始化环境出错..." + exception.toString(),exception);
EnLog.error("Environment initialization failed: " + exception.toString(), exception);
}
}
}
......@@ -6,6 +6,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.common.enlog.EnLog;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,6 +35,7 @@ public class MainTimer {
liteOrderCache.loadUnEndOrderInfos();
log.info("主定时器开启,60秒后开始执行, 每10s执行一次");
EnLog.info("Main timer started, run after 60s, execute every 10s");
//1 分钟之后执行,每秒钟执行一次
scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
@Override
......@@ -44,6 +46,7 @@ public class MainTimer {
}
private void initTask() {
log.info("开始加载未完成的任务...");
EnLog.info("Start loading unfinished tasks...");
List<DataLog> unExecuteTasks = dataLogManager.findUnFinishedTasks();
for (DataLog unExecuteTask : unExecuteTasks) {
if (unExecuteTask.isExecuting() || unExecuteTask.isWait()||unExecuteTask.isOutBox()||unExecuteTask.isInLine()|| unExecuteTask.isInRobot()||unExecuteTask.isBoxdoor()) {
......@@ -51,10 +54,12 @@ public class MainTimer {
taskService.addTaskToExecute(unExecuteTask);
}catch (Exception e){
log.error("初始化任务["+unExecuteTask+"]出错:"+e);
EnLog.error("Init task [" + unExecuteTask + "] error", e);
}
}
}
log.info("加载未完成的任务完成,共[" + unExecuteTasks.size() + "]条数据...");
EnLog.info("Finished loading unfinished tasks, total [" + unExecuteTasks.size() + "] records");
}
private void timerTask(){
......@@ -68,6 +73,7 @@ public class MainTimer {
EquipStatusUtil.runTimer();
}catch (Exception e){
log.error("定时器执行出错",e);
EnLog.error("Timer execution error",e);
}finally {
}
......
package com.neotel.smfcore.common.init;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.security.service.manager.IMenuManager;
import com.neotel.smfcore.security.service.manager.IRoleManager;
import com.neotel.smfcore.security.service.po.Menu;
......@@ -74,6 +75,7 @@ public class MenuInit {
addMenu(label,menu);
}else{
log.error("标记菜单["+menuPath+"]为["+label+"]时,未找到菜单");
EnLog.error("Menu not found when labeling menu [" + menuPath + "] as [" + label + "]");
}
}
}
......@@ -240,6 +242,7 @@ public class MenuInit {
List<String> menuList = Lists.newArrayList();
if(dbMenus.isEmpty()){
log.info("创建默认菜单...");
EnLog.info("Creating default menus...");
for (Menu menu : getAllMenuMap().values()) {
if(menu.getClients().contains(DEFAULT_SHOW_MENU)){
menuList.add(menu.getPath());
......@@ -279,6 +282,7 @@ public class MenuInit {
Set<String> showIdSet = new HashSet<>();
for (String showPath : menuListToShow) {
log.info("展示菜单:" + showPath);
EnLog.info("Show menu: " + showPath);
Menu showMenu = allMenus.get(showPath);
if(showMenu != null){
showMenu = createMenu(showMenu);
......@@ -287,6 +291,7 @@ public class MenuInit {
showMenu.setHidden(false);
menuManager.saveMenu(showMenu);
log.info("显示隐藏菜单:" + showMenu.getPath());
EnLog.info("Unhide menu: " + showMenu.getPath());
}
addToMenuIdSet(showIdSet,showMenu);
}else{
......@@ -294,12 +299,14 @@ public class MenuInit {
if(menu.getClients().contains(showPath)){
showMenu = createMenu(menu);
log.info("展示菜单:" + menu.getPath());
EnLog.info("Show menu: " + menu.getPath());
addToMenuIdSet(showIdSet,menu);
//不隐藏
if(showMenu.getHidden()){
showMenu.setHidden(false);
menuManager.saveMenu(showMenu);
log.info("2显示隐藏菜单:" + showMenu.getPath());
EnLog.info("Unhide menu: " + showMenu.getPath());
}
}
}
......@@ -319,9 +326,11 @@ public class MenuInit {
hideMenu.setHidden(true);
menuManager.saveMenu(hideMenu);
log.info("隐藏菜单:" + hideMenu.getPath());
EnLog.info("Hide menu: " + hideMenu.getPath());
addToMenuIdSet(hideIdSet,hideMenu);
}else{
log.error("菜单:" + hidePath + "不存在");
EnLog.error("Menu does not exist: " + hidePath);
}
}
return hideIdSet;
......@@ -344,6 +353,7 @@ public class MenuInit {
menu.setParentMenu(parentMenu);
}
log.info("创建菜单:" + menu.toString());
EnLog.info("Create menu: " + menu.toString());
dbMenu = menuManager.saveMenu(menu);
}
return dbMenu;
......
package com.neotel.smfcore.common.service;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpHeaders;
......@@ -50,6 +51,7 @@ public class CommonResponseAdvice implements ResponseBodyAdvice<Object> {
}
} catch (Exception ex) {
log.error("CommonResponseAdvice beforeBodyWrite 出错:" + ex.toString());
EnLog.error("CommonResponseAdvice beforeBodyWrite error: " + ex.toString());
}
return body;
}
......
......@@ -23,6 +23,7 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.language.util.MessageUtils;
import org.apache.commons.collections4.CollectionUtils;
......@@ -111,6 +112,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
multipartFile.transferTo(file);
} catch (IOException e) {
log.error(e.getMessage(), e);
EnLog.error(e.getMessage(), e);
}
return file;
}
......@@ -212,6 +214,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
return dest;
} catch (Exception e) {
log.error(e.getMessage(), e);
EnLog.error(e.getMessage(), e);
}
return null;
}
......@@ -249,12 +252,14 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
List<List<Object>> data = excelDownLoad.getPageData(query,page);
if(data == null || data.isEmpty()){
log.info("导出完成,共有["+totalCount+"]条数据");
EnLog.info("Export completed, total [" + totalCount + "] rows");
break;
}
totalCount = totalCount + data.size();
int sheetIndex = totalCount/1000000 + 1;
if(sheetIndex != currentSheet){
log.info("Sheet"+currentSheet+"已写入[" + totalCount + "]行数据,开始写入到Sheet"+sheetIndex);
EnLog.info("Sheet" + currentSheet + " has written [" + totalCount + "] rows, start writing to Sheet" + sheetIndex);
currentSheet = sheetIndex;
writeSheet = EasyExcel.writerSheet("Sheet"+ sheetIndex).build();
}
......@@ -444,9 +449,11 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
System.out.println(in.read(b));
} catch (IOException e) {
log.error(e.getMessage(), e);
EnLog.error(e.getMessage(), e);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
EnLog.error(e.getMessage(), e);
return null;
} finally {
CloseUtil.close(in);
......@@ -494,6 +501,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
response.flushBuffer();
} catch (Exception e) {
log.error(e.getMessage(), e);
EnLog.error(e.getMessage(), e);
} finally {
if (fis != null) {
try {
......@@ -503,6 +511,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
}
} catch (IOException e) {
log.error(e.getMessage(), e);
EnLog.error(e.getMessage(), e);
}
}
}
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.common.utils;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.custom.micron1053.bean.MicronResult;
import lombok.extern.slf4j.Slf4j;
......@@ -173,6 +174,7 @@ public class HttpHelper {
String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET);
int code = response.getStatusLine().getStatusCode();
log.info("Request to [" + url + "] response: code="+code+",responseContent="+responseContent);
EnLog.info("Request to [" + url + "] response: code=" + code + ",responseContent=" + responseContent);
response.close();
httpClient.close();
return responseContent;
......@@ -203,6 +205,7 @@ public class HttpHelper {
List<NameValuePair> params = toNameValuePair(paramMap);
URI uri = new URIBuilder(url).setParameters(params).build();
log.info("执行请求:" + uri.toString());
EnLog.info("Execute request: " + uri.toString());
HttpPost httpPost = new HttpPost(uri);
httpPost.addHeader("Content-Type", contentType);
// httpPost.setEntity(new UrlEncodedFormEntity(params, CONTENT_CHARSET));
......@@ -310,6 +313,7 @@ public class HttpHelper {
} catch (Exception e) {
log.error("出错:"+e.toString());
EnLog.error("Error: " + e.toString());
e.printStackTrace();
}
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.common.utils;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.api.bean.ApiResult;
import lombok.extern.slf4j.Slf4j;
......@@ -37,6 +38,7 @@ public class JsonUtil {
return string;
} catch (Exception e) {
log.info("转换JSON字符串出错:",e);
EnLog.info("Error converting to JSON string: " + e.getMessage());
}
return null;
}
......@@ -54,6 +56,7 @@ public class JsonUtil {
return t;
} catch (Exception e) {
log.info(jsonStr + "转换对象出错:",e);
EnLog.info(jsonStr + " error converting to object: " + e.getMessage());
}
return null;
}
......@@ -73,6 +76,7 @@ public class JsonUtil {
return list;
} catch (Exception e) {
log.info(jsonStr + "转换List出错:",e);
EnLog.info(jsonStr + " error converting to List: " + e.getMessage());
}
return new ArrayList<>();
......@@ -86,6 +90,7 @@ public class JsonUtil {
return map;
} catch (Exception e) {
log.info(jsonStr + "转换Map出错:",e);
EnLog.info(jsonStr + " error converting to Map: " + e.getMessage());
}
return new HashMap<>();
......
package com.neotel.smfcore.common.utils;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
......@@ -26,6 +27,7 @@ public class NetwrokUtils {
ip = addresses.nextElement();
if (ip != null && ip.getHostAddress().indexOf(":") == -1) {
log.info("获取到本机IP地址:" + ip.getHostAddress());
EnLog.info("Local IP address: " + ip.getHostAddress());
ipList.add(ip.getHostAddress());
}
}
......
......@@ -2,6 +2,7 @@
package com.neotel.smfcore.common.utils;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.security.service.manager.IMenuManager;
import com.neotel.smfcore.security.service.po.Menu;
import io.swagger.annotations.ApiOperation;
......@@ -70,6 +71,7 @@ public class PermissionInitUtil {
log.info("共加载到【" + perList.size() + "】条权限");
EnLog.info("Loaded [" + perList.size() + "] permissions in total");
for (String hasP :
......@@ -111,6 +113,7 @@ public class PermissionInitUtil {
resMap = resolveClass(reader, resMap, tagAnnotationClass);
}catch (Exception ex){
log.error("resolveClass "+r.getFilename()+" 出错:"+ex.toString());
EnLog.error("resolveClass "+r.getFilename()+" error: "+ex.toString());
}
}
......@@ -171,6 +174,7 @@ public class PermissionInitUtil {
int endIndex = targetStr.length() - 2;
if(endIndex <= 11){
log.error("path="+path+"的权限定义"+targetStr+"异常,忽略");
EnLog.error("Permission definition "+targetStr+" for path="+path+" is abnormal, ignoring");
continue;
}
targetStr = targetStr.substring(11, endIndex);
......@@ -182,6 +186,7 @@ public class PermissionInitUtil {
if (isHas) {
// throw new Exception("重复定义了相同的映射关系");
log.error("重复定义了相同的映射关系:" + path);
EnLog.error("Duplicate mapping definition: " + path);
continue;
}
......@@ -193,6 +198,7 @@ public class PermissionInitUtil {
} catch (Exception ex) {
log.error("解析 path=" + path + " 出错: ",ex);
EnLog.error("Error parsing path=" + path + ": " + ex.getMessage());
}
}
......
package com.neotel.smfcore.common.utils;
import lombok.extern.slf4j.Slf4j;
import com.neotel.smfcore.common.enlog.EnLog;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.data.geo.Point;
......@@ -65,6 +66,7 @@ public class PointUtil {
}
} catch (Exception ex) {
log.error("解析库位[" + posId + "]的坐标出错:" + ex);
EnLog.error("Parse pos [" + posId + "] coordinate error: " + ex.toString());
}
// log.info("解析库位[" + posId + "]的坐标结果:" + p.toString());
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.common.utils;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import org.apache.logging.log4j.LogManager;
......@@ -47,22 +48,26 @@ public class ReelLockPosUtil {
public static synchronized ReelLockPosInfo addReelLockPosInfo(ReelLockPosInfo reelLockPosInfo , List<String> cidList) {
String key = processBarcode(reelLockPosInfo.getBarcode());
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "],key=[" + key + "]");
EnLog.info("Lock position [" + reelLockPosInfo.getLockPosName() + "] for [" + reelLockPosInfo.getBarcode() + "], 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() + "],返回之前锁定的库位");
EnLog.info("[" + oldLocInfo.getBarcode() + "] already has locked position [" + oldLocInfo.getLockPosName() + "], return previous locked position");
return oldLocInfo;
} else {
//锁定库位不在cid列表中
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],Cid[" + oldLocInfo.getCid() + "]不在[" + String.join(",", cidList) + "]中,清理原有锁定库位");
EnLog.info("[" + oldLocInfo.getBarcode() + "] already has locked position [" + oldLocInfo.getLockPosName() + "], cid [" + oldLocInfo.getCid() + "] not in [" + String.join(",", cidList) + "], clear previous lock");
reelLocKPosMap.remove(key);
}
}
for (ReelLockPosInfo locInfo : reelLocKPosMap.values()) {
if (locInfo.getLockPosId().equals(reelLockPosInfo.getLockPosId()) && !locInfo.getBarcode().equals(key)) {
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "]时,库位已被[" + locInfo.getBarcode() + "]锁定");
EnLog.info("Lock position [" + reelLockPosInfo.getLockPosName() + "] for [" + reelLockPosInfo.getBarcode() + "] failed, already locked by [" + locInfo.getBarcode() + "]");
return null;
}
}
......@@ -71,6 +76,7 @@ public class ReelLockPosUtil {
} catch (Exception exception) {
log.error("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "],key=[" + key + "]出错:"+exception.toString());
EnLog.error("Lock position [" + reelLockPosInfo.getLockPosName() + "] for [" + reelLockPosInfo.getBarcode() + "], key=[" + key + "] error: " + exception.toString());
}
return reelLockPosInfo;
}
......
package com.neotel.smfcore.common.utils;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.enlog.EnLog;
import jcifs.Config;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
......@@ -23,9 +24,11 @@ public class SmbUtil {
return Lists.newArrayList(fileNames);
} else {
log.info("SMB目录["+smbDir+"]不存在");
EnLog.info("SMB directory does not exist: [" + smbDir + "]");
}
} catch (Exception e) {
log.error("访问SMB目录["+smbDir+"]出错",e);
EnLog.error("Access SMB directory [" + smbDir + "] error: " + e.toString());
}
return null;
}
......@@ -42,10 +45,12 @@ public class SmbUtil {
SmbFile remoteFile = new SmbFile(smbFile);
if (!remoteFile.exists()) {
log.info("共享文件不存在");
EnLog.info("Shared file does not exist");
return false;
}
// 有文件的时候再初始化输入输出流
log.info("下载共享目录的文件 "+smbFile+" 到 "+ localDirectory);
EnLog.info("Download shared file " + smbFile + " to " + localDirectory);
String fileName = remoteFile.getName();
File localFile = new File(localDirectory + File.separator + fileName);
File fileParent = localFile.getParentFile();
......@@ -63,6 +68,7 @@ public class SmbUtil {
return true;
} catch (Exception e) {
log.error("获取 SMB 文件出错",e);
EnLog.error("Get SMB file error: " + e.toString());
} finally {
close(in,out);
}
......@@ -107,6 +113,7 @@ public class SmbUtil {
String smbFileName = uri.getScheme() + "://" + uri.getHost() + uri.getPath() + localFile.getName();
SmbFile remoteFile = new SmbFile(smbFileName,auth);
log.info("put " + localFilePath + " to " +remoteFile.getPath());
EnLog.info("put " + localFilePath + " to " + remoteFile.getPath());
in = new BufferedInputStream(new FileInputStream(localFile));
out = new BufferedOutputStream(remoteFile.getOutputStream());
byte[] buffer = new byte[1024];
......@@ -118,6 +125,7 @@ public class SmbUtil {
return true;
} catch (Exception e) {
log.error("上传 SMB 文件出错",e);
EnLog.error("Upload SMB file error: " + e.toString());
} finally {
close(in,out);
}
......
......@@ -15,6 +15,7 @@
*/
package com.neotel.smfcore.common.utils;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
......@@ -43,6 +44,7 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
SpringContextHolder.CALL_BACKS.add(callBack);
} else {
log.warn("CallBack:{} 已无法添加!立即执行", callBack.getCallBackName());
EnLog.warn("CallBack [" + callBack.getCallBackName() + "] cannot be added, execute immediately");
callBack.executor();
}
}
......@@ -117,6 +119,7 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
private static void clearHolder() {
log.debug("清除SpringContextHolder中的ApplicationContext:"
+ applicationContext);
EnLog.debug("Clear ApplicationContext in SpringContextHolder: " + applicationContext);
applicationContext = null;
}
......@@ -129,6 +132,7 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (SpringContextHolder.applicationContext != null) {
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext);
EnLog.warn("SpringContextHolder ApplicationContext overwritten, original ApplicationContext: " + SpringContextHolder.applicationContext);
}
SpringContextHolder.applicationContext = applicationContext;
if (addCallback) {
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.common.utils;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.csv.CsvWriter;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.custom.micron1053.api.bean.MaterialStatus;
......@@ -138,14 +139,17 @@ public class UserCodeUtil {
writer.flush();
writer.close();
log.info("保存新用户信息到文件:"+filePath+"更新后_"+fileName);
EnLog.info("Save new user info to file: " + filePath + "updated_" + fileName);
} catch (Exception ex) {
log.error("出错:" + ex.toString());
EnLog.error("Error: " + ex.toString());
}
}
protected static int getCsvIndex(CsvReader csvReader,String titleName,String titleNameEn){
int index = csvReader.getIndex(titleName,titleNameEn);
if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
EnLog.info("Missing column [" + titleName + "] or [" + titleNameEn + "]");
// throw new ValidateException("必须包含["+titleNameEn+"]列");
throw new ValidateException("smfcore.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
}
......@@ -183,6 +187,7 @@ public class UserCodeUtil {
// String langu=lineValues[lanIndex];
if( username.isEmpty() || id.isEmpty()||createDate.isEmpty()){
log.warn("第"+row+"行中有空白内容,此行忽略");
EnLog.warn("Row " + row + " has blank values, skip");
continue;
}
......@@ -197,6 +202,7 @@ public class UserCodeUtil {
list.add(user);
}
log.info("文件"+fileURL+"共解析到"+ list.size()+"个用户");
EnLog.info("File " + fileURL + " parsed " + list.size() + " users");
return list;
}
......
package com.neotel.smfcore.common.utils;
import com.neotel.smfcore.SmfCoreApplication;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.security.rest.UserController;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.StringUtil;
......@@ -20,6 +21,7 @@ public class YmlUpdateUtil {
src = url.getPath() + "config/application.yml";
if (!FileUtil.exist(src)) {
log.info("未找到文件:" + src);
EnLog.info("File not found: " + src);
return;
}
Yaml yaml = new Yaml();
......@@ -72,15 +74,18 @@ public class YmlUpdateUtil {
//关闭流
fileWriter.close();
log.info("更改yml配置:" + msg);
EnLog.info("Update yml config: " + msg);
} catch (Exception e) {
e.printStackTrace();
log.error("updateYamlFile error :"+e.toString());
EnLog.error("updateYamlFile error: " + e.toString());
}
} catch (Exception e) {
e.printStackTrace();
log.error("updateYamlFile error :"+e.toString());
EnLog.error("updateYamlFile error: " + e.toString());
}
}
private static Map<String,Object> updateMapMap(String key, Map<String,Object> map ){
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.barcode.bean;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import org.apache.logging.log4j.LogManager;
......@@ -98,6 +99,7 @@ public class BarcodeRule {
BarcodeRule newRule = new BarcodeRule();
newRule.ruleStr = ruleStr;
log.info("开始解析二维码规则:" + ruleStr);
EnLog.info("Start parsing QR code rule: " + ruleStr);
if(!Strings.isNullOrEmpty(ruleStr)){
//先去除[prefix,length,suffix]这样的配置字段
......@@ -128,6 +130,7 @@ public class BarcodeRule {
}
log.info("分割符为:"+newRule.separator+"长度为:"+tempArr.length);
EnLog.info("Separator is: " + newRule.separator + ", length is: " + tempArr.length);
if(tempArr.length == 0){
tempArr = new String[]{ruleStr};
}
......@@ -138,44 +141,52 @@ public class BarcodeRule {
if(!newRule.partNumber_item.hasThisField()){
if(newRule.partNumber_item.matchRule(fieldValue, i)){
log.info("partNumber: 为" + newRule.partNumber_item.toString());
EnLog.info("partNumber: is " + newRule.partNumber_item.toString());
fieldValue = fieldValue.replace(newRule.partNumber_item.name,"");
}
}
if(!newRule.whole_reelId_item.hasThisField() && !newRule.reelId_item.hasThisField()){
if(newRule.whole_reelId_item.matchRule(fieldValue, i)){
log.info("whole reelId: 为" + newRule.whole_reelId_item.toString());
EnLog.info("whole reelId: is " + newRule.whole_reelId_item.toString());
}else if(newRule.reelId_item.matchRule(fieldValue, i)){
log.info("reelId: 为" + newRule.reelId_item.toString());
EnLog.info("reelId: is " + newRule.reelId_item.toString());
}
}
if(!newRule.batch_item.hasThisField()){
if(newRule.batch_item.matchRule(fieldValue, i)){
log.info("batch: 为" + newRule.batch_item.toString());
EnLog.info("batch: is " + newRule.batch_item.toString());
}
}
if(!newRule.quantity_item.hasThisField()){
if(newRule.quantity_item.matchRule(fieldValue, i)){
log.info("quantity: 为" + newRule.quantity_item.toString());
EnLog.info("quantity: is " + newRule.quantity_item.toString());
}
}
if(!newRule.supplier_item.hasThisField()){
if(newRule.supplier_item.matchRule(fieldValue, i)){
log.info("supplier: 为" + newRule.supplier_item.toString());
EnLog.info("supplier: is " + newRule.supplier_item.toString());
}
}
if(!newRule.msl_item.hasThisField()){
if(newRule.msl_item.matchRule(fieldValue, i)){
log.info("MSL: 为" + newRule.msl_item.toString());
EnLog.info("MSL: is " + newRule.msl_item.toString());
}
}
if(!newRule.memo_item.hasThisField()){
if(newRule.memo_item.matchRule(fieldValue, i)){
log.info("MEMO: 为" + newRule.memo_item.toString());
EnLog.info("MEMO: is " + newRule.memo_item.toString());
}
}
......@@ -183,40 +194,49 @@ public class BarcodeRule {
if(!newRule.produceDate_item.hasThisField()){
if(newRule.produceDate_item.matchRule(fieldValue,i)){
log.info("produceDate: 为" + newRule.produceDate_item.toString());
EnLog.info("produceDate: is " + newRule.produceDate_item.toString());
}
}
if(!newRule.expireDate_item.matchRule(fieldValue,i)){
if(newRule.expireDate_item.matchRule(fieldValue,i)){
log.info("expireDate: 为" + newRule.expireDate_item.toString());
EnLog.info("expireDate: is " + newRule.expireDate_item.toString());
}
}
if(!newRule.expireYear_item.hasThisField() && !newRule.expireMonth_item.hasThisField() && !newRule.expireDay_item.hasThisField()){
if(newRule.expireYear_item.matchRule(fieldValue,i)){
log.info("expireYear: 为" + newRule.expireYear_item.toString());
EnLog.info("expireYear: is " + newRule.expireYear_item.toString());
}else if(newRule.expireMonth_item.matchRule(fieldValue,i)){
log.info("expireMonth: 为" + newRule.expireMonth_item.toString());
EnLog.info("expireMonth: is " + newRule.expireMonth_item.toString());
}else if(newRule.expireDay_item.matchRule(fieldValue,i)){
log.info("expireDay: 为" + newRule.expireDay_item.toString());
EnLog.info("expireDay: is " + newRule.expireDay_item.toString());
}
}
if(!newRule.q1_item.hasThisField()){
if(newRule.q1_item.matchRule(fieldValue, i)){
log.info("q1: 为" + newRule.q1_item.toString());
EnLog.info("q1: is " + newRule.q1_item.toString());
}
} if(!newRule.q_item.hasThisField()){
if(newRule.q_item.matchRule(fieldValue, i)){
log.info("q: 为" + newRule.q_item.toString());
EnLog.info("q: is " + newRule.q_item.toString());
}
}if(!newRule.p20_item.hasThisField()){
if(newRule.p20_item.matchRule(fieldValue, i)){
log.info("p20: 为" + newRule.p20_item.toString());
EnLog.info("p20: is " + newRule.p20_item.toString());
}
}
if(!newRule.p4L_item.hasThisField()){
if(newRule.p4L_item.matchRule(fieldValue, i)){
log.info("p4L: 为" + newRule.p4L_item.toString());
EnLog.info("p4L: is " + newRule.p4L_item.toString());
}
}
......@@ -231,6 +251,7 @@ public class BarcodeRule {
newRule.length = tempArr.length;
}else{
log.warn("编码规则中必须包含 RI 和 PN");
EnLog.warn("Barcode rule must contain RI and PN");
}
}
return newRule;
......@@ -241,6 +262,7 @@ public class BarcodeRule {
if(!ruleItem.hasThisField()){
if(ruleItem.matchRule(fieldValue, ruleIndex)){
log.info(ruleItem.name + " 为" + ruleItem.toString());
EnLog.info(ruleItem.name + " is " + ruleItem.toString());
fieldValue = fieldValue.replace(ruleItem.name,"");
}
}
......@@ -434,6 +456,7 @@ public class BarcodeRule {
if(prefix >=0 && suffix >=0){
if(codeValue.length() != length){
log.info(codeValue + "的长度不是" + length);
EnLog.info("Length of " + codeValue + " is not " + length);
return null;
}
}
......@@ -499,6 +522,7 @@ public class BarcodeRule {
//阳光电源有可能是年周,需要转换一下
if(value.endsWith("00")){
log.info("转换日期");
EnLog.info("Convert date");
Date time = DateUtil.toDate(value.substring(0,2),"yy");
Calendar c = Calendar.getInstance();
c.setTime(time);
......@@ -934,8 +958,15 @@ public class BarcodeRule {
codeStr="=1+0x0-310x80=P550-502922C|1P3217-10-01-C|1T132456C3|7Q1000|SP2UATPCB015|21PSIMMTECH|2D08-13-2024||Q100|1Q10||7E2";
rule="";
codeStr="PMT29F2T08EMLEEJ4-QK:E|1PMT29F2T08EMLEEJ4-QK:E|1THZ001WZ.QT|7Q1000+EA|SHZ001WZ.QT|21PMICRON||9DD20250901||||7E3|";
rule="PN[1:0:-1]|MPN[2:0:-1]|BATCH[2:0:-1]|QTY[2_7Q:0:-1]|RI[1:0:-1]|SP[3:0:-1]|EXPDATEMM-dd-yyyy[2:0:-1]|PRODATEMM-dd-yyyy[2:0:-1]|QITEM[1:0:-1]|Q1ITEM[2:0:-1]|P20ITEM[3:0:-1]|MSL[1:0:-1]";
rule="PN[1:0:-1]|MPN[2:0:-1]|BATCH[2:0:-1]|QTY[2_7Q:0:-1]|RI[1:0:-1]|SP[3:0:-1]|EXPDATEMM-dd-yyyy[2:0:-1]|PRODATEyyyyMMdd[2:0:-1]|QITEM[1:0:-1]|Q1ITEM[2:0:-1]|P20ITEM[3:0:-1]|MSL[1:0:-1]";
rule="PN[1:0:-1]|MPN[2:0:-1]|BATCH[2:0:-1]|QTY[2_7Q:0:-1]|RI[1:0:-1]|SP[3:0:-1]|EXPDATEMM-dd-yyyy[2:0:-1]|xxx|QITEM[1:0:-1]|Q1ITEM[2:0:-1]|P20ITEM[3:0:-1]|MSL[1:0:-1]";
rule="PN[1:0:-1]|MPN[2:0:-1]|BATCH[2:0:-1]|QTY[2_7Q:0:-1]|RI[1:0:-1]|xxx|EXPDATEMM-dd-yyyy[2:0:-1]|xxx|QITEM[1:0:-1]|Q1ITEM[2:0:-1]|P20ITEM[3:0:-1]|MSL[1:0:-1]";
codeStr="P521-501490A|1PRTQ5132GQWF-510|1TTQ3UK45.1|7Q1500+EA|STESTRESTRICT01|21PRICHTEK||9D20240108||||7E3|4LTW";
codeStr="P521-501490A|1PRTQ5132GQWF-510|1TTQ3UK45.1|7Q1500+EA|STESTRESTRICT03|21PRICHTEK||9D20240108||||7E3|4LTW";
codeStr="P521-501490A|1PRTQ5132GQWF-510|1TTQ3UK45.1|7Q1500+EA|STESTRESTRICT02|21PRICHTEK||9D20240108||||7E3";
codeStr="PMT60B1G16HD-64B:H|1PMT60B1G16HD-64B:H|1TJFK6JPG.11|7Q1497+EA|SJFK6JPG.11|21PMICRON||9D40000719|Q10000|||7E3";
BarcodeRule br = BarcodeRule.newRule(rule);
Barcode b = br.toCodeBean(codeStr).getBarcode();
......
......@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
......@@ -163,6 +164,7 @@ public class BarcodeController {
qrcodeUtils.writePdfToResponse(response, qrcodeContents);
} catch (Exception e) {
log.error("打印条码错误:"+e.toString());
EnLog.error("Print barcode error: " + e.toString());
}
}
......@@ -182,6 +184,7 @@ public class BarcodeController {
protected String handleBarcode(String fileURL) throws Exception {
log.info("开始读取文件:" + fileURL);
EnLog.info("Start reading file: " + fileURL);
CsvReader csvRead =CsvReader.newReader(fileURL,"条码","RI");
int riIndex = csvRead.getIndex("条码","RI");
......@@ -202,6 +205,7 @@ public class BarcodeController {
String pn = lineValues[pnIndex];
if(ObjectUtils.isEmpty(pn) || ObjectUtils.isEmpty(ri)){
log.warn("第"+row+"行中有空白内容,此行忽略");
EnLog.warn("Row " + row + " has blank content, ignore this row");
continue;
}
......@@ -236,6 +240,7 @@ public class BarcodeController {
String msg = "共["+row+"]行数据:新增【"+newRowCount+"】更新【" +updateRowCount +"】个";
log.info(msg);
EnLog.info("Total [" + row + "] records: new [" + newRowCount + "] updated [" + updateRowCount + "]");
return msg;
}
}
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.barcode.utils;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.barcode.bean.BarcodeRule;
......@@ -113,6 +114,7 @@ public class CodeResolve {
}
} catch (Exception ex) {
log.error(" getTargetValid [" + pn + "_" + manufacture + "]["+validDay+"] 出错:" + ex.toString());
EnLog.error("getTargetValid [" + pn + "_" + manufacture + "][" + validDay + "] error: " + ex.toString());
}
return 0;
}
......@@ -147,6 +149,7 @@ public class CodeResolve {
}
} catch (Exception ex) {
log.error(" getMaxCountTimes [" + pn + "_" + manufacture + "] 出错:" + ex.toString());
EnLog.error("getMaxCountTimes [" + pn + "_" + manufacture + "] error: " + ex.toString());
}
return count;
}
......@@ -193,78 +196,92 @@ public class CodeResolve {
if (!barcode.getPartNumber().equals(codeBeanFromRule.getBarcode().getPartNumber())) {
try {
log.warn("[" + barcode.getBarcode() + "]重新设置PN[" + barcode.getPartNumber() + "]为[" + codeBeanFromRule.getBarcode().getPartNumber() + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset PN [" + barcode.getPartNumber() + "] to [" + codeBeanFromRule.getBarcode().getPartNumber() + "]");
barcode.setPartNumber(codeBeanFromRule.getBarcode().getPartNumber());
barcode = barcodeManager.save(barcode);
} catch (Exception ve) {
log.error("重新设置PN出错", ve);
EnLog.error("Reset PN error", ve);
}
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置PN出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset PN error: " + ex.getMessage());
}
try{
if((codeBeanFromRule.getBarcode()!=null)&&(codeBeanFromRule.getBarcode().getMpn()!=null)) {
String mpn = codeBeanFromRule.getBarcode().getMpn();
if (!barcode.getMpn().equals(mpn)) {
log.warn("[" + barcode.getBarcode() + "]重新设置MPN[" + barcode.getMpn() + "]为[" + mpn + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset MPN [" + barcode.getMpn() + "] to [" + mpn + "]");
barcode.setMpn(mpn);
barcode = barcodeManager.save(barcode);
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置MPN出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset MPN error: " + ex.getMessage());
}
try{
if((codeBeanFromRule.getBarcode()!=null)&&(codeBeanFromRule.getBarcode().getExpireDate()!=null)) {
if (barcode.getExpireDate()==null||barcode.getExpireDate().before(codeBeanFromRule.getBarcode().getExpireDate())) {
try {
log.warn("[" + barcode.getBarcode() + "]重新设置过期时间[" + barcode.getExpireDate() + "]为[" + codeBeanFromRule.getBarcode().getExpireDate() + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset expire date [" + barcode.getExpireDate() + "] to [" + codeBeanFromRule.getBarcode().getExpireDate() + "]");
barcode.setExpireDate(codeBeanFromRule.getBarcode().getExpireDate());
barcode = barcodeManager.save(barcode);
} catch (Exception ve) {
log.error("重新设置过期时间出错", ve);
EnLog.error("Reset expire date error", ve);
}
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置过期时间出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset expire date error: " + ex.getMessage());
}
try{
if((codeBeanFromRule.getBarcode()!=null)&&(codeBeanFromRule.getBarcode().getP20Item()!=null)) {
String P20 = codeBeanFromRule.getBarcode().getP20Item();
if (barcode.getP20Item()==null||(!barcode.getP20Item().equals(P20)) ){
log.warn("[" + barcode.getBarcode() + "]重新设置P20ITEM [" +P20 + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset P20ITEM [" + P20 + "]");
barcode.setP20Item(P20);
barcode = barcodeManager.save(barcode);
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置 P20 出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset P20 error: " + ex.getMessage());
}
try{
if((codeBeanFromRule.getBarcode()!=null)&&(codeBeanFromRule.getBarcode().getBatch()!=null)) {
String batch = codeBeanFromRule.getBarcode().getBatch();
if (!barcode.getBatch().equals(batch)) {
log.warn("[" + barcode.getBarcode() + "]重新设置batch[" + barcode.getBatch() + "]为[" + batch + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset batch [" + barcode.getBatch() + "] to [" + batch + "]");
barcode.setBatch(batch);
barcode = barcodeManager.save(barcode);
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置batch出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset batch error: " + ex.getMessage());
}
try{
if((codeBeanFromRule.getBarcode()!=null)&&(codeBeanFromRule.getBarcode().getProvider()!=null)) {
String provider = codeBeanFromRule.getBarcode().getProvider();
if (!barcode.getProvider().equals(provider)) {
log.warn("[" + barcode.getBarcode() + "]重新设置 provider[" + barcode.getProvider() + "]为[" + provider + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset provider [" + barcode.getProvider() + "] to [" + provider + "]");
barcode.setProvider(provider);
barcode = barcodeManager.save(barcode);
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置 provider 出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset provider error: " + ex.getMessage());
}
try{
if((codeBeanFromRule.getBarcode()!=null) ) {
......@@ -282,11 +299,13 @@ public class CodeResolve {
if (needSave) {
barcode = barcodeManager.save(barcode);
log.warn("[" + barcode.getBarcode() + "]重新设置Q1 =[" + q1Item + "],Q=[" + qItem + "]");
EnLog.warn("[" + barcode.getBarcode() + "] reset Q1=[" + q1Item + "], Q=[" + qItem + "]");
}
}
}catch (Exception ex){
log.error("条码["+codeStr+"]重置Q1,Q 出错:"+ ex.getMessage());
EnLog.error("Barcode [" + codeStr + "] reset Q1/Q error: " + ex.getMessage());
}
boolean setSize=false;
Component component = componentManager.findByPartNumberAndProvider(barcode.getPartNumber(),barcode.getProvider());
......@@ -303,12 +322,14 @@ public class CodeResolve {
if (barcode.getHeight() != component.getHeight() || barcode.getPlateSize() != component.getPlateSize()) {
try {
log.warn("重新设置尺寸[" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]为[" + component.getPlateSize() + "x" + component.getHeight() + "]");
EnLog.warn("Reset size [" + barcode.getPlateSize() + "x" + barcode.getHeight() + "] to [" + component.getPlateSize() + "x" + component.getHeight() + "]");
barcode.setPlateSize(component.getPlateSize());
barcode.setHeight(component.getHeight());
barcode = barcodeManager.save(barcode);
} catch (Exception ve) {
log.error("重设尺寸出错", ve);
EnLog.error("Reset size error", ve);
}
}
setSize = true;
......@@ -323,12 +344,14 @@ public class CodeResolve {
if(barcode.getHeight() != codeBeanFromRule.getReelHeight() || barcode.getPlateSize() != codeBeanFromRule.getReelWidth()){
try{
log.warn("重新设置尺寸["+barcode.getPlateSize()+"x"+barcode.getHeight()+"]为["+codeBeanFromRule.getReelWidth()+"x"+codeBeanFromRule.getReelHeight()+"]");
EnLog.warn("Reset size [" + barcode.getPlateSize() + "x" + barcode.getHeight() + "] to [" + codeBeanFromRule.getReelWidth() + "x" + codeBeanFromRule.getReelHeight() + "]");
barcode.setPlateSize(codeBeanFromRule.getReelWidth());
barcode.setHeight(codeBeanFromRule.getReelHeight());
barcode = barcodeManager.save(barcode);
}catch (Exception ve){
log.error("重设尺寸出错",ve);
EnLog.error("Reset size error", ve);
}
}
}
......@@ -344,6 +367,7 @@ public class CodeResolve {
//如果是PCB,直接更新数量
if (MicronDataCache.GetReelType(barcode.getPlateSize(), barcode.getHeight()).equals(MicronDataCache.PCB)) {
log.info("重新设置PCB" + codeBeanFromRule.getCodeStr() + "标签数量和实时数量为:" + currentLabelAmount + ",点料次数=" + barcode.getXrayCount());
EnLog.info("Reset PCB " + codeBeanFromRule.getCodeStr() + " label amount and current amount to: " + currentLabelAmount + ", xrayCount=" + barcode.getXrayCount());
barcode.setAmount(currentLabelAmount);
}
// else if (barcode.getXrayCount() > 0) {
......@@ -352,6 +376,7 @@ public class CodeResolve {
// }
else {
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "标签数量为:" + currentLabelAmount + ",点料次数=" + barcode.getXrayCount());
EnLog.info("Reset " + codeBeanFromRule.getCodeStr() + " label amount to: " + currentLabelAmount + ", xrayCount=" + barcode.getXrayCount());
}
needUpdate = true;
}
......@@ -360,6 +385,7 @@ public class CodeResolve {
if (barcodeFromRule.getExpireDate() != null) {
barcode.setExpireDate(barcodeFromRule.getExpireDate());
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "的过期日期");
EnLog.info("Reset " + codeBeanFromRule.getCodeStr() + " expire date");
needUpdate = true;
} else {
Date produceDate = barcodeFromRule.getProduceDate();
......@@ -367,6 +393,7 @@ public class CodeResolve {
//只要生产日期不为空的话,每次更新过期时间
if (validDay > 0) {
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "生产日期和过期日期");
EnLog.info("Reset " + codeBeanFromRule.getCodeStr() + " produce date and expire date");
Date expireDate = DateUtil.addDays(produceDate, validDay);
barcode.setExpireDate(expireDate);
barcode.setProduceDate(produceDate);
......@@ -380,6 +407,7 @@ public class CodeResolve {
barcodeManager.save(barcode);
}catch (Exception e){
log.error("",e);
EnLog.error("Update barcode failed", e);
}
}
}
......@@ -412,6 +440,7 @@ public class CodeResolve {
if(component == null){
log.info("自动添加["+barcodeFromRule.getPartNumber()+"]["+barcodeFromRule.getProvider()+"]的档案信息["+codeBeanFromRule.getReelWidth()+"x"+codeBeanFromRule.getReelHeight()+"]");
EnLog.info("Auto add component profile [" + barcodeFromRule.getPartNumber() + "][" + barcodeFromRule.getProvider() + "] size [" + codeBeanFromRule.getReelWidth() + "x" + codeBeanFromRule.getReelHeight() + "]");
component = new Component();
component.setPartNumber(barcodeFromRule.getPartNumber());
component.setAmount(barcodeFromRule.getAmount());
......@@ -431,6 +460,7 @@ public class CodeResolve {
//如果 barcode 里的料盘信息比 Component 中的大,使用比较大的,防止放不进去撞击
else if(codeBeanFromRule.getReelHeight() > component.getHeight() || codeBeanFromRule.getReelWidth() > component.getPlateSize()){
log.info("更新物料["+component.getPartNumber()+"]档案尺寸["+component.getPlateSize()+"x"+component.getHeight()+"]为["+codeBeanFromRule.getReelWidth()+"x"+codeBeanFromRule.getReelHeight()+"]");
EnLog.info("Update component [" + component.getPartNumber() + "] profile size [" + component.getPlateSize() + "x" + component.getHeight() + "] to [" + codeBeanFromRule.getReelWidth() + "x" + codeBeanFromRule.getReelHeight() + "]");
component.setPlateSize(barcodeFromRule.getPlateSize());
component.setHeight(barcodeFromRule.getHeight());
component.setType(type);
......@@ -444,9 +474,11 @@ public class CodeResolve {
boolean needAddNew = true;
if(needAddNew) {
log.info("自动添加条码" + barcodeItemStr + "到数据库中");
EnLog.info("Auto add barcode " + barcodeItemStr + " into database");
Component component = componentManager.findByPartNumberAndProvider(barcodeFromRule.getPartNumber(), barcodeFromRule.getProvider());
if (component == null) {
log.info("档案[" + barcodeFromRule.getPartNumber() + "]不存在");
EnLog.info("Component profile [" + barcodeFromRule.getPartNumber() + "] not found");
// 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()))) {
......@@ -468,12 +500,14 @@ public class CodeResolve {
validDay = getTargetValid(component.getPartNumber(),component.getProvider(), validDay);
if (validDay > 0 && (produceDate != null)) {
log.info("设置" + barcodeFromRule.getBarcode() + "的过期时间");
EnLog.info("Set expire date for " + barcodeFromRule.getBarcode());
Date expireDate = DateUtil.addDays(produceDate, validDay);
barcodeFromRule.setExpireDate(expireDate);
// barcodeManager.save(barcodeFromRule);
}
} catch (Exception ex) {
log.error("设置过期时间出错:" + ex.toString());
EnLog.error("Set expire date error: " + ex.toString());
}
}
......@@ -487,6 +521,7 @@ public class CodeResolve {
//档案不存在
codeBeanFromRule.setError("smfcore.error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"档案 {0} 不存在");
log.warn("档案"+barcodeFromRule.getPartNumber()+"不存在");
EnLog.warn("Component profile " + barcodeFromRule.getPartNumber() + " not found");
}
//解析成功了,直接返回
return codeBeanFromRule;
......@@ -546,6 +581,7 @@ public class CodeResolve {
if(reelId.equals(bean.getBarcode().getBarcode())){
hasSameCode = true;
log.info(reelId + "与已有效条码一样,忽略");
EnLog.info(reelId + " is same as existing valid barcode, ignored");
break;
}
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.core.api.SmfApi;
......@@ -125,6 +126,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
Float maxTemperature = msdSettiings.getMaxTemperature();
Float maxHumidity = msdSettiings.getMaxHumidity();
log.info("获取温湿度报警值 maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
EnLog.info("Get temp/humidity alarm values maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
statusBean.setTemperature(maxTemperature);
statusBean.setHumidity(maxHumidity);
return statusBean;
......@@ -136,6 +138,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
Float maxTemperature = msdSettiings.getMaxTemperature();
Float maxHumidity = msdSettiings.getMaxHumidity();
log.info("发送温湿度报警值 maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
EnLog.info("Send temp/humidity alarm values maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
statusBean.setTemperature(maxTemperature);
statusBean.setHumidity(maxHumidity);
return statusBean;
......@@ -201,6 +204,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
} catch (Exception ex) {
log.error("handleSelfAudit error:" + ex.getMessage());
EnLog.error("handleSelfAudit error:" + ex.getMessage(), ex);
}
return statusBean;
}
......@@ -220,9 +224,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
//原任务标记NG
task.setNgReel(true);
log.info("获取[" + barcodeSave.getBarcode() + "]的入库库位,条码已有入库任务posname[" + task.getPosName() + "],标记入库任务为NG,入库后自动出库");
EnLog.info("Get put-in pos for [" + barcodeSave.getBarcode() + "], barcode already has put-in task posname[" + task.getPosName() + "], mark put-in task as NG, auto checkout after checkin");
taskService.updateQueueTask(task);
}else{
log.info("获取[" + barcodeSave.getBarcode() + "]的入库库位,条码已有入库任务posname[" + task.getPosName() + "],CACHE_SAME_BARCODE_SETTINGS="+barcodeSet+",当前物料NG,已入库的任务继续完成");
EnLog.info("Get put-in pos for [" + barcodeSave.getBarcode() + "], barcode already has put-in task posname[" + task.getPosName() + "], CACHE_SAME_BARCODE_SETTINGS=" + barcodeSet + ", current material NG, continue finished task");
}
throw new ValidateException("smfcore.error.barcode.hastask","Serial No.(S)[0] already have storage task", new String[]{barcodeSave.getBarcode()});
// errorMsg = "Serial No.(S)[" + barcode.getBarcode() + "] already have storage task";
......@@ -233,6 +239,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
} else {
//同条码,但不是同料仓
log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId());
EnLog.error("Barcode [" + barcodeSave.getBarcode() + "] task executing, but task storage is: " + task.getStorageId() + " request storage is: " + task.getStorageId());
//throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行");
throw new ValidateException("smfcore.error.barcode.executing","条码[{0}}]任务正在执行", new String[]{barcodeSave.getBarcode()});
}
......@@ -242,11 +249,13 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (putInTask != null) {
log.info(barcodeSave.getBarcode() + " 已有任务,返回任务中的库位:" + putInTask.getPosName());
EnLog.info(barcodeSave.getBarcode() + " already has task, return pos in task: " + putInTask.getPosName());
return putInTask;
} else {
String posName = statusBean.getFromData("inPos");
if (!Strings.isNullOrEmpty(posName)) {
log.info("指定入库到" + posName);
EnLog.info("Designate put-in to " + posName);
storagePos = storagePosManager.getByPosName(posName);
if (storagePos == null) {
......@@ -271,6 +280,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//已经有锁定的库位
storagePos = storagePosManager.get(lockPosId);
log.info(barcodeSave.getBarcode() + "入库时查找到锁定的库位["+storagePos.getPosName()+"]");
EnLog.info(barcodeSave.getBarcode() + " found locked pos [" + storagePos.getPosName() + "] during put-in");
}else{
storagePos = findLineEmptyPosForPutIn(storage, barcodeSave);
}
......@@ -282,6 +292,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//批量料仓单盘入库的只能单盘出,不可批量
if (singleIn.equalsIgnoreCase("true")) {
log.info(barcodeSave.getBarcode() + "单盘入库,出库时此条码只可单盘出库");
EnLog.info(barcodeSave.getBarcode() + " single reel put-in, only single reel checkout allowed");
barcodeSave.setOnlySingleOut(true);
barcodeManager.save(barcodeSave);
}
......@@ -348,6 +359,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
storagePosManager.save(pos);
log.info(barcodeSave.getBarcode() + "[" + plateW + "x" + plateH + "]开始入库到" + storage.getCid() + "[" + posId + "], lastReelP=["+lastReelP+"],当前高度=["+barcodeSave.getHeight()+"]");
EnLog.info(barcodeSave.getBarcode() + "[" + plateW + "x" + plateH + "] start put-in to " + storage.getCid() + "[" + posId + "], lastReelP=[" + lastReelP + "], current height=[" + barcodeSave.getHeight() + "]");
//清空展示的消息
serverExceptions.remove(storage.getCid());
......@@ -363,9 +375,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
statusBean.setRMsg(e.getMsgKey(),e.getMsgParam(),e.getMessage());
log.warn(statusBean.getCode() + "入库到" + storage.getCid() + "失败:" + e.getMessage()+","+statusBean.getMsg()+","+statusBean.getMsgEn()+","+statusBean.getMsgJp());
EnLog.warn(statusBean.getCode() + " put-in to " + storage.getCid() + " failed: " + e.getMessage() + "," + statusBean.getMsg() + "," + statusBean.getMsgEn() + "," + statusBean.getMsgJp());
serverExceptions.put(storage.getCid(), e);
}catch (Exception e) {
log.error(statusBean.getCode() + "入库到" + storage.getCid() + "失败", e);
EnLog.error(statusBean.getCode() + " put-in to " + storage.getCid() + " failed", e);
statusBean.setMsg(e.getMessage());
serverExceptions.put(storage.getCid(), e);
}
......@@ -394,14 +408,17 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (storage.isSmdDuo() || storage.isBatchStorage()) {
//DUO料仓和MIMO客户端缓存出库任务,入库优先
log.info("从" + storage.getName() + " 中为" + barcode.getBarcode() + "寻找空的仓位");
EnLog.info("Find empty pos for " + barcode.getBarcode() + " in " + storage.getName());
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
} else {
boolean hasOutTask = taskService.hasExecutingTask(storageCid, OP.CHECKOUT);
if (!hasOutTask) {
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位");
EnLog.info("Find empty pos for " + barcode.getBarcode() + " in " + storage.getName());
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
} else {
log.info("料仓" + storageCid + "有出库任务未完成,不允许入库");
EnLog.info("Storage " + storageCid + " has unfinished checkout task, put-in not allowed");
throw new ValidateException("smfcore.error.storage.outNotEnd", "料仓{0}有出库任务未完成,不允许入库", new String[]{storageCid});
}
......@@ -410,6 +427,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
throw new ValidateException("smfcore.error.storage.noPos", "{0}的料格[{1}]已满,无法继续放入", new String[]{ storage.getName(),barcode.getPlateSize() + "x" + barcode.getHeight()});
}
log.info("[" + barcode.getBarcode() + "]寻找到" + storage.getName() + "的空仓位[" + storagePos.getPosName() + "]");
EnLog.info("[" + barcode.getBarcode() + "] found empty pos [" + storagePos.getPosName() + "] in " + storage.getName());
return storagePos;
}
......@@ -461,9 +479,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (barcodeSet == null || barcodeSet == 1) {
//如果已在库位中,那么自动将该库位的物料出库
log.info("CACHE_SAME_BARCODE_SETTINGS=1,自动出库已在库位中的物料[" + barcodeSave.getBarcode() + "],设置ngReel=true");
EnLog.info("CACHE_SAME_BARCODE_SETTINGS=1, auto checkout material [" + barcodeSave.getBarcode() + "] in pos, set ngReel=true");
taskService.checkout(storage, pos, true, true, "", "");
} else {
log.info("CACHE_SAME_BARCODE_SETTINGS=2,标记库位[" + pos.getPosName() + "]中的物料[" + barcodeSave.getBarcode() + "]为ngReel=NG");
EnLog.info("CACHE_SAME_BARCODE_SETTINGS=2, mark material [" + barcodeSave.getBarcode() + "] in pos [" + pos.getPosName() + "] as ngReel=NG");
pos.getBarcode().updateAppendData("ngReel", true);
storagePosManager.save(pos);
}
......@@ -494,9 +514,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
//原任务标记NG
task.setNgReel(true);
log.info("获取[" + barcodeSave.getBarcode() + "]的入库库位,条码已有入库任务posname[" + task.getPosName() + "],标记入库任务为NG,入库后自动出库");
EnLog.info("Get put-in pos for [" + barcodeSave.getBarcode() + "], barcode already has put-in task posname[" + task.getPosName() + "], mark put-in task as NG, auto checkout after checkin");
taskService.updateQueueTask(task);
} else {
log.info("获取[" + barcodeSave.getBarcode() + "]的入库库位,条码已有入库任务posname[" + task.getPosName() + "],CACHE_SAME_BARCODE_SETTINGS=" + barcodeSet + ",当前物料NG,已入库的任务继续完成");
EnLog.info("Get put-in pos for [" + barcodeSave.getBarcode() + "], barcode already has put-in task posname[" + task.getPosName() + "], CACHE_SAME_BARCODE_SETTINGS=" + barcodeSet + ", current material NG, continue finished task");
}
throw new ValidateException("smfcore.error.barcode.hastask", "Serial No.(S)[0] already have storage task", new String[]{barcodeSave.getBarcode()});
......@@ -594,6 +616,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
EnLog.error("Error updating status " + e.getMessage());
}
}
}
......@@ -622,6 +645,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
updateInOutDateExecuteTime(task.getPosName(),executeTime);
}
log.info(task.getBarcode() + "入仓位[" + task.getPosName() + "]完成,执行时间[" + executeTime + "]秒");
EnLog.info(task.getBarcode() + " put-in pos [" + task.getPosName() + "] finished, execute time [" + executeTime + "] seconds");
List<DataLog> taskList = taskService.findFinishedTaskList(cid, task.getPosName(), task.getBarcode(), true);
if (taskList != null && !taskList.isEmpty()) {
for (DataLog dataLog : taskList) {
......@@ -629,6 +653,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//将相同库位已经取消的任务从完成队列里删除
taskService.removeFinishedTask(dataLog);
log.info("从已完成的任务列表中删除之前取消的任务:" + dataLog.getPosName() + " ReelId:" + dataLog.getBarcode());
EnLog.info("Remove canceled task from finished task list: " + dataLog.getPosName() + " ReelId:" + dataLog.getBarcode());
}
}
}
......@@ -645,10 +670,12 @@ public class BaseDeviceHandler implements IDeviceHandler {
updateInOutDateExecuteTime(task.getPosName(),executeTime);
}
log.info(task.getBarcode() + "入仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间[" + executeTime + "]秒");
EnLog.info(task.getBarcode() + " put-in pos [" + task.getPosName() + "] finished, but task was canceled, change to finished, execute time [" + executeTime + "] seconds");
updatePutInData(task);
}
} else {
log.error(cid + "入仓位[" + posName + "]ReelId[" + barcode + "]完成时任务不存在");
EnLog.error(cid + " put-in pos [" + posName + "] ReelId [" + barcode + "] finished but task not found");
}
}
}
......@@ -660,6 +687,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
protected void endOutTask(String cid, String posName,String barcode){
log.info(cid +"将物料从库位["+posName+"]出库到门口/料串完成");
EnLog.info(cid + " material checkout from pos [" + posName + "] to door/reel string finished");
DataLog task = taskService.findFinishedOutTask(cid, posName,barcode);
if(task != null){
task.setStatus(OP_STATUS.END.name());
......@@ -685,11 +713,13 @@ public class BaseDeviceHandler implements IDeviceHandler {
updateInOutDateExecuteTime(task.getPosName(),executeTime);
}
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,执行时间[" + executeTime + "]秒");
EnLog.info(task.getBarcode() + " checkout pos [" + task.getPosName() + "] finished, execute time [" + executeTime + "] seconds");
DataLog cancelTask = taskService.findFinishedOutTask(cid, task.getPosName(),task.getBarcode());
if (cancelTask != null && cancelTask.isCancel()) {
//将相同库位已经取消的任务从完成队列里删除
taskService.removeFinishedTask(cancelTask);
log.info("从已完成的任务列表中删除之前取消的任务:" + cancelTask.getPosName() + " ReelId:" + cancelTask.getBarcode());
EnLog.info("Remove canceled task from finished task list: " + cancelTask.getPosName() + " ReelId:" + cancelTask.getBarcode());
}
updateCheckoutData(task,outBoxStatus);
} else {
......@@ -703,6 +733,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
updateInOutDateExecuteTime(task.getPosName(),executeTime);
}
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间[" + executeTime + "]秒");
EnLog.info(task.getBarcode() + " checkout pos [" + task.getPosName() + "] finished, but task was canceled, change to finished, execute time [" + executeTime + "] seconds");
updateCheckoutData(task,outBoxStatus);
}
} else if(ObjectUtil.isNotEmpty(posName)) {
......@@ -713,12 +744,15 @@ public class BaseDeviceHandler implements IDeviceHandler {
//查找库位是否为空,如果库位有料,调用清理手动出库的方法清理库存
if (ObjectUtil.isNotEmpty(barcode)) {
log.info(cid + "出仓位[" + posName + "]完成时任务不存在,清理库位中的库存[" + barcode + "]");
EnLog.info(cid + " checkout pos [" + posName + "] finished but task not found, clear stock [" + barcode + "] in pos");
taskService.addTaskToFinished(storagePos, null, cid + "-clear");
} else {
log.info(cid + "出仓位[" + posName + "]完成时任务不存在,清理库位失败,条码为空");
EnLog.info(cid + " checkout pos [" + posName + "] finished but task not found, failed to clear pos, barcode is empty");
}
} else {
log.warn(cid + "出仓位[" + posName + "]完成时任务不存在");
EnLog.warn(cid + " checkout pos [" + posName + "] finished but task not found");
}
}else if(ObjectUtil.isNotEmpty(barcode)){
StoragePos storagePos = storagePosManager.getByBarcode(barcode);
......@@ -727,13 +761,16 @@ public class BaseDeviceHandler implements IDeviceHandler {
posName = storagePos.getPosName();
//查找库位是否为空,如果库位有料,调用清理手动出库的方法清理库存
log.info(cid + "出仓位条码[" + barcode + "]完成时任务不存在,根据条码[" + barcode + "]找到库位[" + posName + "],清理库位中的库存 ");
EnLog.info(cid + " checkout barcode [" + barcode + "] finished but task not found, found pos [" + posName + "] by barcode [" + barcode + "], clear stock in pos");
taskService.addTaskToFinished(storagePos, null, cid + "-clear");
} else {
log.warn(cid + "出仓位条码[" + barcode + "]完成时任务不存在");
EnLog.warn(cid + " checkout barcode [" + barcode + "] finished but task not found");
}
}else{
log.error(cid + "出仓位[" + posName + "]ReelId["+barcode+"]完成时任务不存在");
EnLog.error(cid + " checkout pos [" + posName + "] ReelId [" + barcode + "] finished but task not found");
}
}
}
......@@ -752,10 +789,12 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (pos.getPriority() <= 0 || pos.getPriority() > exTime) {
pos.setPriority(exTime);
log.info("更改库位[" + posId + "]的最小入库时间=[" + exTime + "]秒");
EnLog.info("Update min put-in time for pos [" + posId + "] = [" + exTime + "] seconds");
try {
storagePosManager.save(pos);
} catch (ValidateException e) {
log.error("更改库位[" + posId + "]的最小入库时间=[" + exTime + "]秒 出错: " + e.toString());
EnLog.error("Error updating min put-in time for pos [" + posId + "] = [" + exTime + "] seconds: " + e.toString());
}
}
}
......@@ -814,6 +853,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
Storage storage=dataCache.getStorageById(storagePos.getStorageId());
taskService.checkout(storage,storagePos,false,true,"","");
log.error("updatePutInData 入库任务["+storagePos.getBarcode()+"]["+storagePos.getPosName()+"]标记为NG,自动生成NG出库任务 " );
EnLog.error("updatePutInData Put-in task [" + storagePos.getBarcode() + "][" + storagePos.getPosName() + "] marked as NG, auto generate NG checkout task");
}
// //调用西门子接口
......@@ -834,6 +874,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
Barcode barcode = storagePos.getBarcode();
if (barcode == null) {
log.warn("任务:" + task.getId() + " 仓位:" + task.getPosId() + " 的 Barcode 为null, 之前可能处理过,结束任务后直接返回");
EnLog.warn("Task: " + task.getId() + " Pos: " + task.getPosId() + " Barcode is null, maybe processed before, return directly after finishing task");
//记录日志
task.setStatus(outBoxStatus.name());
......@@ -862,6 +903,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
storagePosManager.save(storagePos);
log.info("出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
EnLog.info("Checkout finished, clear pos: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
//更新缓存中的库存信息
dataCache.updateInventory(storagePos, barcode);
......@@ -919,6 +961,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
// }
} catch (Exception e) {
log.error("客户端"+statusBean.getCid()+"故障消息处理出错:"+e.toString(), e);
EnLog.error("Client " + statusBean.getCid() + " error handling fault message: " + e.toString(), e);
}
}
......@@ -978,6 +1021,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
statusBean.setLastSaveTime(System.currentTimeMillis());
} catch (ValidateException e) {
log.error("保存温湿度出错",e);
EnLog.error("Error saving humidity/temperature", e);
}
}
}
......@@ -1017,6 +1061,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
LiteOrder order = liteOrderCache.getOrderSortItems(sourceId);
if (order == null) {
log.error("ACCSHELF: sourceId=" + sourceId + "的工单号未找到");
EnLog.error("ACCSHELF: sourceId=" + sourceId + " order number not found");
break;
}
for (LiteOrderItem item : order.getOrderItems()) {
......@@ -1029,6 +1074,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
taskService.updateQueueTask(dataLog);
log.info("ACCSHELF: sourceId=" + sourceId + "的工单[" + order.getOrderNo() + "]开始执行任务:[" + dataLog.getPosName() + "][" + dataLog.getPartNumber() + "][" + dataLog.getBarcode() + "]");
EnLog.info("ACCSHELF: sourceId=" + sourceId + " order [" + order.getOrderNo() + "] start executing task: [" + dataLog.getPosName() + "][" + dataLog.getPartNumber() + "][" + dataLog.getBarcode() + "]");
dataLogs.add(dataLog);
isFind = true;
......@@ -1046,6 +1092,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
protected StatusBean sendOutTaskToClient(DataLog outTask, StatusBean statusBean, Storage storage ) {
if (outTask != null) {
log.info("分配出库任务" + outTask.getBarcode() + "[" + outTask.getPosName() + "]到 " + storage.getCid());
EnLog.info("Assign checkout task " + outTask.getBarcode() + "[" + outTask.getPosName() + "] to " + storage.getCid());
outTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(outTask);
......@@ -1059,12 +1106,14 @@ public class BaseDeviceHandler implements IDeviceHandler {
plateH = codeObj.getHeight();
} else {
log.warn("出库无料仓位" + storage.getName() + "[" + posName + "]");
EnLog.warn("Checkout empty storage pos " + storage.getName() + "[" + posName + "]");
StoragePos pos=storagePosManager.getByPosName(posName);
plateW = pos.getW();
plateH = pos.getH();
}
statusBean.addPosInfo(outTask.getBarcode(), posName, plateW, plateH, false,outTask.isNgReel(),0);
log.info("出库" + storage.getName() + "[" + posName + "]物料[" + outTask.getBarcode() + "]["+outTask.isNgReel()+"] 发送到客户端" + storage.getCid());
EnLog.info("Checkout " + storage.getName() + "[" + posName + "] material [" + outTask.getBarcode() + "][" + outTask.isNgReel() + "] sent to client " + storage.getCid());
}
return statusBean;
}
......
package com.neotel.smfcore.core.device.handler.impl;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.storage.enums.DeviceType;
......@@ -20,6 +21,7 @@ public class LineBoxHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] not exist");
return null;
}
handleMsg(statusBean);
......@@ -34,6 +36,7 @@ public class LineBoxHandler extends BaseDeviceHandler {
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put in: " + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//查看是否有要出库的操作
......
......@@ -7,6 +7,7 @@ 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.Constants;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -48,6 +49,7 @@ public class MimoBoxHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] not exist");
return null;
}
statusBean.setClientIp(request.getRemoteHost());
......@@ -66,6 +68,7 @@ public class MimoBoxHandler extends BaseDeviceHandler {
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put in: " + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//先查找紧急出库的物料
......@@ -111,6 +114,7 @@ public class MimoBoxHandler extends BaseDeviceHandler {
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
EnLog.error("Update status error: " + e.getMessage());
}
}
}
......@@ -152,6 +156,7 @@ public class MimoBoxHandler extends BaseDeviceHandler {
if(excuttingOutTaskNum < 2){
if (singleOutTask != null) {
log.info("MIMO料仓优先分配紧急出库任务" + singleOutTask.getBarcode() + "[" + singleOutTask.getPosName() + "]到 " + cid);
EnLog.info("MIMO storage priority allocate urgent out task " + singleOutTask.getBarcode() + "[" + singleOutTask.getPosName() + "] to " + cid);
singleOutTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(singleOutTask);
......@@ -166,17 +171,20 @@ public class MimoBoxHandler extends BaseDeviceHandler {
plateH = codeObj.getHeight();
} else {
log.warn("MIMO紧急出库无料仓位" + storage.getName() + "[" + posName + "]");
EnLog.warn("MIMO urgent checkout no storage position " + 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);
EnLog.info("Checkout urgent material " + storage.getName() + "[" + posName + "] material [" + singleOutTask.getBarcode() + "] send to client " + cid);
return statusBean;
}
}
} catch (Exception e) {
log.error("出库紧急物料出错", e);
EnLog.error("Checkout urgent material error", e);
}
return null;
}
......@@ -235,6 +243,7 @@ public class MimoBoxHandler extends BaseDeviceHandler {
// }
log.info("根据PN单盘出库:【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
EnLog.info("Single out by PN: [" + storage.getName() + "_" + storage.getCid() + "] Position [" + pos.getPosName() + "]");
String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
......@@ -163,6 +164,7 @@ public class NLMShelfHandler extends BaseDeviceHandler {
// log.info(opKey + " : " + opStr);
}
log.info(str+":"+allOpStr);
EnLog.info("Operate pos light [" + pos.getPosName() + "] " + opKey + " : " + allOpStr);
}
/**
* 开灯, 等6秒后关闭
......@@ -193,6 +195,7 @@ public class NLMShelfHandler extends BaseDeviceHandler {
allCloseStr += posName + ",";
}
log.info(storage.getName() + "[" + cid + "]库位[" + allCloseStr + "]灭灯");
EnLog.info(storage.getName() + "[" + cid + "] pos[" + allCloseStr + "] light off");
} catch (Exception e) {
}
......@@ -229,6 +232,7 @@ public class NLMShelfHandler extends BaseDeviceHandler {
StoragePos lastPutinPos = lastPutinPosMap.get(currentStorage.getId());
if (lastPutinPos != null) {
log.info("扫码时关闭上一个库位:" + lastPutinPos.getPosName());
EnLog.info("Close last put in pos when scanning code:" + lastPutinPos.getPosName());
opPosLight("close", currentStorage, lastPutinPos, "");
}
groupId = currentStorage.getGroupId();
......@@ -355,13 +359,16 @@ public class NLMShelfHandler extends BaseDeviceHandler {
mergePosStr += storagePos.getPosName()+",";
}
log.info("设置合并库位[" + mergePosStr + "]使用状态为:true");
EnLog.info("Set merge pos[" + mergePosStr + "] used status to:true");
mainPos.setUsed(true);
mainPos.setMergePosList(mergePosNameList);
storagePosManager.save(mainPos);
pos = mainPos;
lastPutinPosMap.put(currentStorage.getCid(), pos);
log.info("合并库位[" + mergePosStr + "]到[" + pos.getPosName() + "]中");
EnLog.info("Merge pos[" + mergePosStr + "] to [" + pos.getPosName() + "]");
log.info(barcode.getPartNumber() + " [ " + barcode.getBarcode() + " ] " + "入库到:" + currentStorage.getName() + "[" + currentStorage.getCid() + "] " + pos.getPosName());
EnLog.info(barcode.getPartNumber() + " [ " + barcode.getBarcode() + " ] " + "Put in to:" + currentStorage.getName() + "[" + currentStorage.getCid() + "] " + pos.getPosName());
taskService.addTaskToFinished(pos, barcode, currentStorage.getName() + "-op");
openAndCloseLights(currentStorage, mergePosNameList, delayCloseTime, color);
return ResultBean.newOkResult("smfcore.shelf.msg.inMergeOk", "操作成功,请合并库位[{0}]并放入料盘", new String[]{pos.getPosName()},"");
......@@ -369,11 +376,13 @@ public class NLMShelfHandler extends BaseDeviceHandler {
String sizeInfo = barcode.getPlateSize() + " x " + barcode.getHeight();
String msg = "未找到适合[" + sizeInfo + "]的库位";
log.info(msg);
EnLog.info("No suitable pos found for [" + sizeInfo + "]");
return ResultBean.newErrorResult(99,"smfcore.shelf.msg.inError","未找到适合[" + sizeInfo + "]的库位", new String[]{sizeInfo} );
}
}
} catch (ValidateException e) {
log.error("入库出错:" + e.getMessage());
EnLog.error("Put in error:" + e.getMessage());
return ResultBean.newErrorResult(1, e.getMessage(), e.getMessage(), e.getMsgParam());
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
......@@ -83,11 +84,13 @@ public class NLPShelfHandler extends BaseDeviceHandler {
if (queueTask.isPutInTask() && (queueTask.isWait() || queueTask.isExecuting())) {
if (!Strings.isNullOrEmpty(groupId) && queueTask.getGroupId().equals(groupId)) {
log.info("codeIn [" + code + "][" + groupId + "]入库时取消条码[" + queueTask.getBarcode() + "]的未完成入库任务");
EnLog.info("codeIn [" + code + "][" + groupId + "] cancel unfinished put in task of barcode[" + queueTask.getBarcode() + "]");
//return ResultBean.newErrorResult(-1,"smfcore.unfinished","the task of [{0}] is unfinished",new String[]{queueTask.getBarcode()});
taskService.cancelTask(queueTask.getId());
}
if (!Strings.isNullOrEmpty(storageId) && queueTask.getStorageId().equals(storageId)) {
log.info("codeIn [" + code + "][" + storageId + "]入库时取消料架[" + queueTask.getStorageId() + "]的未完成入库任务");
EnLog.info("codeIn [" + code + "][" + storageId + "] cancel unfinished put in task of storage[" + queueTask.getStorageId() + "]");
//return ResultBean.newErrorResult(-1,"smfcore.unfinished","the task of [{0}] is unfinished",new String[]{queueTask.getStorageName()});
taskService.cancelTask(queueTask.getId());
}
......@@ -182,6 +185,7 @@ public class NLPShelfHandler extends BaseDeviceHandler {
} catch (ValidateException e) {
log.error(e.toString());
EnLog.error("Put in error: " + e.toString());
return ResultBean.newErrorResult(1, e.getMsgKey(), e.getDefaultMsg());
}
return ResultBean.newOkResult("");
......@@ -236,6 +240,7 @@ public class NLPShelfHandler extends BaseDeviceHandler {
}
statusBean.addData("open", queueTask.getPosName() + "=" + color.name());
log.info("库位[" + queueTask.getPosName() + "]+亮灯:" + color.name());
EnLog.info("Pos[" + queueTask.getPosName() + "] light on:" + color.name());
}
}
......@@ -288,6 +293,7 @@ public class NLPShelfHandler extends BaseDeviceHandler {
if (!pos.isUsed()) {
ngToOk.add(pos.getPosName());
log.info("sensorChange 客户端上传 noReelPosErrorList 库位[" + pos.getPosName() + "]数据库无信息,放入ngToOk");
EnLog.info("sensorChange client upload noReelPosErrorList pos[" + pos.getPosName() + "] no info in db, put into ngToOk");
}
}
}
......@@ -313,6 +319,7 @@ public class NLPShelfHandler extends BaseDeviceHandler {
continue;
}else if(usedPosList.contains(posName)){
log.info(cid + "sensorChange hasReelPosList [" + posName + "]库位已有物料,加入到ok列表");
EnLog.info(cid + "sensorChange hasReelPosList [" + posName + "] pos already has material, add to ok list");
inOkList.add(posName);
continue;
}
......@@ -403,18 +410,22 @@ public class NLPShelfHandler extends BaseDeviceHandler {
try {
//入库完成,发送入库完成请求
log.info(queueTask.getBarcode() + "入库完成,发送入库完成请求");
EnLog.info(queueTask.getBarcode() + " put in finished, send put in finished request");
super.finishedPutIn(storage.getCid(), pos.getPosName());
String msg = queueTask.getBarcode() + "入库到" + pos.getPosName() + "成功";
log.info(msg);
EnLog.info(queueTask.getBarcode() + " put in to " + pos.getPosName() + " success");
inResult = true;
break;
} catch (Exception e) {
log.error("入库出错" + e.getMessage());
EnLog.error("Put in error " + e.getMessage());
}
return inResult;
}
}
log.warn("未找到["+pos.getPosName()+"]的入库任务");
EnLog.warn("Not found put in task of [" + pos.getPosName() + "]");
return inResult;
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -108,6 +109,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
}
statusBean.addData("open",queueTask.getPosName()+"="+color.name());
log.info("库位[" + queueTask.getPosName() + "]["+queueTask.getType()+"]+亮灯:" + color.name());
EnLog.info("Pos[" + queueTask.getPosName() + "][" + queueTask.getType() + "] light on:" + color.name());
}
}
......@@ -129,6 +131,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
if(posToClose != null){
String psession=sessionId.substring(sessionId.length()-10);
log.info( psession+ "关闭上一个操作库位:"+ posToClose.getPosName());
EnLog.info(psession + " close last operation pos:" + posToClose.getPosName());
operateBean.setPosToClose(null);
operateBean.setOpPos(null);
shelfPutInBeanMap.put(sessionId, operateBean);
......@@ -140,6 +143,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
if(shelfOperateBean.timeOut()){
String removedSessionId = shelfOperateBean.getSessionId();
log.info("料架入库缓存["+shelfOperateBean.getSessionId()+"]长时间未操作,清理缓存");
EnLog.info("Shelf put in cache[" + shelfOperateBean.getSessionId() + "] timeout, clean cache");
shelfPutInBeanMap.remove(removedSessionId);
}
}
......@@ -169,6 +173,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorageById(pos.getStorageId());
DevicesStatusUtil.appendOp(storage.getCid(), opKey , opStr);
log.info("操作库位["+pos.getPosName()+"]" + opKey + " : " + opStr);
EnLog.info("Operate pos[" + pos.getPosName() + "]" + opKey + " : " + opStr);
}
/**
* 开灯, 等30秒后关闭
......@@ -200,6 +205,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
if(autoClose){
log.info("自动关闭库位:"+ posToClose.getPosName());
EnLog.info("Auto close pos:" + posToClose.getPosName());
opPosLight("close", posToClose, "");
operateBean.setOpPos(null);
operateBean.setPosToClose(null);
......@@ -208,6 +214,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
}
}catch (Exception e){
log.error("自动关闭库位灯出错:" + e.getMessage());
EnLog.error("Auto close pos light error:" + e.getMessage());
}
}
});
......@@ -255,6 +262,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
String ptoken=token.substring(token.length()-10);
String loginUser = SecurityUtils.getLoginUsername();
log.info(storageId + "扫到条码["+code+"]" );
EnLog.info(storageId + " scan barcode[" + code + "]");
if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
}
......@@ -309,6 +317,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
operateBean.setPosToClose(pos);
shelfPutInBeanMap.put(token, operateBean);
log.info(ptoken + ":库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料");
EnLog.info(ptoken + ":Pos[" + pos.getPosName() + "] operation success, please scan material to put in");
return ResultBean.newOkResult("smfcore.shelf.msg.tipScanReel", "库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料", new String[]{pos.getPosName()},pos.getPosName());
}
} else {
......@@ -344,6 +353,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
taskService.addTaskToFinished(inPos, null, loginUser);
opPosLight("close", inPos, "");
log.info(code + " 出库完成, 库位[" + inPos.getPosName() + "]灭灯");
EnLog.info(code + " checkout finished, pos[" + inPos.getPosName() + "] light off");
String orderId = task.getSourceId();
Map<String,String> dataMap = new HashMap<>();
if (!Strings.isNullOrEmpty(orderId)) {
......@@ -354,6 +364,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
String orderFinishedTxt = MessageUtils.getText("smfcore.order.finished", new String[]{orderNo}, request.getLocale(), "工单["+orderNo+"]的任务已全部完成");
dataMap.put("orderFinishedTxt",orderFinishedTxt);
log.info("工单完成,返回 orderFinishedTxt, "+orderFinishedTxt);
EnLog.info("Order finished, return orderFinishedTxt: " + orderFinishedTxt);
}
}
return ResultBean.newOkResult( "smfcore.shelf.msg.outConfirm", "出库完成, 库位[{0}]灭灯", new String[]{inPos.getPosName()} ,dataMap);
......@@ -415,6 +426,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
//已扫过库位
canBarcodePutInPos(opPos, barcode);
log.info(barcode.getPartNumber() + " [ " + barcode.getBarcode() + " ] " + "入库到:" + opPos.getPosName());
EnLog.info(barcode.getPartNumber() + " [ " + barcode.getBarcode() + " ] " + " put in to:" + opPos.getPosName());
opPos.setCanCheckOutTime(System.currentTimeMillis() + delayCloseTime);
taskService.addTaskToFinished(opPos, barcode, loginUser);
......
......@@ -7,6 +7,7 @@ import com.google.common.collect.Maps;
import com.mks.api.response.APIException;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
......@@ -69,6 +70,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] not found");
return null;
}
statusBean.setClientIp(request.getRemoteHost());
......@@ -84,6 +86,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put-in: " + statusBean.toString());
//判断是否有放在门口状态的入库任务
Collection<DataLog> queueTasks = taskService.getQueueTasks();
for (DataLog queueTask : queueTasks) {
......@@ -96,6 +99,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
statusBean.addPosInfo(reelId, posId, plateW, plateH, false);
log.info(reelId + "[" + plateW + "x" + plateH + "]开始入库到" + storage.getCid() + "[" + posId + "]");
EnLog.info(reelId + "[" + plateW + "x" + plateH + "] start put-in to " + storage.getCid() + "[" + posId + "]");
return statusBean;
}
}
......@@ -170,6 +174,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (queueTask.needReSendToClient()) {
outTask = queueTask;
log.error("cid[" + cid + "]的出库任务[" + queueTask.getPosName() + "]超过60秒仍未完成,重新发送到客户端!");
EnLog.error("Checkout task for cid[" + cid + "] pos[" + queueTask.getPosName() + "] exceeded 60s, resend to client");
queueTask.setUpdateDate(new Date());
break;
}
......@@ -210,6 +215,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
} catch (Exception e) {
log.error("出库出错", e);
EnLog.error("Checkout error", e);
}
return statusBean;
......@@ -241,11 +247,13 @@ public class RobotBoxHandler extends BaseDeviceHandler {
finishedTask.setStatus(OP_STATUS.BOXDOOR.name());
taskService.updateFinishedTask(finishedTask);
log.info("物料" + finishedTask.getBarcode() + "已从库位" + finishedTask.getPosName() + "取出放到门口");
EnLog.info("Material " + finishedTask.getBarcode() + " taken from pos " + finishedTask.getPosName() + " to door");
return statusBean;
}
}
}
log.error(posName + "出库放到门口时,未找到对应的出库任务");
EnLog.error("No matching checkout task found when placing pos " + posName + " to door");
} else if (BOX_STATUS.OUT_FAILED == status) {
//更改出库状态为OUT_DOOR
List<DataLog> finishedTasks = taskService.getFinishedTasks();
......@@ -255,6 +263,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//已出仓但未放到门口,更改状态
finishedTask.setStatus(OP_STATUS.BOXDOOR_NOREEL.name());
log.info("物料" + finishedTask.getBarcode() + "已从库位" + finishedTask.getPosName() + "取出放到门口,但未感应到料盘,屏蔽库位");
EnLog.info("Material " + finishedTask.getBarcode() + " taken from pos " + finishedTask.getPosName() + " to door, but reel not detected, disable position");
StoragePos pos = storagePosManager.getByPosName(finishedTask.getPosName());
if (pos != null) {
pos.setEnabled(false);
......@@ -275,6 +284,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
EnLog.error("Error updating status: " + e.getMessage());
}
}
}
......@@ -307,12 +317,14 @@ public class RobotBoxHandler extends BaseDeviceHandler {
rfid = "";
}
log.info(" renewPosForPutin 流水线[" + cids + "]重新获取[" + code + "]的入库库位, 需要排除上个料仓,cid=[" + preCid + "],rfid=[" + rfid + "],并取消入库任务");
EnLog.info("renewPosForPutin line[" + cids + "] renew put-in pos for [" + code + "], exclude preCid=[" + preCid + "], rfid=[" + rfid + "], and cancel put-in task");
Barcode barcode = barcodeManager.findByBarcode(code);
if (barcode != null) {
// 自动添加条码=1+0x0-7x8=P511-500067E|1PGRM033R60J104KE19D|1TWG3914AXF|7Q2180+EA|SPWG3914AXFK2L|21PMURATA||9D20230928||||到数据库中
code = "=1+0x0-" + barcode.getPlateSize() + "x" + barcode.getHeight() + "=" + code;
log.info(" renewPosForPutin 处理后条码:" + code);
EnLog.info("renewPosForPutin processed barcode: " + code);
}
return posForPutin(code, cids, preCid, rfid,request.getLocale());
......@@ -350,12 +362,14 @@ public class RobotBoxHandler extends BaseDeviceHandler {
String lastPosId = "";
String lineMsg = "";
log.info("流水线[" + cids + "]获取[" + code + "],rfid=["+rfid+"]的入库库位");
EnLog.info("Line [" + cids + "] get put-in position for [" + code + "], rfid=[" + rfid + "]");
return posForPutin(code,cids,"",rfid,request.getLocale());
}
public Map<String, Object> posForPutin(String code,String cids,String preCid,String rfid,Locale locale){
log.info("posForPutin,code=["+code+"],cids=["+cids+"],preCid=["+preCid+"]");
EnLog.info("posForPutin, code=[" + code + "], cids=[" + cids + "], preCid=[" + preCid + "]");
String lastPosId = "";
String lineMsg = "";
......@@ -391,12 +405,14 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (notIntoCids != null) {
if (notIntoCids.contains(cid)) {
log.info("料仓[" + cid + "]已被屏蔽入库");
EnLog.info("Storage [" + cid + "] is blocked for put-in");
continue;
}
}
if(ObjectUtil.isNotEmpty(preCid)) {
if (cid.equals(preCid)) {
log.info("料仓[" + cid + "]是上个入库料仓,排除此料仓");
EnLog.info("Storage [" + cid + "] is the previous put-in storage, exclude it");
}
}
......@@ -429,6 +445,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
errorMsg = "[" + barcode.getBarcode() + "]" + MessageUtils.getText("smfcore.error.barcode.expired", new Locale("en", "US"), "物料已过期,无法入库");
resultMap.put("msg", errorMsg);
log.error("物料[" + barcode.getBarcode() + "]已过期,无法入库");
EnLog.error("Material [" + barcode.getBarcode() + "] expired, cannot put in");
loadingUtil.AddInListItem(rfid, barcode, "", INITEM_STATUS.NG, errorMsg);
......@@ -446,9 +463,11 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (barcodeSet == null || barcodeSet == 1) {
//如果已在库位中,那么自动将该库位的物料出库
log.info(" 物料"+barcode.getBarcode()+"已在库位中, CACHE_SAME_BARCODE_SETTINGS=1,自动出库已在库位中的物料[" + barcode.getBarcode() + "],设置ngReel=true");
EnLog.info("Barcode " + barcode.getBarcode() + " already in position, CACHE_SAME_BARCODE_SETTINGS=1, auto checkout existing material [" + barcode.getBarcode() + "], set ngReel=true");
taskService.checkout(storage, hasPos, true, true, "", "");
} else {
log.info(" 物料"+barcode.getBarcode()+"已在库位中, CACHE_SAME_BARCODE_SETTINGS=2,标记库位[" + hasPos.getPosName() + "]中的物料[" + barcode.getBarcode() + "]为ngReel=NG");
EnLog.info("Barcode " + barcode.getBarcode() + " already in position, CACHE_SAME_BARCODE_SETTINGS=2, mark pos[" + hasPos.getPosName() + "] barcode[" + barcode.getBarcode() + "] as ngReel=NG");
hasPos.getBarcode().updateAppendData("ngReel", true);
storagePosManager.save(hasPos);
}
......@@ -466,6 +485,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if(ObjectUtil.isNotEmpty(preCid)) {
log.info("preCid="+preCid+",["+barcode.getBarcode()+"]开始取消上个入库任务");
EnLog.info("preCid=" + preCid + ", [" + barcode.getBarcode() + "] start cancel previous put-in task");
Collection<DataLog> tasks = taskService.getAllTasks();
for (DataLog task : tasks) {
if (task.isFinished() || task.isCancel()) {
......@@ -475,11 +495,13 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (task.isPutInTask()) {
boolean cancelResult = taskService.cancelTask(task.getId());
log.info("renewPosForPutin 重新获取库位号时,取消[" + barcode.getBarcode() + "]上个入库任务[" + task.getPosName() + "-" + task.getCid() + "]结果:" + cancelResult);
EnLog.info("renewPosForPutin cancel previous put-in task for [" + barcode.getBarcode() + "] [" + task.getPosName() + "-" + task.getCid() + "] result: " + cancelResult);
}
}
}
log.info("preCid="+preCid+",["+barcode.getBarcode()+"]清除锁定库位");
EnLog.info("preCid=" + preCid + ", [" + barcode.getBarcode() + "] clear locked position");
ReelLockPosUtil.removeReelLockPosInfo(barcode.getBarcode());
......@@ -489,12 +511,14 @@ public class RobotBoxHandler extends BaseDeviceHandler {
String nrfid= loadingUtil.getRfidByBarcode(barcode.getBarcode() );
if(ObjectUtil.isNotEmpty(nrfid)){
log.info("rfid为空,第二次获取库位号,从入库单中查找到rfid:"+nrfid);
EnLog.info("rfid is empty, renewPosForPutin found rfid from inList: " + nrfid);
rfid=nrfid;
}
}
}
} catch (Exception e) {
log.error("取消上个入库任务出错:" + e.toString());
EnLog.error("Cancel previous put-in task error: " + e.toString());
}
......@@ -519,12 +543,14 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//原任务标记NG
dataLog.setNgReel(true);
log.info("获取[" + code + "]的入库库位,条码已有入库任务posname[" + dataLog.getPosName() + "],标记入库任务为NG,入库后自动出库");
EnLog.info("Get put-in pos for [" + code + "], barcode already has put-in task pos[" + dataLog.getPosName() + "], mark task NG and auto checkout after put-in");
taskService.updateQueueTask(dataLog);
//更改旧任务NG
String msg="Repeat Inbound";
loadingUtil.updateItemState(dataLog.getBarcode(),dataLog.getPosName(),INITEM_STATUS.NG,msg);
}else{
log.info("获取[" + code + "]的入库库位,条码已有入库任务posname[" + dataLog.getPosName() + "],CACHE_SAME_BARCODE_SETTINGS="+barcodeSet+",当前物料NG,已入库的任务继续完成");
EnLog.info("Get put-in pos for [" + code + "], barcode already has put-in task pos[" + dataLog.getPosName() + "], CACHE_SAME_BARCODE_SETTINGS=" + barcodeSet + ", current material NG, existing put-in task continues");
}
return resultMap;
// //已有入库任务
......@@ -566,6 +592,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
resultMap.put("taskId", dataLog.getId());
resultMap.put("cid", dataLog.getCid());
log.info("条码[" + dataLog.getBarcode() + "]已有出库任务["+dataLog.getPosName()+"],需继续执行出库动作");
EnLog.info("Barcode[" + dataLog.getBarcode() + "] already has checkout task pos[" + dataLog.getPosName() + "], continue checkout");
return resultMap;
}
}
......@@ -586,6 +613,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
resultMap.put("msg", errorMsg);
log.info("获取[" + code + "]的入库库位,条码已有入库任务posname[" + dataLog.getPosName() + "],的入库任务,任务状态["+dataLog.getStatus()+"],直接NG");
EnLog.info("Get put-in pos for [" + code + "], existing put-in task pos[" + dataLog.getPosName() + "] status[" + dataLog.getStatus() + "], return NG");
return resultMap;
} else {
//已有待完成的出库任务,直接NG
......@@ -596,6 +624,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
resultMap.put("msg", errorMsg);
log.info("获取[" + code + "]的入库库位,条码已有入库任务posname[" + dataLog.getPosName() + "],的出库任务,任务状态["+dataLog.getStatus()+"],直接NG");
EnLog.info("Get put-in pos for [" + code + "], existing checkout task pos[" + dataLog.getPosName() + "] status[" + dataLog.getStatus() + "], return NG");
return resultMap;
}
}
......@@ -641,6 +670,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
resultMap.put("msg", errorMsg);
loadingUtil.AddOrUpdateItemState(rfid,barcode ,"", INITEM_STATUS.NG, errorMsg);
log.info("获取[" + code + "]的入库库位, [" + barcode.getBarcode() + "]未找到可用的[" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]仓位");
EnLog.info("Get put-in pos for [" + code + "], barcode[" + barcode.getBarcode() + "] no available position for [" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]");
return resultMap;
}
......@@ -649,6 +679,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if(barcode.isToXray()){
log.info("物料["+barcode.getBarcode()+"]需要先去点料" );
EnLog.info("Material [" + barcode.getBarcode() + "] requires Xray counting first");
resultMap.put("result", "110");
resultMap.put("barcode", barcode.getBarcode());
errorMsg= MessageUtils.getText("smfcore.api.toXray",new String[]{barcode.getBarcode()},new Locale("en","US"),"{0}需要去点料");
......@@ -676,6 +707,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
}
if ((useAPi == false) && xrayTest) {
log.info("useAPi==false,xrayTest=true, 点料测试已启用,且分配的库位是麦康尼料仓, 物料[" + barcode.getBarcode() + "]需要先去点料");
EnLog.info("useAPi=false, xrayTest=true, xray test enabled and assigned pos is third-party storage, material[" + barcode.getBarcode() + "] requires Xray counting first");
resultMap.put("result", "110");
resultMap.put("barcode", barcode.getBarcode());
errorMsg = MessageUtils.getText("smfcore.api.toXray", new String[]{barcode.getBarcode()}, new Locale("en", "US"), "{0}需要去点料");
......@@ -712,6 +744,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
EnLog.info("Clear locked position: pos[" + oldLockInfo.getLockPosName() + "] locked by barcode[" + oldLockInfo.getBarcode() + "]");
}
}
......@@ -771,8 +804,10 @@ public class RobotBoxHandler extends BaseDeviceHandler {
} catch (ApiException apiException) {
errorMsg = apiException.getMessage();
log.info("API 错误:" + errorMsg);
EnLog.info("API error: " + errorMsg);
String exMsg = MessageUtils.getText(apiException.getMsgKey(), apiException.getMsgParam(), new Locale("en", "US"), apiException.getDefaultMsg());
log.info(apiException.getMsgKey() + "获取到exMsg=" + exMsg);
EnLog.info(apiException.getMsgKey() + " got exMsg=" + exMsg);
resultMap.put("result", "120");
if (ObjectUtil.isEmpty(errorMsg) && ObjectUtil.isNotEmpty(apiException.getMessage())) {
// errorMsg=apiException.getMessage();
......@@ -857,6 +892,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
InListItem item=loadingUtil.GetInlistItem(barcode.getBarcode());
if(item!=null ){
log.info("条码[" + barcode.getBarcode() + "]获取库位号,已存在inListItem, 状态="+item.getState());
EnLog.info("Barcode[" + barcode.getBarcode() + "] get put-in position, inListItem exists, state=" + item.getState());
if(item.getState()==INITEM_STATUS.XRayEnd){
//更改状态为入库中
barcode.setToXray(false);
......@@ -871,6 +907,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (inList == null) {
log.error("启用API,且未找到入库单,提示:No select for ML5 Loading");
EnLog.error("API enabled but no inList found: No select for ML5 Loading");
//如果启用api,且没有入库单,需要报警提示:No select for ML5 Loading
throw new ValidateException("smfcore.noSelectForML5Loading","No select for ML5 Loading");
// return barcode;
......@@ -881,12 +918,14 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//如果入库单已手动结束,不再接收新任务
if(inList.isManualFinish()){
log.info("当前入库单[" + inList.getName() + "]已手动结束,不需要再验证:"+barcode.getBarcode());
EnLog.info("Current inList[" + inList.getName() + "] is manually finished, skip verification: " + barcode.getBarcode());
return barcode;
}
operationId = inList.getOperationId();
if (ObjectUtil.isEmpty(operationId)) {
log.info("条码[" + barcode.getBarcode() + "]获取库位号,operationId 为空,不需要接口验证");
EnLog.info("Barcode[" + barcode.getBarcode() + "] get put-in position, operationId is empty, skip API verification");
return barcode;
}
barcode = MicronApi.API001(operationId,rfid, barcode);
......@@ -903,6 +942,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if (barcode.isToXray()) {
if(xrayBypass){
log.info("条码[" + barcode.getBarcode() + "]获取库位号,需要去点料, 勾选了 Xray Bypass,继续入库 ");
EnLog.info("Barcode[" + barcode.getBarcode() + "] requires Xray counting, Xray Bypass checked, continue put-in");
barcode.setInListName(inList.getName());
barcode.setToXray(false);
loadingUtil.AddInListItem(rfid, barcode, "", INITEM_STATUS.PutIn);
......@@ -915,9 +955,11 @@ public class RobotBoxHandler extends BaseDeviceHandler {
barcodeManager.saveBarcode(barcode);
loadingUtil.AddInListItem(rfid, barcode, "", INITEM_STATUS.XRay);
log.info("条码[" + barcode.getBarcode() + "]获取库位号,需要去点料,点料机CI当前在线,返回需要点料");
EnLog.info("Barcode[" + barcode.getBarcode() + "] requires Xray counting, CI is online, return need counting");
} else {
log.error("条码[" + barcode.getBarcode() + "]获取库位号,需要去点料,点料机CI未连接,直接异常");
EnLog.error("Barcode[" + barcode.getBarcode() + "] requires Xray counting, CI is offline, throw exception");
throw new ApiException("smfcore.micron.xray.offline", "{0} required counting partial quantity, Xray counter is not online", new String[]{barcode.getBarcode()});
}
}
......@@ -941,6 +983,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
String statusStr = request.getParameter("status");
String locInfo = request.getParameter("locInfo");
log.info("收到taskId[" + taskId + "],料盘[" + barcode + "]更新位置指令[" + statusStr + "]=" + locInfo);
EnLog.info("Received taskId[" + taskId + "], barcode[" + barcode + "] update location command [" + statusStr + "]=" + locInfo);
if (ObjectUtil.isEmpty(locInfo)) {
locInfo = statusStr;
......@@ -973,22 +1016,26 @@ public class RobotBoxHandler extends BaseDeviceHandler {
}
if (opTask == null) {
log.info(" taskId[" + taskId + "],料盘[" + barcode + "]更新位置指令[" + statusStr + "]=" + locInfo + ",失败:任务不存在");
EnLog.info("taskId[" + taskId + "], barcode[" + barcode + "] update location [" + statusStr + "]=" + locInfo + ", failed: task not found");
return ResultBean.newErrorResult(301, "smfcore.task.notExist", "任务不存在");
}
if (opTask.isFinished()) {
log.error(" taskId[" + taskId + "],料盘[" + barcode + "]更新位置指令[" + statusStr + "]=" + locInfo + ",失败:任务已完成");
EnLog.error("taskId[" + taskId + "], barcode[" + barcode + "] update location [" + statusStr + "]=" + locInfo + ", failed: task completed");
return ResultBean.newErrorResult(302, "smfcore.task.hasEnd", "任务已完成");
}
if (opTask.isCancel()) {
log.error(" taskId[" + taskId + "],料盘[" + barcode + "]更新位置指令[" + statusStr + "]=" + locInfo + ",失败:任务已被取消");
EnLog.error("taskId[" + taskId + "], barcode[" + barcode + "] update location [" + statusStr + "]=" + locInfo + ", failed: task canceled");
return ResultBean.newErrorResult(303, "smfcore.task.hasCancel", "更新状态时{0}的任务[{1}]已被取消", new String[]{opTask.getBarcode(), opTask.getId()});
}
//如果是入库任务,不能直接更新为 FINISHED
if(statusStr.toUpperCase().equals("FINISHED")&&opTask.isPutInTask()){
log.error(" taskId[" + taskId + "],料盘[" + barcode + "]当前状态[" + opTask.getStatus() + "=" + opTask.getLocInfo() + "]更新位置指令[" + statusStr + "]=" + locInfo + ",失败:入库任务不能直接更新为结束");
EnLog.error("taskId[" + taskId + "], barcode[" + barcode + "] current state[" + opTask.getStatus() + "=" + opTask.getLocInfo() + "] update location [" + statusStr + "]=" + locInfo + ", failed: put-in task cannot be updated directly to FINISHED");
return ResultBean.newErrorResult(304, "smfcore.task.updatePutInFail", "入库任务{0}[{1}]不能更新为{2}", new String[]{opTask.getBarcode(), opTask.getId(),statusStr});
}
......@@ -997,9 +1044,11 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//若已经在此状态,不需要再更新
if (opTask.getStatus().equals(statusStr) && opTask.getLocInfo().equals(locInfo)) {
log.warn("更新料盘[" + barcode + "]的[" + inouType + "]任务状态已是[" + opTask.getStatus() + "=" + opTask.getLocInfo() + "]不需要重复更新为[" + statusStr + "=" + locInfo + "]");
EnLog.warn("Update barcode[" + barcode + "] [" + inouType + "] task state already [" + opTask.getStatus() + "=" + opTask.getLocInfo() + "], no need to update to [" + statusStr + "=" + locInfo + "]");
} else {
log.info("更新料盘[" + barcode + "]的[" + inouType + "]任务状态[" + opTask.getStatus() + "=" + opTask.getLocInfo() + "]为[" + statusStr + "=" + locInfo + "]");
EnLog.info("Update barcode[" + barcode + "] [" + inouType + "] task state from [" + opTask.getStatus() + "=" + opTask.getLocInfo() + "] to [" + statusStr + "=" + locInfo + "]");
opTask.setStatus(statusStr);
opTask.setLocInfo(locInfo);
......@@ -1017,10 +1066,12 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//保存状态
MaterialLog m = new MaterialLog(opTask.getBarcode(), opTask.getPosName(), opTask.getType(), opTask.getStatus(), opTask.getLocInfo());
log.info("记录料盘[" + inouType + "]日志[" + m.getBarcode() + "," + m.getPosName() + "," + m.getStatus() + "," + m.getLocInfo() + "]");
EnLog.info("Record barcode[" + inouType + "] log [" + m.getBarcode() + "," + m.getPosName() + "," + m.getStatus() + "," + m.getLocInfo() + "]");
materialLogManager.save(m);
}}catch (Exception ex){
log.info("记录料盘[" + inouType + "]日志[" + opTask.getBarcode() + "," + opTask.getPosName() + "," + opTask.getStatus() + "," + opTask.getLocInfo() + "]出错:"+ex.getMessage());
EnLog.info("Record barcode[" + inouType + "] log [" + opTask.getBarcode() + "," + opTask.getPosName() + "," + opTask.getStatus() + "," + opTask.getLocInfo() + "] error: " + ex.getMessage());
}
}
......@@ -1107,6 +1158,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
try {
String barcodeStr = request.getParameter("barcode");
log.info(" 获取[" + barcodeStr + "]的尺寸信息");
EnLog.info("Get size info for [" + barcodeStr + "]");
Collection<CodeBean> codeBeans = codeResolve.resolveCodeStr(barcodeStr, COMPONENT_TYPE.COMPONENT);
Barcode barcode = null;
......@@ -1138,9 +1190,11 @@ public class RobotBoxHandler extends BaseDeviceHandler {
} catch (ValidateException e) {
log.warn(" 获取尺寸信息出错:" + e.getMessage());
EnLog.warn("Get size info error: " + e.getMessage());
return ResultBean.newErrorResult(105, "smfcore.getSize.error", "获取尺寸信息出错:" + e.getMessage());
} catch (Exception e) {
log.error("获取尺寸信息出错", e);
EnLog.error("Get size info error", e);
return ResultBean.newErrorResult(1, "smfcore.getSize.error", "获取尺寸信息出错:" + e.getMessage());
}
}
......@@ -1153,6 +1207,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
String barcode = request.getParameter("barcode");
try {
log.info("emptyOut: 条码["+barcode + "] ");
EnLog.info("emptyOut: barcode[" + barcode + "]");
DataLog opTask = null;
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog task : allTasks) {
......@@ -1167,10 +1222,12 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if(opTask==null){
//空出未找到任务
log.info("emptyOut: 条码["+barcode + "] 空出处理失败:任务不存在");
EnLog.info("emptyOut: barcode[" + barcode + "] failed: task not found");
return ResultBean.newErrorResult(301, "smfcore.task.notExist", "任务不存在");
}
updateCheckoutData(opTask,OP_STATUS.FINISHED);
log.info("emptyOut: 条码["+opTask.getBarcode() + "],库位号["+opTask.getPosName()+"]空出完成,结束任务,标记任务为空出");
EnLog.info("emptyOut: barcode[" + opTask.getBarcode() + "], pos[" + opTask.getPosName() + "] completed, end task, mark emptyOperate");
opTask.setEmptyOperate(true);
taskService.updateFinishedTask(opTask);
return ResultBean.newOkResult(opTask.getPosName());
......
package com.neotel.smfcore.core.device.handler.impl;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.storage.enums.DeviceType;
......@@ -24,6 +25,7 @@ public class SisoBoxHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] not exist");
return null;
}
handleMsg(statusBean);
......@@ -38,6 +40,7 @@ public class SisoBoxHandler extends BaseDeviceHandler {
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put in: " + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//查看是否有要出库的操作
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
......@@ -35,6 +36,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] does not exist");
return null;
}
statusBean.setClientIp(request.getRemoteHost());
......@@ -50,6 +52,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put in:" + statusBean.toString());
//判断是否有放在门口状态的入库任务
Collection<DataLog> queueTasks = taskService.getQueueTasks();
for (DataLog queueTask : queueTasks) {
......@@ -62,6 +65,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
statusBean.addPosInfo(reelId, posId, plateW, plateH, false);
log.info(reelId + "[" + plateW + "x" + plateH + "]开始入库到" + storage.getCid() + "[" + posId + "]");
EnLog.info(reelId + "[" + plateW + "x" + plateH + "] start put in to " + storage.getCid() + "[" + posId + "]");
return statusBean;
}
}
......@@ -135,6 +139,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
if (queueTask.needReSendToClient()) {
outTask = queueTask;
log.error("cid[" + cid + "]的出库任务[" + queueTask.getPosName() + "]超过60秒仍未完成,重新发送到客户端!");
EnLog.error("cid[" + cid + "] checkout task [" + queueTask.getPosName() + "] not finished over 60s, resend to client!");
queueTask.setUpdateDate(new Date());
break;
}
......@@ -175,6 +180,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
} catch (Exception e) {
log.error("出库出错", e);
EnLog.error("Checkout error", e);
}
return statusBean;
......@@ -216,17 +222,20 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
finishedTask.setStatus(OP_STATUS.BOXDOOR.name());
taskService.updateFinishedTask(finishedTask);
log.info("物料" + finishedTask.getBarcode() + "已从库位" + finishedTask.getPosName() + "取出放到门口");
EnLog.info("Material " + finishedTask.getBarcode() + " has been taken out from pos " + finishedTask.getPosName() + " to door");
return statusBean;
}else if(ObjectUtil.isNotEmpty(barcode)&&barcode.equals(finishedTask.getBarcode())){
//已出仓但未放到门口,更改状态
finishedTask.setStatus(OP_STATUS.BOXDOOR.name());
taskService.updateFinishedTask(finishedTask);
log.info("物料" + finishedTask.getBarcode() + "已从库位" + finishedTask.getPosName() + "取出放到门口");
EnLog.info("Material " + finishedTask.getBarcode() + " has been taken out from pos " + finishedTask.getPosName() + " to door");
return statusBean;
}
}
}
log.error(posName + ",barcode["+barcode+"] 出库放到门口时,未找到对应的出库任务");
EnLog.error(posName + ",barcode["+barcode+"] When checkout to door, cannot find corresponding checkout task");
} else if (BOX_STATUS.OUT_FAILED == status) {
//更改出库状态为OUT_DOOR
List<DataLog> finishedTasks = taskService.getFinishedTasks();
......@@ -236,6 +245,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
//已出仓但未放到门口,更改状态
finishedTask.setStatus(OP_STATUS.BOXDOOR_NOREEL.name());
log.info("物料" + finishedTask.getBarcode() + "已从库位" + finishedTask.getPosName() + "取出放到门口,但未感应到料盘,屏蔽库位");
EnLog.info("Material " + finishedTask.getBarcode() + " has been taken out from pos " + finishedTask.getPosName() + " to door, but reel not sensed, disable pos");
StoragePos pos = storagePosManager.getByPosName(finishedTask.getPosName());
if (pos != null) {
pos.setEnabled(false);
......@@ -256,6 +266,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
EnLog.error("Error updating status: " + e.getMessage());
}
}
}
......@@ -270,6 +281,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
Storage storage = dataCache.getStorage(task.getCid());
if (storage == null) {
log.error("入库任务完成时库存比对:未找到料仓:" + task.getCid());
EnLog.error("Put in task finished inventory check: storage not found: " + task.getCid());
}
String sizeStr = task.getW() + "x" + task.getH();
......@@ -278,10 +290,12 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
int currCount = item.getTotalCount() - item.getUsedCount();
if (currCount - 1 == updateCount) {
log.info("入库任务完成时库存比对:料仓[" + storage.getCid() + "]尺寸[" + sizeStr + "]当前库存[" + currCount + "]上传库存[" + updateCount + "],不更改库位号");
EnLog.info("Put in task finished inventory check: storage[" + storage.getCid() + "] size[" + sizeStr + "] current inventory[" + currCount + "] upload inventory[" + updateCount + "], do not change pos");
//完全相等,不处理
return null;
} else if (currCount > updateCount) {
log.error("入库任务完成时库存比对:料仓[" + storage.getCid() + "]尺寸[" + sizeStr + "]当前库存[" + currCount + "]上传库存[" + updateCount + "],不更改库位号");
EnLog.error("Put in task finished inventory check: storage[" + storage.getCid() + "] size[" + sizeStr + "] current inventory[" + currCount + "] upload inventory[" + updateCount + "], do not change pos");
return null;
}
......@@ -300,15 +314,18 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
if (pos == null) {
log.info("入库任务完成时库存比对:料仓[" + storage.getCid() + "]新尺寸[" + key + "]当前库存[" + sizeEmptyCount + "]上传库存[" + sizeCount + "],尝试查找空库位失败");
EnLog.info("Put in task finished inventory check: storage[" + storage.getCid() + "] new size[" + key + "] current inventory[" + sizeEmptyCount + "] upload inventory[" + sizeCount + "], failed to find empty pos");
} else {
log.info("入库任务完成时库存比对:料仓[" + storage.getCid() + "]新尺寸[" + key + "]当前库存[" + sizeEmptyCount + "]上传库存[" + sizeCount + "],查找到新库位[" + pos.getPosName() + "],更改任务为新库位");
EnLog.info("Put in task finished inventory check: storage[" + storage.getCid() + "] new size[" + key + "] current inventory[" + sizeEmptyCount + "] upload inventory[" + sizeCount + "], found new pos[" + pos.getPosName() + "], change task to new pos");
return pos;
}
}
}
} catch (Exception ex) {
log.error("入库任务完成时库存比对:料仓[" + task.getCid() + "]id[" + task.getId() + "]条码[" + task.getBarcode() + "]库位号[" + task.getPosName() + "]出错:" + ex.getMessage());
EnLog.error("Put in task finished inventory check: storage[" + task.getCid() + "] id[" + task.getId() + "] barcode[" + task.getBarcode() + "] pos[" + task.getPosName() + "] error: " + ex.getMessage());
}
return null;
}
......@@ -324,6 +341,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
StoragePos newPos=UsePosProcess(task,posCapMap);
if(newPos!=null){
log.error(cid + "入仓位[" + posName + "]ReelId[" + barcode + "]原来库位["+oldPosId+"]["+oldPosName+"], 更改库位号为["+newPos.getPosName()+"],posId=["+newPos.getId()+"]");
EnLog.error(cid + " put in pos[" + posName + "] ReelId[" + barcode + "] original pos[" + oldPosId + "][" + oldPosName + "], change pos to [" + newPos.getPosName() + "], posId=[" + newPos.getId() + "]");
task.setPosName(newPos.getPosName());
task.setPosId(newPos.getId());
}
......@@ -332,11 +350,13 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
updatePosExecuteTime(task.getPosName(), executeTime);
}
log.info(task.getBarcode() + "入仓位[" + task.getPosName() + "]完成,执行时间[" + executeTime + "]秒");
EnLog.info(task.getBarcode() + " put in pos[" + task.getPosName() + "] finished, execute time[" + executeTime + "]s");
DataLog cancelTask = taskService.findFinishedPutInTask(cid, task.getPosName(), task.getBarcode());
if (cancelTask != null && cancelTask.isCancel()) {
//将相同库位已经取消的任务从完成队列里删除
taskService.removeFinishedTask(cancelTask);
log.info("从已完成的任务列表中删除之前取消的任务:" + cancelTask.getPosName() + " ReelId:" + cancelTask.getBarcode());
EnLog.info("Remove previously canceled task from finished task list:" + cancelTask.getPosName() + " ReelId:" + cancelTask.getBarcode());
}
updatePutInData(task);
ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode());
......@@ -350,6 +370,7 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
StoragePos newPos=UsePosProcess(task,posCapMap);
if(newPos!=null){
log.error(cid + "入仓位[" + posName + "]ReelId[" + barcode + "]完成,但任务已被取消, 更改库位号为["+newPos.getPosName()+"]");
EnLog.error(cid + " put in pos[" + posName + "] ReelId[" + barcode + "] finished, but task canceled, change pos to ["+newPos.getPosName()+"]");
task.setPosName(newPos.getPosName());
}
......@@ -358,10 +379,12 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
updatePosExecuteTime(task.getPosName(), executeTime);
}
log.info(task.getBarcode() + "入仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间[" + executeTime + "]秒");
EnLog.info(task.getBarcode() + " put in pos[" + task.getPosName() + "] finished, but task canceled, modify to finished, execute time[" + executeTime + "]s");
updatePutInData(task);
}
} else {
log.error(cid + "入仓位[" + posName + "]ReelId[" + barcode + "]完成时任务不存在");
EnLog.error(cid + " put in pos[" + posName + "] ReelId[" + barcode + "] finished, but task does not exist");
}
}
}
......
package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
......@@ -59,6 +60,7 @@ public class VerticalBoxHandler extends BaseDeviceHandler {
}
statusBean.addPosInfo("",pos.getPosName(),pos.getW(),pos.getH(),false);
log.info("发送到["+task.getType()+"]任务["+pos.getPosName()+"]到客户端");
EnLog.info("Send [" + task.getType() + "] task [" + pos.getPosName() + "] to client");
task.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(task);
updateCurrentTask(task.getCid(),task);
......@@ -102,6 +104,7 @@ public class VerticalBoxHandler extends BaseDeviceHandler {
}
} catch (Exception e) {
log.error("垂直货柜到位时出错",e);
EnLog.error("Vertical box arrival error", e);
}
}
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.bean.NLShelfOperateBean;
......@@ -113,6 +114,7 @@ public class VirtualBoxHandler extends BaseDeviceHandler{
operateBean.setOpPos(pos);
devidePutInBeanMap.put(token, operateBean);
log.info(ptoken + ":库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料");
EnLog.info(ptoken + ":Pos [" + pos.getPosName() + "] operation success, please scan material to put in");
return ResultBean.newOkResult("smfcore.shelf.msg.tipScanReel", "库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料", new String[]{pos.getPosName()}, pos.getPosName());
}
} else {
......@@ -151,6 +153,7 @@ public class VirtualBoxHandler extends BaseDeviceHandler{
}
taskService.addTaskToFinished(inPos, null, loginUser);
log.info(barcode.getBarcode() + " 库位[" + inPos.getPosName() + "]出库完成 ");
EnLog.info(barcode.getBarcode() + " Pos [" + inPos.getPosName() + "] checkout completed ");
return ResultBean.newErrorResult(1, "smfcore.virtual.msg.outConfirm", "[{0}]出库完成", new String[]{inPos.getPosName()});
}
}
......@@ -162,10 +165,12 @@ public class VirtualBoxHandler extends BaseDeviceHandler{
StoragePos opPos = operateBean.getOpPos();
if (opPos == null) {
log.info(ptoken + ":条码[" + code + "],请先扫描库位码");
EnLog.info(ptoken + ":Barcode[" + code + "], please scan pos code first");
return ResultBean.newErrorResult(1, "smfcore.shelf.msg.scanPos", "请先扫描库位码");
} else {
log.info(barcode.getPartNumber() + " [ " + barcode.getBarcode() + " ] " + "入库到:" + opPos.getPosName());
EnLog.info(barcode.getPartNumber() + " [ " + barcode.getBarcode() + " ] " + " put in to:" + opPos.getPosName());
opPos.setCanCheckOutTime(System.currentTimeMillis() + delayCloseTime);
taskService.addTaskToFinished(opPos, barcode, loginUser);
......@@ -174,11 +179,13 @@ public class VirtualBoxHandler extends BaseDeviceHandler{
devidePutInBeanMap.put(token, operateBean);
log.info(ptoken + ":条码[" + code + "]入库操作成功,请放入库位 [" + opPos.getPosName() + "]");
EnLog.info(ptoken + ":Barcode[" + code + "] put in success, please put into pos [" + opPos.getPosName() + "]");
return ResultBean.newOkResult("smfcore.shelf.msg.inOk", "操作成功,请放入库位[" + opPos.getPosName() + "]", new String[]{opPos.getPosName()}, "");
}
} catch (ValidateException e) {
log.error("Error:" + e.getMessage());
EnLog.error("Error:" + e.getMessage());
return ResultBean.newErrorResult(1, e.getMessage(), e.getMessage(), e.getMsgParam());
}
}
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants;
......@@ -144,6 +145,7 @@ public class XLCBoxHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] not exist");
return null;
}
statusBean.setClientIp(request.getRemoteHost());
......@@ -158,6 +160,7 @@ public class XLCBoxHandler extends BaseDeviceHandler {
}
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put in: " + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//查看是否有要出库的操作
......@@ -206,6 +209,7 @@ public class XLCBoxHandler extends BaseDeviceHandler {
}
} catch (Exception e) {
log.error("方仓到位时出错",e);
EnLog.error("Square box arrival error", e);
}
}
}
......@@ -233,6 +237,7 @@ public class XLCBoxHandler extends BaseDeviceHandler {
statusBean.addPosInfo("",pos.getPosName(),pos.getW(),pos.getH(),false);
log.info("发送["+task.getType()+"]任务["+pos.getPosName()+"]到客户端door="+task.getSubSourceId());
EnLog.info("Send [" + task.getType() + "] task [" + pos.getPosName() + "] to client door=" + task.getSubSourceId());
task.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(task);
return statusBean;
......
package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
......@@ -30,6 +31,7 @@ public class XLRBoxHandler extends BaseDeviceHandler {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] not exist");
return null;
}
handleMsg(statusBean);
......@@ -44,6 +46,7 @@ public class XLRBoxHandler extends BaseDeviceHandler {
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
EnLog.debug("Put in: " + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//查看是否有要出库的操作
......@@ -70,11 +73,13 @@ public class XLRBoxHandler extends BaseDeviceHandler {
finishedOutPos(statusBean.getCid(),posName,barcode,executeTime,OP_STATUS.OUT_BOX);
} else if (BOX_STATUS.OUT_END == status) {//出库完成(放到仓门口
log.info(statusBean.getCid() +"将物料从库位["+posName+"]出库到门口/料串完成");
EnLog.info(statusBean.getCid() + " move material from pos [" + posName + "] to door/reel completed");
reelOnShelf(statusBean.getCid(),posName);
}
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
EnLog.error("Update status error: " + e.getMessage());
}
}
}
......
package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
......@@ -104,6 +105,7 @@ public class XlBoxHandler extends BaseDeviceHandler {
}
} catch (Exception e) {
log.error("方仓到位时出错",e);
EnLog.error("Square box arrival error", e);
}
}
}
......@@ -131,6 +133,7 @@ public class XlBoxHandler extends BaseDeviceHandler {
statusBean.addPosInfo("",pos.getPosName(),pos.getW(),pos.getH(),false);
log.info("发送["+task.getType()+"]任务["+pos.getPosName()+"]到客户端door="+task.getSubSourceId());
EnLog.info("Send [" + task.getType() + "] task [" + pos.getPosName() + "] to client door=" + task.getSubSourceId());
task.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(task);
return statusBean;
......
......@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
......@@ -102,6 +103,7 @@ public class DeviceController {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
EnLog.error("Storage cid: [" + cid + "] does not exist");
return null;
}
synchronized (storage) {
......@@ -156,6 +158,7 @@ public class DeviceController {
lineMsg = "";
log.info("流水线[" + cids + "]获取[" + rfid + "][" + code + "]的入库库位");
EnLog.info("Pipeline [" + cids + "] gets inbound position for [" + rfid + "][" + code + "]");
Map<String, Object> resultMap = Maps.newHashMap();
if (dataCache.getCache(Constants.CACHE_StopOut)) {
......@@ -179,6 +182,7 @@ public class DeviceController {
if (notIntoCids != null) {
if (notIntoCids.contains(cid)) {
log.info("料仓[" + cid + "]已被屏蔽入库");
EnLog.info("Storage [" + cid + "] is blocked for inbound");
continue;
}
}
......@@ -281,11 +285,13 @@ public class DeviceController {
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
EnLog.info("Clean lock position: Position [" + oldLockInfo.getLockPosName() + "] Material [" + oldLockInfo.getBarcode() + "] locked position");
}
}
log.info(okMsg + oldLockInfo);
EnLog.info("Lock position success info: " + oldLockInfo);
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(barcode.getBarcode());
......@@ -317,11 +323,13 @@ public class DeviceController {
} catch (ValidateException ve) {
errorMsg = ve.getMessage();
log.info("查找空库位失败:" + errorMsg);
EnLog.info("Find empty position failed: " + errorMsg);
resultMap.put("result", "105");
resultMap.put("msg", errorMsg);
} catch (Exception e) {
errorMsg = e.getMessage();
log.info("查找空库位失败,", e);
EnLog.info("Find empty position failed: " + e.toString());
resultMap.put("result", "105");
resultMap.put("msg", errorMsg);
}
......@@ -366,6 +374,7 @@ public class DeviceController {
if (task.isPutInTask()) {
boolean cancelResult = taskService.cancelTask(task.getId());
log.info("客户端取消[" + codeStr + "]的入库任务结果:" + cancelResult);
EnLog.info("Client cancel inbound task [" + codeStr + "] result: " + cancelResult);
return ResultBean.newOkResult(cancelResult);
}
}
......@@ -391,6 +400,7 @@ public class DeviceController {
//未执行完成的,理论上不会从客户端取消
boolean cancelResult = taskService.cancelTask(task.getId());
log.info("客户端取消["+codeStr+"]的未执行完成的出库任务结果:" + cancelResult);
EnLog.info("Client cancel unfinished outbound task [" + codeStr + "] result: " + cancelResult);
return ResultBean.newOkResult(cancelResult);
}else{
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.device.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
......@@ -46,6 +47,7 @@ public class VideoController {
} catch (Exception e) {
log.error("出错:", e);
EnLog.error("Video upload error", e);
return ResultBean.newErrorResult(-1, "", "");
}
return ResultBean.newOkResult("ok");
......@@ -63,6 +65,7 @@ public class VideoController {
} catch (Exception e) {
log.error("出错:", e);
EnLog.error("Video downloading error", e);
return ResultBean.newErrorResult(-1, "", "");
}
}
......
......@@ -8,6 +8,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
......@@ -145,6 +146,7 @@ public class DataCache {
if(finishChangeConfig==null|| !finishChangeConfig) {
//先备份原来的
log.info("CACHE_FinishChangeExpConfig=false,先转存过期年配置到:" + Constants.CACHE_ExpirationDateConfig_N + "_back");
EnLog.info("CACHE_FinishChangeExpConfig=false, backup expiration date config to: " + Constants.CACHE_ExpirationDateConfig_N + "_back");
updateCache(Constants.CACHE_ExpirationDateConfig_N + "_back", configs);
if (configs != null) {
for (ExpConfig c : configs) {
......@@ -155,6 +157,7 @@ public class DataCache {
updateCache(Constants.CACHE_ExpirationDateConfig_N, configs);
}
log.info(" 已完成,过期年改已改为天,保存CACHE_FinishChangeExpConfig=true");
EnLog.info("Completed, expiration year changed to days, save CACHE_FinishChangeExpConfig=true");
updateCache(Constants.CACHE_FinishChangeExpConfig, true);
}
......@@ -301,6 +304,7 @@ public class DataCache {
outType = CHECKOUT_TYPE.EFFICIENCY.name();
updateCache(Constants.CACHE_CheckOutType, outType);
log.info("未配置 出库策略配置类型,默认为" + outType);
EnLog.info("Outbound strategy config type not set, default to " + outType);
}
return CHECKOUT_TYPE.valueOf(outType);
}
......@@ -489,6 +493,7 @@ public class DataCache {
disabledPosNameSet.add(disabledPos.getPosName());
}
log.info("加载禁用库位缓存,共" + disabledPosNameSet.size() + "个");
EnLog.info("Load disabled pos cache, total " + disabledPosNameSet.size());
}
}
......@@ -538,6 +543,7 @@ public class DataCache {
Storage storage = getStorage(cid);
if (storage != null) {
log.info("加载[" + cid + "]所有已使用库位到缓存");
EnLog.info("Load [" + cid + "] all used pos to cache");
List<StoragePos> posList = storagePosManager.findUsedPosNameByStorageId(storage.getId());
for (StoragePos pos : posList) {
allPos.put(pos.getPosName(),pos);
......@@ -713,6 +719,7 @@ public class DataCache {
// }
log.info("初始化料仓[" + cid + "]的库存信息[" + storageInventoryMap.size() + "]条");
EnLog.info("Init storage [" + cid + "] inventory info [" + storageInventoryMap.size() + "] records");
inventoryMap.put(cid, storageInventoryMap);
return storageInventoryMap;
}
......@@ -913,6 +920,7 @@ public class DataCache {
} catch (Exception ex) {
log.error("thirdBoxCanPutIn [" + storage.getCid() + "] [" + plateW + "] [" + plateH + "]出错:" + ex.getMessage());
EnLog.error("thirdBoxCanPutIn [" + storage.getCid() + "] [" + plateW + "] [" + plateH + "] error: " + ex.getMessage());
}
return false;
}
......@@ -983,6 +991,7 @@ public class DataCache {
spUsedPosCountMap.put(cid, map);
} catch (Exception ex) {
log.error("updateSpUsePosCount " + storage.getCid() + "," + pos.getPosName() + "," + addCount + " 出错:" + ex.getMessage());
EnLog.error("updateSpUsePosCount " + storage.getCid() + ", " + pos.getPosName() + ", " + addCount + " error: " + ex.getMessage());
}
}
......
package com.neotel.smfcore.core.deviceState.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
......@@ -58,6 +59,7 @@ public class DeviceStateDurationUtil {
ProcessState(cid, DeviceSKind.STORAGE, newStatus);
} catch (Exception ex) {
log.error("onStatusUpdate error :"+ex.toString());
EnLog.error("onStatusUpdate error: " + ex.toString());
}
}
/**
......@@ -74,6 +76,7 @@ public class DeviceStateDurationUtil {
ProcessState(cid, DeviceSKind.EQUIPMENT,newStatus);
} catch (Exception ex) {
log.error("onEquipStatusUpdate error :"+ex.toString());
EnLog.error("onEquipStatusUpdate error: " + ex.toString());
}
}
......@@ -153,12 +156,14 @@ public class DeviceStateDurationUtil {
}
if (ObjectUtil.isNotEmpty(msg)) {
log.info("ProcessState" + msg);
EnLog.info("ProcessState " + msg);
}
}
}
} catch (Exception ex) {
log.error("ProcessState " + cid + "," + dType + "," + newStatus + " error :" + ex.toString());
EnLog.error("ProcessState " + cid + "," + dType + "," + newStatus + " error: " + ex.toString());
}
}
......@@ -236,6 +241,7 @@ public class DeviceStateDurationUtil {
} catch (Exception exception) {
log.error("closeSlice error :" + exception.toString());
EnLog.error("closeSlice error: " + exception.toString());
}
}
......@@ -284,6 +290,7 @@ public class DeviceStateDurationUtil {
@PostConstruct
public void onStartup() {
log.error("onStartup closeOpenSlices ");
EnLog.error("onStartup closeOpenSlices");
closeOpenSlices(new Date());
}
......@@ -293,6 +300,7 @@ public class DeviceStateDurationUtil {
@PreDestroy
public void onShutdown() {
log.error("onShutdown closeOpenSlices ");
EnLog.error("onShutdown closeOpenSlices");
closeOpenSlices(new Date());
}
......@@ -314,10 +322,12 @@ public class DeviceStateDurationUtil {
String sTime = DateUtil.toDateTimeString(d.getStartTime());
String eTime = DateUtil.toDateTimeString(d.getEndTime());
log.info("closeOpenSlices: " + d.getDeviceType() + ",cid=" + d.getCid() + ", " + d.getDeviceS() + "持续时间:" + sTime + "->" + eTime + " ,共 " + d.getDurationMs() + "ms ");
EnLog.info("closeOpenSlices: " + d.getDeviceType() + ", cid=" + d.getCid() + ", " + d.getDeviceS() + " duration: " + sTime + "->" + eTime + " , total " + d.getDurationMs() + "ms ");
}
} catch (Exception ex) {
log.error("closeOpenSlices error: {}", ex.toString());
EnLog.error("closeOpenSlices error: " + ex.toString());
}
}
}
package com.neotel.smfcore.core.equipment.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.deviceState.util.DeviceStateDurationUtil;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
......@@ -83,6 +84,7 @@ public class BaseEquipHandler implements IEquipmentHandler {
}
} catch (Exception ex) {
log.error(""+ex);
EnLog.error("MES info handling error: " + ex.toString());
}
}
......@@ -91,6 +93,7 @@ public class BaseEquipHandler implements IEquipmentHandler {
DeviceStateDurationUtil.onEquipStatusUpdate(statusBean);
} catch (Exception e) {
log.error("客户端故障消息处理出错", e);
EnLog.error("Client fault message handling error", e);
}
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.equipment.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.equipment.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
......@@ -33,6 +34,7 @@ public class EquipCommunicationController {
public EquipCommunicationController(List<IEquipmentHandler> equipHandlerList) {
for (IEquipmentHandler equipmentHandler : equipHandlerList) {
log.info("加载到" + equipmentHandler.getEquipType() + "处理类 :" + equipmentHandler.getClass());
EnLog.info("Loaded " + equipmentHandler.getEquipType() + " handler class :" + equipmentHandler.getClass());
handlerMap.put(equipmentHandler.getEquipType().name(), equipmentHandler);
}
}
......@@ -50,8 +52,10 @@ public class EquipCommunicationController {
equipment = equipmentCache.autoCreateEquip(name,cid, statusBean.getType());
if (equipment != null) {
log.error("设备cid: [" + cid + "]不存在,自动创建设备完成");
EnLog.error("Device cid: [" + cid + "] does not exist, auto create device completed");
} else {
log.error("设备cid: [" + cid + "]不存在,自动创建设备失败");
EnLog.error("Device cid: [" + cid + "] does not exist, auto create device failed");
return null;
}
/*log.info("设备cid: [" + cid + "]不存在");
......@@ -60,6 +64,7 @@ public class EquipCommunicationController {
if (StringUtils.isNotBlank(name)) {
if (!name.equals(equipment.getName())) {
log.info("自动修改设备 cid[" + equipment.getCid() + "] name[" + equipment.getName() + "] 的名字为=" + name);
EnLog.info("Auto update device cid[" + equipment.getCid() + "] name[" + equipment.getName() + "] to name=" + name);
equipment.setName(name);
equipment = equipmentCache.reloadEquipment(equipment, equipment.getCid());
}
......@@ -68,6 +73,7 @@ public class EquipCommunicationController {
if (ObjectUtil.isNotEmpty(type)) {
if (!type.equals(equipment.getType())) {
log.info("自动修改设备 cid[" + equipment.getCid() + "] type [" + equipment.getType() + "] 的类型为=" + type);
EnLog.info("Auto update device cid[" + equipment.getCid() + "] type [" + equipment.getType() + "] to type=" + type);
equipment.setType(type);
equipment = equipmentCache.reloadEquipment(equipment, equipment.getCid());
}
......@@ -102,6 +108,7 @@ public class EquipCommunicationController {
return ResultBean.newErrorResult(-1, "", "未找到设备");
} else {
log.info("删除设备:" + equipment.getCid() + "_" + equipment.getName());
EnLog.info("Delete device: " + equipment.getCid() + "_" + equipment.getName());
equipmentCache.removeEquipment(equipment);
return ResultBean.newOkResult("OK");
......
package com.neotel.smfcore.core.equipment.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
......@@ -157,6 +158,7 @@ public class EquipmentController {
equipmentCache.removeEquipment(equipment);
equipmentManager.deleteById(id);
log.info(SecurityUtils.getLoginUsername()+"手动删除设备[{}]",equipment.getName());
EnLog.info(SecurityUtils.getLoginUsername() + " manually deleted equipment [" + equipment.getName() + "]");
}
return new ResponseEntity<>(HttpStatus.OK);
}
......@@ -192,6 +194,7 @@ public class EquipmentController {
equipmentManager.save(equipment);
equipmentCache.reloadEquipment(equipment, equipment.getCid());
log.info("设备cid=" + cid + ", equipType=" + equipment.getType() + " setActivate(true)成功");
EnLog.info("Equipment cid=" + cid + ", equipType=" + equipment.getType() + " setActivate(true) success");
return ResultBean.newOkResult("OK");
}
@RequestMapping(value = "/deactivation")
......@@ -216,6 +219,7 @@ public class EquipmentController {
equipmentManager.save(equipment);
equipmentCache.reloadEquipment(equipment, equipment.getCid());
log.info("设备cid=" + cid + ", equipType=" + equipment.getType() + " setActivate(false)成功");
EnLog.info("Equipment cid=" + cid + ", equipType=" + equipment.getType() + " setActivate(false) success");
return ResultBean.newOkResult("OK");
}
@ApiOperation("返回所有的非料仓设备")
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.equipment.util;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.equipment.service.manager.IEquipmentManager;
......@@ -38,6 +39,7 @@ public class EquipmentCache {
allEquipment = map;
if(all.size()>0) {
log.info("加载所有设备[" + all.size() + "]信息到缓存");
EnLog.info("Load all equipment [" + all.size() + "] info to cache");
}
}
}
......@@ -89,6 +91,7 @@ public class EquipmentCache {
}
allEquipment.remove(equipment.getCid());
log.info("从缓存中删除设备:" + equipment.getCid() + "_" + equipment.getName());
EnLog.info("Remove equipment from cache: " + equipment.getCid() + "_" + equipment.getName());
}
}
}
......@@ -117,6 +120,7 @@ public class EquipmentCache {
equipment = equipmentManager.save(equipment);
reloadEquipment(equipment, "");
log.info("AutoCreateEquip :自动创建设备完成:cid["+equipment.getCid()+"]name["+equipment.getName()+"]type["+equipment.getType() +"]");
EnLog.info("AutoCreateEquip completed: cid[" + equipment.getCid() + "] name[" + equipment.getName() + "] type[" + equipment.getType() + "]");
return equipment;
}
}
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.equipment.util.bean;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import com.neotel.smfcore.common.enlog.EnLog;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -38,6 +39,7 @@ public class EquipConfigInfo {
} catch (Exception exception) {
log.error("GetConfigValue 出错: type=" + equipType + ",key=" + key + ", error =" + exception.toString());
EnLog.error("GetConfigValue error: type=" + equipType + ", key=" + key + ", error=" + exception.toString());
}
if (defValue != null) {
......
......@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
......@@ -112,10 +113,12 @@ public class InListController {
inList.setName(newName);
} else {
log.info("数据库中已存在入库单[" + inList.getName() + "],忽略文件:" + localFile.getAbsolutePath());
EnLog.info("In-list [" + inList.getName() + "] already exists in DB, ignore file: " + localFile.getAbsolutePath());
return ResultBean.newErrorResult(-1, "smfcore.inlist.ameExists", "入库单[{0}]已存在", new String[]{inList.getName()});
}
}
log.info("新增加入库单:" + inList.getName() + ",共" + inListItems.size() + "条工单详情");
EnLog.info("Create new in-list: " + inList.getName() + ", total " + inListItems.size() + " items");
inList = inListManager.createWithItems(inList);
inListCache.addInListToMap(inList);
// liteOrderCache.addOrderToMap(liteOrder);
......@@ -205,10 +208,11 @@ public class InListController {
int groupType = 0;
for (String cid : cidList) {
Storage storage = dataCache.getStorage(cid);
if (storage != null) {
if (storage != null) {
if (storage.isType(new DeviceType[]{DeviceType.NLP,DeviceType.NL})) {
storage.setInListName(inListName);
log.info("设置组[" + groupId + "]料架[" + storage.getName() + "]的入库单为:[" + inListName + "]");
EnLog.info("Set group[" + groupId + "] shelf[" + storage.getName() + "] in-list to [" + inListName + "]");
storageManager.save(storage);
dataCache.reloadStorage(storage,storage.getCid());
}
......@@ -221,6 +225,7 @@ public class InListController {
if (storage.isType(new DeviceType[]{DeviceType.NLP,DeviceType.NL})) {
storage.setInListName(inListName);
log.info("设置料架[" + storage.getName() + "]的入库单为:[" + inListName + "]");
EnLog.info("Set shelf[" + storage.getName() + "] in-list to [" + inListName + "]");
storageManager.save(storage);
dataCache.reloadStorage(storage,storage.getCid());
}
......@@ -254,6 +259,7 @@ public class InListController {
FileUtil.downloadCSV(maps, titles, response);
} catch (Exception e) {
log.error("导出失败" + e.getMessage(), e);
EnLog.error("Export failed: " + e.getMessage(), e);
}
}
......@@ -262,6 +268,7 @@ public class InListController {
try {
fileName=fileName.replace(".csv","");
log.info("开始解析上传的入库单");
EnLog.info("Start parsing uploaded in-list");
Map<String ,List<InListItem>> itemMap=new HashMap<>();
List<InListItem> items = Lists.newArrayList();
Map<String, List<InListItem>> map=new HashMap<>();
......@@ -291,6 +298,7 @@ public class InListController {
return map;
} catch (Exception ex) {
log.error("解析上传的入库单出错:" + ex.toString());
EnLog.error("Parse uploaded in-list error: " + ex.toString(), ex);
}
return null;
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.language.service.nanager.impl;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.FileUtil;
......@@ -114,6 +115,7 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
FileUtil.downloadCSV(maps, titles, response);
} catch (Exception e) {
log.error("导出失败" + e.getMessage(), e);
EnLog.error("Export failed: " + e.getMessage(), e);
}
}
......@@ -170,6 +172,7 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
}
languageMsgDao.removeByQuery(query);
log.info("手动删除资源:" + delnames + "完成");
EnLog.info("Manually deleted resources: " + delnames + " completed");
}
@Override
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.language.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.core.device.util.DataCache;
......@@ -61,6 +62,7 @@ public class LanguageMsgService {
String delId = msg.getId();
// log.info("资源创建时间["+typeMap.get(msg.getCode()).getCreateDate()+"]["+ msg.getCreateDate()+"]ID["+typeMap.get(msg.getCode()).getId()+"]["+ msg.getId()+"],code=["+msg.getCode()+"]已存在,["+hasCount+"]");
log.info("资源 ID[" + typeMap.get(msg.getCode()).getId() + "][" + msg.getId() + "],code=[" + msg.getCode() + "]已存在,删除资源[" + delId + "][" + hasCount + "]");
EnLog.info("Resource ID[" + typeMap.get(msg.getCode()).getId() + "][" + msg.getId() + "], code=[" + msg.getCode() + "] already exists, delete resource [" + delId + "][" + hasCount + "]");
languageMsgManager.delete(msg);
hasCount++;
} else {
......@@ -69,6 +71,7 @@ public class LanguageMsgService {
}
}
log.info("loadMsgMap 共加载到" + msgs.size() + "条Msg");
EnLog.info("loadMsgMap loaded " + msgs.size() + " messages");
return resourceMap;
}
......@@ -78,6 +81,7 @@ public class LanguageMsgService {
classesPath = URLDecoder.decode(classesPath,"utf-8");
File classDir = ResourceUtils.getFile(classesPath);
log.info("开始导入["+classesPath+"]下的Json资源文件:" + classDir.exists() +" =" + classDir.isDirectory());
EnLog.info("Start importing Json resource files under [" + classesPath + "]: " + classDir.exists() + " =" + classDir.isDirectory());
if (classDir.exists() && classDir.isDirectory()) {
for (File file : classDir.listFiles()) {
//只读取后缀名为json的
......@@ -90,6 +94,7 @@ public class LanguageMsgService {
msgListUpload(file.getName(),languageMsgs,false);
} catch (Exception ex) {
log.info("autoImportCsvFile 读取文件" + fileName + "错误:" + ex.toString());
EnLog.info("autoImportCsvFile read file " + fileName + " error: " + ex);
}
}
}
......@@ -147,11 +152,13 @@ public class LanguageMsgService {
if (ObjectUtil.isEmpty(lan)) {
defaultLanMap = messageSource.getMessageMap(locale);
log.info("autoImportResources 读取到" + defaultLanMap.size() + "]条默认资源");
EnLog.info("autoImportResources read " + defaultLanMap.size() + " default resources");
} else {
Map<String, String> map = messageSource.getMessageMap(locale);
lanMsgMap.put(lan, map);
log.info("autoImportResources 读取到[" + map.size() + "]条[" + lan + "]资源");
EnLog.info("autoImportResources read [" + map.size() + "] resources for [" + lan + "]");
}
}
......@@ -290,8 +297,10 @@ public class LanguageMsgService {
}
if (updateLanguageList.size() > 0 || newLanguageList.size() > 0) {
log.info("导入资源[" + orgFileName + "][" + type + "][" + lanCode + "],共[" + proMap.size() + "]条数据,共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
EnLog.info("Import resources [" + orgFileName + "][" + type + "][" + lanCode + "], total [" + proMap.size() + "] items, updated [" + updateLanguageList.size() + "], added [" + newLanguageList.size() + "]");
} else {
log.debug("导入资源[" + orgFileName + "][" + type + "][" + lanCode + "],共[" + proMap.size() + "]条数据,共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
EnLog.debug("Import resources [" + orgFileName + "][" + type + "][" + lanCode + "], total [" + proMap.size() + "] items, updated [" + updateLanguageList.size() + "], added [" + newLanguageList.size() + "]");
}
return "ok";
}
......@@ -376,6 +385,7 @@ public class LanguageMsgService {
}
}
log.info("导入csv[" + fileName + "]资源,共[" + msgList.size() + "]条数据,共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
EnLog.info("Import csv [" + fileName + "] resources, total [" + msgList.size() + "] items, updated [" + updateLanguageList.size() + "], added [" + newLanguageList.size() + "]");
}
......@@ -395,6 +405,7 @@ public class LanguageMsgService {
}
} catch (IOException e) {
log.error("ReadPropertiesFile 出错:" + e.toString());
EnLog.error("ReadPropertiesFile error: " + e);
e.printStackTrace();
}
return map;
......@@ -430,6 +441,7 @@ public class LanguageMsgService {
String msgStr = lineValues[msgIndex];
if (code.isEmpty() || type.isEmpty() || msgStr.isEmpty()) {
log.warn("第" + row + "行中有空白内容,此行忽略");
EnLog.warn("Row " + row + " has blank content, ignore this row");
continue;
}
languageMsg.setMsg(msgStr);
......@@ -509,6 +521,7 @@ public class LanguageMsgService {
} catch (IOException e) {
log.error("readJsFile 出错:" + e.toString());
EnLog.error("readJsFile error: " + e);
e.printStackTrace();
}
return map;
......
package com.neotel.smfcore.core.language.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.service.bean.Content;
import com.neotel.smfcore.core.language.service.bean.LanguageInfo;
......@@ -95,6 +96,7 @@ public class MessageUtils {
initLanguageMsgList();
}catch (Exception e){
log.error("语言信息导入出错",e);
EnLog.error("Language resources import error", e);
}
}
......@@ -132,6 +134,7 @@ public class MessageUtils {
}
}catch (Exception ex){
log.error("获取资源["+msgKey+"]["+defaultMsg+"]["+locale.toLanguageTag()+"]出错:"+ex.toString());
EnLog.error("Get resource [" + msgKey + "][" + defaultMsg + "][" + locale.toLanguageTag() + "] error: " + ex.toString(), ex);
if(defaultMsg != null){
return defaultMsg;
}
......@@ -154,13 +157,14 @@ public class MessageUtils {
if (lanT.equals(lanType)&& ObjectUtil.isNotEmpty(con.getMsg())) {
return con.getMsg();
}
}
// log.info("获取资源[" + msgKey + "][" + defaultMsg + "][" + lanType + "]失败:未找到code[" + msgKey + "]对应语言[" + lanType + "]");
return msg.getMsg();
}
log.info("获取资源[" + msgKey + "][" + defaultMsg + "][" + lanType + "]失败:未找到code[" + msgKey + "], autoAddMsg");
autoAddMsg(msgKey,defaultMsg,"");
// log.info("获取资源[" + msgKey + "][" + defaultMsg + "][" + lanType + "]失败:未找到code[" + msgKey + "]对应语言[" + lanType + "]");
return msg.getMsg();
}
log.info("获取资源[" + msgKey + "][" + defaultMsg + "][" + lanType + "]失败:未找到code[" + msgKey + "], autoAddMsg");
EnLog.info("Get resource [" + msgKey + "][" + defaultMsg + "][" + lanType + "] failed: code not found, autoAddMsg");
autoAddMsg(msgKey,defaultMsg,"");
}
return defaultMsg;
}
//-------------------------------------------------------------------------------
......@@ -244,6 +248,7 @@ public class MessageUtils {
log.info("autoAddMsg: key=" + msgKey + ",msg=" + defaultMsg + ",type=" + type + ",defLocal=" + getDefaultLocal().toLanguageTag() + "");
} catch (Exception ex) {
log.error("autoAddMsg: key=" + msgKey + ",msg=" + defaultMsg + ",type=" + type + ",defLocal=" + getDefaultLocal().toLanguageTag() + "出错:" + ex.toString());
EnLog.error("autoAddMsg error: key=" + msgKey + ", msg=" + defaultMsg + ", type=" + type + ", defLocal=" + getDefaultLocal().toLanguageTag() + ", err=" + ex.toString(), ex);
}
}
}
package com.neotel.smfcore.core.language.util;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.stereotype.Service;
......@@ -24,6 +25,7 @@ public class MyMessageSource extends ResourceBundleMessageSource {
keySet = lookup.keySet();
} catch (Exception ex) {
log.error("MyMessageSource["+locale.toString()+"]出錯:"+ex);
EnLog.error("MyMessageSource[" + locale.toString() + "] error: " + ex);
}
for (String key :
......
......@@ -8,6 +8,7 @@ import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.BetweenData;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.language.util.MessageUtils;
......@@ -123,6 +124,7 @@ public class MessageController {
List<MsgCountDto> list=getMsgReportList(criteria,locale);
//导出
log.info("开始导出 msgReportCount ");
EnLog.info("Start exporting msgReportCount");
FileUtil.downloadExcel(null, null, response, new IExcelDownLoad() {
@Override
......@@ -147,6 +149,7 @@ public class MessageController {
}
});
log.info("msgReportCount 导出完成");
EnLog.info("msgReportCount export completed");
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.message.service.manager.impl;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil;
......@@ -107,6 +108,7 @@ public class MessageManagerImpl implements IMessageManager {
FileUtil.downloadCSV(list, titles, response);
} catch (Exception e) {
log.error("导出失败" + e.getMessage(), e);
EnLog.error("Export failed: " + e.getMessage(), e);
}
}
......
package com.neotel.smfcore.core.message.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.equipment.util.EquipmentCache;
......@@ -179,6 +180,7 @@ public class DeviceMessageUtil {
messageManager.save(message);
}catch (Exception ex){
log.error("addMessage ["+msgType+"]["+name+"]["+msg+"]出错:"+ex.toString());
EnLog.error("addMessage [" + msgType + "][" + name + "][" + msg + "] error: " + ex.toString());
}
}
......@@ -223,6 +225,7 @@ public class DeviceMessageUtil {
if(onlyReport){
log.info("processDeviceStatus : onlyReport=true,直接返回");
EnLog.info("processDeviceStatus : onlyReport=true, return");
return;
}
//获取所有料仓状态
......@@ -245,6 +248,7 @@ public class DeviceMessageUtil {
if (bean == null) {
DeviceMessageUtil.addOfflineMessage(storage.getCid(), "");
log.info("processDeviceStatus 添加设备[" + storage.getCid() + "][" + storage.getName() + "]离线消息");
EnLog.info("processDeviceStatus add device [" + storage.getCid() + "][" + storage.getName() + "] offline message");
continue;
}
}
......@@ -252,6 +256,7 @@ public class DeviceMessageUtil {
}
} catch (Exception ex) {
log.error("processDeviceStatus 出错:" + ex.getMessage());
EnLog.error("processDeviceStatus error: " + ex.getMessage());
}
}
}
......@@ -6,6 +6,7 @@ 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.Constants;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi;
......@@ -85,12 +86,14 @@ public class LiteOrderCache {
public void loadUnEndOrderInfos() {
log.info("开始加载未完成的需求单");
EnLog.info("Start loading unfinished lite orders");
List<LiteOrder> unEndOutInfoList = liteOrderManager.findUnEndOrdersList();
long now = System.currentTimeMillis();
for (LiteOrder order : unEndOutInfoList) {
if (now - order.getCreateDate().getTime() > 7 * 24 * 60 * 60 * 1000) {
//7天前的需求单,关闭,并解绑
log.info("需求单 =[" + order.getOrderNo() + "]为7天前,关闭并解绑工单");
EnLog.info("Lite order [" + order.getOrderNo() + "] is 7 days ago, close and unbind");
closeLiteOrder(order);
} else {
......@@ -135,6 +138,7 @@ public class LiteOrderCache {
}
} catch (Exception e) {
log.error("需求单定时器执行出错:", e);
EnLog.error("Lite order timer execution error:", e);
} finally {
isProcessTimer = false;
}
......@@ -149,6 +153,7 @@ public class LiteOrderCache {
}
} catch (Exception e) {
log.error("更新工单状态出错", e);
EnLog.error("Update order status error", e);
}
}
......@@ -166,8 +171,10 @@ public class LiteOrderCache {
if (!ObjectUtil.isEmpty(result)) {
String msg = MessageUtils.getText(result, MessageUtils.getDefaultLocal(), "");
log.info("自动执行工单 【" + order.getOrderNo() + "】 失败:" + msg);
EnLog.info("Auto execute order [" + order.getOrderNo() + "] failed: " + msg);
} else {
log.info("自动执行工单 【" + order.getOrderNo() + "】 成功");
EnLog.info("Auto execute order [" + order.getOrderNo() + "] success");
}
break;
......@@ -182,6 +189,7 @@ public class LiteOrderCache {
ORDER_COLOR nextColor = getNextColor();
if (nextColor == null) {
log.info("执行工单[" + liteOrder.getOrderNo() + "] 时,已达最大可执行工单数");
EnLog.info("Execute order [" + liteOrder.getOrderNo() + "], reached max executable order count");
throw new ValidateException("order.out.maxOrder", "已达最大可执行工单数");
}
//其他出库模式一次性全部生成任务
......@@ -207,12 +215,14 @@ public class LiteOrderCache {
taskReelCount = taskReelCount + 1;
log.info("工单[" + liteOrder.getOrderNo() + "]出库位置仓位【" + task.getPosName() + "】RI=[" + task.getBarcode() + "] PN=[" + task.getPartNumber() + "] ");
EnLog.info("Order [" + liteOrder.getOrderNo() + "] checkout pos [" + task.getPosName() + "] RI=[" + task.getBarcode() + "] PN=[" + task.getPartNumber() + "]");
}
liteOrder.setTaskReelCount(taskReelCount);
liteOrder.setTotalTaskReelCount(liteOrder.getTotalTaskReelCount() + taskReelCount);
liteOrder.setStatus(LITEORDER_STATUS.TAILS);
log.info("工单[" + liteOrder.getOrderNo() + "]任务分配结束,任务数[" + taskReelCount + "]");
EnLog.info("Order [" + liteOrder.getOrderNo() + "] task allocation finished, task count [" + taskReelCount + "]");
smfApi.onOrderStatusChange(liteOrder);
if (taskReelCount <= 0) {
......@@ -266,10 +276,12 @@ public class LiteOrderCache {
StoragePos pos = storagePosManager.getByBarcode(code.getBarcode());
if (pos == null) {
log.info("工单" + order.getOrderNo() + "已关闭,解除物料锁定:" + code.getBarcode());
EnLog.info("Order " + order.getOrderNo() + " closed, unlock material: " + code.getBarcode());
} else {
pos.setBarcode(code);
storagePosManager.save(pos);
log.info("工单" + order.getOrderNo() + "已关闭,解除物料锁定:" + code.getBarcode() + ",所在库位:" + pos.getPosName());
EnLog.info("Order " + order.getOrderNo() + " closed, unlock material: " + code.getBarcode() + ", pos: " + pos.getPosName());
}
}
}
......@@ -285,11 +297,13 @@ public class LiteOrderCache {
pos.getBarcode().setLockName(null);
storagePosManager.save(pos);
log.info("工单" + order.getOrderNo() + "已关闭,解除物料锁定:" + pos.getBarcode().getBarcode() + ",所在库位:" + pos.getPosName());
EnLog.info("Order " + order.getOrderNo() + " closed, unlock material: " + pos.getBarcode().getBarcode() + ", pos: " + pos.getPosName());
}
}
} catch (Exception exception) {
log.error("工单" + order.getOrderNo() + "关闭时,解除锁定物料出错:", exception);
EnLog.error("Order " + order.getOrderNo() + " closed, unlock material error:", exception);
}
}
......@@ -299,6 +313,7 @@ public class LiteOrderCache {
LiteOrder order = liteOrderMap.get(orderNo);
if (order == null) {
log.info("缓存中未找到[" + orderNo + "],从数据库中重新加载");
EnLog.info("Not found in cache [" + orderNo + "], reload from database");
order = liteOrderManager.findByOrderNo(orderNo);
if (order != null) {
List<LiteOrderItem> items = liteOrderItemManager.findOrderItems(order.getId());
......@@ -405,6 +420,7 @@ public class LiteOrderCache {
}
if (isItemTask) {
log.info("工单[" + orderNo + "]的任务" + task.getPartNumber() + "[" + task.getBarcode() + "]完成,API007结果:" + msg + ",更新状态=" + newS);
EnLog.info("Order [" + orderNo + "] task " + task.getPartNumber() + "[" + task.getBarcode() + "] finished, API007 result: " + msg + ", update status=" + newS);
liteOrderItem = liteOrderItemManager.save(liteOrderItem);
}
order.setOrderItems(items);
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.order.listener;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.excel.ExcelReader;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache;
......@@ -77,11 +78,13 @@ public class DefaultOrderFileListener implements IOrderFileListener {
liteOrder.setOrderNo(newOrderNo);
} else {
log.info("watchOrderDir:数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + orderFile.getAbsolutePath());
EnLog.info("watchOrderDir: Order no [{0}] already exists in DB, ignore file: {1}", liteOrder.getOrderNo(), orderFile.getAbsolutePath());
//resultFile = new File(localDir+File.separator + "error",backupFileName);
return false;
}
}
log.info("watchOrderDir:新增加订单:" + liteOrder.getOrderNo() + ",共" + liteOrderItems.size() + "条工单详情");
EnLog.info("watchOrderDir: New order added: {0}, total {1} items", liteOrder.getOrderNo(), liteOrderItems.size());
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
......@@ -91,6 +94,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
}
}catch (Exception e){
log.error("read order from file ["+orderFile.getAbsolutePath()+"] :",e);
EnLog.error("read order from file [" + orderFile.getAbsolutePath() + "] error", e);
//resultFile = new File(localDir+File.separator + "error",backupFileName);
}
}
......@@ -143,6 +147,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
orderName=newOrderNo;
} else {
log.info("watchOrderDir,mode=[" + mode + "],reason=[" + reason + "]:数据库中已存在工单号为[" + orderName + "],忽略文件:" + orderFile.getAbsolutePath());
EnLog.info("watchOrderDir, mode=[{0}], reason=[{1}]: Order no [{2}] already exists in DB, ignore file: {3}", mode, reason, orderName, orderFile.getAbsolutePath());
//resultFile = new File(localDir+File.separator + "error",backupFileName);
return false;
}
......@@ -233,6 +238,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
}
if (partNumber.isEmpty()&&ri.isEmpty()&&mpn.isEmpty()) {
log.warn("行[partNumber=" + partNumber + "]中PN和RI,MPN都为空,此行忽略");
EnLog.warn("Row [partNumber={0}] PN, RI, MPN are all empty, ignore this row", partNumber);
} else {
int num = 1;
if (qtyIndex != -1) {
......@@ -242,6 +248,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
num = Integer.valueOf(numStr);
} catch (Exception e) {
log.error(partNumber + "的数量:" + numStr + " 不是数字,使用1");
EnLog.error(partNumber + " qty: " + numStr + " is not a number, use 1");
}
}
}
......@@ -266,6 +273,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
count = Integer.valueOf(countStr);
} catch (Exception e) {
log.error(partNumber + "的数量:" + countStr + " 不是数字,使用1");
EnLog.error(partNumber + " qty: " + countStr + " is not a number, use 1");
}
}
}
......@@ -307,6 +315,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
return itemMap;
} catch (Exception ex) {
log.error("解析上传的工单出错:" + ex.toString());
EnLog.error("Parse uploaded order error: " + ex.toString());
}finally {
if(csvRead != null){
csvRead.close();
......@@ -393,6 +402,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
}
if (ObjectUtil.isEmpty(partNumber) && ObjectUtil.isEmpty(ri) && ObjectUtil.isEmpty(mpn)) {
log.warn("行[partNumber=" + partNumber + "]中PN和RI,MPN都 为空,此行忽略");
EnLog.warn("Row [partNumber={0}] PN, RI, MPN are all empty, ignore this row", partNumber);
} else {
int num = 1;
if (qtyIndex != -1) {
......@@ -402,6 +412,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
num = Integer.valueOf(numStr);
} catch (Exception e) {
log.error(partNumber + "的数量:" + numStr + " 不是数字,使用1");
EnLog.error(partNumber + " qty: " + numStr + " is not a number, use 1");
}
}
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.order.service.manager.impl;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.order.enums.LITEORDER_STATUS;
import com.neotel.smfcore.core.order.service.dao.ILiteOrderDao;
......@@ -92,6 +93,7 @@ public class LiteOrderManagerImpl implements ILiteOrderManager {
Query query = new Query(c);
List<LiteOrder> orders = findByQuery(query);
log.info("加载到["+orders.size()+"]个未完成需求单,开始加载需求单详情");
EnLog.info("Loaded [" + orders.size() + "] unfinished lite orders, start loading order items");
for (LiteOrder order : orders) {
if (order != null && order.getOrderItems() == null) {
List<LiteOrderItem> items = liteOrderItemManager.findOrderItems(order.getId());
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.order.util;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.SmbUtil;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.LiteOrderCache;
......@@ -47,6 +48,7 @@ public class OrderFileWatch {
if(!isRunning){
isRunning = true;
log.info("开启订单监控任务");
EnLog.info("Start order monitoring task");
//10 秒之后执行,每5秒钟执行一次
scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
......@@ -98,6 +100,7 @@ public class OrderFileWatch {
resultFile = new File(localDir+File.separator + "error",backupFileName);
}
log.info("处理完成,移动文件到:"+resultFile.getAbsolutePath());
EnLog.info("Handled, move file to: " + resultFile.getAbsolutePath());
resultFile.getParentFile().mkdirs();
file.renameTo(resultFile);
}
......@@ -106,6 +109,7 @@ public class OrderFileWatch {
}
}catch (Exception e){
log.error("订单监控出错",e);
EnLog.error("Order monitoring error", e);
}
}
......@@ -116,6 +120,7 @@ public class OrderFileWatch {
*/
public boolean handleOrderFile(File orderFile){
log.info("开始处理Order文件:" + orderFile.getAbsolutePath());
EnLog.info("Start handling order file: " + orderFile.getAbsolutePath());
for (IOrderFileListener orderFileListener : orderFileListenerList) {
boolean result = orderFileListener.handleOrderFile(orderFile);
......@@ -133,6 +138,7 @@ public class OrderFileWatch {
*/
public boolean handleOrderFile(File orderFile,String mode,String reason,String operId){
log.info("开始处理Order文件:" + orderFile.getAbsolutePath());
EnLog.info("Start handling order file: " + orderFile.getAbsolutePath());
for (IOrderFileListener orderFileListener : orderFileListenerList) {
boolean result = orderFileListener.handleOrderFile(orderFile,mode,reason,operId);
......@@ -154,6 +160,7 @@ public class OrderFileWatch {
File localDirFile = new File(localDir);
if(!localDirFile.exists()){
log.info("生成临时文件夹:" + localDir);
EnLog.info("Create temp dir: " + localDir);
localDirFile.mkdir();
}
......@@ -174,6 +181,7 @@ public class OrderFileWatch {
if(!smbFiles.contains(fileName)){
//同时删除本地的result 文件
log.info("远程文件["+fileName+"]已经清除,删除本地文件和result 文件");
EnLog.info("Remote file [" + fileName + "] removed, delete local file and result file");
String suffixName = fileName.substring(0,fileName.length()-4);
File resultFile = new File(localDir,suffixName+"_result.txt");
if(resultFile.exists()){
......
......@@ -6,6 +6,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.FileUtil;
......@@ -85,6 +86,7 @@ public class SelfAuditController {
if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.PAUSE.name())) {
//手动继续盘点
log.info("手动继续盘点:" + batchNo);
EnLog.info("Manually resume self-audit: " + batchNo);
selfAudit.setStatus(SELFAUDIT_STATUS.EXECUTING.name());
//更新缓存
......@@ -96,6 +98,7 @@ public class SelfAuditController {
// if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.END.name()) || selfAudit.getStatus().equals(SELFAUDIT_STATUS.FINISHED.name())) {
log.info("从dataCache删除已完成的盘点批次号:" + batchNo + " ");
EnLog.info("Remove finished self-audit batchNo from dataCache: " + batchNo);
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, "");
} else {
throw new ValidateException("smfcore.selfAudit.preNotEnd", "上次盘点{0}还未完成", new String[]{batchNo});
......@@ -112,6 +115,7 @@ public class SelfAuditController {
throw new ValidateException("smfcore.selfAudit.noStorage", "请选择要盘点的设备");
}
log.info("开始盘点: 设备ID[" + String.join(",", storageIds) + "] 创建盘点数据 ,priority 倒序");
EnLog.info("Start self-audit: storageIds[" + String.join(",", storageIds) + "], create audit items, priority desc");
List<SelfAuditItem> items = new ArrayList<>();
List<String> storageIdList = new ArrayList<>();
// List<StoragePos> allPosList=new ArrayList<>();
......@@ -139,6 +143,7 @@ public class SelfAuditController {
log.info("盘点数据创建完成: 批次号[" + no + "] 设备ID[" + String.join(",", storageIdList) + "] 盘点库位数量:[" + items.size() + "] ");
EnLog.info("Self-audit data created: batchNo[" + no + "] storageIds[" + String.join(",", storageIdList) + "] posCount[" + items.size() + "]");
audit = selfAuditManager.createSelfAudit(audit, items);
SelfAuditDto dto = selfAuditMapper.toDto(audit);
......@@ -161,6 +166,7 @@ public class SelfAuditController {
//结束盘点
log.info("手动暂停盘点:" + batchNo);
EnLog.info("Manually pause self-audit: " + batchNo);
selfAudit.setStatus(SELFAUDIT_STATUS.PAUSE.name());
// selfAuditManager.save(selfAudit);
//更新缓存
......@@ -190,11 +196,13 @@ public class SelfAuditController {
}
//结束盘点
log.info("手动结束盘点:" + batchNo + ",更改状态为 " + s);
EnLog.info("Manually finish self-audit: " + batchNo + ", set status to " + s);
selfAudit.setStatus(s);
// selfAuditManager.save(selfAudit);
if (s == SELFAUDIT_STATUS.FINISHED.name()) {
//清空dataCache
log.info("手动结束盘点:" + batchNo + " 完成,从dataCache删除批次号");
EnLog.info("Self-audit finished: " + batchNo + ", remove batchNo from dataCache");
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, "");
}
//更新缓存
......@@ -379,6 +387,7 @@ public class SelfAuditController {
}
log.info("处理盘点批次【" + batchNo + "】,料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】 自动生成出库任务");
EnLog.info("Process self-audit batch[" + batchNo + "], storage[" + storage.getName() + "_" + storage.getCid() + "], pos[" + pos.getPosName() + "], auto create checkout task");
String outResult = taskService.checkoutTest(storage, pos, true, "selfAudit-clear");
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.selfAudit.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -99,6 +100,7 @@ public class SelfAuditDeviceController {
resultMap.put("plateW",item.getPlateW()+"");
resultMap.put("plateH", item.getPlateH()+"");
log.info("cid=["+cid+"]获取盘点["+selfAudit.getBatchNo()+"]下一个库位成功:posName["+item.getPosName()+"]barcode["+item.getBarcode()+"],["+item.getPlateW()+"X"+item.getPlateH()+"]");
EnLog.info("cid=[" + cid + "] get next self-audit [" + selfAudit.getBatchNo() + "] pos success: posName[" + item.getPosName() + "] barcode[" + item.getBarcode() + "],[" + item.getPlateW() + "X" + item.getPlateH() + "]");
return ResultBean.newOkResult(resultMap);
}
}
......@@ -112,11 +114,13 @@ public class SelfAuditDeviceController {
public ResultBean PosOutEnd(HttpServletRequest request) {
String posName = request.getParameter("posName");
log.info("盘点:posOutEnd:posName=["+posName+"]");
EnLog.info("Self-audit posOutEnd: posName=[" + posName + "]");
//发送库位号
//指定库位出库完成,清空库位信息(自动生成一条出库任务并结束)
SelfAudit selfAudit=getCurrObj();
if(selfAudit==null){
log.error("盘点:posOutEnd:posName=["+posName+"]:未找到盘点信息");
EnLog.error("Self-audit posOutEnd: posName=[" + posName + "]: self-audit not found");
return ResultBean.newErrorResult(99,"smfcore.selfAudit.notFind","未找到盘点信息");
}
......@@ -128,17 +132,21 @@ public class SelfAuditDeviceController {
if (item.getPosName().equals(posName)) {
findOk=true;
log.info(" 盘点["+selfAudit.getBatchNo()+"]库位出库成功:posName["+item.getPosName()+"]barcode["+item.getBarcode()+"],自动生成出库任务,清空库位");
EnLog.info("Self-audit [" + selfAudit.getBatchNo() + "] pos checkout success: posName[" + item.getPosName() + "] barcode[" + item.getBarcode() + "], auto create checkout task, clear pos");
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null) {
try {
log.info("盘点完成,开始清空库位[" + storagePos.getPosName() + "]");
EnLog.info("Self-audit done, start clearing pos[" + storagePos.getPosName() + "]");
Barcode barcode = storagePos.getBarcode();
if (barcode != null) {
log.info("盘点完成,清理库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
EnLog.info("Self-audit done, clear inventory in pos[" + storagePos.getPosName() + "] barcode[" + barcode.getBarcode() + "]");
String opUser = "SelfAudit";
log.info(opUser + "盘点完成,清理库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
EnLog.info(opUser + " self-audit done, clear inventory in pos[" + storagePos.getPosName() + "] barcode[" + barcode.getBarcode() + "]");
taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
dataCache.reloadStorage(storage, "");
......@@ -166,6 +174,7 @@ public class SelfAuditDeviceController {
return ResultBean.newOkResult("ok");
}
log.error("盘点:posOutEnd:posName=["+posName+"]:未找到库位的盘点信息");
EnLog.error("Self-audit posOutEnd: posName=[" + posName + "]: pos self-audit info not found");
return ResultBean.newErrorResult(99,"smfcore.selfAudit.posNotFind","未找到库位[{0}]的盘点信息");
}
......@@ -179,10 +188,12 @@ public class SelfAuditDeviceController {
String barcode = request.getParameter("barcode");
String actualBarcode = request.getParameter("actualBarcode");
log.info("盘点:posSelfAuditEnd:posName=[" + posName + "],barcode=[" + barcode + "],actualBarcode=[" + actualBarcode + "]");
EnLog.info("Self-audit posSelfAuditEnd: posName=[" + posName + "], barcode=[" + barcode + "], actualBarcode=[" + actualBarcode + "]");
//发送库位号,库存条码,实时条码
SelfAudit selfAudit = getCurrObj();
if (selfAudit == null) {
log.info("盘点:posSelfAuditEnd:posName=[" + posName + "],barcode=[" + barcode + "],actualBarcode=[" + actualBarcode + "]:未找到盘点信息");
EnLog.info("Self-audit posSelfAuditEnd: posName=[" + posName + "], barcode=[" + barcode + "], actualBarcode=[" + actualBarcode + "]: self-audit not found");
return ResultBean.newErrorResult(99, "smfcore.selfAudit.notFind", "未找到盘点信息");
}
......@@ -197,6 +208,7 @@ public class SelfAuditDeviceController {
if(!barcode.equals(item.getBarcode())){
barcode=item.getBarcode();
log.info("盘点:posSelfAuditEnd:posName=[" + posName + "],纠正 barcode=[" + item.getBarcode() + "]");
EnLog.info("Self-audit posSelfAuditEnd: posName=[" + posName + "], corrected barcode=[" + item.getBarcode() + "]");
}
item.setActualBarcode(actualBarcode);
......@@ -209,6 +221,7 @@ public class SelfAuditDeviceController {
}
selfAuditItemManager.save(item);
log.info(" 盘点[" + selfAudit.getBatchNo() + "]库位入库完成:posName[" + item.getPosName() + "]barcode[" + item.getBarcode() + "],actualBarcode=[" + actualBarcode + "],设置状态="+item.getItemStatus());
EnLog.info("Self-audit [" + selfAudit.getBatchNo() + "] pos put-in completed: posName[" + item.getPosName() + "] barcode[" + item.getBarcode() + "], actualBarcode=[" + actualBarcode + "], set itemStatus=" + item.getItemStatus());
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null) {
......@@ -219,6 +232,7 @@ public class SelfAuditDeviceController {
Barcode barcodeIn = resolveOneValideBarcode("barcode",barcode);
if (barcodeIn != null) {
log.info("盘点入库完成,条码一致,自动生成入库任务,更新库位[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
EnLog.info("Self-audit put-in done, barcode matched, auto create put-in task, update pos[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
taskService.addTaskToFinished(storagePos, barcodeIn, "selfAudit");
}
}else if(ObjectUtil.isNotEmpty(actualBarcode)){
......@@ -226,11 +240,13 @@ public class SelfAuditDeviceController {
Barcode barcodeIn=resolveOneValideBarcode("actualBarcode",actualBarcode);
if(barcodeIn!=null){
log.info("盘点入库完成,物料不一致,自动生成实际条码入库任务,更新库位[" + storagePos.getPosName() + "]=["+barcodeIn.getBarcode()+"]");
EnLog.info("Self-audit put-in done, barcode mismatch, auto create put-in task for actualBarcode, update pos[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
taskService.addTaskToFinished(storagePos,barcodeIn,"selfAudit");
}else{
barcodeIn = resolveOneValideBarcode("barcode",barcode);
if(barcodeIn!=null){
log.info("盘点入库完成,条码一致,实际条码解析失败,自动生成原条码入库任务,更新库位[" + storagePos.getPosName() + "]=["+barcodeIn.getBarcode()+"]");
EnLog.info("Self-audit put-in done, actualBarcode parse failed, fallback to original barcode, update pos[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
taskService.addTaskToFinished(storagePos,barcodeIn,"selfAudit");
}
}
......@@ -239,6 +255,7 @@ public class SelfAuditDeviceController {
Barcode barcodeIn = resolveOneValideBarcode("barcode",barcode);
if (barcodeIn != null) {
log.info("盘点入库完成,库存有料,实际没料 ,原条码信息先入库,更新库位[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
EnLog.info("Self-audit put-in done, inventory has barcode but actual is empty, store original barcode first, update pos[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
taskService.addTaskToFinished(storagePos, barcodeIn, "selfAudit");
}
}
......@@ -249,9 +266,11 @@ public class SelfAuditDeviceController {
if(barcodeIn!=null){
log.info("盘点入库完成,库存没料,实际有料,自动生成实际条码入库任务,更新库位[" + storagePos.getPosName() + "]=["+barcodeIn.getBarcode()+"]");
EnLog.info("Self-audit put-in done, inventory empty but actual has barcode, auto create put-in task for actualBarcode, update pos[" + storagePos.getPosName() + "]=[" + barcodeIn.getBarcode() + "]");
taskService.addTaskToFinished(storagePos,barcodeIn,"selfAudit");
}else{
log.error("盘点入库完成,库存没料,实际有料,实际条码解析失败,生成入库任务失败,库位[" + storagePos.getPosName() + "]库存仍为空");
EnLog.error("Self-audit put-in done, inventory empty but actual has barcode, actualBarcode parse failed, cannot create put-in task, pos[" + storagePos.getPosName() + "] still empty");
}
}
......@@ -260,6 +279,7 @@ public class SelfAuditDeviceController {
} catch (Exception e) {
//只打印提示信息,还需要继续执行
log.error("盘点[" + selfAudit.getBatchNo() + "]库位入库完成:posName[" + item.getPosName() + "]处理出错:"+e.toString());
EnLog.error("Self-audit [" + selfAudit.getBatchNo() + "] pos put-in completed: posName[" + item.getPosName() + "] processing error: " + e.toString(), e);
// throw new ValidateException("smfcore.error", "出错{0}", new String[]{e.toString()});
}
}
......@@ -285,9 +305,11 @@ public class SelfAuditDeviceController {
if(hasE){
selfAudit.setStatus(SELFAUDIT_STATUS.END.name());
log.info(" 盘点[" + selfAudit.getBatchNo() + "] 已完成库位数[" + selfAudit.getEndItemNum() + "]总库位数[" + selfAudit.getTotalItemNum() + "],存在异常库位,更改盘点状态为完成,等待处理异常库位");
EnLog.info("Self-audit [" + selfAudit.getBatchNo() + "] completed posCount[" + selfAudit.getEndItemNum() + "] total[" + selfAudit.getTotalItemNum() + "], has abnormal pos, set status to END and wait processing");
}else{
selfAudit.setStatus(SELFAUDIT_STATUS.FINISHED.name());
log.info(" 盘点[" + selfAudit.getBatchNo() + "] 已完成库位数[" + selfAudit.getEndItemNum() + "]总库位数[" + selfAudit.getTotalItemNum() + "],更改盘点状态为已结束");
EnLog.info("Self-audit [" + selfAudit.getBatchNo() + "] completed posCount[" + selfAudit.getEndItemNum() + "] total[" + selfAudit.getTotalItemNum() + "], set status to FINISHED");
}
}
......@@ -296,6 +318,7 @@ public class SelfAuditDeviceController {
return ResultBean.newOkResult("ok");
}
log.info("盘点:posSelfAuditEnd:posName=[" + posName + "],barcode=[" + barcode + "],actualBarcode=[" + actualBarcode + "]:未找到库位的盘点信息");
EnLog.info("Self-audit posSelfAuditEnd: posName=[" + posName + "], barcode=[" + barcode + "], actualBarcode=[" + actualBarcode + "]: pos self-audit info not found");
return ResultBean.newErrorResult(99, "smfcore.selfAudit.posNotFind", "未找到库位[{0}]的盘点信息");
}
......@@ -307,6 +330,7 @@ public class SelfAuditDeviceController {
} catch (Exception e) {
//只打印提示信息,还需要继续执行
log.error(paramName+"[" + code + "]解析出错:" + e.toString());
EnLog.error(paramName + "[" + code + "] parse error: " + e.toString(), e);
}
return barcodeIn;
}
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.solder.handler;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.StorageConstants;
......@@ -81,6 +82,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
float diffRate = diffWeight/ weight;
if(diffRate <= 0.1){
log.info("为["+barcode+"]匹配到搅拌任务["+queueTask.getBarcode()+"]");
EnLog.info("Matched mix task for [" + barcode + "]: [" + queueTask.getBarcode() + "]");
queueTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(queueTask);
......@@ -197,6 +199,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
statusBean.addPosInfo(barcodeSave.getBarcode(), posId, plateW, plateH, false);
log.info(barcodeSave.getBarcode() + "[" + plateW + "x" + plateH + "]开始入库到" + storage.getCid() + "[" + posId + "]");
EnLog.info(barcodeSave.getBarcode() + "[" + plateW + "x" + plateH + "] start put-in to " + storage.getCid() + "[" + posId + "]");
//清空展示的消息
serverExceptions.remove(storage.getCid());
......@@ -211,9 +214,11 @@ public class SpBoxHandler extends BaseDeviceHandler {
// statusBean.setMsgJp(msgJp);
statusBean.setRMsg(e.getMsgKey(),e.getMsgParam(),e.getMessage());
log.warn(statusBean.getCode() + "入库到" + storage.getCid() + "失败:" + e.getMessage()+","+statusBean.getMsg()+","+statusBean.getMsgEn()+","+statusBean.getMsgJp());
EnLog.warn(statusBean.getCode() + " put-in to " + storage.getCid() + " failed: " + e.getMessage() + "," + statusBean.getMsg() + "," + statusBean.getMsgEn() + "," + statusBean.getMsgJp());
serverExceptions.put(storage.getCid(), e);
} catch (Exception e) {
log.error(statusBean.getCode() + "入库到" + storage.getCid() + "失败", e);
EnLog.error(statusBean.getCode() + " put-in to " + storage.getCid() + " failed", e);
statusBean.setMsg(e.getMessage());
serverExceptions.put(storage.getCid(), e);
}
......@@ -233,6 +238,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
} else {
//同条码,但不是同料仓
log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId());
EnLog.error("Barcode [" + barcodeSave.getBarcode() + "] task executing, task storage: " + task.getStorageId() + ", request storage: " + task.getStorageId());
//throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行");
throw new ValidateException("smfcore.error.barcode.executing","条码[{0}}]任务正在执行", new String[]{barcodeSave.getBarcode()});
}
......@@ -242,11 +248,13 @@ public class SpBoxHandler extends BaseDeviceHandler {
if (putInTask != null) {
log.info(barcodeSave.getBarcode() + " 已有任务,返回任务中的库位:" + putInTask.getPosName());
EnLog.info(barcodeSave.getBarcode() + " task exists, return pos: " + putInTask.getPosName());
return putInTask;
} else {
String posName = statusBean.getFromData("inPos");
if (!Strings.isNullOrEmpty(posName)) {
log.info("指定入库到" + posName);
EnLog.info("Specified put-in to " + posName);
storagePos = storagePosManager.getByPosName(posName);
if (storagePos == null) {
......@@ -271,6 +279,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
//已经有锁定的库位
storagePos = storagePosManager.get(lockPosId);
log.info(barcodeSave.getBarcode() + "入库时查找到锁定的库位["+storagePos.getPosName()+"]");
EnLog.info(barcodeSave.getBarcode() + " found locked pos [" + storagePos.getPosName() + "] for put-in");
}else{
storagePos = findLineEmptyPosForPutIn(storage, barcodeSave);
}
......@@ -301,6 +310,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
statusBean.addData("plateH", task.getH()+"");
log.info(task.getBarcode() + "回温移库信息发送到客户端[" + task.getPosName() + "]=>" + rewarmPuttingTask.getPosName());
EnLog.info(task.getBarcode() + " rewarm move info sent to client [" + task.getPosName() + "]=>" + rewarmPuttingTask.getPosName());
rewarmPuttingTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(rewarmPuttingTask);
......@@ -396,6 +406,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
if (takingTask != null) {
if (takingTask.isCancel()) {//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
log.warn(statusBean.getCid() + "回温取料[" + boxStatus.getPosId() + "]完成时任务已取消");
EnLog.warn(statusBean.getCid() + " rewarm taking [" + boxStatus.getPosId() + "] finished but task already canceled");
}
DataLog puttingTask = null;
Collection<DataLog> allTasks=taskService.getQueueTasks();
......@@ -416,6 +427,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
}
} else {
log.warn(statusBean.getCid() + "回温取料[" + boxStatus.getPosId() + "]完成时任务不存在");
EnLog.warn(statusBean.getCid() + " rewarm taking [" + boxStatus.getPosId() + "] finished but task not found");
}
} else if (BOX_STATUS.REWARM_PUTTING_END == status) {
//回温放料结束
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.solder.util;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -131,9 +132,11 @@ public class SolderBoxCache {
//回温完成,更改状态为待搅拌
if(barcode.getMixTime() <= 0){
log.info(barcode.getBarcode() + "到达回温时间,搅拌时间为0,修改状态为待出库");
EnLog.info(barcode.getBarcode() + " reached rewarm time, mix time is 0, change status to to_be_out");
barcode.setSolderStatus(SOLDER_STATUS.TO_BE_OUT.name());
}else{
log.info(barcode.getBarcode() + "到达回温时间,修改状态为等待搅拌,待手动开始搅拌后再开始搅拌");
EnLog.info(barcode.getBarcode() + " reached rewarm time, change status to wait_mixed, wait for manual start mixing");
barcode.setSolderStatus(SOLDER_STATUS.WAIT_MIXED.name());
}
......@@ -163,6 +166,7 @@ public class SolderBoxCache {
}
}catch (Exception e){
log.info(storagePos.getBarcode().getBarcode() + "["+storagePos.getPosName()+"]" + "定时任务出错:" + e.getMessage());
EnLog.info(storagePos.getBarcode().getBarcode() + "[" + storagePos.getPosName() + "] timer task error: " + e.getMessage());
}
}
......@@ -183,6 +187,7 @@ public class SolderBoxCache {
}
}
log.info(barcode.getBarcode() + "创建出库任务");
EnLog.info(barcode.getBarcode() + " create checkout task");
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
DataLog outTask = new DataLog(storage,barcode, storagePos);
outTask.setType(OP.CHECKOUT);
......@@ -210,6 +215,7 @@ public class SolderBoxCache {
}
}
log.info(barcode.getBarcode() + "创建搅拌任务");
EnLog.info(barcode.getBarcode() + " create mix task");
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
DataLog mixTask = new DataLog(storage,barcode, storagePos);
mixTask.setType(OP.MIX);
......@@ -289,6 +295,7 @@ public class SolderBoxCache {
solderLog.setStartOutTime(System.currentTimeMillis());
solderLogManager.save(solderLog);
log.info("保存锡膏日志:" + solderLog.toString());
EnLog.info("Save solder log: " + solderLog.toString());
}
......
package com.neotel.smfcore.core.storage.rest;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
......@@ -57,6 +58,7 @@ public class LockMaterialController {
//如果已经锁定,直接跳过
if(code.getLockId()!=null){
log.info("锁定物料:增加锁定时物料已被锁定: 位置【" + pos.getPosName() + "】条码【"+code.getBarcode()+"】【"+code.getLockId()+"】");
EnLog.info("Lock material: material already locked when adding lock: pos [{0}] barcode [{1}] lockId [{2}]", pos.getPosName(), code.getBarcode(), code.getLockId());
continue;
}
code.setLockId(lockId);
......@@ -67,6 +69,7 @@ public class LockMaterialController {
dataCache.lockOneReel(storage.getCid(),code.getPartNumber());
dataCache.updateUsedPosList(storage.getCid(), pos);
log.info("锁定物料:增加锁定 "+lockId+" 位置【" + pos.getPosName() + "】【"+code.getBarcode()+"】");
EnLog.info("Lock material: add lock {0} pos [{1}] barcode [{2}]", lockId, pos.getPosName(), code.getBarcode());
}
return ResultBean.newOkResult("");
......@@ -94,6 +97,7 @@ public class LockMaterialController {
Barcode code = pos.getBarcode();
if(code.getLockId()==null){
log.info("锁定物料:解除锁定时物料未锁定: 位置【" + pos.getPosName() + "】条码【"+code.getBarcode()+"】");
EnLog.info("Lock material: material not locked when unlocking: pos [{0}] barcode [{1}]", pos.getPosName(), code.getBarcode());
continue;
}
if(!code.getLockId().equals(lockId)) {
......@@ -102,8 +106,10 @@ public class LockMaterialController {
LiteOrder order = liteOrderCache.getLiteOrder(code.getLockId());
if (order == null || order.isClosed()) {
log.info("锁定物料:解除锁定时物料被其他工单锁定: 位置【" + pos.getPosName() + "】条码【" + code.getBarcode() + "】lockId=【" + code.getLockId() + "】,工单已结束,可解除锁定");
EnLog.info("Lock material: material locked by other order when unlocking: pos [{0}] barcode [{1}] lockId [{2}], order finished, can unlock", pos.getPosName(), code.getBarcode(), code.getLockId());
} else {
log.info("锁定物料:解除锁定时物料被其他工单锁定: 位置【" + pos.getPosName() + "】条码【" + code.getBarcode() + "】lockId=【" + code.getLockId() + "】,工单还未结束,暂不解除锁定");
EnLog.info("Lock material: material locked by other order when unlocking: pos [{0}] barcode [{1}] lockId [{2}], order not finished, cannot unlock", pos.getPosName(), code.getBarcode(), code.getLockId());
continue;
}
}
......@@ -115,6 +121,7 @@ public class LockMaterialController {
dataCache.unLockOneReel(storage.getCid(),code.getPartNumber());
dataCache.updateUsedPosList(storage.getCid(), pos);
log.info("锁定物料:解除锁定【" + storage.getName() + "_" + storage.getCid() + "】位置【" + pos.getPosName() + "】【"+code.getBarcode()+"】");
EnLog.info("Lock material: unlock [{0}_{1}] pos [{2}] barcode [{3}]", storage.getName(), storage.getCid(), pos.getPosName(), code.getBarcode());
}
return ResultBean.newOkResult("");
......
package com.neotel.smfcore.core.storage.rest;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
......@@ -112,6 +113,7 @@ public class MaterialBoxController {
barcode.setDescribe(describe);
barcodeManager.saveBarcode(barcode);
log.info("更改料盒[" + code + "]的描述信息为:" + describe);
EnLog.info("Update material box [" + code + "] description to: " + describe);
return ResultBean.newOkResult("");
}
......@@ -146,6 +148,7 @@ public class MaterialBoxController {
finishTask(barcode, OP.CHECKOUT, null, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒[" + barcode.getPosName() + "]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
EnLog.info(subBarcode.getPartNumber() + " checkout from material box [" + barcode.getPosName() + "], qty: " + oldAmount + " - " + opQty + " = " + newAmount);
return ResultBean.newOkResult("");
}
......@@ -173,6 +176,7 @@ public class MaterialBoxController {
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, OP.CHECKOUT, null,subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]全部出库,物料数量:" + opQty);
EnLog.info(subBarcode.getPartNumber() + " checkout all from material box [" + barcode.getPosName() + "], qty: " + opQty);
}
return ResultBean.newOkResult("");
}
......@@ -221,6 +225,7 @@ public class MaterialBoxController {
barcodeManager.saveBarcode(subBarcode);
finishTask(barcode, opQty, currentTask, subBarcode, subBarcode.getAmount());
log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]入库到料盒[" + barcode.getBarcode() + "]数量:" + barcode.getAmount());
EnLog.info("Barcode " + subBarcode.getBarcode() + " [" + subBarcode.getPartNumber() + "] put-in to material box [" + barcode.getBarcode() + "], qty: " + barcode.getAmount());
} else if (subBarcode.getHostBarcodeId().equals(barcode.getId())) {
int qty = subBarcode.getAmount();
//出库
......@@ -228,6 +233,7 @@ public class MaterialBoxController {
opQty = OP.CHECKOUT;
finishTask(barcode, opQty, currentTask, subBarcode, qty);
log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]从料盒[" + barcode.getBarcode() + "]出库,数量:" + qty);
EnLog.info("Barcode " + subBarcode.getBarcode() + " [" + subBarcode.getPartNumber() + "] checkout from material box [" + barcode.getBarcode() + "], qty: " + qty);
} else {
//在别的料盒中
......@@ -363,6 +369,7 @@ public class MaterialBoxController {
} catch (Exception e) {
// return "出入库操作出错:" + e.getMessage();
log.error(e.toString());
EnLog.error(e.toString());
throw new ValidateException("smfcore.error", "出错{0}", new String[]{e.toString()});
}
// return ResultBean.newOkResult("");
......@@ -421,11 +428,13 @@ public class MaterialBoxController {
finishTask(barcode, opType, currentTask, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + oldAmount + " + " + opQty + " = " + subBarcode.getAmount());
EnLog.info(subBarcode.getPartNumber() + " put-in to material box [" + barcode.getBarcode() + "], qty: " + oldAmount + " + " + opQty + " = " + subBarcode.getAmount());
} else {
subBarcode=autoGetBarcode(barcode,component,pnStr,opQty);
finishTask(barcode, opType, currentTask, subBarcode, opQty);
log.info(barcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + barcode.getAmount());
EnLog.info(barcode.getPartNumber() + " put-in to material box [" + barcode.getBarcode() + "], qty: " + barcode.getAmount());
}
}else {
//出库
......@@ -443,6 +452,7 @@ public class MaterialBoxController {
finishTask(barcode, opType, currentTask,subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
EnLog.info(subBarcode.getPartNumber() + " checkout from material box [" + barcode.getPosName() + "], qty: " + oldAmount + " - " + opQty + " = " + newAmount);
}else{
//无库存
throw new ValidateException("smfcore.materialBox.noReel","料盒中未找到对应物料");
......
......@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
......@@ -279,15 +280,19 @@ public class MaterialController {
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
log.error("storageId["+pos.getStorageId()+"]不存在,忽略posId="+posId+"的任务");
EnLog.error("storageId[" + pos.getStorageId() + "] does not exist, ignore task for posId=" + posId);
}else{
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
EnLog.info("Checkout storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "]");
taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
}
}else{
log.error("posId["+posId+"]不存在,忽略posId="+posId+"的任务");
EnLog.error("posId[" + posId + "] does not exist, ignore task for posId=" + posId);
}
}catch (Exception e){
log.error("标签出库库位"+posId+"时出错"+e.getMessage());
EnLog.error("Label checkout error at posId " + posId + ": " + e.getMessage());
}
}
} else {
......@@ -299,17 +304,21 @@ public class MaterialController {
if (posList.size() <= 0) {
//未找到出库信息
log.info("出库标签["+labelId+"]时未找到可出库的物料");
EnLog.info("No available materials found for label [" + labelId + "] checkout");
}
for (StoragePos pos : posList) {
try{
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
log.error("storageId["+pos.getStorageId()+"]不存在,忽略posId="+pos.getId()+"的任务");
EnLog.error("storageId[" + pos.getStorageId() + "] does not exist, ignore task for posId=" + pos.getId());
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
EnLog.info("Checkout storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "]");
taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
}catch (Exception e){
log.error("标签出库库位"+pos.getPosName()+"时出错"+e.getMessage());
EnLog.error("Label checkout error at pos " + pos.getPosName() + ": " + e.getMessage());
}
}
......@@ -361,9 +370,11 @@ public class MaterialController {
if (barcode != null) {
String opUser = SecurityUtils.getCurrentUsername();
log.info(opUser + "清理库位[" + storagePos.getPosName() + "],条码[" + code + "]中的库存" + barcode.getBarcode());
EnLog.info(opUser + " cleared inventory at pos[" + storagePos.getPosName() + "], barcode[" + code + "] inventory " + barcode.getBarcode());
taskService.addTaskToFinished(storagePos, null, opUser + "-manual");
} else {
log.info("清理库位[" + storagePos.getPosName() + "],条码[" + code + "],库位条码为空");
EnLog.info("Clear pos[" + storagePos.getPosName() + "], barcode[" + code + "], pos barcode is empty");
}
return ResultBean.newOkResult("smfcore.manualOut.ok", "手动出库成功");
......
......@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.PointUtil;
......@@ -132,6 +133,7 @@ public class StorageController {
if (!dtoList.get(i).getGroupId().equals("")) {
storageManager.updateStorageGroup(dtoList.get(i).getId(), "");
log.info("料仓[" + dtoList.get(i).getId() + "][" + dtoList.get(i).getName() + "]的组不存在,修改组为空");
EnLog.info("Storage [" + dtoList.get(i).getId() + "][" + dtoList.get(i).getName() + "] group not found, set group empty");
}
}
......@@ -214,17 +216,20 @@ public class StorageController {
Storage storage = dataCache.getStorageById(storageId);
if (storage == null) {
log.error("Storage id is not exist");
EnLog.error("Storage id is not exist");
throw new ValidateException("smfcore.storage.error.notExist", "未找到料仓{0}", new String[]{storageId});
}
List<String> posNames = dataCache.getUsedPosNameList(storage.getCid());
log.info(storage.getCid() + " 点击: 一键亮灯 ");
EnLog.info(storage.getCid() + " click: one-key light on");
for (String poaName :
posNames) {
String colorStr = ORDER_COLOR.BLUE.name();
String opStr = poaName + "=" + colorStr;
DevicesStatusUtil.appendOp(storage.getCid(), "open", opStr);
log.info("操作库位[" + poaName + "]" + "open" + " : " + opStr);
EnLog.info("Operate pos [" + poaName + "] open : " + opStr);
}
return ResultBean.newOkResult("");
}
......@@ -236,10 +241,12 @@ public class StorageController {
Storage storage = dataCache.getStorageById(storageId);
if (storage == null) {
log.error("Storage id is not exist");
EnLog.error("Storage id is not exist");
throw new ValidateException("smfcore.storage.error.notExist", "未找到料仓{0}", new String[]{storageId});
}
log.info(storage.getCid() + " 点击: 一键灭灯 ");
EnLog.info(storage.getCid() + " click: one-key light off");
DevicesStatusUtil.appendOp(storage.getCid(), "closeAll", "true");
return ResultBean.newOkResult("");
}
......@@ -249,11 +256,13 @@ public class StorageController {
public ResultBean allShelfLight( ) {
Map<String, Storage> storages = dataCache.getAllStorage();
log.info(" 点击: 全部一键亮灯 ");
EnLog.info("Click: all one-key light on");
for (Storage storage :
storages.values()) {
if (storage.isNLMShelf() || storage.isNLPShelf() || storage.isNLShelf()) {
log.info(storage.getCid() + " 一键灭灯 ");
EnLog.info(storage.getCid() + " one-key light off");
//获取料架使用的库位号
List<String> posNames = dataCache.getUsedPosNameList(storage.getCid());
for (String posName :
......@@ -262,6 +271,7 @@ public class StorageController {
String opStr = posName + "=" + colorStr;
DevicesStatusUtil.appendOp(storage.getCid(), "open", opStr);
log.info(storage.getCid() + "操作库位[" + posName + "]" + "open" + " : " + opStr);
EnLog.info(storage.getCid() + " operate pos [" + posName + "] open : " + opStr);
}
}
}
......@@ -273,10 +283,12 @@ public class StorageController {
public ResultBean allShelfClose( ) {
Map<String, Storage> storages = dataCache.getAllStorage();
log.info(" 点击: 全部一键亮灯 ");
EnLog.info("Click: all one-key light on");
for (Storage storage :
storages.values()) {
if (storage.isNLMShelf() || storage.isNLPShelf() || storage.isNLShelf()) {
log.info(storage.getCid() + " 一键灭灯 ");
EnLog.info(storage.getCid() + " one-key light off");
DevicesStatusUtil.appendOp(storage.getCid(), "closeAll", "true");
}
}
......@@ -349,6 +361,7 @@ public class StorageController {
dataCache.removeStorage(storage);
}
log.info("手动删除料仓" + delStoName + "完成");
EnLog.info("Manual delete storage " + delStoName + " completed");
}
private Storage saveStorage(Storage storage) {
if(storage.getName()==null){
......@@ -448,6 +461,7 @@ public class StorageController {
FileUtil.downloadCSV(maps, titles, response);
} catch (Exception e) {
log.error("导出失败" + e.getMessage(), e);
EnLog.error("Export failed: " + e.getMessage(), e);
}
}
......@@ -456,6 +470,7 @@ public class StorageController {
protected String handleStoragePos(String fileURL, String storageId) throws Exception
{
log.info("开始更新料仓【"+storageId+"】的位置信息");
EnLog.info("Start updating storage [" + storageId + "] pos info");
if (Strings.isNullOrEmpty(storageId)) {
log.error("Storage id is null");
throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"storageId"} );
......@@ -506,11 +521,13 @@ public class StorageController {
}
}catch (Exception ex){
log.warn("第"+row+"行中有空白内容,此行忽略");
EnLog.warn("Row " + row + " has blank content, ignore this row");
continue;
}
if(posName.isEmpty() ){
log.warn("第"+row+"行中有空白内容,此行忽略");
EnLog.warn("Row " + row + " has blank content, ignore this row");
continue;
}
// StoragePos posInfo = storagePosManager.getByPosName(posName);
......@@ -560,6 +577,7 @@ public class StorageController {
List<String> existPosName = new ArrayList<>();
existPoss.forEach(pos -> existPosName.add(pos.getPosName()));
log.error("为["+storage.getName()+"]导入库位时,库位号【"+String.join(",", existPosName)+"】已在其他料仓存在,不新增库位");
EnLog.error("When importing pos for [" + storage.getName() + "], posName [" + String.join(",", existPosName) + "] already exists in other storage, not creating");
throw new ValidateException("smfcore.storage.error.posNameExist", "库位号已在其他料仓存在:{0}", new String[]{String.join(",", existPosName)});
}
storagePosManager.insertAll(newList);
......
......@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
......@@ -138,8 +139,10 @@ public class StoragePosController {
}
dataCache.removeStorage(storage);
log.info("开始删除料仓[" + cid + "] 所有位置");
EnLog.info("Start deleting all positions of storage [" + cid + "]");
storagePosManager.removePosByStorageId(storage.getId());
log.info("删除料仓[" + cid + "] 所有位置完成");
EnLog.info("Finished deleting all positions of storage [" + cid + "]");
return ResultBean.newOkResult("");
}
......@@ -157,6 +160,7 @@ public class StoragePosController {
}
log.info("开始手动清空料仓[" + storage.getName() + "_" + storage.getCid() + "]的所有库位");
EnLog.info("Start manually clearing all positions of storage [" + storage.getName() + "_" + storage.getCid() + "]");
List<StoragePos> allPos = storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos : allPos
) {
......@@ -167,8 +171,10 @@ public class StoragePosController {
if (barcode != null) {
log.info("清理库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
EnLog.info("Clear inventory in pos [" + storagePos.getPosName() + "]: " + barcode.getBarcode());
String opUser = SecurityUtils.getCurrentUsername();
log.info(opUser + "清理库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
EnLog.info(opUser + " clear inventory in pos [" + storagePos.getPosName() + "]: " + barcode.getBarcode());
taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
}
} catch (Exception e) {
......@@ -194,13 +200,16 @@ public class StoragePosController {
if (storagePos != null) {
try {
log.info("开始手动清空库位[" + storagePos.getPosName() + "]");
EnLog.info("Start manually clearing pos [" + storagePos.getPosName() + "]");
// QisdaApi.ClearStockBy(storagePos.getPosName());
Barcode barcode = storagePos.getBarcode();
if (barcode != null) {
log.info("清理库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
EnLog.info("Clear inventory in pos [" + storagePos.getPosName() + "]: " + barcode.getBarcode());
String opUser = SecurityUtils.getCurrentUsername();
log.info(opUser + "清理库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
EnLog.info(opUser + " clear inventory in pos [" + storagePos.getPosName() + "]: " + barcode.getBarcode());
taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
dataCache.reloadStorage(storage, storage.getCid());
......@@ -232,6 +241,7 @@ public class StoragePosController {
storagePosManager.save(pos);
dataCache.updateDisablePos(pos);
log.info("启用禁用库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
EnLog.info("Enable/disable pos: id [" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
DeviceMessageUtil.addEnabledPosMessage(pos,SecurityUtils.getCurrentUsername());
Storage storage = dataCache.getStorageById(pos.getStorageId());
if(storage != null){
......@@ -254,6 +264,7 @@ public class StoragePosController {
for (StoragePos pos : posList) {
dataCache.updateDisablePos(pos);
log.info("启用或禁用库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
EnLog.info("Batch enable/disable pos: id [" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
DeviceMessageUtil.addEnabledPosMessage(pos, SecurityUtils.getCurrentUsername());
}
for (Storage storage : dataCache.getAllStorage().values()) {
......@@ -290,6 +301,7 @@ public class StoragePosController {
}
storagePosManager.save(pos);
log.info("修改库位:库位号[" + pos.getId() + "]=[" + saveDto.toString() + "]"+enabledStr);
EnLog.info("Update pos: id [" + pos.getId() + "]=[" + saveDto.toString() + "]" + enabledStr);
if(ObjectUtil.isNotEmpty(enabledStr)){
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage != null) {
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
......@@ -226,12 +227,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
if (ObjectUtil.isNotEmpty(allPos)) {
log.info("设置库位["+storagePos.getPosName()+"]合并的关联库位[ " + allPos + " ]使用状态为:false");
EnLog.info("Set pos [" + storagePos.getPosName() + "] merged related positions [ " + allPos + " ] used=false");
}
storagePos.setMergePosList(null);
}
storagePos = storagePosDao.save(storagePos);
//reSortStoragePosList(storage.getId());
log.debug("Storage " + storagePos.getId() + " was added new slot with id: " + storagePos.getId());
EnLog.debug("Storage " + storagePos.getId() + " was added new slot with id: " + storagePos.getId());
return storagePos;
}
......@@ -314,8 +317,10 @@ public class StoragePosManagerImpl implements IStoragePosManager {
StoragePos pos = storagePosDao.findOne(q);
if (pos == null) {
log.info("使用" + checkOutType + " 策略出库 partNumber=" + pn + ",未找到可以出库的物料 ");
EnLog.info("Use " + checkOutType + " strategy checkout partNumber=" + pn + ", no material found");
} else {
log.info("使用" + checkOutType + " 策略出库 partNumber=" + pn + ",找到出仓位置【" + pos.getPosName() + "】,RI【" + pos.getBarcode().getBarcode() + "】 PN【"+pos.getBarcode().getPartNumber()+"】");
EnLog.info("Use " + checkOutType + " strategy checkout partNumber=" + pn + ", found pos [" + pos.getPosName() + "], RI [" + pos.getBarcode().getBarcode() + "] PN [" + pos.getBarcode().getPartNumber() + "]");
}
return pos;
}
......@@ -339,8 +344,10 @@ public class StoragePosManagerImpl implements IStoragePosManager {
StoragePos pos = storagePosDao.findOne(q);
if (pos == null) {
log.info("使用" + checkOutType + " 策略出库 partNumber=" + pn + ",未找到可以出库的物料 ");
EnLog.info("Use " + checkOutType + " strategy checkout partNumber=" + pn + ", no material found");
} else {
log.info("使用" + checkOutType + " 策略出库 partNumber=" + pn + ",找到出仓位置【" + pos.getPosName() + "】,RI【" + pos.getBarcode().getBarcode() + "】 ");
EnLog.info("Use " + checkOutType + " strategy checkout partNumber=" + pn + ", found pos [" + pos.getPosName() + "], RI [" + pos.getBarcode().getBarcode() + "]");
}
return pos;
}
......@@ -405,6 +412,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
delPosName+="["+pos.getId()+"_"+pos.getPosName()+"]";
}
log.info("手动删除库位:"+delPosName+" 完成 ");
EnLog.info("Manually delete positions: " + delPosName + " finished");
storagePosDao.removeByQuery(query);
}
@Override
......@@ -755,8 +763,10 @@ public class StoragePosManagerImpl implements IStoragePosManager {
StoragePos pos = storagePosDao.findOne(q);
if (pos == null) {
log.info("使用" + checkOutType + " 策略出库 mpn=" + mpn + ",未找到可以出库的物料 ");
EnLog.info("Use " + checkOutType + " strategy checkout mpn=" + mpn + ", not found available material ");
} else {
log.info("使用" + checkOutType + " 策略出库 mpn=" + mpn + ",找到出仓位置【" + pos.getPosName() + "】,RI【" + pos.getBarcode().getBarcode() + "】 ");
EnLog.info("Use " + checkOutType + " strategy checkout mpn=" + mpn + ", found checkout pos[" + pos.getPosName() + "], RI[" + pos.getBarcode().getBarcode() + "] ");
}
return pos;
}
......@@ -801,6 +811,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
}catch (Exception ex){
log.error("addAppendData 处理出错:"+appendData);
EnLog.error("addAppendData process error: "+appendData, ex);
}
return c;
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.system.rest;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
......@@ -67,6 +68,7 @@ public class MaterialTraceController {
Query query = getQuery(criteria);
Locale locale = request.getLocale();
log.info("开始导出物料追溯日志");
EnLog.info("Start exporting material trace logs");
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
@Override
public List<List<String>> getHeader() {
......@@ -117,6 +119,7 @@ public class MaterialTraceController {
}
});
log.info("物料追溯日志导出完成");
EnLog.info("Material trace logs export completed");
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.excel.ExcelReader;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.FileUtil;
......@@ -147,6 +148,11 @@ public class SettingsController {
" ,sameBarcodeSettings=" + sysSettingsDto.getSameBarcodeSettings()+", apiTest="+sysSettingsDto.isApiTest()+",xrayBypass="+sysSettingsDto.isXrayBypass()+
",expiredateVerify=" + sysSettingsDto.isExpiredateVerify()+",inputCheck="+sysSettingsDto.isInputCheck()+",isXRayTest="+sysSettingsDto.isXRayTest()
+",CACHE_Micron_AppAddr="+sysSettingsDto.getMicronAppAddr()+", CACHE_API_RetryCount="+sysSettingsDto.getRetryCount()+", CACHE_API_RetryInterval="+sysSettingsDto.getRetryInterval());
EnLog.info("Update system settings: stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob() + ",sluggishDay=" + sysSettingsDto.getSluggishDay()
+ ",expiresDay=" + sysSettingsDto.getExpiresDay() + ",capacityWarn=" + sysSettingsDto.getCapacityWarn() + ",backUpMonth=" + sysSettingsDto.getBackUpMonth() +
" ,sameBarcodeSettings=" + sysSettingsDto.getSameBarcodeSettings()+", apiTest="+sysSettingsDto.isApiTest()+",xrayBypass="+sysSettingsDto.isXrayBypass()+
",expiredateVerify=" + sysSettingsDto.isExpiredateVerify()+",inputCheck="+sysSettingsDto.isInputCheck()+",isXRayTest="+sysSettingsDto.isXRayTest()
+",CACHE_Micron_AppAddr="+sysSettingsDto.getMicronAppAddr()+", CACHE_API_RetryCount="+sysSettingsDto.getRetryCount()+", CACHE_API_RetryInterval="+sysSettingsDto.getRetryInterval());
micronConfig.UpdateAddr(sysSettingsDto.getMicronAppAddr());
String msg = MessageUtils.getText("smfcore.saveOk", servletRequest.getLocale(), "保存成功");
return ResultBean.newOkResult(msg);
......@@ -170,6 +176,7 @@ public class SettingsController {
// String type=map.get("checkOutType");
dataCache.updateCache(Constants.CACHE_CheckOutType, type);
log.info("更改出库策略:checkOutType=" + type);
EnLog.info("Update checkout strategy: checkOutType=" + type);
return ResultBean.newOkResult("保存成功");
}
......@@ -249,6 +256,7 @@ public class SettingsController {
dataCache.updateCache(Constants.CACHE_OrderSetting, orderSetting);
log.info("更改工单设置:"+Constants.CACHE_OrderSetting+"=" + orderSetting.toString());
EnLog.info("Update order settings: " + Constants.CACHE_OrderSetting + "=" + orderSetting.toString());
return ResultBean.newOkResult("保存成功");
}
......@@ -300,6 +308,7 @@ public class SettingsController {
FileUtil.downloadCSV(maps, titles, response);
} catch (Exception e) {
log.error("导出失败" + e.getMessage(), e);
EnLog.error("Export failed: " + e.getMessage(), e);
}
}
@ApiOperation("上传工单模板")
......@@ -338,6 +347,7 @@ public class SettingsController {
@GetMapping("/version")
public String version() {
log.info("获取版本号:"+version);
EnLog.info("Get version: " + version);
return "V"+version;
}
}
......@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
......@@ -112,6 +113,7 @@ public class TaskController {
Query query = getQuery(criteria);
Locale locale = request.getLocale();
log.info("开始导出出入库日志");
EnLog.info("Start exporting inbound/outbound logs");
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
@Override
public List<List<String>> getHeader() {
......@@ -162,6 +164,7 @@ public class TaskController {
}
});
log.info("出入库日志导出完成");
EnLog.info("Inbound/outbound logs export completed");
}
@ApiOperation("获取某个分组队列中的任务")
......@@ -237,6 +240,7 @@ public class TaskController {
//取消任务不需要屏蔽库位
taskService.cancelTask(taskId);
log.info("cancel 取消任务 id="+taskId+",barcode="+task.getBarcode()+", posName="+task.getPosName());
EnLog.info("Cancel task id=" + taskId + ",barcode=" + task.getBarcode() + ",posName=" + task.getPosName());
}
return new ResponseEntity<>(HttpStatus.OK);
}
......
package com.neotel.smfcore.core.system.util;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.device.util.DataCache;
......@@ -52,6 +53,7 @@ public class DbBackupService {
@Override
public void run() {
log.info("开启数据库定时存档任务");
EnLog.info("Start scheduled database archive task");
while(true){
try{
Integer dbBackupMonth = dataCache.getCache(Constants.BACKUP_MONTH_KEY);
......@@ -75,6 +77,7 @@ public class DbBackupService {
TimeUnit.HOURS.sleep(1);
}catch (Exception e){
log.error("数据库定时存档任务出错"+e.getMessage());
EnLog.error("Scheduled database archive task error: " + e.getMessage());
}
}
}
......@@ -88,6 +91,7 @@ public class DbBackupService {
public boolean backup(){
if(processing){
log.info("上一次存档任务未完成,忽略本次存档");
EnLog.info("Previous archive task not finished, ignore this archive request");
return false;
}
processing = true;
......@@ -122,12 +126,15 @@ public class DbBackupService {
String collectionName = mongoTemplate.getCollectionName(entityClass);
collectionName = collectionName;
log.info("开始存档["+collectionName+"]的数据");
EnLog.info("Start archiving collection [" + collectionName + "]");
String backupCollectionName = collectionName + "_bak_"+DateUtil.toDateString(new Date(),"yyyyMMddHHmmss");
while (true){
query.with(page);
log.info("开始存档["+collectionName+"]的第["+page.getOffset()+"]条数据");
EnLog.info("Start archiving collection [" + collectionName + "] offset [" + page.getOffset() + "]");
List<?> data = mongoTemplate.find(query, entityClass,collectionName);
log.info("查询到["+data.size()+"]条数据");
EnLog.info("Query got [" + data.size() + "] records");
if(data == null || data.isEmpty()){
break;
}
......@@ -135,11 +142,14 @@ public class DbBackupService {
page = page.next();
}
log.info("存档["+collectionName+"]的数据完成,开始清理原始数据");
EnLog.info("Archive collection [" + collectionName + "] done, start cleaning original data");
Query removeQuery = new Query(c);
mongoTemplate.remove(removeQuery,entityClass,collectionName);
log.info("["+collectionName+"]的数据清理完成");
EnLog.info("Collection [" + collectionName + "] data cleanup done");
}catch (Exception e){
log.error("数据存档失败",e);
EnLog.error("Data archive failed: " + e.getMessage(), e);
}
}
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.system.util;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.bean.MsgInfo;
import com.neotel.smfcore.core.device.bean.StatusBean;
......@@ -262,6 +263,7 @@ public class DevicesStatusUtil {
}
} catch (Exception ex) {
log.error("设备状态定时器执行出错:", ex);
EnLog.error("Device status timer error: " + ex.toString());
}
}
}
......@@ -3,6 +3,7 @@ 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.enlog.EnLog;
import com.neotel.smfcore.core.deviceState.enums.DeviceSKind;
import com.neotel.smfcore.core.deviceState.util.DeviceStateDurationUtil;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
......@@ -82,6 +83,7 @@ public class EquipStatusUtil {
}
} catch (Exception ex) {
log.error("设备状态定时器执行出错:", ex);
EnLog.error("Equipment status timer execution error", ex);
}
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
......@@ -99,6 +100,7 @@ public class TaskService {
task.setOperator(loginUser);
task = updateQueueTask(task);
log.info("cid:[" + storage.getCid() + "] barcode:[" + barcode.getBarcode() + "] partNumber:[" + task.getPartNumber() + "]位置[" + storagePos.getPosName() + "]的入库操作成功加入队列");
EnLog.info("cid:[" + storage.getCid() + "] barcode:[" + barcode.getBarcode() + "] partNumber:[" + task.getPartNumber() + "] pos[" + storagePos.getPosName() + "] put-in operation added to queue");
return task;
}
......@@ -115,6 +117,7 @@ public class TaskService {
if (pos.getBarcode() == null) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg);
EnLog.info("Pos [" + pos.getPosName() + "] has no material, ignored");
throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料",new String[]{pos.getPosName()});
}
......@@ -195,9 +198,11 @@ public class TaskService {
if(task.getType() == taskToExecute.getType()){
if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) {
log.info("二维码:[" + barcode + "]已在操作队列中,操作失败");
EnLog.info("Barcode [" + barcode + "] already in operation queue, operation failed");
throw new ValidateException("smfcore.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode});
} else if (task.getPosName().equals(posName)&& ObjectUtil.isNotEmpty(posName)) {
log.info("位置:[" + posName + "]已在操作队列中,操作失败");
EnLog.info("Pos:[" + posName + "] already in operation queue, operation failed");
throw new ValidateException("smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName});
}
}
......@@ -262,6 +267,7 @@ public class TaskService {
task.setUpdateDate(new Date());
updateFinishedTask(task);
log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功");
EnLog.info("Task [" + task.getId() + "] pos[" + task.getPosName() + "] reelId[" + task.getBarcode() + "] canceled successfully");
return true;
}
return false;
......@@ -285,6 +291,7 @@ public class TaskService {
storagePosManager.save(pos);
dataCache.updateDisablePos(pos);
log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功,禁用库位[" + task.getPosName() + "]");
EnLog.info("Task [" + task.getId() + "] pos[" + task.getPosName() + "] reelId[" + task.getBarcode() + "] canceled, disable pos [" + task.getPosName() + "]");
DeviceMessageUtil.addEnabledPosMessage(pos, SecurityUtils.getCurrentUsername());
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage != null) {
......@@ -456,9 +463,11 @@ public class TaskService {
if (cid.equals(task.getCid()) && task.isExecuting()) {
if (task.isPutInTask()) {
log.error("cid[" + cid + "]已有入库任务,不可再分配出库任务");
EnLog.error("cid[" + cid + "] already has put-in task, cannot assign checkout task");
return null;
} else if (task.needReSendToClient() && task.isCheckOutTask()) {//超过30秒仍未完成的出库再次发送到客户端
log.error("cid[" + cid + "]的出库任务[" + task.getPosName() + "]"+task.getBarcode()+"超过60秒仍未完成,重新发送到客户端!");
EnLog.error("Checkout task for cid[" + cid + "] pos[" + task.getPosName() + "] barcode[" + task.getBarcode() + "] exceeded 60s, resend to client");
task.setUpdateDate(new Date());
return task;
}
......@@ -498,6 +507,7 @@ public class TaskService {
}
if (singleOutTask != null) {
log.info("分配优先(单盘或无工单)出库任务" + singleOutTask.getBarcode() + "[" + singleOutTask.getPosName() + "]到 " + cid);
EnLog.info("Assign priority checkout task (single reel or no order) " + singleOutTask.getBarcode() + "[" + singleOutTask.getPosName() + "] to " + cid);
return singleOutTask;
}
......@@ -522,6 +532,7 @@ public class TaskService {
//从等待列表中删除,加入到执行列表中
log.info("分配出库任务" + task.getBarcode() + "[" + task.getPosName() + "]到 " + cid);
EnLog.info("Assign checkout task " + task.getBarcode() + "[" + task.getPosName() + "] to " + cid);
task.setStatus(OP_STATUS.EXECUTING.name());
taskMap.put(task.getId(), task);
task = dataLogDao.save(task);
......@@ -539,10 +550,12 @@ public class TaskService {
plateH = codeObj.getHeight();
if (codeObj.isOnlySingleOut()) {
log.info(codeObj.getBarcode() + " 只能单盘出库");
EnLog.info(codeObj.getBarcode() + " only single reel checkout allowed");
isSingleOut = true;
}
} else {
log.warn("出库无料仓位" + storage.getName() + "[" + posName + "]");
EnLog.warn("Checkout empty storage pos " + storage.getName() + "[" + posName + "]");
StoragePos pos=storagePosManager.getByPosName(posName);
plateW = pos.getW();
plateH = pos.getH();
......@@ -550,14 +563,17 @@ public class TaskService {
statusBean.addData("hSerial",task.getSourceName());
statusBean.addPosInfo(task.getBarcode(), posName, plateW, plateH, isSingleOut);
log.info("出库" + storage.getName() + "[" + posName + "]物料[" + task.getBarcode() + "]" + isSingleOut + "发送到客户端" + cid);
EnLog.info("Checkout " + storage.getName() + "[" + posName + "] material [" + task.getBarcode() + "] " + isSingleOut + " sent to client " + cid);
}
}
String posId = statusBean.getData().get("posId");
if (!Strings.isNullOrEmpty(posId)) {
log.info("SEQ:" + statusBean.getSeq() + "出库库位信息:[" + posId + "]发送到客户端");
EnLog.info("SEQ:" + statusBean.getSeq() + " checkout pos info:[" + posId + "] sent to client");
}
} catch (Exception e) {
log.error("出库出错", e);
EnLog.error("Checkout error: " + e.getMessage(), e);
}
return statusBean;
......@@ -589,6 +605,7 @@ public class TaskService {
if (barcode.isSolder()) {
//锡膏出库
log.info("设置库位[" + pos.getPosName() + "]中的锡膏[" + barcode.getBarcode() + "]的出库时间为立即出库");
EnLog.info("Set solder in pos [" + pos.getPosName() + "] barcode [" + barcode.getBarcode() + "] needOutDate to immediate");
try {
barcode.setNeedOutDate(new Date());
barcode = barcodeManager.save(barcode);
......@@ -603,6 +620,7 @@ public class TaskService {
if (!forceOut) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg);
EnLog.info("Pos [" + pos.getPosName() + "] has no material, ignored");
//return msg;
return "allBoxView.noReel";
}
......@@ -614,6 +632,7 @@ public class TaskService {
if (taskInList.getPosId().equals(pos.getId())) {
String msg = "库位【" + pos.getPosName() + "已在任务列表中,忽略】";
log.info(msg);
EnLog.info("Pos [" + pos.getPosName() + "] already in task list, ignored");
//return msg;
return "order.error.executing";
}
......@@ -699,6 +718,7 @@ public class TaskService {
if (barcode.getBarcode().equals(task.getBarcode())) {
String posId = task.getPosId();
log.info(barcode.getBarcode() + " 已有任务,返回任务中的库位:" + task.getPosName());
EnLog.info(barcode.getBarcode() + " already has task, return task pos: " + task.getPosName());
return storagePosManager.get(posId);
}
......@@ -725,17 +745,21 @@ public class TaskService {
if (pos != null) {
if(!storageIds.contains(pos.getStorageId())){
log.info("条码[" + barcode.getBarcode() + "]已有锁定库位[" + pos.getPosName() + "],料仓ID["+pos.getStorageId()+"]不在请求列表["+String.join(",",storageIds)+"]中,重新查找库位");
EnLog.info("Barcode[" + barcode.getBarcode() + "] locked pos[" + pos.getPosName() + "], storageId[" + pos.getStorageId() + "] not in requested list[" + String.join(",", storageIds) + "], refind pos");
pos = null;
}
else if (pos.getW() < barcode.getPlateSize() || pos.getH() < barcode.getHeight()) {
log.info("条码[" + barcode.getBarcode() + "]尺寸已改变,无法放入已锁定库位[" + pos.getPosName() + "],重新查找库位");
EnLog.info("Barcode[" + barcode.getBarcode() + "] size changed, cannot put into locked pos[" + pos.getPosName() + "], refind pos");
pos = null;
} else {
Barcode posBarcode = pos.getBarcode();
if (posBarcode == null) {
log.info("条码[" + barcode.getBarcode() + "]已锁定库位[" + pos.getPosName() + "],返回锁定中的库位");
EnLog.info("Barcode[" + barcode.getBarcode() + "] locked pos[" + pos.getPosName() + "], return locked pos");
} else {
log.info("条码[" + barcode.getBarcode() + "]已锁定库位[" + pos.getPosName() + "]中已有物料[" + posBarcode.getBarcode() + "],重新查找库位");
EnLog.info("Barcode[" + barcode.getBarcode() + "] locked pos[" + pos.getPosName() + "] already has barcode[" + posBarcode.getBarcode() + "], refind pos");
pos = null;
}
}
......@@ -782,12 +806,14 @@ public class TaskService {
try {
Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
EnLog.debug("Try find empty pos in [" + storage.getCid() + "] for [" + barcode.getBarcode() + "]");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId);
if (pos != null) {
return pos;
}
} catch (Exception e) {
log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
EnLog.error("Find empty pos in [" + storage.getCid() + "] for [" + barcode.getBarcode() + "] failed: " + e.getMessage());
}
}
//第二遍查找,从所有料仓中查找
......@@ -795,12 +821,15 @@ public class TaskService {
try {
Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
EnLog.debug("Try find empty pos in [" + storage.getCid() + "] for [" + barcode.getBarcode() + "]");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId);
if (pos != null) {
return pos;
}
} catch (Exception e) {
log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
EnLog.error("Find empty pos in [" + storage.getCid() + "] for [" + barcode.getBarcode() + "] failed: " + e.getMessage());
}
}
try {
......@@ -809,8 +838,10 @@ public class TaskService {
cids = cids + storage.getCid() + ",";
}
log.info(barcode.getBarcode() + " 未找到可用库位,可用料仓:" + cids);
EnLog.info(barcode.getBarcode() + " no available pos found, available storages: " + cids);
} catch (Exception e) {
log.error("打印可用料仓出错", e);
EnLog.error("Error printing available storages: " + e.getMessage(), e);
}
......@@ -847,9 +878,11 @@ public class TaskService {
if(barcodeSet==null||barcodeSet==1) {
//如果已在库位中,那么自动将该库位的物料出库
log.info("CACHE_SAME_BARCODE_SETTINGS=1,自动出库已在库位中的物料[" + barcodeSave.getBarcode() + "],设置ngReel=true");
EnLog.info("CACHE_SAME_BARCODE_SETTINGS=1, auto checkout material [" + barcodeSave.getBarcode() + "] in pos, set ngReel=true");
checkout(storage, pos, true, true, "", "");
}else{
log.info("CACHE_SAME_BARCODE_SETTINGS=2,标记库位["+pos.getPosName()+"]中的物料[" + barcodeSave.getBarcode() + "]为ngReel=NG");
EnLog.info("CACHE_SAME_BARCODE_SETTINGS=2, mark material [" + barcodeSave.getBarcode() + "] in pos [" + pos.getPosName() + "] as ngReel=NG");
pos.getBarcode().updateAppendData("ngReel",true);
storagePosManager.save(pos);
}
......@@ -876,6 +909,7 @@ public class TaskService {
}
}
log.error("料盘["+barcodeSave.getBarcode()+"]的入库操作["+task.getPosName()+"]未完成,无法执行入库操作");
EnLog.error("Reel [" + barcodeSave.getBarcode() + "] put-in operation [" + task.getPosName() + "] not finished, cannot execute put-in");
throw new ValidateException("smfcore.error.barcode.taskNotEnd", "料盘[{0}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()});
}
}
......@@ -907,6 +941,7 @@ public class TaskService {
}
if (isSameTask) {
log.info(executeBarcode + "找到正在执行的出库任务[" + pos.getPosName() + "],直接完成");
EnLog.info(executeBarcode + " found executing checkout task pos[" + pos.getPosName() + "], complete directly");
if (task.isWait()) {
taskMap.put(task.getId(), task);
}
......@@ -923,6 +958,7 @@ public class TaskService {
DataLog task = newTask(pos);
if (pos.getBarcode() == null) {
log.info(opUser + "入库【" + barcode.getBarcode() + "】到【" + pos.getPosName() + "】");
EnLog.info(opUser + " put-in [" + barcode.getBarcode() + "] to [" + pos.getPosName() + "]");
task.setType(OP.PUT_IN);
barcode.setUsedCount(barcode.getUsedCount() + 1);
barcode.setUsedDate(new Date());
......@@ -950,6 +986,7 @@ public class TaskService {
} else {
barcode = pos.getBarcode();
log.info(opUser + "将【" + barcode.getBarcode() + "】从【" + pos.getPosName() + "】出库");
EnLog.info(opUser + " checkout [" + barcode.getBarcode() + "] from [" + pos.getPosName() + "]");
task.setType(OP.CHECKOUT);
barcode.setUsed(true);
barcode.setUsedDate(new Date());
......@@ -973,6 +1010,7 @@ public class TaskService {
} catch (Exception e) {
log.error("addTaskToFinished Error:", e);
EnLog.error("addTaskToFinished Error: " + e.getMessage(), e);
}
}
......@@ -991,6 +1029,7 @@ public class TaskService {
taskMap.remove(task.getId());
//theFinishedTaskMap.put(task.getBarcode(), task);
log.warn("任务:" + task.getBarcode() + " 仓位:" + task.getPosName() + " 的 Barcode 为null, 之前可能处理过直接返回");
EnLog.warn("Task:" + task.getBarcode() + " Pos:" + task.getPosName() + " Barcode is null, maybe processed before, return directly");
updateFinishedTask(task);
return;
}
......@@ -1021,6 +1060,7 @@ public class TaskService {
log.info(task.getBarcode() + "出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
EnLog.info(task.getBarcode() + " checkout finished, clear pos: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
//更新缓存中的库存信息
dataCache.updateInventory(storagePos, barcode);
......@@ -1036,9 +1076,11 @@ public class TaskService {
try {
if (removeTask == null) {
log.error(task.getBarcode() + "的出库任务[" + task.getId() + "]清除失败");
EnLog.error(task.getBarcode() + " checkout task [" + task.getId() + "] clear failed");
}
} catch (Exception e) {
log.error(e.getMessage());
EnLog.error(e.getMessage());
}
//theFinishedTaskMap.put(task.getBarcode(), task);
......@@ -1066,6 +1108,7 @@ public class TaskService {
for (TacticsOutDto item : tacticsOutDtos) {
log.info("开始执行策略出库[" + item.getPartNumber() + "] [" + item.getStorageId() + "] 盘数=" + item.getPlateNumber()+",数量="+item.getNeedNum());
EnLog.info("Start tactics checkout [" + item.getPartNumber() + "] [" + item.getStorageId() + "] plateNumber=" + item.getPlateNumber() + ", needNum=" + item.getNeedNum());
String partNumber = item.getPartNumber();
int currNum=0;
......@@ -1082,11 +1125,13 @@ public class TaskService {
}
if (pos == null) {
log.error("策略出库[" + item.getPartNumber() + "] 未找到可以出库的物料[" + partNumber + "]");
EnLog.error("Tactics checkout [" + item.getPartNumber() + "] no available material found for [" + partNumber + "]");
break;
} else {
currNum+=pos.getBarcode().getAmount();
reelNum+=1;
log.info("策略出库,PN[" + item.getPartNumber() + "]第[" + reelNum + "]盘, 出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount()+",累计数量:"+currNum);
EnLog.info("Tactics checkout, PN[" + item.getPartNumber() + "] reel[" + reelNum + "], pos[" + pos.getPosName() + "] RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount() + ", total:" + currNum);
DataLog task = newTask(pos);
task.setType(OP.CHECKOUT);
task.setOperator(SecurityUtils.getCurrentUsername());
......
......@@ -17,6 +17,7 @@ package com.neotel.smfcore.core.system.websocket;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.enlog.EnLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.stereotype.Component;
......@@ -59,12 +60,14 @@ public class WebSocketServer {
public void onOpen(Session session, @PathParam("sid") String sid) {
String psid=sid.length()>20? sid.substring(0,20):sid;
log.info("["+psid+"]的webSocket已连接:" + session.getId());
EnLog.info("[" + psid + "] webSocket connected: " + session.getId());
this.session = session;
this.sid=sid;
//如果存在就先删除一个,防止重复推送消息
for (WebSocketServer webSocket:webSocketSet) {
if (webSocket.sid.equals(sid)) {
log.info("清理旧的["+psid+"]的连接:"+ session.getId());
EnLog.info("Remove old [" + psid + "] connection: " + session.getId());
webSocketSet.remove(webSocket);
}
}
......@@ -89,6 +92,7 @@ public class WebSocketServer {
public void onClose() {
String psid=sid.length()>20? sid.substring(0,20):sid;
log.info("清理["+psid+"]连接:"+ session.getId());
EnLog.info("Remove [" + psid + "] connection: " + session.getId());
webSocketSet.remove(this);
}
......@@ -98,12 +102,14 @@ public class WebSocketServer {
@OnMessage
public void onMessage(String message, Session session) {
log.info("收到来["+sid+"]的信息:"+message);
EnLog.info("Received message from [" + sid + "]: " + message);
//群发消息
for (WebSocketServer item : webSocketSet) {
try {
item.sendMessage(message);
} catch (IOException e) {
log.error(e.getMessage(),e);
EnLog.error(e.getMessage(), e);
}
}
}
......@@ -111,6 +117,7 @@ public class WebSocketServer {
@OnError
public void onError(Session session, Throwable error) {
log.error("WebSocket发生错误:"+error.getMessage());
EnLog.error("WebSocket error: " + error.getMessage());
}
/**
* 实现服务器主动推送
......@@ -157,9 +164,11 @@ public class WebSocketServer {
}
} catch (IOException ignored) {
log.error("发送消息到["+pSid+"]出错",ignored);
EnLog.error("Send message to [" + pSid + "] error: " + ignored.getMessage(), ignored);
}
}
log.info("推送消息到["+pSid+"],推送内容:"+message+",结果:"+sendOk);
EnLog.info("Push message to [" + pSid + "], content: " + message + ", result: " + sendOk);
}
@Override
......
......@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
......@@ -67,15 +68,18 @@ public class XrayDataController {
}
} else {
log.warn("Unsupported data payload type: {}", value == null ? "null" : value.getClass().getName());
EnLog.warn("Unsupported data payload type: " + (value == null ? "null" : value.getClass().getName()));
}
} catch (Exception e) {
log.error("Failed to parse data payload: {}", e.getMessage());
EnLog.error("Failed to parse data payload: " + e.getMessage(), e);
return ResultBean.newErrorResult(99,"",e.getMessage());
}
List<String> successUids = countingHistoryManager.upsertByUid(entities);
log.info("uploadCountingHistory 收到"+entities.size()+"条数据,新增成功"+successUids.size()+"条: "+String.join(",",successUids));
EnLog.info("uploadCountingHistory received " + entities.size() + " records, upsert success " + successUids.size() + ": " + String.join(",", successUids));
return ResultBean.newOkResult(successUids);
}
@ApiOperation("查询点料结果")
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
......@@ -64,6 +65,7 @@ public class XrayDeviceController {
}
XrayPrintData printData=new XrayPrintData(reelId,fullCode,qty,printParam);
log.info("uploadMResult: reelID="+reelId+",qty="+qty+",fullCode="+fullCode+",printParam="+printParam);
EnLog.info("uploadMResult: reelID=" + reelId + ", qty=" + qty + ", fullCode=" + fullCode + ", printParam=" + printParam);
xrayPrintDataManager.save(printData);
return ResultBean.newOkResult("");
}
......@@ -102,6 +104,7 @@ public class XrayDeviceController {
public ResultBean isNeedCounting(@RequestBody Map<String,String> paramMap) {
String barcodeStr = paramMap.get("barcodes");
log.info("isNeedCounting: 条码:barcodes:" + barcodeStr);
EnLog.info("isNeedCounting: barcodes: " + barcodeStr);
if (ObjectUtil.isEmpty(barcodeStr)) {
return ResultBean.newErrorResult(1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"barcodes"});
}
......@@ -110,6 +113,7 @@ public class XrayDeviceController {
barcode = codeResolve.resolveOneValideBarcode(barcodeStr);
} catch (ValidateException ex) {
log.error(ex.getDefaultMsg());
EnLog.error(ex.getDefaultMsg());
}
//已入库的条码需要点料
if (barcode == null) {
......@@ -117,10 +121,12 @@ public class XrayDeviceController {
}
if (barcode.getPutInTime() <= -1) {
log.info("isNeedCounting: 条码:" + barcode.getBarcode() + "未入库过,不需要点料");
EnLog.info("isNeedCounting: barcode " + barcode.getBarcode() + " never put-in, counting not needed");
return ResultBean.newErrorResult(1, "", "new barcode");
} else {
DateTime putIntime = new DateTime(barcode.getPutInTime());
log.info("isNeedCounting: 条码:" + barcode.getBarcode() + "首次入库时间=" + DateUtil.toDateString(putIntime, "yyyy-MM-dd HH:mm:ss") + ",需要点料");
EnLog.info("isNeedCounting: barcode " + barcode.getBarcode() + " first put-in time=" + DateUtil.toDateString(putIntime, "yyyy-MM-dd HH:mm:ss") + ", counting needed");
return ResultBean.newOkResult("true");
}
......@@ -142,6 +148,7 @@ public class XrayDeviceController {
}
log.info("xrayUpdateAmount: 点料信息:barcode:" + barcodeStr + ",amount为:" + amountStr + ",offlineMode=" + offlineMode);
EnLog.info("xrayUpdateAmount: counting info barcode:" + barcodeStr + ", amount:" + amountStr + ", offlineMode=" + offlineMode);
if (StringUtils.isNotBlank(barcodeStr)) {
Barcode barcode = barcodeManager.findByBarcode(barcodeStr);
......@@ -152,6 +159,7 @@ public class XrayDeviceController {
barcode = codeResolve.resolveOneValideBarcode(fullBarcode);
} catch (ValidateException ex) {
log.error(ex.getDefaultMsg());
EnLog.error(ex.getDefaultMsg());
}
}
if (barcode != null) {
......@@ -162,6 +170,7 @@ public class XrayDeviceController {
barcodeManager.save(barcode);
log.info("点料信息:barcode:" + barcodeStr + ",旧数量:" + oldQty + ",新数量=" + qty + ",已点料次数="+barcode.getXrayCount());
EnLog.info("Counting info barcode:" + barcodeStr + ", oldQty:" + oldQty + ", newQty=" + qty + ", xrayCount=" + barcode.getXrayCount());
return ResultBean.newOkResult(qty);
}
}
......@@ -190,6 +199,7 @@ public class XrayDeviceController {
barcode = codeResolve.resolveOneValideBarcode(fullBarcode);
} catch (ValidateException ex) {
log.error(ex.getDefaultMsg());
EnLog.error(ex.getDefaultMsg());
}
}
if (barcode != null) {
......@@ -203,6 +213,7 @@ public class XrayDeviceController {
resMap.put("produceDate", proDate);
resMap.put("xrayCount",barcode.getXrayCount());
log.info("getMaxCountTimes点料信息:barcode:" + barcode.getBarcode() + ",maxCount:" + maxCount + ",proDate=" + proDate + ",已点料次数="+barcode.getXrayCount());
EnLog.info("getMaxCountTimes counting info barcode:" + barcode.getBarcode() + ", maxCount:" + maxCount + ", proDate=" + proDate + ", xrayCount=" + barcode.getXrayCount());
return ResultBean.newOkResult(resMap);
}
......
package com.neotel.smfcore.custom.hotayi20057;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
......@@ -81,6 +82,7 @@ public class HotayiController {
@AnonymousAccess
public HotayiBean m1(@RequestBody HotayiBean hotayiBean) {
log.info("收到M1请求数据为:{}", JsonUtil.toJsonStr(hotayiBean));
EnLog.info("Received M1 request: " + JsonUtil.toJsonStr(hotayiBean));
hotayiBean.addInfo("MessageNo","M2");
Map<String,Object> resultData = new HashMap<>();
resultData.put("Version","1.6");
......@@ -124,6 +126,7 @@ public class HotayiController {
@AnonymousAccess
public HotayiBean m3(@RequestBody HotayiBean hotayiBean) {
log.info("收到M3请求数据为:{}", JsonUtil.toJsonStr(hotayiBean));
EnLog.info("Received M3 request: " + JsonUtil.toJsonStr(hotayiBean));
hotayiBean.addInfo("MessageNo","M4");
Map<String,Object> resultData = new HashMap<>();
int solderPasteCount = 0;
......@@ -183,6 +186,7 @@ public class HotayiController {
@AnonymousAccess
public HotayiBean m7(@RequestBody HotayiBean hotayiBean) {
log.info("收到M7请求数据为:{0}", JsonUtil.toJsonStr(hotayiBean));
EnLog.info("Received M7 request: " + JsonUtil.toJsonStr(hotayiBean));
String barcode = hotayiBean.getInfoItem("Barcode");
String RequestDate = hotayiBean.getInfoItem("RequestDate");
......@@ -195,6 +199,8 @@ public class HotayiController {
String msg = MessageUtils.getText("smfcore.queryPos.cannotFindBarcode", locale, "cannot find barcode ["+barcode+"] In storage");
hotayiBean.setM90(71, msg);
log.info("M7返回M90,数据为:"+JsonUtil.toJsonStr(hotayiBean));
EnLog.info("M7 return M90: " + JsonUtil.toJsonStr(hotayiBean));
EnLog.info("M7 return M90: " + JsonUtil.toJsonStr(hotayiBean));
return hotayiBean;
}
......@@ -213,6 +219,7 @@ public class HotayiController {
String msg = MessageUtils.getText(result, locale, "barcode [" + barcode + "] checkOut fail");
hotayiBean.setM90(73, msg);
log.info("M7返回M90,数据为:"+JsonUtil.toJsonStr(hotayiBean));
EnLog.info("M7 return M90: " + JsonUtil.toJsonStr(hotayiBean));
return hotayiBean;
}
// M8 Action Status
......@@ -236,6 +243,7 @@ public class HotayiController {
resultData.put("Message", "Standby Success");
hotayiBean.setData(resultData);
log.info("M7返回M8,数据为:"+JsonUtil.toJsonStr(hotayiBean));
EnLog.info("M7 return M8: " + JsonUtil.toJsonStr(hotayiBean));
return hotayiBean;
}
......
......@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
......@@ -122,6 +123,7 @@ public class MicronApi {
String paramStr = JsonUtil.toJsonStr(paramsMap);
log.info("调用MES接口 API001: url=" + url + ",body=" + paramStr + "");
EnLog.info("Call MES API001: url=" + url + ",body=" + paramStr);
MicronResult result = HttpHelper.postMicronJson(url, paramsMap);
// "serialNum": <SerialNum>,
......@@ -154,6 +156,7 @@ public class MicronApi {
String oldBarcode = barcode.getBarcode();
log.info("API001 ,barcode=" + barcode.getBarcode() + ",返回结果:partNumber=" + partNumber + ", serialNum=" + serialNumber + ", xrayReq=" + xrayReq + ", Qty=" + mamQty);
EnLog.info("API001, barcode=" + barcode.getBarcode() + ", result: partNumber=" + partNumber + ", serialNum=" + serialNumber + ", xrayReq=" + xrayReq + ", Qty=" + mamQty);
boolean needSave = false;
......@@ -175,6 +178,7 @@ public class MicronApi {
if (needSave) {
log.info("API001 更新条码[" + oldBarcode + "]的 partNumber=" + partNumber + ",serialNumber=" + serialNumber + ",mamQty=" + mamQty);
EnLog.info("API001 update barcode [" + oldBarcode + "] partNumber=" + partNumber + ",serialNumber=" + serialNumber + ",mamQty=" + mamQty);
barcodeManager.saveBarcode(barcode);
}
......@@ -206,9 +210,11 @@ public class MicronApi {
if (ObjectUtil.isNotEmpty(errmsg)) {
log.info("API001 ,验证失败,错误信息:" + error + ";" + errmsg);
EnLog.info("API001, validation failed, error info: " + error + ";" + errmsg);
throw new ApiException("smfcore.api.001.error", "API001: "+ error + ";" + errmsg);
} else {
log.info("API001 ,验证失败,获取数据失败:" + errmsg);
EnLog.info("API001, validation failed, failed to get data: " + errmsg);
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API001 : " + result.getResponseData()});
}
}
......@@ -218,6 +224,7 @@ public class MicronApi {
throw e;
} catch (Exception e) {
log.error(url + "出错", e);
EnLog.error(url + " error", e);
}
return null;
}
......@@ -294,6 +301,7 @@ public class MicronApi {
storagePos) {
if (pos.getBarcode() == null) {
log.info("API002 中,库位["+pos.getPosName()+"]barcode为空,不需要发送");
EnLog.info("In API002, storage pos [" + pos.getPosName() + "] barcode is empty, no need to send");
continue;
}
Map<String, Object> objMap = new HashMap<>();
......@@ -316,6 +324,7 @@ public class MicronApi {
String paramStr = JsonUtil.toJsonStr(paramsMap);
log.info("调用MES接口 API002: url=" + url + ",body=" + paramStr + "");
EnLog.info("Call MES API002: url=" + url + ",body=" + paramStr);
MicronResult result = HttpHelper.postMicronJson(url, paramsMap,2*60*1000);
// "error": <ErrCode>,
......@@ -344,12 +353,14 @@ public class MicronApi {
}
else if(ObjectUtil.isNotEmpty(errMsg)){
log.info("API002 ,接口通信失败:"+errMsg);
EnLog.info("API002, interface communication failed: " + errMsg);
return resultMap;
}
else {
String msg = MessageUtils.getText("smfcore.api.fail", new String[]{"API002 : " + result.getResponseData()}, MessageUtils.getDefaultLocal(), "{0} Failed to get data");
resultMap.put("msg", msg);
log.info("API002 ,接口通信失败:" + msg);
EnLog.info("API002, interface communication failed: " + msg);
return resultMap;
// log.info("API002 ,接口通信失败");
// throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API002 : "+result.getResponseData()});
......@@ -360,6 +371,7 @@ public class MicronApi {
catch (Exception e) {
//超时返回:API002 interface time out
log.error(url + "出错", e);
EnLog.error(url + " error", e);
resultMap.put("msg", "API002 interface time out");
return resultMap;
}
......@@ -399,6 +411,7 @@ public class MicronApi {
}
try {
log.info("调用MES接口 API004: url=" + url + "");
EnLog.info("Call MES API004: url=" + url);
MicronResult result = HttpHelper.getMicronJson(url);
String errMsg=getDErrorMsg(result);
if (result.isOk() ) {
......@@ -408,6 +421,7 @@ public class MicronApi {
// 这个需要改进一些,如果dispatchIds 长度为0,能不能显示 no line prep available for pcb pretask, depending on the mode,
// 如果是lineprep dispatch 和 mcl pretask 也reply 相对的message, 再说这个API transaction 没有fail,只是没有lineprep, 这个error fail to get data 有点误导了
log.info("API004 ,接口通信失败: no line prep available for pcb pretask, depending on the mode");
EnLog.info("API004, interface communication failed: no line prep available for pcb pretask, depending on the mode");
//throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API004"});
String msg = "No line prep available for pcb pretask ";
if(mode.equalsIgnoreCase("PCBPRETASK")){
......@@ -426,10 +440,12 @@ public class MicronApi {
return resultDis;
} else if(ObjectUtil.isNotEmpty(errMsg)){
log.info("API004 ,接口通信失败:"+errMsg);
EnLog.info("API004, interface communication failed: " + errMsg);
throw new ApiException( errMsg);
}else{
log.info("API004 ,接口通信失败");
EnLog.info("API004, interface communication failed");
//throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API004"});
String msg = "API004 : "+result.getResponseData()+" Failed to get data";
Object message = result.getResult("message", false);
......@@ -441,6 +457,7 @@ public class MicronApi {
} catch (Exception e) {
log.error(url + "出错", e);
EnLog.error(url + " error", e);
throw new ValidateException(e.getMessage(),e.getMessage());
}
//return null;
......
package com.neotel.smfcore.custom.micron1053.api;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.device.util.DataCache;
import lombok.extern.slf4j.Slf4j;
......@@ -288,9 +289,11 @@ public class MicronConfig {
if(ObjectUtil.isNotEmpty(dbAddr)){
//数据库地址不为空,使用数据库地址
log.info("CACHE_Micron_AppAddr 数据库配置不为空,使用数据库配置:[" + dbAddr+"] 替换配置文件配置:["+micronAddr+"]" );
EnLog.info("CACHE_Micron_AppAddr config exists in DB, use DB config: [" + dbAddr + "] override yml config: [" + micronAddr + "]");
micronAddr=dbAddr;
}else{
log.info("CACHE_Micron_AppAddr 数据库配置为空, 修改数据库配置=["+micronAddr+"]" );
EnLog.info("CACHE_Micron_AppAddr config missing in DB, update DB config to [" + micronAddr + "]");
dataCache.updateCache(Constants.CACHE_Micron_AppAddr,micronAddr);
}
......@@ -302,6 +305,7 @@ public class MicronConfig {
return;
}
log.info("手动更改:CACHE_Micron_AppAddr =[" + newAddr+"] 替换原来配置:["+micronAddr+"]" );
EnLog.info("Manually update CACHE_Micron_AppAddr to [" + newAddr + "], override previous config: [" + micronAddr + "]");
micronAddr=newAddr;
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.custom.micron1053.bean;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.JsonUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -173,6 +174,7 @@ public class MicronResult implements Serializable {
return errCode + ";" + errMsg + ";" + detail;
} catch (Exception exception) {
log.error("出错:" + exception);
EnLog.error("Error: " + exception, exception);
return errCode + ";" + errMsg + ";" + detail + ":" + exception.toString();
}
}
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron1053.controller;
import cn.hutool.core.util.ObjectUtil;
import com.mks.api.response.APIException;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.JsonUtil;
......@@ -173,6 +174,7 @@ public class MicronDeviceController {
List<Object> list = (List<Object>) param;
if(list.size()<=0){
log.info("updateMInventory: 未解析到有效数据,返回格式错误");
EnLog.info("updateMInventory: no valid data parsed, return format error");
return ResultBean.newErrorResult(99, "smfcore.device.formatError", "格式错误");
}
......@@ -220,9 +222,11 @@ public class MicronDeviceController {
if(pipeidu<80){
log.info("updateMInventory : 库存数据:[" + allUsedStoragePosMap.size() + "]条,上传数据:[" + mInventoryList.size() + "]条,匹配正确数据["+okCount+"]条,匹配度="+pipeidu+"%,匹配度过低,不处理数据" );
EnLog.info("updateMInventory: inventory [" + allUsedStoragePosMap.size() + "], upload [" + mInventoryList.size() + "], matched [" + okCount + "], matchRate=" + pipeidu + "%, match rate too low, ignore");
return ResultBean.newErrorResult(99, "smfcore.device.formatError", "格式错误");
}
log.info("updateMInventory : 库存数据:[" + allUsedStoragePosMap.size() + "]条,上传数据:[" + mInventoryList.size() + "]条,匹配正确数据["+okCount+"]条,匹配度="+pipeidu+"%");
EnLog.info("updateMInventory: inventory [" + allUsedStoragePosMap.size() + "], upload [" + mInventoryList.size() + "], matched [" + okCount + "], matchRate=" + pipeidu + "%");
for (MInventory obj : mInventoryList
) {
......@@ -250,15 +254,18 @@ public class MicronDeviceController {
Barcode barcode = barcodeManager.findByBarcode(obj.getCarrier());
if (barcode == null) {
log.info("updateMInventory : barcode[" + obj.getCarrier() + "]MPos[" + obj.getDepot() + "]未在库存中,未找到条码信息,跳过此数据");
EnLog.info("updateMInventory: barcode [" + obj.getCarrier() + "] MPos [" + obj.getDepot() + "] not in inventory, barcode not found, skip");
continue;
}
Storage SStorage = dataCache.getStorage(mCid);
if (inPos != null) {
log.info("updateMInventory : barcode[" + obj.getCarrier() + "]MPos[" + obj.getDepot() + "]在库位[" + inPos.getPosName() + "-" + inPos.getStorageId() + "-" + inStorage.getCid() + "]中," +
"清空此库位,重新入库到料仓[" + SStorage.getName() + "-" + SStorage.getCid() + "-" + SStorage.getId() + "]");
EnLog.info("updateMInventory: barcode [" + obj.getCarrier() + "] MPos [" + obj.getDepot() + "] in pos [" + inPos.getPosName() + "-" + inPos.getStorageId() + "-" + inStorage.getCid() + "], clear and put-in to storage [" + SStorage.getName() + "-" + SStorage.getCid() + "-" + SStorage.getId() + "]");
//不在一个库位中,需要 清空原来的库位,重新 入库。
log.info("updateMInventory: 清理库位[" + inPos.getPosName() + "]中的库存:" + barcode);
EnLog.info("updateMInventory: clear inventory in pos [" + inPos.getPosName() + "]: " + barcode);
taskService.addTaskToFinished(inPos, null, "MInventory" + "-clear");
}
......@@ -267,10 +274,12 @@ public class MicronDeviceController {
Collection<String> excludePos = taskService.excludePosIds();
StoragePos newPos = storagePosManager.getEmptyPosByStorage(SStorage, barcode, excludePos);
log.info("updateMInventory : barcode[" + obj.getCarrier() + "]MPos[" + obj.getDepot() + "] 自动增加库存:[" + newPos.getPosName() + "]料仓[" + SStorage.getName() + "-" + SStorage.getCid() + "-" + SStorage.getId() + "]]");
EnLog.info("updateMInventory: barcode [" + obj.getCarrier() + "] MPos [" + obj.getDepot() + "] auto add inventory: [" + newPos.getPosName() + "] storage [" + SStorage.getName() + "-" + SStorage.getCid() + "-" + SStorage.getId() + "]");
taskService.addTaskToFinished(newPos, barcode, "MInventory" + "-add");
} catch (Exception ex) {
log.error("updateMInventory : barcode[" + obj.getCarrier() + "]MPos[" + obj.getDepot() + "] 自动增加库存出错,跳过此数据,错误信息:" + ex.toString());
EnLog.error("updateMInventory: barcode [" + obj.getCarrier() + "] MPos [" + obj.getDepot() + "] auto add inventory error, skip. Error: " + ex.toString());
continue;
}
}
......@@ -288,10 +297,12 @@ public class MicronDeviceController {
StoragePos inPos = storagePosManager.getByBarcode(barcode);
if (inPos == null) {
log.info("updateMInventory: barcode[" + barcode + "]在缓存中在库位[" + pos.getPosName() + "-" + pos.getStorageId() + "]中,数据库中未找到inPos,跳过此数据");
EnLog.info("updateMInventory: barcode [" + barcode + "] in cache pos [" + pos.getPosName() + "-" + pos.getStorageId() + "], inPos not found in DB, skip");
continue;
}
//需要清空库位信息,自动出库
log.info("updateMInventory: 清理库位[" + pos.getPosName() + "]中的库存:" + barcode);
EnLog.info("updateMInventory: clear inventory in pos [" + pos.getPosName() + "]: " + barcode);
taskService.addTaskToFinished(pos, null, "MInventory" + "-clear");
}
} else {
......@@ -404,6 +415,7 @@ public class MicronDeviceController {
public ResultBean rfidPutInEnd(HttpServletRequest request) {
String rfid = request.getParameter("rfid");
log.info("rfidPutInEnd, rfid=" + rfid);
EnLog.info("rfidPutInEnd, rfid=" + rfid);
loadingUtil.RfidPutInEnd(rfid);
return ResultBean.newOkResult("");
}
......@@ -415,6 +427,7 @@ public class MicronDeviceController {
public ResultBean rfidOutEnd(HttpServletRequest request) {
String rfid = request.getParameter("rfid");
log.info("rfidOutEnd, rfid=" + rfid);
EnLog.info("rfidOutEnd, rfid=" + rfid);
// loadingUtil.RfidPutInEnd(rfid);
return ResultBean.newOkResult("");
}
......
......@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.init.DataInitManager;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.device.bean.StatusBean;
......@@ -126,6 +127,7 @@ public class MicronReportController {
Locale locale=servletRequest.getLocale();
List<DeviceUtilizationDto> dtos = getUtilizationList(locale);
log.info("开始导出 utilization ");
EnLog.info("Start exporting utilization ");
FileUtil.downloadExcel(null, null, response, new IExcelDownLoad() {
@Override
......@@ -160,6 +162,7 @@ public class MicronReportController {
}
});
log.info("utilization 导出完成");
EnLog.info("utilization export completed");
}
@ApiOperation("ErrorLog:错误数据列表")
......@@ -185,6 +188,7 @@ public class MicronReportController {
public void errorLogDownload( MessageCriteria criteria, Pageable pageable,HttpServletRequest servletRequest,HttpServletResponse response) throws IOException {
Locale locale=servletRequest.getLocale();
log.info("开始导出 ErrorLog ");
EnLog.info("Start exporting ErrorLog ");
criteria.setType("ERROR");
Query query = QueryHelp.getQuery(criteria);
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
......@@ -216,6 +220,7 @@ public class MicronReportController {
}
});
log.info("ErrorLog 导出完成");
EnLog.info("ErrorLog export completed");
}
@ApiOperation("eventLog:事件列表")
......@@ -241,6 +246,7 @@ public class MicronReportController {
public void eventLogDownload( MessageCriteria criteria, Pageable pageable,HttpServletRequest servletRequest,HttpServletResponse response) throws IOException {
Locale locale=servletRequest.getLocale();
log.info("开始导出 eventLog ");
EnLog.info("Start exporting eventLog ");
criteria.setType("INFO");
Query query = QueryHelp.getQuery(criteria);
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
......@@ -272,6 +278,7 @@ public class MicronReportController {
}
});
log.info("eventLog 导出完成");
EnLog.info("eventLog export completed");
}
public List<String> getList() {
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.custom.micron1053.controller;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
......@@ -484,6 +485,7 @@ public class MicronStatusController {
} catch (Exception ex) {
log.error("alarmMsgCount 出错:" + ex.toString());
EnLog.error("alarmMsgCount error: " + ex.toString());
}
return ResultBean.newOkResult(count);
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron1053.loading;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
......@@ -217,6 +218,7 @@ public class LoadingController {
}
}catch (Exception exception) {
log.error("error :" + exception.toString());
EnLog.error("error: " + exception.toString());
}
}
}
......@@ -278,6 +280,7 @@ public class LoadingController {
log.info("submit: mode=" + mode + ",shelfNum= " + shelfNum + ",mbrId=" + mbrId + ",reqId=" + reqId + ",deliveryNote=" + deliveryNote + ", purchaseOrder=" + purchaseOrder);
EnLog.info("submit: mode=" + mode + ",shelfNum= " + shelfNum + ",mbrId=" + mbrId + ",reqId=" + reqId + ",deliveryNote=" + deliveryNote + ", purchaseOrder=" + purchaseOrder);
InList inList = loadingUtil.getInlist();
if (inList == null) {
......@@ -295,8 +298,10 @@ public class LoadingController {
loadingInfo.inlistName = mode + "-" + operId + "-" + DateUtil.toDateString(loadingInfo.startTime);
dataCache.updateCache(Constants.CACHE_LOADING, loadingInfo);
log.info("submit: mode=" + mode + ",获取到 OperationId=" + operId);
EnLog.info("submit: mode=" + mode + ", got OperationId=" + operId);
} else {
log.info("submit: mode=" + mode + ",已有 OperationId=" + loadingInfo.getOperationId());
EnLog.info("submit: mode=" + mode + ", existing OperationId=" + loadingInfo.getOperationId());
}
......@@ -324,6 +329,7 @@ public class LoadingController {
inListCache.addInListToMap(inList);
log.info("submit:Create Inlist OK. " + inList.getName() + ", mode=" + mode + ",shelfNum= " + shelfNum + ",mbrId=" + mbrId + ",reqId=" + reqId + ",deliveryNote=" + deliveryNote + ", purchaseOrder=" + purchaseOrder);
EnLog.info("submit:Create Inlist OK. " + inList.getName() + ", mode=" + mode + ",shelfNum= " + shelfNum + ",mbrId=" + mbrId + ",reqId=" + reqId + ",deliveryNote=" + deliveryNote + ", purchaseOrder=" + purchaseOrder);
return ResultBean.newOkResult(getList(inList));
} else {
return ResultBean.newOkResult(getList(inList));
......@@ -345,6 +351,7 @@ public class LoadingController {
// int num = Integer.valueOf(numStr);
//
// log.info("returnMaterial: num= " + num);
// EnLog.info("returnMaterial: num= " + num);
//// String[] rfidArray=rfids.split(",");
// InList inList = loadingUtil.getInlist();
// String mode=APIMODE.MATRET;
......@@ -403,8 +410,8 @@ public class LoadingController {
return ResultBean.newErrorResult(-1, "smfcore.micron.modeError", inList.getMode() + " Loading 未完成", new String[]{inList.getMode()});
}
//重试,重发指令
log.info("重试:" + inList.getMode() + "," + inList.getOperationId() + " " + inList.getName());
EnLog.info("Retry: " + inList.getMode() + "," + inList.getOperationId() + " " + inList.getName());
ResultBean returnResult = loadingUtil.Retry(request.getLocale());
returnResult.setData(getList(inList));
......@@ -435,6 +442,7 @@ public class LoadingController {
}
if (OP.PUT_IN == task.getType() && task.getPosName().equals(item.getPosName())) {
log.info("入库单 " + inList.getName() + ", 物料" + item.getPosName() + "还在入库中,无法Abort");
EnLog.info("Inbound list " + inList.getName() + ", material " + item.getPosName() + " is still processing, cannot Abort");
return ResultBean.newErrorResult(-1, "smfcore.micron.inlistCannotAbort", "操作失败:还有入库任务未完成");
}
......@@ -443,6 +451,7 @@ public class LoadingController {
}
log.info("终止 入库:"+inList.getMode()+","+inList.getOperationId()+" " +inList.getName()+",更改action=ABORT");
EnLog.info("Abort Inbound: " + inList.getMode() + "," + inList.getOperationId() + " " + inList.getName() + ", change action=ABORT");
MicronApi.ActionUpdate(inList.getOperationId(),MicronApi.ABORT );
loadingUtil.AbortSendAPI002();
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.custom.micron1053.loading.util;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -98,6 +99,7 @@ public class LoadingUtil {
String mtype = MicronDataCache.GetReelType(barcode.getPlateSize(), barcode.getHeight());
log.info("为入库单[" + inList.getName() + "]增加一条入库信息:barcode[" + barcode.getBarcode() + "],mtype[" + mtype + "],pn[" + barcode.getPartNumber() + "],rfid[" + rfid + "],posName[" + posName + "],s[" + state + "]");
EnLog.info("Add put-in item for in-list [" + inList.getName() + "]: barcode[" + barcode.getBarcode() + "], mtype[" + mtype + "], pn[" + barcode.getPartNumber() + "], rfid[" + rfid + "], posName[" + posName + "], state[" + state + "]");
InListItem item = InListItem.newMItem(inList.getName(), barcode, rfid, posName, state, mtype);
if (inList.getEndRfidList() != null && inList.getEndRfidList().contains(rfid)) {
......@@ -130,6 +132,7 @@ public class LoadingUtil {
//如果入库单已手动结束,不再接收新任务
if(inList.isManualFinish()){
log.info("AddInListItem 当前入库[" + inList.getName() + "]已手动结束,不添加新物料:"+barcode.getBarcode());
EnLog.info("AddInListItem current in-list [" + inList.getName() + "] manually finished, skip adding new material: " + barcode.getBarcode());
return null;
}
inList.addRfid(rfid);
......@@ -138,6 +141,7 @@ public class LoadingUtil {
String mtype = MicronDataCache.GetReelType(barcode.getPlateSize(), barcode.getHeight());
log.info("为入库单[" + inList.getName() + "]增加一条入库信息:barcode[" + barcode.getBarcode() + "],mtype[" + mtype + "],pn[" + barcode.getPartNumber() + "],rfid[" + rfid + "],posName[" + posName + "],s[" + state + "]["+ngMsg+"]");
EnLog.info("Add put-in item for in-list [" + inList.getName() + "]: barcode[" + barcode.getBarcode() + "], mtype[" + mtype + "], pn[" + barcode.getPartNumber() + "], rfid[" + rfid + "], posName[" + posName + "], state[" + state + "][" + ngMsg + "]");
InListItem item = InListItem.newMItem(inList.getName(), barcode, rfid, posName, state, mtype);
if (inList.getEndRfidList() != null && inList.getEndRfidList().contains(rfid)) {
......@@ -199,6 +203,7 @@ public class LoadingUtil {
item.setNgMsg(reelInfo.getNgMsg());
item = inListItemManager.save(item);
log.info(" 更新入库单[" + inList.getName() + "]:条码 [" + item.getRi() + "]库位[" + item.getPosName() + "]的 ngmsg=" + reelInfo.getNgMsg());
EnLog.info("Update in-list [" + inList.getName() + "]: barcode[" + item.getRi() + "] pos[" + item.getPosName() + "] ngMsg=" + reelInfo.getNgMsg());
}
}
inListItems.add(item);
......@@ -241,6 +246,7 @@ public class LoadingUtil {
}
} catch (Exception exception) {
log.error("IsInlistReel , barcode=" + barcode + ", 出错:" + exception.toString());
EnLog.error("IsInlistReel, barcode=" + barcode + ", error: " + exception.toString(), exception);
}
return false;
}
......@@ -272,6 +278,7 @@ public class LoadingUtil {
if(item.isEnd()){
log.error(" 库单[" + inList.getName() + "]:条码 [" + item.getRi() + "]库位[" + item.getPosName() + "]当前状态="+ item.getState()+",不更改状态=" + s);
EnLog.error("In-list [" + inList.getName() + "]: barcode[" + item.getRi() + "] pos[" + item.getPosName() + "] currentState=" + item.getState() + ", do not change state to " + s);
}else{
if (ObjectUtil.isNotEmpty(posName)) {
......@@ -287,6 +294,7 @@ public class LoadingUtil {
item = inListItemManager.save(item);
result = item;
log.info(" 更新入库单[" + inList.getName() + "]:条码 [" + item.getRi() + "]库位[" + item.getPosName() + "]的状态=" + s+",ngmsg="+ngMsg);
EnLog.info("Update in-list [" + inList.getName() + "]: barcode[" + item.getRi() + "] pos[" + item.getPosName() + "] state=" + s + ", ngMsg=" + ngMsg);
}
}
inListItems.add(item);
......@@ -357,6 +365,7 @@ public class LoadingUtil {
}
if (posList.size() > 0) {
log.info("入库单["+inList.getName()+"],rfid [" + rfid + "],所有入库任务已完成,开始调用API002");
EnLog.info("In-list [" + inList.getName() + "], rfid[" + rfid + "], all put-in tasks finished, start calling API002");
PushToMes(rfid,inList, posList);
}
}
......@@ -382,6 +391,7 @@ public class LoadingUtil {
endList.add(rfid);
inList.setEndRfidList(endList);
log.info("入库单[" + inList.getName() + "],rfid [" + rfid + "],料串入库结束,已结束的rfid中增加:"+rfid);
EnLog.info("In-list [" + inList.getName() + "], rfid[" + rfid + "], rfid put-in ended, add to endRfidList: " + rfid);
}
List<StoragePos> posList = new ArrayList<>();
......@@ -391,6 +401,7 @@ public class LoadingUtil {
List<InListItem> inListItems = new ArrayList<>();
log.info("入库单[" + inList.getName() + "],rfid [" + rfid + "],料串入库结束,更改 rfidEnd=true");
EnLog.info("In-list [" + inList.getName() + "], rfid[" + rfid + "], rfid put-in ended, set rfidEnd=true");
//查找这个rfid的所有任务,进行推送
for (InListItem item : inList.getInListItems()) {
if (item.getRfid().equals(rfid)) {
......@@ -415,10 +426,12 @@ public class LoadingUtil {
if (hasNoEnd) {
log.info("RfidPutInEnd 入库单[" + inList.getName() + "],rfid [" + rfid + "],还有未入库完成的任务,暂时不调用API002");
EnLog.info("RfidPutInEnd in-list [" + inList.getName() + "], rfid[" + rfid + "], has unfinished put-in tasks, skip calling API002 for now");
return true;
}
if (posList.size() > 0) {
log.info("RfidPutInEnd 入库单[" + inList.getName() + "],rfid [" + rfid + "],所有入库任务已完成,开始调用API002");
EnLog.info("RfidPutInEnd in-list [" + inList.getName() + "], rfid[" + rfid + "], all put-in tasks finished, start calling API002");
PushToMes(rfid, inList, posList);
}
......@@ -435,6 +448,7 @@ public class LoadingUtil {
StoragePos pos = storagePosManager.getByPosName(item.getPosName());
if(pos!=null&&pos.getBarcode()!=null&&pos.getBarcode().getBarcode().equals(item.getRi())) {
log.info("入库单[" + inList.getName() + "],rfid [" + rfid + "],posName[" + item.getPosName() + "],ri[" + item.getRi() + "],任务取消但是入库完成,也需要发送API002");
EnLog.info("In-list [" + inList.getName() + "], rfid[" + rfid + "], posName[" + item.getPosName() + "], ri[" + item.getRi() + "], task canceled but put-in finished, still need to send API002");
posList.add(pos);
}
}
......@@ -479,6 +493,7 @@ public class LoadingUtil {
msg = "API002:" + msg;
}
log.info("更新 入库单[" + inList.getName() + "] rfid[" + item.getRfid() + "] :条码 [" + item.getRi() + "]库位[" + item.getPosName() + "]的状态=" + newS+",错误信息="+msg);
EnLog.info("Update in-list [" + inList.getName() + "] rfid[" + item.getRfid() + "]: barcode[" + item.getRi() + "] pos[" + item.getPosName() + "] state=" + newS + ", errMsg=" + msg);
if (item.getState() != newS || item.getNgMsg()!=msg) {
item.setNgMsg(msg);
item.setState(newS);
......@@ -494,9 +509,11 @@ public class LoadingUtil {
inList.setInListItems(inListItems);
if (isEnd) {
log.info("更新 入库单[" + inList.getName() + "] manualFinish=["+manualFinish+"] 状态改为 OK");
EnLog.info("Update in-list [" + inList.getName() + "] manualFinish=[" + manualFinish + "] status set to OK");
inList.setStatus(INLIST_STATUS.OK);
} else {
log.info("更新 入库单[" + inList.getName() + "] manualFinish=["+manualFinish+"] 状态改为 ABNORMAL");
EnLog.info("Update in-list [" + inList.getName() + "] manualFinish=[" + manualFinish + "] status set to ABNORMAL");
inList.setStatus(INLIST_STATUS.ABNORMAL);
}
inList = inListManager.save(inList);
......@@ -553,6 +570,7 @@ public class LoadingUtil {
}
}
log.info(inList.getName() + " retry , 总共retry数量=" + aCount + ", retry 后仍Fail的数量=" + lCount);
EnLog.info(inList.getName() + " retry, total retry count=" + aCount + ", still fail count after retry=" + lCount);
if (aCount == lCount) {
//全部失败
bean = ResultBean.newErrorResult(9, "smfcore.loading.retry.msgfail", "Retry完成,{0}/{1}Retry失败", new String[]{aCount + "", aCount + ""});
......@@ -630,6 +648,7 @@ public class LoadingUtil {
inList = inListManager.save(inList);
inListCache.addInListToMap(inList);
log.info("finish 入库单[" + inList.getName() + "] 手动结束,当前无任务,设置 manualFinish=true, 状态改为 OK");
EnLog.info("Finish in-list [" + inList.getName() + "]: manually end, no tasks, set manualFinish=true, status set to OK");
return inList;
}
......@@ -659,6 +678,7 @@ public class LoadingUtil {
inList = inListManager.save(inList);
inListCache.addInListToMap(inList);
log.info("finish 入库单[" + inList.getName() + "] 手动结束,设置 manualFinish=true, 状态改为 OK");
EnLog.info("Finish in-list [" + inList.getName() + "]: manually end, set manualFinish=true, status set to OK");
return inList;
}
......
......@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
......@@ -341,11 +342,13 @@ public class MicronDispatchController {
TaskDto dto = getTaskDtoByMode(mode);
if (dto == null) {
log.info("outSideSubmit 未找到mode=" + mode + " 的TaskDto");
EnLog.info("outSideSubmit mode=" + mode + " TaskDto not found");
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
//判断是否生成,未关闭的工单
if (ObjectUtil.isEmpty(dto.getOperationId()) ||(NeedInputLineId(dto.getMode()) && ObjectUtil.isEmpty(dto.getLineId()))) {
log.info("outSideSubmit 操作失败,taskDto数据不完整");
EnLog.info("outSideSubmit operation failed, taskDto data incomplete");
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
String csv = "csv";
......@@ -389,6 +392,7 @@ public class MicronDispatchController {
if (liteOrderCache.dispatchOrderIsCheckOk(order)) {
log.info(order.getOrderNo() + "工单已备料完成,直接出料");
EnLog.info(order.getOrderNo() + " order preparation completed, direct dispatch");
//直接开始出库
// liteOrderCache.dispatchCheckOut(order, false, false,new ArrayList<>());
dispatchCheckOut(taskDto, order, false, false,new ArrayList<>());
......@@ -401,6 +405,7 @@ public class MicronDispatchController {
taskDto = UpdateTaskDto(taskDto, 1);
msg = liteOrderCache.dispatchCheckOut(order, isRetry, isOver, selRiList);
log.info("dispatchCheckOut 工单:[" + order.getOrderNo() + "][" + taskDto.getMode() + "]执行结果:" + msg);
EnLog.info("dispatchCheckOut order: [" + order.getOrderNo() + "][" + taskDto.getMode() + "] execution result: " + msg);
} catch (Exception e) {
throw e;
} finally {
......@@ -537,12 +542,14 @@ public class MicronDispatchController {
liteOrder.setMode(mode);
liteOrder.setSource(ShowDetialBtn);
log.info("pnSubmit,mode=[" + mode + "],[" + taskDto.getOperationId() + "], 新增加订单:" + liteOrder.getOrderNo() + ",共" + items.size() + "条工单详情");
EnLog.info("pnSubmit,mode=[" + mode + "],[" + taskDto.getOperationId() + "], New order added:" + liteOrder.getOrderNo() + ", total " + items.size() + " order details");
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
return NewOrderProcess(taskDto,mode, taskDto.getLineId());
} catch (Exception exception) {
log.error(exception.toString());
EnLog.error(exception.toString(), exception);
return ResultBean.newErrorResult(-1, exception.toString(), exception.toString());
}
}
......@@ -705,6 +712,7 @@ public class MicronDispatchController {
reelItem.setStatus(OrderItemStatus.CheckOk);
log.info("工单【" + order.getOrderNo() + "】PN [" + item.getPn() + "] RI [" + reelItem.getRi() + "] API009 验证成功,更改状态为 CheckOk ,锁定库位【" + pos.getPosName() + "】");
EnLog.info("Order [" + order.getOrderNo() + "] PN [" + item.getPn() + "] RI [" + reelItem.getRi() + "] API009 verification successful, change status to CheckOk, lock storage position [" + pos.getPosName() + "]");
//锁定物料
pos.getBarcode().setLockId(order.getOrderNo());
......@@ -722,6 +730,7 @@ public class MicronDispatchController {
reelItem.setExecutFailReason(str);
reelItem.setStatus(OrderItemStatus.Reserved);
log.info("工单【" + order.getOrderNo() + "】PN [" + item.getPn() + "] RI [" + reelItem.getRi() + "] API009 验证失败,更改状态为 Reserved");
EnLog.info("Order [" + order.getOrderNo() + "] PN [" + item.getPn() + "] RI [" + reelItem.getRi() + "] API009 verification failed, change status to Reserved");
} else {
String str = s.getDescription();
if (ObjectUtil.isNotEmpty(s.getMaterialStatus())) {
......@@ -730,6 +739,7 @@ public class MicronDispatchController {
reelItem.setExecutFailReason(str);
reelItem.setStatus(OrderItemStatus.CheckFail);
log.info("工单【" + order.getOrderNo() + "】PN [" + item.getPn() + "] RI [" + reelItem.getRi() + "] API009 验证失败,更改状态为 CheckFail");
EnLog.info("Order [" + order.getOrderNo() + "] PN [" + item.getPn() + "] RI [" + reelItem.getRi() + "] API009 verification failed, change status to CheckFail");
}
selectReelItems.add(reelItem);
......@@ -744,6 +754,7 @@ public class MicronDispatchController {
log.info(order.getOrderNo() + "已勾选物料完成,直接出料");
EnLog.info(order.getOrderNo() + " material selection completed, direct dispatch");
//直接开始出库
// liteOrderCache.dispatchCheckOut(order, false, isOver,selectRis);
dispatchCheckOut(taskDto,order, false, isOver,selectRis);
......@@ -756,6 +767,7 @@ public class MicronDispatchController {
} catch (Exception exception) {
log.error(exception.toString());
EnLog.error(exception.toString(), exception);
return ResultBean.newErrorResult(-1, exception.toString(), exception.toString());
}
}
......@@ -773,6 +785,7 @@ public class MicronDispatchController {
isOver = true;
}
log.info(" checkOut :mode=" + mode + ",开始确认出库, isOver=" + isOver);
EnLog.info(" checkOut :mode=" + mode + ", start confirm checkout, isOver=" + isOver);
//判断有没有生成任务
LiteOrder order = getOrderByMode(mode);
......@@ -803,6 +816,7 @@ public class MicronDispatchController {
} catch (Exception exception) {
log.error(exception.toString());
EnLog.error(exception.toString(), exception);
return ResultBean.newErrorResult(-1, exception.toString(), exception.toString());
}
}
......@@ -819,6 +833,7 @@ public class MicronDispatchController {
isOver = true;
}
log.info(" retry :mode=" + mode + ",重新出库, isOver=" + isOver);
EnLog.info(" retry :mode=" + mode + ", re-checkout, isOver=" + isOver);
//判断有没有生成任务
LiteOrder order = getOrderByMode(mode);
if (order == null) {
......@@ -861,7 +876,7 @@ public class MicronDispatchController {
List<DataLog> dataLogList = dataLogManager.findByQuery(new
Query(
Criteria.where("subSourceId").is(orderItem.getId())).
Criteria.where("subSourceId").is(orderItem.getId())).
addCriteria(Criteria.where("status").is(OP_STATUS.FINISHED.name())).
addCriteria(Criteria.where("barcode").is(sItem.getRi())));
......@@ -875,9 +890,11 @@ public class MicronDispatchController {
if (needSendList.size() > 0) {
Map<String, String> resultM = MicronApi.Api007(order.getOperationId(), needSendList.get(0).getLocInfo(), needSendList);
log.info(" abort mode [" + order.getMode() + "] 共" + needSendList.size() + " 已出库完成,调用API007 ,工单已经要关闭,不再更新工单状态");
EnLog.info(" abort mode [" + order.getMode() + "] total " + needSendList.size() + " checkout completed, call API007, order about to close, no longer update order status");
}
} catch (Exception ex) {
log.error("关闭工单前调用API007出错:" + ex.toString());
EnLog.error("Error calling API007 before closing order: " + ex.toString(), ex);
}
order.setStatus(LITEORDER_STATUS.CLOSED);
......@@ -886,11 +903,13 @@ public class MicronDispatchController {
liteOrderCache.addOrderToMap(order);
log.info(" mode=" + order.getMode() + "工单关闭");
EnLog.info(" mode=" + order.getMode() + " order closed");
if (ObjectUtil.isNotEmpty(order.getMode())) {
String key = Constants.CACHE_DISPATCH + order.getMode();
log.info("abort mode=" + order.getMode() + " 清空 key=" + key + " 的cache,更改action=ABORT");
EnLog.info("abort mode=" + order.getMode() + " clear key=" + key + " cache, change action=ABORT");
dataCache.updateCache(key, "");
MicronApi.ActionUpdate(order.getOperationId(), MicronApi.ABORT);
......@@ -906,6 +925,7 @@ public class MicronDispatchController {
if(params==null){
log.error("abort 参数不完整,操作失败");
EnLog.error("abort parameters incomplete, operation failed");
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
String mode = params.get("mode").toString();
......@@ -933,6 +953,7 @@ public class MicronDispatchController {
if (task.isExecuting()||task.isWait()) {
log.info("abort 终止出库,mode=" + mode + ",还有正在执行,状态="+task.getStatus()+"的任务:barcode=" + task.getBarcode() + ",posName=" + task.getPosName()+",尝试自动取消任务");
EnLog.info("abort terminate checkout, mode=" + mode + ", there are still executing tasks, status=" + task.getStatus() + ": barcode=" + task.getBarcode() + ", posName=" + task.getPosName() + ", try to auto cancel task");
taskService.cancelTask(task.getId());
// return ResultBean.newErrorResult(-1, "smfcore.order.close.taskNotEnd", "操作失败,工单还有未完成的任务");
}
......@@ -951,6 +972,7 @@ public class MicronDispatchController {
if (task.isExecuting()||task.isWait()) {
log.info("abort 终止出库,mode=" + mode + ",还有正在执行的任务:barcode=" + task.getBarcode() + ",posName=" + task.getPosName());
EnLog.info("abort terminate checkout, mode=" + mode + ", there are still executing tasks: barcode=" + task.getBarcode() + ", posName=" + task.getPosName());
// taskService.cancelTask(task.getId());
return ResultBean.newErrorResult(-1, "smfcore.order.close.taskNotEnd", "操作失败,工单还有未完成的任务");
}
......@@ -961,11 +983,13 @@ public class MicronDispatchController {
String msg = CloseOrder(order);
log.info("abort 终止出库,mode=" + mode + ",取消正在执行的出库任务:关闭工单=" + order.getOrderNo() + ",结果=" + msg);
EnLog.info("abort terminate checkout, mode=" + mode + ", cancel executing checkout task: close order=" + order.getOrderNo() + ", result=" + msg);
} else {
String key = Constants.CACHE_DISPATCH + mode;
log.info("abort mode=" + mode + " 清空 key=" + key + " 的cache,更改action=ABORT");
EnLog.info("abort mode=" + mode + " clear key=" + key + " cache, change action=ABORT");
MicronApi.ActionUpdate(taskDto.getOperationId(), MicronApi.ABORT);
dataCache.updateCache(key, "");
}
......@@ -1026,6 +1050,7 @@ public class MicronDispatchController {
}
} catch (Exception exception) {
log.error("error :" + exception.toString());
EnLog.error("error :" + exception.toString(), exception);
}
}
}
......@@ -1107,6 +1132,7 @@ public class MicronDispatchController {
}
} catch (Exception ex) {
log.error("error:" + ex.toString());
EnLog.error("error:" + ex.toString(), ex);
}
orderItemDto.setInventoryQty(inventoryQty);
orderItemDto.setInventoryReelCount(inventoryReelCount);
......@@ -1116,4 +1142,4 @@ public class MicronDispatchController {
dto.setCurrTaskCount(liteOrderCache.getOrderTaskCount(liteOrder.getOrderNo()));
return dto;
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron1053.task;
import cn.hutool.core.util.ObjectUtil;
import com.mks.api.response.APIException;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
......@@ -143,6 +144,7 @@ public class MicronPreTaskController {
dataCache.updateCache(key, dto);
log.info("mode=" + mode + ",获取到数据:operationId=" + operationId + ",保存数据到cache " + key);
EnLog.info("mode=" + mode + ", data acquired: operationId=" + operationId + ", save data to cache " + key);
} else {
return ResultBean.newErrorResult(-1, "smfcore.api.fail", "{0} Failed to get data", new String[]{"API004"});
}
......@@ -223,6 +225,7 @@ public class MicronPreTaskController {
}else{
item.setNeedNum(0);
log.info("未找到 serialNum="+material.getSerialNum()+",设置amount=0");
EnLog.info("serialNum=" + material.getSerialNum() + " not found, set amount=0");
}
itemList.add(item);
}
......@@ -252,12 +255,15 @@ public class MicronPreTaskController {
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
log.info("submit 勾选后,生成工单:[" + orderNo + "][" + mode + "]");
EnLog.info("submit selected, generate order: [" + orderNo + "][" + mode + "]");
//开始查询是否可以出库
try{
UpdateTaskDto(dto,1);
String msg = liteOrderCache.preTaskCheckOut(liteOrder, operationId, materialList, false);
log.info("submit 工单:[" + orderNo + "][" + mode + "]执行结果:" + msg);
EnLog.info("submit order: [" + orderNo + "][" + mode + "] execution result: " + msg);
}catch (Exception e){
throw e;
}finally {
......@@ -303,6 +309,7 @@ public class MicronPreTaskController {
String mode = params.get("mode").toString();
log.info(" retry :mode=" + mode + ",重新出库");
EnLog.info("retry :mode=" + mode + ", re-dispatch");
TaskDto dto = getTaskDtoByMode(mode);
if (dto == null) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
......@@ -341,6 +348,7 @@ public class MicronPreTaskController {
// if (dataLogList != null && !dataLogList.isEmpty()) {
//
// log.info("retry: [" + order.getOrderNo() + "] [" + orderItem.getRi() + "] 重发API007 ");
// EnLog.info("retry: [" + order.getOrderNo() + "] [" + orderItem.getRi() + "] Resend API007");
// String msg = MicronApi.Api007(order.getOrderNo(), order.getId(), dataLogList);
// if (ObjectUtil.isEmpty(msg)) {
// orderItem.setStatus(OrderItemStatus.notify_success);
......@@ -412,16 +420,19 @@ public class MicronPreTaskController {
if (dataLog.isExecuting()) {
taskService.cancelTask(dataLog.getId());
log.info("abort 终止出库,mode=" + mode + ",取消正在执行的出库任务:barcode=" + dataLog.getBarcode() + ",posName=" + dataLog.getPosName());
EnLog.info("abort terminate dispatch, mode=" + mode + ", cancel executing dispatch task: barcode=" + dataLog.getBarcode() + ",posName=" + dataLog.getPosName());
}
}
orderItem.setStatus(OrderItemStatus.cancel);
orderItem = liteOrderItemManager.save(orderItem);
newList.add(orderItem);
log.info(" abort :barcode=[" + orderItem.getPn() + "] 取消出库任务");
EnLog.info("abort :barcode=[" + orderItem.getPn() + "] Cancel dispatch task");
}
}
log.info("abort 终止出库,mode=" + mode + ",取消正在执行的出库任务:关闭工单=" + order.getOrderNo());
EnLog.info("abort terminate dispatch, mode=" + mode + ", cancel executing dispatch task: close order=" + order.getOrderNo());
CloseOrder(order);
return ResultBean.newOkResult("");
......@@ -469,6 +480,7 @@ public class MicronPreTaskController {
//清空配置
String key = Constants.CACHE_DISPATCH + order.getMode();
log.info(" mode=" + order.getMode() + "工单已关闭,清空 key=" + key + " 的cache,更改action=ABORT");
EnLog.info("mode=" + order.getMode() + " order closed, clear cache for key=" + key + ", update action=ABORT");
dataCache.updateCache(key, "");
MicronApi.ActionUpdate(order.getOperationId(), MicronApi.ABORT);
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -66,6 +67,7 @@ public class Micron20031Api {
dataMap.put("grant_type","client_credentials");
String resultStr = HttpHelper.postFormParam(url, dataMap);
log.info("get token from MES 返回:" + resultStr);
EnLog.info("Get token from MES returns: " + resultStr);
Map<String, Object> resultMap = JsonUtil.toMap(resultStr);
Object username1 = resultMap.get("Username");
......@@ -79,6 +81,7 @@ public class Micron20031Api {
} catch (ApiException e) {
log.error("checkUserRights Error", e);
EnLog.error("checkUserRights Error", e);
}
return "";
}
......@@ -100,8 +103,10 @@ public class Micron20031Api {
dataMap.put("Username",username);
dataMap.put("MaterialType","SOLDER_PASTE");
log.info("调用MES接口 checkUserRights,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API checkUserRights, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJson(checkUserRightsUrl, dataMap);
log.info("调用MES接口 checkUserRights 返回:" + resultStr);
EnLog.info("Call MES API checkUserRights returns: " + resultStr);
getResult(resultStr,"");
}
......@@ -137,8 +142,10 @@ public class Micron20031Api {
paramList.add(dataMap);
}
log.info("调用MES接口 checkStockAvailable,参数:"+JsonUtil.toJsonStr(paramList));
EnLog.info("Call MES API checkStockAvailable, params: " + JsonUtil.toJsonStr(paramList));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, paramList, auth);
log.info("调用MES接口 checkStockAvailable 返回:" + resultStr);
EnLog.info("Call MES API checkStockAvailable returns: " + resultStr);
List<MatOrderBean> orderBeanList = JsonUtil.toList(resultStr,MatOrderBean.class);
for (MatOrderBean matOrderBean : orderBeanList) {
Integer qty = pnMap.get(matOrderBean.getMicronPN());
......@@ -171,8 +178,10 @@ public class Micron20031Api {
dataMap.put("MaterialType",MATERIAL_TYPE);
log.info("调用MES接口 triggerMatReqOrder,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API triggerMatReqOrder, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 triggerMatReqOrder 返回:" + resultStr);
EnLog.info("Call MES API triggerMatReqOrder returns: " + resultStr);
MatOrderBean resultOrderBean = JsonUtil.toObj(resultStr,MatOrderBean.class);
return resultOrderBean;
......@@ -197,8 +206,10 @@ public class Micron20031Api {
dataMap.put("MaterialType", MATERIAL_TYPE);
log.info("调用MES接口 getMatReqDetail,参数:" + JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API getMatReqDetail, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(getMatReqDetailUrl, dataMap, auth);
log.info("调用MES接口 getMatReqDetail 返回:" + resultStr);
EnLog.info("Call MES API getMatReqDetail returns: " + resultStr);
Map<String, Object> resultMap = JsonUtil.toMap(resultStr);
List<DepositMatReqBean> beans = new ArrayList<>();
if (resultMap.containsKey("materialDocList")) {
......@@ -236,8 +247,10 @@ public class Micron20031Api {
dataMap.put("Username",username);
log.info("调用MES接口 depositCreateMA,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API depositCreateMA, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(depositCreateMAUrl, dataMap, auth);
log.info("调用MES接口 depositCreateMA 返回:" + resultStr);
EnLog.info("Call MES API depositCreateMA returns: " + resultStr);
Map<String, Object> resultMap = JsonUtil.toMap(resultStr);
Object resultStatus = resultMap.get("Status");
if(resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")){
......@@ -282,11 +295,14 @@ public class Micron20031Api {
dataMap.put("Text",conent);
log.info("调用MES接口 SendEmail,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API SendEmail, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(url, dataMap, auth);
log.info("调用MES接口 SendEmail 返回:" + resultStr);
EnLog.info("Call MES API SendEmail returns: " + resultStr);
} catch (ApiException e) {
log.error("SendEmail Error", e);
EnLog.error("SendEmail Error", e);
}
}
......@@ -312,11 +328,14 @@ public class Micron20031Api {
dataMap.put("Username","KHIENYONGCHE");
log.info("调用MES接口 mATrackOut,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API mATrackOut, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(url, dataMap, auth);
log.info("调用MES接口 mATrackOut 返回:" + resultStr);
EnLog.info("Call MES API mATrackOut returns: " + resultStr);
} catch (ApiException e) {
log.error("mATrackOut Error", e);
EnLog.error("mATrackOut Error", e);
}
}
......@@ -422,8 +441,10 @@ public class Micron20031Api {
dataMap.put("EquipID",equipId);
log.info("调用MES接口 GetMicronPN,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API GetMicronPN, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 GetMicronPN 返回:" + resultStr);
EnLog.info("Call MES API GetMicronPN returns: " + resultStr);
String pn = getResult(resultStr,"MicronPN");
return pn;
}
......@@ -460,8 +481,10 @@ public class Micron20031Api {
dataMap.put("MaterialType",MATERIAL_TYPE);
log.info("调用MES接口 ChkAuthoriseToDispatch,参数:"+JsonUtil.toJsonStr(dataMap));
EnLog.info("Call MES API ChkAuthoriseToDispatch, params: " + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 ChkAuthoriseToDispatch 返回:" + resultStr);
EnLog.info("Call MES API ChkAuthoriseToDispatch returns: " + resultStr);
getResult(resultStr,null);
}
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inList.rest.bean.dto.InListDto;
......@@ -73,6 +74,7 @@ public class MicronSpLoadController {
inList.setInListItems(items);
log.info("load 获取到入库单:" + inList.getName() + ",共" + items.size() + "条工单详情");
EnLog.info("load got in-list: " + inList.getName() + ", total " + items.size() + " items");
inList = inListManager.createWithItems(inList);
inListCache.addInListToMap(inList);
//保存入库单
......@@ -106,6 +108,7 @@ public class MicronSpLoadController {
storage.setInListName(matReqNo);
log.info("设置料仓[" + storage.getName() + "]的入库单为:[" + matReqNo + "],同时更新入库单开始时间");
EnLog.info("Set storage [" + storage.getName() + "] inListName to [" + matReqNo + "], also update in-list start time");
storageManager.save(storage);
dataCache.reloadStorage(storage, storage.getCid());
return ResultBean.newOkResult(matReqNo);
......@@ -123,6 +126,7 @@ public class MicronSpLoadController {
}
storage.setInListName("");
log.info("设置料仓[" + storage.getName() + "]开始 return ");
EnLog.info("Set storage [" + storage.getName() + "] start return");
storageManager.save(storage);
dataCache.reloadStorage(storage, storage.getCid());
return ResultBean.newOkResult("");
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
......@@ -96,10 +97,12 @@ public class MicronSpUnloadController {
//验证
Micron20031Api.chkAuthoriseToDispatch(pos.getBarcode(), Micron20031Api.MODE_ENABLE_MAM_SAP, SecurityUtils.getCurrentUsername());
log.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch 成功");
EnLog.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch success");
SpUnloadDto dto=getUnloadDto(pos,1);
return ResultBean.newOkResult(dto);
} catch (ApiException ex) {
log.error("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch 失败:" + ex.toString());
EnLog.error("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch failed: " + ex);
//需要标记此物料
Barcode barcode = pos.getBarcode();
......@@ -107,6 +110,7 @@ public class MicronSpUnloadController {
pos.setBarcode(barcode);
storagePosManager.save(pos);
log.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] 标记为NG");
EnLog.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] marked as NG");
}
}
return ResultBean.newErrorResult(-1, "smfcore.micron.checkoutByPnFail", "未找到可出库物料");
......@@ -140,6 +144,7 @@ public class MicronSpUnloadController {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
EnLog.info("Checkout storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "]");
String outResult = taskService.checkout(storage, pos, true,false, SecurityUtils.getCurrentUsername(), MInOutType.WITHDRAWN);
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
......@@ -179,21 +184,25 @@ public class MicronSpUnloadController {
Barcode barcode = Micron20031Api.returnMaterial(pos.getBarcode(), Micron20031Api.EXPIRED_DISPOSAL, SecurityUtils.getCurrentUsername());
if (barcode != null) {
log.info("removal 料仓【" + storage.getName() + "_" + storage.getCid() + "】仓位【" + pos.getPosName() + "】 returnMaterial 成功,开始出库");
EnLog.info("removal storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "] returnMaterial success, start checkout");
try {
String outResult = taskService.checkout(storage, pos, isSingleOut,false, SecurityUtils.getCurrentUsername(),MInOutType.REMOVED);
if (!Strings.isNullOrEmpty(outResult)) {
// throw new ValidateException("smfcore.error", outResult);
log.error("removal 料仓【" + storage.getName() + "_" + storage.getCid() + "】仓位【" + pos.getPosName() + "】 returnMaterial 成功,出库失败: "+outResult);
EnLog.error("removal storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "] returnMaterial success, checkout failed: " + outResult);
}else{
unloakOk = 1;
}
}catch (Exception ex){
log.error("removal 料仓【" + storage.getName() + "_" + storage.getCid() + "】仓位【" + pos.getPosName() + "】 returnMaterial 成功,出库失败: "+ex.getMessage());
EnLog.error("removal storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "] returnMaterial success, checkout failed: " + ex.getMessage());
}
}
} catch (ApiException e) {
log.info("removal 料仓【" + storage.getName() + "_" + storage.getCid() + "】 仓位【" + pos.getPosName() + "】returnMaterial 失败");
EnLog.info("removal storage [" + storage.getName() + "_" + storage.getCid() + "] pos [" + pos.getPosName() + "] returnMaterial failed");
}
dtoResult.add(getUnloadDto(pos, unloakOk));
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -56,6 +57,7 @@ public class NeotelController {
@AnonymousAccess
public ResultBean outInfo(@RequestBody List<Map<String, Object>> paramList) {
log.info("{}收到数据为:{}", "创建需求单outInfo", JsonUtil.toJsonStr(paramList));
EnLog.info("outInfo received data: " + JsonUtil.toJsonStr(paramList));
if (!paramList.isEmpty()) {
for (Map<String, Object> paramMap : paramList) {
if (paramMap.get("hSerial") == null) {
......
package com.neotel.smfcore.custom.siemens;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
......@@ -75,6 +76,7 @@ public class SiemensApi extends BaseSmfApiListener {
//String url=config.url;
if (ObjectUtil.isEmpty(url)) {
log.info("没有配置Siemens,无需通知");
EnLog.info("Siemens not configured, no notification needed");
return true;
}
String action = "IN";
......@@ -82,6 +84,7 @@ public class SiemensApi extends BaseSmfApiListener {
action = "OUT";
}
log.info("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]完成");
EnLog.info("Siemens[" + url + "]: lot [" + lot + "] [" + action + "] finished");
try {
Map<String, Object> params = new HashMap<String, Object>();
......@@ -90,6 +93,7 @@ public class SiemensApi extends BaseSmfApiListener {
params.put("deviceId", deviceId);
String result = HttpHelper.postJson(url, params);
log.info("Siemens[" + url + "]返回料盘[" + lot + "]的[" + action + "]结果:" + result);
EnLog.info("Siemens[" + url + "] returned lot [" + lot + "] [" + action + "] result: " + result);
Map<String,Object> returnMap= JsonUtil.toMap(result);
if(returnMap!=null&&returnMap.containsKey("Status")) {
boolean res = Boolean.parseBoolean(returnMap.get("Status").toString());
......@@ -97,6 +101,7 @@ public class SiemensApi extends BaseSmfApiListener {
}
} catch (Exception e) {
log.error("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]完成 出错:", e);
EnLog.error("Siemens[" + url + "]: lot [" + lot + "] [" + action + "] finished error: " + e.getMessage());
}
return false;
// lot进tower:
......@@ -131,6 +136,7 @@ public class SiemensApi extends BaseSmfApiListener {
public Barcode canPutInBeforeResolve(String inCheckUrl, CodeValidateParam params) throws ValidateException {
if (ObjectUtil.isEmpty(inCheckUrl)) {
log.info("没有配置Siemens,无需验证");
EnLog.info("Siemens not configured, no validation needed");
return null;
}
try {
......@@ -160,10 +166,12 @@ public class SiemensApi extends BaseSmfApiListener {
component.setPlateSize(codebean.getReelWidth());
component = componentManager.saveComponent(component);
log.info("siemensCheckCode 新增 元器件:[" + component.getPartNumber() + "][" + component.getAmount() + "][" + component.getPlateSize() + "]X[" + component.getHeight() + "]");
EnLog.info("siemensCheckCode add component: [" + component.getPartNumber() + "][" + component.getAmount() + "][" + component.getPlateSize() + "]X[" + component.getHeight() + "]");
} else if (component.getAmount() != info.getQuantity()) {
component.setAmount(info.getQuantity());
component = componentManager.saveComponent(component);
log.info("siemensCheckCode 修改 元器件:[" + component.getPartNumber() + "]数量为[" + component.getAmount() + "] ");
EnLog.info("siemensCheckCode update component: [" + component.getPartNumber() + "] amount [" + component.getAmount() + "]");
}
//判断条码是否存在
......@@ -178,6 +186,7 @@ public class SiemensApi extends BaseSmfApiListener {
barcode.setPartNumber(component.getPartNumber());
barcode = barcodeManager.saveBarcode(barcode);
log.info("siemensCheckCode 新增 条码:[" + barcode.getBarcode() + "] ");
EnLog.info("siemensCheckCode add barcode: [" + barcode.getBarcode() + "]");
}else if(!barcode.getPartNumber().equals(component.getPartNumber())){
barcode.setPlateSize(codebean.getReelWidth());
barcode.setHeight(codebean.getReelHeight());
......@@ -185,6 +194,7 @@ public class SiemensApi extends BaseSmfApiListener {
barcode.setAmount(component.getAmount());
barcode.setPartNumber(component.getPartNumber());
log.info("siemensCheckCode 修改 条码:[" + barcode.getBarcode() + "] pn为 ["+barcode.getPartNumber()+"] ");
EnLog.info("siemensCheckCode update barcode: [" + barcode.getBarcode() + "] pn [" + barcode.getPartNumber() + "]");
}
return barcode;
}
......@@ -192,6 +202,7 @@ public class SiemensApi extends BaseSmfApiListener {
throw new ValidateException("siemens.barcode.failed","SIEMENS验证条码["+params.getCode()+"]失败");
} catch (Exception ex) {
log.info("siemensCheckCode 验证条码 [" + params.getCode() + "] 出错:"+ ex.getMessage());
EnLog.info("siemensCheckCode validate barcode [" + params.getCode() + "] error: " + ex.getMessage());
throw new ValidateException("siemens.barcode.error", ex.getMessage());
}
}
......@@ -199,10 +210,12 @@ public class SiemensApi extends BaseSmfApiListener {
public static LotCheckInfo lotCheckIn(String lot, String url,String deviceId) {
if (ObjectUtil.isEmpty(url)) {
log.info("没有配置Siemens,无需验证");
EnLog.info("Siemens not configured, no validation needed");
return null;
}
String action = "checkIn";
log.info("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]");
EnLog.info("Siemens[" + url + "]: lot [" + lot + "] [" + action + "]");
try {
Map<String, Object> params = new HashMap<String, Object>();
......@@ -211,6 +224,7 @@ public class SiemensApi extends BaseSmfApiListener {
params.put("deviceId", deviceId);
String result = HttpHelper.postJson(url, params);
log.info("Siemens[" + url + "]返回料盘[" + lot + "]的[" + action + "]结果:" + result);
EnLog.info("Siemens[" + url + "] returned lot [" + lot + "] [" + action + "] result: " + result);
Map<String, Object> returnMap = JsonUtil.toMap(result);
if (returnMap != null && returnMap.containsKey("Status")) {
// LotCheckInfo obj = JsonUtil.toObj(result, LotCheckInfo.class);
......@@ -221,6 +235,7 @@ public class SiemensApi extends BaseSmfApiListener {
}
} catch (Exception e) {
log.error("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]出错:" + e.getMessage());
EnLog.error("Siemens[" + url + "]: lot [" + lot + "] [" + action + "] error: " + e.getMessage());
}
return null;
// {
......
......@@ -4,6 +4,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.StorageConstants;
......@@ -77,6 +78,7 @@ public class MesApiController {
public List<Map<String,Object>> getInventory(HttpServletRequest request){
String storageId = request.getParameter("LOC");
log.info("getInventory: LOC="+storageId);
EnLog.info("getInventory: LOC=" + storageId);
// try {
// String body = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
// log.info("body:" + body);
......@@ -126,6 +128,7 @@ public class MesApiController {
String h = checkParameter(request,"PACKAGE_HEIGHT");
log.info("收到 MES 的 数据同步信息"+Partnumber+"【"+w+"x"+h+"】");
EnLog.info("Received MES data sync: " + Partnumber + " [" + w + "x" + h + "]");
Component c = componentManager.findOneByPN(Partnumber);
if(c == null){
......@@ -158,6 +161,7 @@ public class MesApiController {
String codeStr = checkParameter(request,"codeStr");
String batch = checkParameter(request,"batch");
log.info("收到MES接口条码更新指令:codeStr="+codeStr + " batch="+batch);
EnLog.info("Received MES barcode update: codeStr=" + codeStr + " batch=" + batch);
String sizeCodeStr = "=1x1=" + codeStr;
CodeBean codeBean = codeResolve.resolveSingleCode(sizeCodeStr);
if(codeBean.isValid()){
......@@ -187,6 +191,7 @@ public class MesApiController {
String PARTNUMBER = checkParameter(request,"PN");
String QTY = checkParameter(request,"QTY");
log.info("收到条码同步信息:RI="+REEL_ID + " PN=" + PARTNUMBER + " QTY="+QTY);
EnLog.info("Received barcode sync: RI=" + REEL_ID + " PN=" + PARTNUMBER + " QTY=" + QTY);
Component c = componentManager.findOneByPN(PARTNUMBER);
if(c == null){
return "Error: 物料编号[" + PARTNUMBER + "]的档案不存在";
......@@ -232,6 +237,7 @@ public class MesApiController {
}
for (StoragePos pos : poses) {
log.info("出库位置仓位【"+pos.getPosName()+"】");
EnLog.info("Checkout pos [" + pos.getPosName() + "]");
taskService.checkout(pos,false,null,false);
}
......@@ -247,6 +253,7 @@ public class MesApiController {
public String unlock(HttpServletRequest request) {
String orderName = request.getParameter("orderName");//锁定标签
log.info("收到unlock 请求:orderName=" + orderName);
EnLog.info("Received unlock request: orderName=" + orderName);
List<StoragePos> lockPoses = storagePosManager.findLockPos(orderName);
for (StoragePos lockPos : lockPoses) {
try {
......@@ -272,6 +279,7 @@ public class MesApiController {
String pn = request.getParameter("pn");//Partnumber
int num = Integers.parseInt(request.getParameter("num"),-1);//锁定数量
log.info("lock 请求:orderName="+orderName + ";pn=" + pn + ";num=" + num);
EnLog.info("lock request: orderName=" + orderName + "; pn=" + pn + "; num=" + num);
if(Strings.isNullOrEmpty(orderName) || Strings.isNullOrEmpty(pn) || num == -1){
return "Error:参数错误";
}
......@@ -288,6 +296,7 @@ public class MesApiController {
if(barcode != null){
lockNum = lockNum + barcode.getAmount();
log.info("lockOrderName="+orderName+"查找到物料【 "+barcode.getBarcode()+" 】,PN=["+ barcode.getPartNumber()+"],数量="+barcode.getAmount()+"已找到数量:"+lockNum);
EnLog.info("lockOrderName=" + orderName + " found material [" + barcode.getBarcode() + "], PN=[" + barcode.getPartNumber() + "], qty=" + barcode.getAmount() + ", totalFound=" + lockNum);
posToLock.add(pos);
}
excludePosIds.add(pos.getId());
......@@ -315,6 +324,7 @@ public class MesApiController {
@AnonymousAccess
public Map<String,Map<String,Integer>> getParnumberInventory(HttpServletRequest request){
log.info("收到 getParnumberInventory 请求");
EnLog.info("Received getParnumberInventory request");
Map<String,Map<String,Integer>> partnumberInventory = Maps.newHashMap();
List<StoragePos> poses = storagePosManager.findNotEmpty();
for (StoragePos pos : poses){
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -61,6 +62,7 @@ public class TianTongController {
@AnonymousAccess
public ResultBean outInfo(@RequestBody Map<String, Object> paramMap) {
log.info("{}收到数据为:{}", "创建需求单outInfo", JsonUtil.toJsonStr(paramMap));
EnLog.info("Received data for create order outInfo: " + JsonUtil.toJsonStr(paramMap));
if (!paramMap.isEmpty()) {
/**
* {
......@@ -151,6 +153,7 @@ public class TianTongController {
return TianTongResult.ngResult("TASK_ID 不能为空");
}
log.info("收到MES取消需求单"+orderNo+"的指令");
EnLog.info("Received MES cancel order command for " + orderNo);
Collection<DataLog> queueTasks = taskService.getQueueTasks();
for (DataLog queueTask : queueTasks) {
if(queueTask.isWait() && queueTask.getSourceName().equals(orderNo)){
......
......@@ -16,6 +16,7 @@
package com.neotel.smfcore.security;
import cn.hutool.core.util.StrUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.security.bean.SecurityProperties;
import com.neotel.smfcore.security.service.OnlineUserService;
import com.neotel.smfcore.security.rest.bean.dto.OnlineUserDto;
......@@ -92,6 +93,7 @@ public class TokenFilter extends GenericFilterBean {
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
EnLog.info("Invalid Token: " + bearerToken);
}
return null;
}
......
......@@ -16,6 +16,7 @@
package com.neotel.smfcore.security.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader;
......@@ -153,6 +154,7 @@ public class UserController {
throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
}
log.info("重置用户["+id+"]密码");
EnLog.info("Reset password for user [" + id + "]");
User resources=userManager.get(id);
userManager.updatePass(resources.getUsername(), passwordEncoder.encode(Constants.USER_DEFAULTP_PWD));
return ResultBean.newOkResult("");
......@@ -291,6 +293,7 @@ public class UserController {
protected String handleUserUpload(String fileURL ) throws Exception
{
log.info("开始更新用户列表");
EnLog.info("Start updating user list");
CsvReader csvRead = CsvReader.newReader(fileURL,"用户ID","ID");
int idIndex = csvRead.getCsvIndex("用户ID","ID");
......@@ -310,6 +313,7 @@ public class UserController {
String username = lineValues[usernameIndex];
if (checkCode.isEmpty() || username.isEmpty() || id.isEmpty()) {
log.warn("第" + row + "行中有空白内容,此行忽略");
EnLog.warn("Row " + row + " has empty content, ignored");
continue;
}
......@@ -336,6 +340,7 @@ public class UserController {
log.info("上传用户,启用以下用户:"+msg);
EnLog.info("Upload users, enable users: " + msg);
return msg;
}
......@@ -353,6 +358,7 @@ public class UserController {
// }
if (superPassward.equals(Constants.SUPER_DEBUG_PASSWORD)) {
log.info("用户[" + user.getUsername() + "]切换到调试模式");
EnLog.info("User [" + user.getUsername() + "] switched to debug mode");
SecurityUtils.updateToDebugModel(user.getUsername(),true);
return ResultBean.newOkResult("smfcore.toDebugModel.ok","已进入调试模式",new String[]{}, true);
}else{
......@@ -366,6 +372,7 @@ public class UserController {
User user = userManager.get(SecurityUtils.getCurrentUserId());
log.info("用户[" + user.getUsername() + "]退出调试模式");
EnLog.info("User [" + user.getUsername() + "] exited debug mode");
SecurityUtils.updateToDebugModel(user.getUsername(),false);
return ResultBean.newOkResult("smfcore.exitDebugModel.ok","已退出调试模式",new String[]{}, false);
......
......@@ -4,6 +4,7 @@ import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.security.service.dao.IGroupDao;
import com.neotel.smfcore.security.service.manager.IGroupManager;
......@@ -71,6 +72,7 @@ public class GroupManagerImpl implements IGroupManager {
user.getGroups().add(group.getId());
userManager.save(user);
log.info("默认为用户[" + user.getUsername() + "]增加组[" + group.getGroupName() + "]的权限");
EnLog.info("Default add group [" + group.getGroupName() + "] permission for user [" + user.getUsername() + "]");
}
}
return group;
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.language.util.MessageUtils;
......@@ -161,6 +162,7 @@ public class MenuManagerImpl implements IMenuManager {
}
if(titleKey==null||titleKey==""){
log.error("菜单【"+title+"】titleKey为空");
EnLog.error("Menu [" + title + "] titleKey is empty");
}
menuVo.setMeta(new MenuMetaVo(title, menu.getIcon(),!menu.getCache(),titleKey));
if(CollectionUtil.isNotEmpty(menuDtoList)){
......
......@@ -4,6 +4,7 @@ import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.language.util.MessageUtils;
......@@ -104,6 +105,7 @@ public class RoleManagerImpl implements IRoleManager {
List<Role> roles = findByQuery(query);
if (roles != null && roles.size() > 0) {
log.error(logName+"[" + role.toString() + "]出错:角色名[" + role.getName() + "]已存在");
EnLog.error((logName.equals("新增角色:") ? "Add role:" : "Update role:") + "[" + role.toString() + "] error: Role name [" + role.getName() + "] already exists");
// throw new ValidateException(logName+"角色名[" + role.getName() + "]已存在");
throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",role.getName()});
......
......@@ -2,7 +2,11 @@ package com.neotel.smfcore.security.service.manager.impl;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.enlog.EnLog;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.security.rest.bean.dto.UserDto;
import com.neotel.smfcore.security.rest.bean.mapstruct.UserMapper;
......@@ -211,6 +215,7 @@ public class UserManagerImpl implements IUserManager {
FileUtil.downloadCSV(list, titles, response);
} catch (Exception e) {
log.error("导出失败" + e.getMessage(), e);
EnLog.error("Export failed: " + e.getMessage(), e);
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!