rm30335
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| rm30335 [2019/04/08 09:13] – [Fix] kalaschnikow | rm30335 [2019/04/08 15:38] (current) – [Analyse] kalaschnikow | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== rm30335 DA Fehler 462 tauchen nicht mehr im Despatch Advice Error Report auf ====== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ===== Nachvollziehen ===== | ||
| + | - Smarti Admin Kundenprofile / DA Conf -> AIRBUS | ||
| + | - Bestellung mit 2 Positionen mit 2 verschiedenen Final Delivery Locations | ||
| + | - Eine DA importieren, | ||
| + | - 2 Positionen enthält, die auf diesen 2 verschiedenen Order Positionen basieren | ||
| + | - Noch schlimmer wird es wenn die 2 DA Positionen in der gleichen UX sind | ||
| + | |||
| + | ===== Analyse ===== | ||
| + | |||
| + | * Ursache: In '' | ||
| + | * Der Code, der den Fehler verursacht, wurde für [[https:// | ||
| + | |||
| + | Hat mit der Sache eigentlich nichts zu tun ist aber interessant: | ||
| + | * Die Methode '' | ||
| + | |||
| + | ===== Fix ===== | ||
| + | ==== Variante 1 ==== | ||
| + | Die umgekehrte Operation zu: | ||
| + | <code java> | ||
| + | ClientResultMessageEntry clientMessage = | ||
| + | ErrorMsgUtil.getClientResultMessageEntry( ctx, | ||
| + | uiErrMsgObj, | ||
| + | uiErrMsgObj.getRelation() == null ? relation : uiErrMsgObj.getRelation(), | ||
| + | asnModel.getDespatchId(), | ||
| + | asnModel.getASNId(), | ||
| + | asnModel.getCreationDate(), | ||
| + | counter++ ); | ||
| + | </ | ||
| + | |||
| + | Also: | ||
| + | <code java> | ||
| + | /** | ||
| + | * This method makes the & | ||
| + | * {@link # | ||
| + | * Unfortunately the & | ||
| + | * @param clientMessage message to convert | ||
| + | * @return converted {@link UIErrorMsg} or null if the parameter clientMessage is null. | ||
| + | */ | ||
| + | public static UIErrorMsg convertClientResultMessageEntryToUiErrorMsg(ClientResultMessageEntry clientMessage) { | ||
| + | |||
| + | if(clientMessage==null || clientMessage.isSuccess()) { | ||
| + | return null; | ||
| + | } | ||
| + | |||
| + | UIErrorMsg uiErrMsgObj = new UIErrorMsg(); | ||
| + | // is NOT contained in getClientResultMessageEntry() | ||
| + | uiErrMsgObj.setErrorDescription(clientMessage.getText()); | ||
| + | |||
| + | // Nls nls = new Nls(); | ||
| + | // nls.init(ctx); | ||
| + | // | ||
| + | // int csvLineId = uiErrMsgObj.getCsvLineId(); | ||
| + | // String lineTxt = null; | ||
| + | // if (csvLineId != -1){ | ||
| + | // lineTxt = nls.getText(" | ||
| + | // } | ||
| + | // | ||
| + | // String asnIdentifier = null; | ||
| + | // if (despatchId != null && !despatchId.trim().equals("" | ||
| + | // asnIdentifier = nls.getText(" | ||
| + | // } | ||
| + | // | ||
| + | // String errorTxt = uiErrMsgObj.getErrorDescription(); | ||
| + | // if (asnIdentifier != null){ | ||
| + | // errorTxt += " "; | ||
| + | // errorTxt += asnIdentifier; | ||
| + | // } | ||
| + | // | ||
| + | // if (lineTxt != null){ | ||
| + | // errorTxt += " " +lineTxt; | ||
| + | // } | ||
| + | |||
| + | |||
| + | // clientMessage.setIsSuccess(false); | ||
| + | // clientMessage.setResultNumber(counter); | ||
| + | uiErrMsgObj.setErrorCode(clientMessage.getCode()); | ||
| + | uiErrMsgObj.setAreaName(clientMessage.getAreaName()); | ||
| + | // clientMessage.setReferenceId(despatchId); | ||
| + | uiErrMsgObj.setAlertCreationDate(clientMessage.getCreationDate()); | ||
| + | // clientMessage.setObjectCreationDate(creationDate); | ||
| + | |||
| + | if( clientMessage.getCustomerGroupName()!=null | ||
| + | && clientMessage.getSupplierGroupName()!=null | ||
| + | && clientMessage.getSupplierNumber()!=null ) { | ||
| + | RelationModel relation = new RelationModel(); | ||
| + | relation.setCustomerGroupName(clientMessage.getCustomerGroupName()); | ||
| + | relation.setSupplierGroupName(clientMessage.getSupplierGroupName()); | ||
| + | relation.setSupplierNo(clientMessage.getSupplierNumber()); | ||
| + | |||
| + | uiErrMsgObj.setRelation(relation); | ||
| + | } | ||
| + | |||
| + | uiErrMsgObj.setObjectId(clientMessage.getObjectId()); | ||
| + | uiErrMsgObj.setFieldName(clientMessage.getFieldName()); | ||
| + | // clientMessage.setNlsDefaultMessage(errorTxt); | ||
| + | uiErrMsgObj.setPageId(clientMessage.getTargetId()); | ||
| + | try { | ||
| + | uiErrMsgObj.setSectionName(ASN_SECTION.valueOf(clientMessage.getSectionName())); | ||
| + | } catch (IllegalArgumentException e) { | ||
| + | // do nothing here | ||
| + | } | ||
| + | |||
| + | uiErrMsgObj.setPreventRefIdLink(clientMessage.isPreventRefIdLink()); | ||
| + | uiErrMsgObj.setPreventSectionLink(clientMessage.isPreventSectionLink()); | ||
| + | |||
| + | copyRefIdList(clientMessage, | ||
| + | |||
| + | return uiErrMsgObj; | ||
| + | } | ||
| + | |||
| + | private static void copyRefIdList(ClientResultMessageEntry clientMessage, | ||
| + | List< | ||
| + | |||
| + | if(fromList!=null) { | ||
| + | |||
| + | List< | ||
| + | |||
| + | for (Map< | ||
| + | Map< | ||
| + | |||
| + | for(Entry< | ||
| + | |||
| + | String key = fieldRefIdsEntry.getKey(); | ||
| + | if (ClientResultMessageEntry.REFERENCE_KEYS.INTERNAL_OBJECTID.toString().equals(key)) { | ||
| + | if (uiErrMsgObj.getInternalObjectId()==0) { | ||
| + | uiErrMsgObj.setInternalObjectId(parseStringToIntOrDefault(fieldRefIdsEntry.getValue(), | ||
| + | } | ||
| + | } else if ( ClientResultMessageEntry.REFERENCE_KEYS.INTERNAL_REFERENCEID.toString().equals(key) ) { | ||
| + | if (uiErrMsgObj.getInternalReferenceId()==0) { | ||
| + | uiErrMsgObj.setInternalReferenceId(parseStringToIntOrDefault(fieldRefIdsEntry.getValue(), | ||
| + | } | ||
| + | } else if ( ClientResultMessageEntry.REFERENCE_KEYS.FILTER_NAME.toString().equals(key) ) { | ||
| + | if (StringUtils.isEmpty(uiErrMsgObj.getFilterName())) { | ||
| + | uiErrMsgObj.setFilterName(fieldRefIdsEntry.getValue()); | ||
| + | } | ||
| + | } else if ( ClientResultMessageEntry.REFERENCE_KEYS.ATTRIBUTE_NAME.toString().equals(key) ) { | ||
| + | if (StringUtils.isEmpty(uiErrMsgObj.getAttributeName())) { | ||
| + | uiErrMsgObj.setAttributeName(fieldRefIdsEntry.getValue()); | ||
| + | } | ||
| + | } else // | ||
| + | if ( ClientResultMessageEntry.REFERENCE_KEYS.DOCUMENT_ID.toString().equals(key) ) { | ||
| + | // asnId = Integer.parseInt(fieldRefIdsEntry.getValue()); | ||
| + | // do nothing for now | ||
| + | } else { | ||
| + | toMap.put(fieldRefIdsEntry.getKey(), | ||
| + | } | ||
| + | } | ||
| + | toList.add(toMap); | ||
| + | } | ||
| + | uiErrMsgObj.setFieldRefIds(toList); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @SuppressWarnings(" | ||
| + | private static int parseStringToIntOrDefault(String value, int defaultInt) { | ||
| + | try { | ||
| + | return Integer.parseInt(value); | ||
| + | } catch (NumberFormatException e) { | ||
| + | return defaultInt; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Variante 2 ==== | ||
| + | |||
| + | Diese Variante ziehen wir vor, da der Code so gut wie gar nicht geändert werden muss. Wir nutzen aus, dass die Methode '' | ||
| + | |||
| + | |||
| + | ===== Test ===== | ||
| + | * **-** Test, whether the error messages are not written twice for CSV upload | ||
| + | |||
