Commit 323044bb LN

1.API003中sapItem改为boolean值。

2.API011中source默认为KTS-0001。
3.系统设置页面增加apitest.
1 个父辈 553f9f9c
......@@ -180,5 +180,9 @@ public class Constants {
* 当前出库信息:
*/
public static final String CACHE_DISPATCH ="CACHE_DISPATCH_INFO_";
/**
* 是否启用接口测试,true=启用
*/
public static final String CACHE_API_TEST ="CACHE_API_TEST";
}
......@@ -647,6 +647,13 @@ public class RobotBoxHandler extends BaseDeviceHandler {
}
private Barcode ApiCheck(String rfid,Barcode barcode) throws ApiException {
if(ObjectUtil.isEmpty(rfid)){
return barcode;
}
//是否启用
if(!MicronApi.isEnable()) {
return barcode;
}
barcode.setToXray(false);
barcode.setInListName("");
String operationId="";
......
......@@ -69,6 +69,11 @@ public class SettingsController {
Integer caWarn=dataCache.getCache(Constants.CACHE_CapacityWarn);
Integer backUpMonth = dataCache.getCache(Constants.BACKUP_MONTH_KEY);
Integer barcodeSet=dataCache.getCache(Constants.CACHE_SAME_BARCODE_SETTINGS);
Boolean useAPi=dataCache.getCache(Constants.CACHE_API_TEST);
if(useAPi==null){
useAPi=false;
dataCache.updateCache(Constants.CACHE_API_TEST,useAPi);
}
SysSettingsDto dto = new SysSettingsDto();
dto.setStartJob(startJob);
dto.setStopOut(stopOut);
......@@ -77,6 +82,7 @@ public class SettingsController {
dto.setCapacityWarn(caWarn);
dto.setBackUpMonth(backUpMonth);
dto.setSameBarcodeSettings(barcodeSet);
dto.setApiTest(useAPi);
return dto;
}
......@@ -91,9 +97,10 @@ public class SettingsController {
dataCache.updateCache(Constants.CACHE_CapacityWarn, sysSettingsDto.getCapacityWarn());
dataCache.updateCache(Constants.BACKUP_MONTH_KEY, sysSettingsDto.getBackUpMonth());
dataCache.updateCache(Constants.CACHE_SAME_BARCODE_SETTINGS, sysSettingsDto.getSameBarcodeSettings());
dataCache.updateCache(Constants.CACHE_API_TEST, sysSettingsDto.isApiTest());
log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob() + ",sluggishDay=" + sysSettingsDto.getSluggishDay()
+ ",expiresDay=" + sysSettingsDto.getExpiresDay() + ",capacityWarn=" + sysSettingsDto.getCapacityWarn() + ",backUpMonth=" + sysSettingsDto.getBackUpMonth() +
" ,sameBarcodeSettings=" + sysSettingsDto.getSameBarcodeSettings());
" ,sameBarcodeSettings=" + sysSettingsDto.getSameBarcodeSettings()+", apiTest="+sysSettingsDto.isApiTest());
String msg = MessageUtils.getText("smfcore.saveOk", servletRequest.getLocale(), "保存成功");
return ResultBean.newOkResult(msg);
......
......@@ -30,4 +30,6 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty("同条码入库设置,1=全部NG,2=第二盘NG")
private Integer sameBarcodeSettings=1;
@ApiModelProperty("开启api测试")
private boolean apiTest = false;
}
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron1053.api;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
......@@ -54,7 +55,16 @@ public class MicronApi {
public static boolean isEnable( ) {
// return apiName != null && apiName.equalsIgnoreCase("Micron");
return ObjectUtil.isNotEmpty(config.micronAddr);
Boolean apiTest = dataCache.getCache(Constants.CACHE_API_TEST);
if (apiTest == null) {
apiTest = false;
dataCache.updateCache(Constants.CACHE_API_TEST, apiTest);
}
if (apiTest) {
return ObjectUtil.isNotEmpty(config.micronAddr);
} else {
return false;
}
}
......@@ -498,11 +508,13 @@ public class MicronApi {
if(ObjectUtil.isEmpty(source)){
source=config.api_011_Source;
}
source="KTS-0001";
if(ObjectUtil.isEmpty(url)&&Debug){
return mode+"_test_operationId";
}
url = MessageFormat.format(url,mode,userName,source);
try {
log.info("调用MES接口 Api011: url=[" + url + "] ");
MicronResult result = HttpHelper.getMicronJson(url);
String operationId=result.getResult("operationId");
return operationId;
......
......@@ -53,6 +53,11 @@ public class LoadingController {
@AnonymousAccess
public ResultBean list(HttpServletRequest servletRequest ) {
//判断是否验证
if(!MicronApi.isEnable()){
return ResultBean.newErrorResult(9,"smfcore.micron.apiClose"," Not yet open");
}
InList inList=loadingUtil.getInlist();
if(inList==null){
return ResultBean.newErrorResult(-1,"smfcore.micron.nodata","未找到信息");
......@@ -97,11 +102,17 @@ public class LoadingController {
@ApiOperation("loading->ReturnMaterial 输入RFID后获取数据")
@PostMapping("/returnMaterial")
@AnonymousAccess
public ResultBean returnMaterial(@RequestBody Object params ) {
List<String> rfids = (List<String>) params;
if (ObjectUtil.isEmpty((rfids))) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"rfids"});
public ResultBean returnMaterial(@RequestBody Map<String,Object> params ) {
// List<String> rfids = (List<String>) params;
String numStr = params.get("num").toString();
if (ObjectUtil.isEmpty((numStr))) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"Num"});
}
int num = Integer.valueOf(numStr);
log.info("returnMaterial: num= " + num);
// String[] rfidArray=rfids.split(",");
InList inList = loadingUtil.getInlist();
if (inList == null) {
......@@ -117,12 +128,12 @@ public class LoadingController {
loadingInfo.inlistName = id + "-" + DateUtil.toDateString(loadingInfo.startTime);
dataCache.updateCache(Constants.CACHE_LOADING, loadingInfo);
int count = rfids.size();
// int count = rfids.size();
// List<String> list = new ArrayList<>(Arrays.asList(rfidArray));
inList = new InList(loadingInfo.inlistName, INLIST_STATUS.WAIT, new ArrayList<>(), System.currentTimeMillis(), false);
inList.setMode(loadingInfo.mode);
inList.setShelfNum(count);
inList.setShelfNum(num);
inList.setOperationId(loadingInfo.getOperationId());
inList = inListManager.createWithItems(inList);
......
......@@ -88,6 +88,10 @@ public class MicronPreTaskController {
@AnonymousAccess
@GetMapping("/getTaskId")
public ResultBean task(String mode) {
//判断是否验证
if(!MicronApi.isEnable()){
return ResultBean.newErrorResult(9,"smfcore.micron.apiClose"," Not yet open");
}
//判断是否生成,未关闭的工单
TaskDto dto = getTaskDtoByMode(mode);
String key = Constants.CACHE_DISPATCH + mode;
......
......@@ -214,7 +214,7 @@ public class NeotelController {
resultMap.put("serialNum", barcode.getBarcode());
resultMap.put("partNumber", barcode.getPartNumber());
resultMap.put("sapItem", "True");
resultMap.put("sapItem", Boolean.TRUE);
resultMap.put("mfgPartNum", barcode.getMpn());
resultMap.put("mfgLotNum", barcode.getBatch());
resultMap.put("mfgName", barcode.getProvider());
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!