Commit 14a0f64e LN

入库验证测试修改

1 个父辈 1aa037e4
...@@ -12,9 +12,9 @@ public class ApiException extends Exception { ...@@ -12,9 +12,9 @@ public class ApiException extends Exception {
super(message); super(message);
} }
private String msgKey=""; public String msgKey="";
private String[] msgParam; public String[] msgParam;
private String defaultMsg=""; public String defaultMsg="";
public ApiException(String msgKey, String defMsg){ public ApiException(String msgKey, String defMsg){
super(defMsg); super(defMsg);
......
...@@ -343,6 +343,8 @@ public class Micron20031Api { ...@@ -343,6 +343,8 @@ public class Micron20031Api {
log.info("调用MES接口 triggerMatReqOrder,参数:"+JsonUtil.toJsonStr(dataMap)); log.info("调用MES接口 triggerMatReqOrder,参数:"+JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth); String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 triggerMatReqOrder 返回:" + resultStr); log.info("调用MES接口 triggerMatReqOrder 返回:" + resultStr);
Object object=getResult(resultStr,"MicronPN");
MatOrderBean resultOrderBean = JsonUtil.toObj(resultStr,MatOrderBean.class); MatOrderBean resultOrderBean = JsonUtil.toObj(resultStr,MatOrderBean.class);
return resultOrderBean; return resultOrderBean;
...@@ -419,17 +421,20 @@ public class Micron20031Api { ...@@ -419,17 +421,20 @@ public class Micron20031Api {
String resultStr = HttpHelper.postJsonWithAuth(depositCreateMAUrl, dataMap, auth); String resultStr = HttpHelper.postJsonWithAuth(depositCreateMAUrl, dataMap, auth);
log.info("调用MES接口 depositCreateMA 返回:" + resultStr); log.info("调用MES接口 depositCreateMA 返回:" + resultStr);
Map<String, Object> resultMap = JsonUtil.toMap(resultStr); Map<String, Object> resultMap = JsonUtil.toMap(resultStr);
Object resultStatus = resultMap.get("Status"); Object resultStatus = resultMap.get("status");
if (ObjectUtil.isEmpty(resultStr) ||ObjectUtil.isEmpty(resultStatus)) {
throw new ApiException("smfcore.api.returnNoData", "depositCreateMA Failed to get data", new String[]{"depositCreateMA"});
}
if(resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")){ if(resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")){
String msg = resultMap.get("Message").toString(); String msg = resultMap.get("message").toString();
throw new ApiException(msg); throw new ApiException(msg);
} }
Object stabilizationEndDateObj = resultMap.get("StabilizationEndDate"); Object stabilizationEndDateObj = resultMap.get( "stabilizationEndDate");
Date stabilizationEndDate = DateUtil.toDate(stabilizationEndDateObj.toString(),"MM-dd-yyyy"); Date stabilizationEndDate = DateUtil.toDate(stabilizationEndDateObj.toString(),"MM-dd-yyyy");
barcode.updateAppendData("stabilizationEndDate",stabilizationEndDate); barcode.updateAppendData("stabilizationEndDate",stabilizationEndDate);
barcode.updateAppendData("opUsername",username); barcode.updateAppendData("opUsername",username);
barcode.updateAppendData("maTrackOut",false); barcode.updateAppendData("maTrackOut",false);
Object exposureStartDateObj = resultMap.get("ExposureStartDate"); Object exposureStartDateObj = resultMap.get("exposureStartDate");
Date exposureStartDate = DateUtil.toDate(exposureStartDateObj.toString(),"MM-dd-yyyy"); Date exposureStartDate = DateUtil.toDate(exposureStartDateObj.toString(),"MM-dd-yyyy");
barcode.setOpenTime(exposureStartDate); barcode.setOpenTime(exposureStartDate);
return barcode; return barcode;
...@@ -657,9 +662,9 @@ public class Micron20031Api { ...@@ -657,9 +662,9 @@ public class Micron20031Api {
return null; return null;
} }
Map<String, Object> resultMap = JsonUtil.toMap(resultJson); Map<String, Object> resultMap = JsonUtil.toMap(resultJson);
Object resultStatus = resultMap.get("Status"); Object resultStatus = resultMap.get("status");
if (resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")) { if (resultStatus != null && !resultStatus.toString().equalsIgnoreCase("PASS")) {
String msg = resultMap.get("Message").toString(); String msg = resultMap.get("message").toString();
throw new ApiException("smfcore.api.error", msg); throw new ApiException("smfcore.api.error", msg);
} }
if (key != null && !key.isEmpty()) { if (key != null && !key.isEmpty()) {
...@@ -722,9 +727,9 @@ public class Micron20031Api { ...@@ -722,9 +727,9 @@ public class Micron20031Api {
log.info("调用MES接口 ReturnMaterial,参数:"+JsonUtil.toJsonStr(dataMap)); log.info("调用MES接口 ReturnMaterial,参数:"+JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth); String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr); log.info("调用MES接口 ReturnMaterial 返回:" + resultStr);
if(ObjectUtil.isEmpty(resultStr)){ if(ObjectUtil.isEmpty(resultStr)) {
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr+" ,返回数据为空,return null "); log.info("调用MES接口 ReturnMaterial 返回:" + resultStr + " ,返回数据为空,return null ");
return null; throw new ApiException("smfcore.api.returnNoData", "ReturnMaterial Failed to get data", new String[]{"ReturnMaterial"});
} }
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr); log.info("调用MES接口 ReturnMaterial 返回:" + resultStr);
......
...@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
@Slf4j @Slf4j
public class MicronSpApiListener extends BaseSmfApiListener { public class MicronSpApiListener extends BaseSmfApiListener {
...@@ -30,36 +32,49 @@ public class MicronSpApiListener extends BaseSmfApiListener { ...@@ -30,36 +32,49 @@ public class MicronSpApiListener extends BaseSmfApiListener {
} }
@Override @Override
public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException { public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException {
List<Storage> ids=params.getStorageList();
if(ids==null||ids.size()<=0){
if(ObjectUtil.isNotEmpty(params.getStorageId())){
Storage storage=dataCache.getStorageById(params.getStorageId());
if(storage!=null) {
ids.add(storage);
}
}
}
//判断是否是入库单入库 //判断是否是入库单入库
for (Storage storage : for (Storage storage :
params.getStorageList()) { ids) {
if (ObjectUtil.isNotEmpty(storage.getInListName())) { if (ObjectUtil.isNotEmpty(storage.getInListName())) {
//如果入库单还在执行中,验证是否可以入库 //如果入库单还在执行中,验证是否可以入库
InList inList = inListCache.getInList(storage.getInListName()); InList inList = inListCache.getInList(storage.getInListName());
if (inList.getStatus() < INLIST_STATUS.WAIT) { if (inList.getStatus() <= INLIST_STATUS.WAIT) {
log.info("canPutInAfterResolve 料仓【"+storage.getName()+"】入库单【"+inList.getName()+"】入库, 调用 depositCreateMA");
try { try {
Barcode resultBarcode = Micron20031Api.depositCreateMA(barcode, params.getLoginUser()); Barcode resultBarcode = Micron20031Api.depositCreateMA(barcode, params.getLoginUser());
if(resultBarcode!=null){ if (resultBarcode != null) {
return resultBarcode; return resultBarcode;
} }
} catch (ApiException apiException) { } catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve depositCreateMA error: " + apiException.getMessage()); log.error("MicronSpApiListener canPutInAfterResolve depositCreateMA error: " + apiException.getMessage());
return null; throw new ValidateException(apiException.msgKey, apiException.defaultMsg, apiException.msgParam);
} }
} }
}
//普通入库验证 调用return //普通入库验证 调用return
try { try {
Barcode resultBarcode = Micron20031Api.returnMaterial(barcode, Micron20031Api.MODE_ENABLE_MAM_SAP, params.getLoginUser()); log.info("canPutInAfterResolve 普通入库验证 调用return");
if(resultBarcode!=null){ Barcode resultBarcode = Micron20031Api.returnMaterial(barcode, Micron20031Api.MODE_ENABLE_MAM_SAP, params.getLoginUser());
return resultBarcode; if (resultBarcode != null) {
} return resultBarcode;
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve returnMaterial error: " + apiException.getMessage());
return null;
} }
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve returnMaterial error: " + apiException.getMessage());
throw new ValidateException(apiException.msgKey, apiException.defaultMsg, apiException.msgParam);
} }
} }
return null; return null;
} }
......
...@@ -17,7 +17,8 @@ micron: ...@@ -17,7 +17,8 @@ micron:
to: to:
cc: cc:
api: api:
# name: 20031 name: 20031
inCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/ReturnMaterial
# loginCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/CheckUserRights # loginCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/CheckUserRights
# 登录相关配置 # 登录相关配置
......
...@@ -20,7 +20,8 @@ micron: ...@@ -20,7 +20,8 @@ micron:
to: to:
cc: cc:
api: api:
# name: 20031 name: 20031
inCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/ReturnMaterial
# loginCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/CheckUserRights # loginCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/CheckUserRights
# 文件存储路径 # 文件存储路径
file: file:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!