采购收货确认修正解析SAP结果错误

This commit is contained in:
彭枝刚 2024-11-25 20:05:36 +08:00
parent 6e5974fb14
commit dd9b09b2d0
2 changed files with 8 additions and 4 deletions

View File

@ -14,6 +14,8 @@ import com.foreverwin.iep.integration.utils.Local;
import com.foreverwin.mom.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -31,6 +33,7 @@ public class MaterialConsumptionService implements HandlerService {
// ---------------------------- 批次物料消耗逻辑开始 -----------------------------------------------------
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public InvokeResponse call(InvokeRequest invokeRequest) {
String reqId = invokeRequest.getTransSid();
InvokeResponse invokeResponse = new InvokeResponse(invokeRequest);
@ -48,7 +51,7 @@ public class MaterialConsumptionService implements HandlerService {
JSONObject bodyJson = jsonObject.getJSONObject("RESPONSE_BODY");
JSONObject outJson = bodyJson.getJSONObject("ES_OUTPUT");
String result = outJson.getString("MSGTY");
status = "S".equals(result) ? "E" : result;
status = !"S".equals(result) ? "E" : result;
String message = outJson.getString("MSGTX");
invokeResponse.setMessageContent(StringUtils.isEmpty(message) ? "成功" : message);
}

View File

@ -25,6 +25,7 @@ import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -127,9 +128,9 @@ public class RegisterDocumentServiceImpl implements RegisterDocumentService {
invokeResponse.setMessageContent(e.getMessage());
}
// 如果处理失败,抛出异常,让其回滚
/*if ("E".equals(invokeResponse.getResult())) {
if ("E".equals(invokeResponse.getResult())) {
throw BusinessException.build(invokeResponse.getMessageContent());
}*/
}
return invokeResponse;
}
@ -256,7 +257,7 @@ public class RegisterDocumentServiceImpl implements RegisterDocumentService {
}
bodyRe.put("IT_INPUT", itemList);
jsonObject.put("REQUEST_BODY", bodyRe);
return JsonUtils.converToString(jsonObject);
return jsonObject.toJSONString();
}
}