Commit 0acb2563 LN

增加接口参数配置功能。

1 个父辈 1cece8c7
...@@ -179,4 +179,24 @@ public class Constants { ...@@ -179,4 +179,24 @@ public class Constants {
*/ */
public static final String CACHE_MaxQuantity="CACHE_MaxQuantity"; public static final String CACHE_MaxQuantity="CACHE_MaxQuantity";
/**
* 镁光接口参数: Facility:
*/
public static final String CACHE_APIPARAM_Facility="CACHE_APIPARAM_Facility";
/**
* 镁光接口参数: Area:
*/
public static final String CACHE_APIPARAM_Area="CACHE_APIPARAM_Area";
/**
* 镁光接口参数: EquipmentGroup:
*/
public static final String CACHE_APIPARAM_EquipmentGroup="CACHE_APIPARAM_EquipmentGroup";
/**
* 镁光接口参数: SystemID:
*/
public static final String CACHE_APIPARAM_SystemID="CACHE_APIPARAM_SystemID";
/**
* 镁光接口参数: Type:
*/
public static final String CACHE_APIPARAM_Type="CACHE_APIPARAM_Type";
} }
...@@ -400,12 +400,17 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -400,12 +400,17 @@ public class BaseDeviceHandler implements IDeviceHandler {
throw new ValidateException("条码无效", "无效的条码" ); throw new ValidateException("条码无效", "无效的条码" );
} }
if(Micron20031Api.Debug){
log.info("调试状态,不验证过期时间");
}else{
Date expireDate = barcodeSave.getExpireDate(); Date expireDate = barcodeSave.getExpireDate();
if (expireDate != null) { if (expireDate != null) {
if (System.currentTimeMillis() > expireDate.getTime()) { if (System.currentTimeMillis() > expireDate.getTime()) {
throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库."); throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
} }
} }
}
int w = barcodeSave.getPlateSize(); int w = barcodeSave.getPlateSize();
int h = barcodeSave.getHeight(); int h = barcodeSave.getHeight();
......
...@@ -139,7 +139,15 @@ public class DataCache { ...@@ -139,7 +139,15 @@ public class DataCache {
updateCache(Constants.CACHE_MaxQuantity, 2); updateCache(Constants.CACHE_MaxQuantity, 2);
} }
} }
public <T> T getCache(String cacheKey,T defValue) {
Object value = cacheMap.get(cacheKey);
if (value != null) {
return (T) value;
}else{
updateCache(cacheKey,defValue);
return defValue;
}
}
/** /**
* 获取缓存信息 * 获取缓存信息
* *
......
...@@ -6,42 +6,27 @@ import com.neotel.smfcore.common.csv.CsvReader; ...@@ -6,42 +6,27 @@ import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.excel.ExcelReader; import com.neotel.smfcore.common.excel.ExcelReader;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.service.bean.LanguageInfo;
import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.bean.OrderSetting; import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.rest.bean.dto.SettingsDto;
import com.neotel.smfcore.core.system.rest.bean.dto.SysSettingsDto; import com.neotel.smfcore.core.system.rest.bean.dto.SysSettingsDto;
import com.neotel.smfcore.core.system.rest.bean.mapstruct.SettingsMapper;
import com.neotel.smfcore.core.system.service.po.Settings; import com.neotel.smfcore.core.system.service.po.Settings;
import com.neotel.smfcore.core.system.util.DbBackupService; import com.neotel.smfcore.core.system.util.DbBackupService;
import com.neotel.smfcore.custom.micron20031.Micron20031Api;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.bean.FileProperties; import com.neotel.smfcore.security.bean.FileProperties;
import com.neotel.smfcore.security.rest.bean.dto.MenuDto;
import com.neotel.smfcore.security.rest.bean.query.UserQueryCriteria;
import com.neotel.smfcore.security.service.po.Menu;
import com.neotel.smfcore.security.service.po.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.aggregation.BooleanOperators;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -95,6 +80,11 @@ public class SettingsController { ...@@ -95,6 +80,11 @@ public class SettingsController {
dto.setBackUpMonth(backUpMonth); dto.setBackUpMonth(backUpMonth);
dto.setDepositExceedTime(depositExceedTime); dto.setDepositExceedTime(depositExceedTime);
dto.setMaxQuantity(MaxQuantity); dto.setMaxQuantity(MaxQuantity);
dto.setParam_Area(dataCache.getCache(Constants.CACHE_APIPARAM_Area, Micron20031Api.param_Area));
dto.setParam_Facility(dataCache.getCache(Constants.CACHE_APIPARAM_Facility, Micron20031Api.param_Facility));
dto.setParam_EquipmentGroup(dataCache.getCache(Constants.CACHE_APIPARAM_EquipmentGroup, Micron20031Api.param_EquipmentGroup));
dto.setParam_SystemID(dataCache.getCache(Constants.CACHE_APIPARAM_SystemID, Micron20031Api.param_SystemID));
dto.setParam_Type(dataCache.getCache(Constants.CACHE_APIPARAM_Type, Micron20031Api.param_Type));
return dto; return dto;
} }
...@@ -110,9 +100,16 @@ public class SettingsController { ...@@ -110,9 +100,16 @@ public class SettingsController {
dataCache.updateCache(Constants.BACKUP_MONTH_KEY,sysSettingsDto.getBackUpMonth()); dataCache.updateCache(Constants.BACKUP_MONTH_KEY,sysSettingsDto.getBackUpMonth());
dataCache.updateCache(Constants.CACHE_Deposit_Exceed_Time,sysSettingsDto.getDepositExceedTime()); dataCache.updateCache(Constants.CACHE_Deposit_Exceed_Time,sysSettingsDto.getDepositExceedTime());
dataCache.updateCache(Constants.CACHE_MaxQuantity,sysSettingsDto.getMaxQuantity()); dataCache.updateCache(Constants.CACHE_MaxQuantity,sysSettingsDto.getMaxQuantity());
dataCache.updateCache(Constants.CACHE_APIPARAM_Area,sysSettingsDto.getParam_Area());
dataCache.updateCache(Constants.CACHE_APIPARAM_EquipmentGroup,sysSettingsDto.getParam_EquipmentGroup());
dataCache.updateCache(Constants.CACHE_APIPARAM_Facility,sysSettingsDto.getParam_Facility());
dataCache.updateCache(Constants.CACHE_APIPARAM_SystemID,sysSettingsDto.getParam_SystemID());
dataCache.updateCache(Constants.CACHE_APIPARAM_Type,sysSettingsDto.getParam_Type());
log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob()+",sluggishDay="+sysSettingsDto.getSluggishDay() log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob()+",sluggishDay="+sysSettingsDto.getSluggishDay()
+",expiresDay="+sysSettingsDto.getExpiresDay()+",capacityWarn="+sysSettingsDto.getCapacityWarn()+",backUpMonth="+sysSettingsDto.getBackUpMonth() +",expiresDay="+sysSettingsDto.getExpiresDay()+",capacityWarn="+sysSettingsDto.getCapacityWarn()+",backUpMonth="+sysSettingsDto.getBackUpMonth()
+",depositExceedTime="+sysSettingsDto.getDepositExceedTime()+",maxQuantity="+sysSettingsDto.getMaxQuantity()); +",depositExceedTime="+sysSettingsDto.getDepositExceedTime()+",maxQuantity="+sysSettingsDto.getMaxQuantity()+", Area="+sysSettingsDto.getParam_Area()
+",Facility="+sysSettingsDto.getParam_Facility()+", equipmentGroup="+sysSettingsDto.getParam_EquipmentGroup()+", systemId="+sysSettingsDto.getParam_SystemID()
+", type="+sysSettingsDto.getParam_Type());
return ResultBean.newOkResult("保存成功"); return ResultBean.newOkResult("保存成功");
} }
......
...@@ -33,4 +33,20 @@ public class SysSettingsDto implements Serializable { ...@@ -33,4 +33,20 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty("允许LineId数量") @ApiModelProperty("允许LineId数量")
private Integer maxQuantity=2; private Integer maxQuantity=2;
@ApiModelProperty("api参数:Facility=MODULE SINGAPORE")
private String param_Facility="MODULE SINGAPORE";
@ApiModelProperty("api参数:Area=MSA MODSSD-ASSEMBLY")
private String param_Area="MSA MODSSD-ASSEMBLY";
@ApiModelProperty("api参数:EquipmentGroup=SMT AUTO ETA")
private String param_EquipmentGroup="SMT AUTO ETA";
@ApiModelProperty("api参数:SystemID=SPMMS")
private String param_SystemID="SPMMS";
@ApiModelProperty("api参数:Type=")
private String param_Type="";
} }
...@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ApiException; ...@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.*; import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.micron20031.bean.DepositMatReqBean; import com.neotel.smfcore.custom.micron20031.bean.DepositMatReqBean;
import com.neotel.smfcore.custom.micron20031.bean.MatOrderBean; import com.neotel.smfcore.custom.micron20031.bean.MatOrderBean;
import com.neotel.smfcore.custom.micron20031.cache.LoginCache; import com.neotel.smfcore.custom.micron20031.cache.LoginCache;
...@@ -49,7 +50,14 @@ public class Micron20031Api { ...@@ -49,7 +50,14 @@ public class Micron20031Api {
private static String api_ChkAuthoriseToDispatch="ChkAuthoriseToDispatch"; private static String api_ChkAuthoriseToDispatch="ChkAuthoriseToDispatch";
private static String api_ReturnMaterial="ReturnMaterial"; private static String api_ReturnMaterial="ReturnMaterial";
private static boolean Debug=false; public static boolean Debug=false;
public static String param_Facility="MODULE SINGAPORE";
public static String param_Area="MSA MODSSD-ASSEMBLY";
public static String param_EquipmentGroup="SMT AUTO ETA";
public static String param_SystemID="SPMMS";
public static String param_Type="";
@Value("${micron.api_CheckUserRights:}") @Value("${micron.api_CheckUserRights:}")
public void setApi_CheckUserRights(String api_config) { public void setApi_CheckUserRights(String api_config) {
...@@ -188,6 +196,12 @@ public class Micron20031Api { ...@@ -188,6 +196,12 @@ public class Micron20031Api {
Micron20031Api.loginCache = cache; Micron20031Api.loginCache = cache;
} }
private static DataCache dataCache;
@Autowired
private void setDataCache(DataCache dataCache){
Micron20031Api.dataCache = dataCache;
}
private static String MATERIAL_TYPE = "SOLDER_PASTE"; private static String MATERIAL_TYPE = "SOLDER_PASTE";
public static boolean isEnable(){ public static boolean isEnable(){
...@@ -479,7 +493,8 @@ public class Micron20031Api { ...@@ -479,7 +493,8 @@ public class Micron20031Api {
dateStr = cn.hutool.core.date.DateUtil.format(expireDate, "MM-dd-yyyy"); dateStr = cn.hutool.core.date.DateUtil.format(expireDate, "MM-dd-yyyy");
} }
dataMap.put("ExpiredDate", dateStr); dataMap.put("ExpiredDate", dateStr);
dataMap.put("SystemID", "SPMMS"); // dataMap.put("SystemID", "SPMMS");
dataMap.put("SystemID", dataCache.getConfigCache(Constants.CACHE_APIPARAM_SystemID,param_SystemID));
dataMap.put("MaterialType", MATERIAL_TYPE); dataMap.put("MaterialType", MATERIAL_TYPE);
dataMap.put("Username", username); dataMap.put("Username", username);
dataMap.put("supplier", barcode.getProvider()); dataMap.put("supplier", barcode.getProvider());
...@@ -663,9 +678,15 @@ public class Micron20031Api { ...@@ -663,9 +678,15 @@ public class Micron20031Api {
} }
String auth = getAuthToken(); String auth = getAuthToken();
Map<String,String> dataMap = new HashMap<>(); Map<String,String> dataMap = new HashMap<>();
dataMap.put("Facility","MODULE SINGAPORE");
dataMap.put("Area","MSA MODSSD-ASSEMBLY"); // dataMap.put("Facility","MODULE SINGAPORE");
dataMap.put("EquipmentGroup","SMT AUTO ETA"); // dataMap.put("Area","MSA MODSSD-ASSEMBLY");
// dataMap.put("EquipmentGroup","SMT AUTO ETA");
dataMap.put("Facility",dataCache.getConfigCache(Constants.CACHE_APIPARAM_Facility,param_Facility));
dataMap.put("Area",dataCache.getConfigCache(Constants.CACHE_APIPARAM_Area,param_Area));
dataMap.put("EquipmentGroup",dataCache.getConfigCache(Constants.CACHE_APIPARAM_EquipmentGroup,param_EquipmentGroup));
log.info("调用MES接口 GetEquipIDList,参数:"+JsonUtil.toJsonStr(dataMap)); log.info("调用MES接口 GetEquipIDList,参数:"+JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth); String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
......
...@@ -33,10 +33,10 @@ public class Micron20031Menu { ...@@ -33,10 +33,10 @@ public class Micron20031Menu {
Menu report = Menu.CreatePMenu("报表", 1, "report","inOutData",null); Menu report = Menu.CreatePMenu("报表", 1, "report","inOutData",null);
//Report菜单 //Report菜单
MenuInit.addMenu(menuLabel,report, 120, "AllReport", "allReport", "micron/allReport/index","allReport"); MenuInit.addMenu(menuLabel,report, 120, "AllReport", "allReport", "micron/allReport/index","allReport");
MenuInit.addMenu(menuLabel,report, 121, "Material Movement", "movementReport", "micron/movementReport/index","movementReport"); MenuInit.addMenu(menuLabel,report, 121, "Material Movement", "movementReport", "micron/movementReport/index","maMovement");
MenuInit.addMenu(menuLabel,report, 122, "Inventory", "inventoryReport", "system/inventoryReport/index","inventoryReport"); MenuInit.addMenu(menuLabel,report, 122, "Inventory", "inventoryReport", "system/inventoryReport/index","inventoryReport");
MenuInit.addMenu(menuLabel,report, 123, "Abnormality", "abnormReport", "system/abnormReport/index","abnormReport"); MenuInit.addMenu(menuLabel,report, 123, "Abnormality", "abnormReport", "system/abnormReport/index","allReport");
MenuInit.addMenu(menuLabel,report, 124, "Performance", "performanceReport", "system/performanceReport/index","performanceReport"); MenuInit.addMenu(menuLabel,report, 124, "Performance", "performanceReport", "system/performanceReport/index","perform");
MenuInit.addMenu(menuLabel,report, 125, "Order", "orderReport", "system/order/index","orderReport"); MenuInit.addMenu(menuLabel,report, 125, "Order", "orderReport", "system/order/index","orderReport");
// MenuInit.addMenu(menuLabel,null, 2, "Inventory Report", "inventoryReport", "system/inventoryReport/index","inventoryReport"); // MenuInit.addMenu(menuLabel,null, 2, "Inventory Report", "inventoryReport", "system/inventoryReport/index","inventoryReport");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!