Commit 14a0f64e LN

入库验证测试修改

1 个父辈 1aa037e4
......@@ -12,9 +12,9 @@ public class ApiException extends Exception {
super(message);
}
private String msgKey="";
private String[] msgParam;
private String defaultMsg="";
public String msgKey="";
public String[] msgParam;
public String defaultMsg="";
public ApiException(String msgKey, String defMsg){
super(defMsg);
......
......@@ -343,6 +343,8 @@ public class Micron20031Api {
log.info("调用MES接口 triggerMatReqOrder,参数:"+JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 triggerMatReqOrder 返回:" + resultStr);
Object object=getResult(resultStr,"MicronPN");
MatOrderBean resultOrderBean = JsonUtil.toObj(resultStr,MatOrderBean.class);
return resultOrderBean;
......@@ -419,17 +421,20 @@ public class Micron20031Api {
String resultStr = HttpHelper.postJsonWithAuth(depositCreateMAUrl, dataMap, auth);
log.info("调用MES接口 depositCreateMA 返回:" + 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")){
String msg = resultMap.get("Message").toString();
String msg = resultMap.get("message").toString();
throw new ApiException(msg);
}
Object stabilizationEndDateObj = resultMap.get("StabilizationEndDate");
Object stabilizationEndDateObj = resultMap.get( "stabilizationEndDate");
Date stabilizationEndDate = DateUtil.toDate(stabilizationEndDateObj.toString(),"MM-dd-yyyy");
barcode.updateAppendData("stabilizationEndDate",stabilizationEndDate);
barcode.updateAppendData("opUsername",username);
barcode.updateAppendData("maTrackOut",false);
Object exposureStartDateObj = resultMap.get("ExposureStartDate");
Object exposureStartDateObj = resultMap.get("exposureStartDate");
Date exposureStartDate = DateUtil.toDate(exposureStartDateObj.toString(),"MM-dd-yyyy");
barcode.setOpenTime(exposureStartDate);
return barcode;
......@@ -657,9 +662,9 @@ public class Micron20031Api {
return null;
}
Map<String, Object> resultMap = JsonUtil.toMap(resultJson);
Object resultStatus = resultMap.get("Status");
Object resultStatus = resultMap.get("status");
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);
}
if (key != null && !key.isEmpty()) {
......@@ -722,9 +727,9 @@ public class Micron20031Api {
log.info("调用MES接口 ReturnMaterial,参数:"+JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(checkStockAvailableUrl, dataMap, auth);
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr);
if(ObjectUtil.isEmpty(resultStr)){
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr+" ,返回数据为空,return null ");
return null;
if(ObjectUtil.isEmpty(resultStr)) {
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr + " ,返回数据为空,return null ");
throw new ApiException("smfcore.api.returnNoData", "ReturnMaterial Failed to get data", new String[]{"ReturnMaterial"});
}
log.info("调用MES接口 ReturnMaterial 返回:" + resultStr);
......
......@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class MicronSpApiListener extends BaseSmfApiListener {
......@@ -30,36 +32,49 @@ public class MicronSpApiListener extends BaseSmfApiListener {
}
@Override
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 :
params.getStorageList()) {
ids) {
if (ObjectUtil.isNotEmpty(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 {
Barcode resultBarcode = Micron20031Api.depositCreateMA(barcode, params.getLoginUser());
if(resultBarcode!=null){
if (resultBarcode != null) {
return resultBarcode;
}
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve depositCreateMA error: " + apiException.getMessage());
return null;
throw new ValidateException(apiException.msgKey, apiException.defaultMsg, apiException.msgParam);
}
}
}
//普通入库验证 调用return
try {
Barcode resultBarcode = Micron20031Api.returnMaterial(barcode, Micron20031Api.MODE_ENABLE_MAM_SAP, params.getLoginUser());
if(resultBarcode!=null){
return resultBarcode;
}
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve returnMaterial error: " + apiException.getMessage());
return null;
//普通入库验证 调用return
try {
log.info("canPutInAfterResolve 普通入库验证 调用return");
Barcode resultBarcode = Micron20031Api.returnMaterial(barcode, Micron20031Api.MODE_ENABLE_MAM_SAP, params.getLoginUser());
if (resultBarcode != null) {
return resultBarcode;
}
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve returnMaterial error: " + apiException.getMessage());
throw new ValidateException(apiException.msgKey, apiException.defaultMsg, apiException.msgParam);
}
}
return null;
}
......
......@@ -17,7 +17,8 @@ micron:
to:
cc:
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
# 登录相关配置
......
......@@ -20,7 +20,8 @@ micron:
to:
cc:
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
# 文件存储路径
file:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!