Uploaded image for project: 'CFA MX '
  1. CFA MX
  2. CFAMX-23006

The "Requested Operation Failed" when creating a purchase order in InFORM

    Details

    • Type: Customer Defect
    • Status: Done (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: CFA 2022R5
    • Fix Version/s: CFA 2023R1
    • Component/s: Ordering
    • Labels:
      None
    • VTask #:
      VTASK0505922
    • Root cause - Reason:
      Code defect
    • Source Code ID(s):
    • Root Cause:
      duplicate data fix

      Description

      CFA reported that they are receiving "Requested Operation Failed" when attempt the create new purchase orders.

      Ex: Store 00123 , Vendor = QCD SVCS with the dates in the screenshot below:

      We were able to replicate the issue in ATL2CFAWEBV001 and get the elmah logs:

      https://m.inform.cfahome.com/elmah.axd/detail?id=b56c9702-bdea-4c34-b6b3-e341f4629e1d

      Violation of PRIMARY KEY constraint 'PK_#BA190A7_ED7FE9926B2AED4A'. Cannot insert duplicate key in object 'dbo.@closedDays'. The duplicate key value is (2022-12-25). The statement has been terminated.

      System.Data.SqlClient.SqlExceptionViolation of PRIMARY KEY constraint 'PK_#BA190A7_ED7FE9926B2AED4A'. Cannot insert duplicate key in object 'dbo.@closedDays'. The duplicate key value is (2022-12-25). The statement has been terminated.
      NHibernate.Exceptions.GenericADOException: could not execute query [ EXEC [dbo].[MXC_Forecast_GetOrderItemForecastByDateRangeWithProcessingTimes] @p0, @p1, @p2, @p3 ] Name:entityId - Value:80 Name:startDate - Value:12/14/2022 2:30:00 PM Name:endDate - Value:12/23/2022 9:00:00 PM Name:serviceTypes - Value:1,2 [SQL: EXEC [dbo].[MXC_Forecast_GetOrderItemForecastByDateRangeWithProcessingTimes] @p0, @p1, @p2, @p3] ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_#BA190A7ED7FE9926B2AED4A'. Cannot insert duplicate key in object 'dbo.@closedDays'. The duplicate key value is (2022-12-25). The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(DbCommand cmd) at NHibernate.Loader.Loader.GetResultSet(DbCommand st, QueryParameters queryParameters, ISessionImplementor session, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer) — End of inner exception stack trace — at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery customQuery, QueryParameters queryParameters, IList results) at NHibernate.Impl.AbstractSessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters, IList results) at NHibernate.Impl.AbstractSessionImpl.List[T](NativeSQLQuerySpecification spec, QueryParameters queryParameters) at NHibernate.Impl.SqlQueryImpl.List[T]() at Mx.Forecasting.Services.Repositories.InventoryItemMetricDetailRepository.GetInventoryItemTotalsByDateRangeWithExcludedWithProcessingTime(Int64 entityId, DateTime startDate, DateTime endDate, IEnumerable`1 excludedTypes) at Mx.Forecasting.Services.QueryServices.ForecastQueryServiceShim.GetItemProjectionsPerDateRangeWithExcluded(GetItemProjectionsPerDateRangeRequest request, ForecastFilterFunction function) at Mx.Inventory.Services.Inventory.AbstractOrderCommandHelper.GetItemProjectionsPerDateRangeAdjustedForecastQuantityLookup(GetItemProjectionsPerDateRangeRequest request, ForecastFilterFunction excludeFunction, Dictionary`2& totalForecast, Dictionary`2& includedForecast, Dictionary`2& excludedForecast) at Mx.Inventory.Services.Inventory.AbstractOrderCommandHelper.InsertProjectedOrderWithCubeDataForItemList(IList`1 allUnits, Int64 entityId, DateTime startDate, DateTime endDate, Nullable`1 templateType, Boolean useEntityItemAutoOrderType, ICollection`1 simpleOrderItemList, IEnumerable`1 allVeiList, Boolean setQuantityToZero, Boolean includeProcessingTime) at Mx.Inventory.Services.Inventory.AbstractOrderCommandHelper.ListAutoSelectOrder(Int64 entityId, Int64 vendorId, DateTime dateTimeOfOrder, DateTime endDate, Nullable`1 orderClassId, IList`1 allUnits, IEnumerable`1 allVeiList, Boolean includeProcessingTime) at Mx.Inventory.Services.Inventory.AbstractOrderCommandHelper.GetSalesOrderToCreateSupplyOrder(Int64 entityId, Int64 vendorId, DateTime deliveryDate, DateTime coverUntilDate, String userName, ActionItemInstance scheduledOrderInstance) at Mx.Inventory.Services.CommandServices.SalesOrderCommandService.CreateAutoSelectOrder(Int64 entityId, Int64 vendorId, DateTime deliveryDate, DateTime coverUntilDate, String userName, ActionItemInstance scheduledOrderInstance) at Mx.Inventory.Services.CommandServices.SalesOrderCommandService.CreateAutoSelectTemplate(Int64 entityId, Int64 vendorId, DateTime deliveryDate, DateTime coverUntilDate, String userName, Int32 actionItemInstanceId) at Mx.Web.UI.Areas.Inventory.Order.Api.OrderController.PostCreateAutoSelectTemplate(Int64 entityId, Int64 vendorId, String deliveryDate, String coverUntilDate) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.<GetExecutor>b9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d0.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d0.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d0.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d2.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d2.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d2.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d_0.MoveNext()

       

       

        Attachments

        1. image-2022-12-14-16-46-46-531.png
          19 kB
          Wesam El-Gendy
        2. image-2022-12-14-16-52-27-073.png
          126 kB
          Wesam El-Gendy
        3. image-2023-01-13-11-51-22-722.png
          21 kB
          Charles Wheeler

          Issue Links

            Activity

              People

              • Assignee:
                wesam.el-gendy Wesam El-Gendy
                Reporter:
                wesam.el-gendy Wesam El-Gendy
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.