Commit e72be902 LN

增加英文日志EnLog

1 个父辈 dcf74fdf
正在显示 103 个修改的文件 包含 715 行增加11 行删除
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;
}
}
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);
......
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 {
//查看是否有要出库的操作
......
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);
......
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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){
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!