{"data":{"exception":"DbUpdateException","message":"An error occurred while saving the entity changes. See the inner exception for details.","helpLink":null,"data":{},"source":"Microsoft.EntityFrameworkCore.Relational","stackTrace":" at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)\n at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)\n at Redsand.Site.Data.ApplicationDbContext.SaveChangesAsync(String caller, String file) in D:\\WORKSPACE\\ECRM-NOBI-R2\\NobiV2\\Data\\ApplicationDbContext.cs:line 257\n at Redsand.Site.Api.OrdersEcommerceController.Create(EcommerceOrderBody model, String conversationId) in D:\\WORKSPACE\\ECRM-NOBI-R2\\NobiV2\\Api\\EcommerceOrder\\OrderController.cs:line 771\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)","inner":{"exception":"PostgresException","message":"23505: duplicate key value violates unique constraint \"IX_Invoices_Code\"\n\nDETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.","helpLink":null,"data":{"severity":"ERROR","invariantSeverity":"ERROR","sqlState":"23505","messageText":"duplicate key value violates unique constraint \"IX_Invoices_Code\"","detail":"Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.","schemaName":"public","tableName":"Invoices","constraintName":"IX_Invoices_Code","file":"nbtinsert.c","line":"673","routine":"_bt_check_unique"},"source":"Npgsql","stackTrace":" at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|223_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)\n at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)\n at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)","inner":null}},"status":400,"statusText":"","headers":{"access-control-allow-origin":"*","cache-control":"no-store","content-type":"application/json; charset=utf-8","date":"Fri, 19 Dec 2025 06:39:15 GMT","expires":"0","pragma":"no-cache","server":"nginx/1.28.0"},"config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json","Content-Type":"application/json","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6Ijc5IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6Im5oYW52aWVkYW9xdXluaCIsIkFzcE5ldC5JZGVudGl0eS5TZWN1cml0eVN0YW1wIjoiTFJHNEI3NlBOVkhaQ0hJRjdVVDVNUkVFSUY1V1VRUUMiLCJzdWIiOiJuaGFudmllZGFvcXV5bmgiLCJqdGkiOiIzNjQxNmM0MC0xZGQ0LTRhNTAtYjhlMi0yYjkxZTZjNmZiNjciLCJpYXQiOjE3NjYxMjIzOTMsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6WyIxLWdpYW0tZG9jIiwiMy1zYWxlLXRydWMtcGFnZSJdLCJuYmYiOjE3NjYxMjIzOTMsImV4cCI6MTc2NjIwODc5MywiaXNzIjoiUlMiLCJhdWQiOiJSUyJ9.JUVZlxb3HRNqUHy5OMIb7lG6RrJXbY00h0uC3pBl8Bs","ContentType":"application/json","x-hour-offset":"7","BranchId":"1","Locale":"vi"},"baseURL":"https://thoitrangcaocap6666.nobi.pro","paramsSerializer":{},"method":"post","url":"/api/orders","data":"{\"invoice\":{\"type\":1,\"customerId\":165932,\"isDiscountPrice\":true,\"discount\":0,\"relatedCustomerId\":null,\"details\":null,\"warehouseId\":1,\"notes\":null,\"vat\":0,\"total\":1115000,\"shippingFee\":19000,\"shippingFeeX\":19000,\"ecommerceDetails\":[{\"productId\":251322,\"key\":251322,\"isCombo\":false,\"product\":{\"id\":251322,\"name\":\"Set len hoa cuốn cao cấp - Đỏ\",\"weight\":0,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":\"/uploads/thoitrangcaocap6666.nobi.pro/product/cae36714e4704abf9f1bdaad260bec36-jpeg.jpg\",\"sku\":null,\"code\":\"SP8111716825\",\"price\":1180000,\"unit\":\"--\",\"inventoryBefore\":0,\"inventory\":28,\"productId\":140941,\"priceAvg\":780000,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":50,\"length\":1,\"width\":1,\"height\":1,\"price\":1180000,\"discount\":100000,\"isDiscountPrice\":true,\"totalAmount\":1080000,\"quantityX\":1},{\"productId\":7996,\"key\":7996,\"isCombo\":false,\"product\":{\"id\":7996,\"name\":\"Tiền ship\",\"weight\":0,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":\"/uploads/thoitrangcaocap6666.nobi.pro/product/550dbccfcb1a4f8daf24729361c24061-jpeg.jpg\",\"sku\":null,\"code\":\"SP077746\",\"price\":35000,\"unit\":\"--\",\"inventoryBefore\":0,\"inventory\":9339,\"productId\":17013,\"priceAvg\":35000,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":50,\"length\":1,\"width\":1,\"height\":1,\"price\":35000,\"discount\":0,\"isDiscountPrice\":true,\"totalAmount\":35000,\"quantityX\":1}],\"insuranceValue\":\"1115000.000\"},\"customer\":null,\"sourceId\":15,\"transporter\":\"GiaoHangTietKiem\",\"transporterId\":11,\"trackingCode\":null,\"weight\":999,\"salerId\":79,\"status\":1,\"checkingPolicy\":3,\"customerName\":\"Huế Bếp FA\",\"customerNotes\":\" Đơn này khách cần gấp a! Không tự ý xem hàng , có vấn đề gì phát sinh gọi shop , Không Tự Ý Sửa Cod ! Không tự Huỷ đơn. Khách KO lấy hàng thu 50k ship. SDT shop: 0763381393. MINH PHUONG PHUNG TKS shipper nhiều . KHÁCH MUỐN KHIẾU NẠI VUI LÒNG QUAY VIDEO Ạ\",\"customerPhoneNumber\":\"0372010101\",\"orderAddress\":{\"provinceId\":\"36\",\"districtId\":\"36361\",\"wardId\":\"3636113909\",\"addressLevel4\":\" \",\"shippingAddress\":\"Cổng chính nhà thờ chương nghĩa\",\"provinceName\":\"Nam Định\",\"districtName\":\"Huyện Nghĩa Hưng\",\"wardName\":\"Xã Hoàng Nam\"},\"orderExtra\":{\"weight\":999,\"flagsStr\":\"{}\",\"flags\":{}},\"orderFee\":{},\"transporterServiceId\":\"4974\",\"transportType\":0,\"sendToTransporterAfterSave\":false,\"isFreeShipping\":true,\"isCustomFee\":false,\"couponIds\":[],\"totalAmount\":1115000,\"conversationId\":\"105844335585735_8109826499130583\",\"createdFrom\":\"nobichat\"}"},"request":{}}
"{\"invoice\":{\"type\":1,\"customerId\":165932,\"isDiscountPrice\":true,\"discount\":0,\"relatedCustomerId\":null,\"details\":null,\"warehouseId\":1,\"notes\":null,\"vat\":0,\"total\":1115000,\"shippingFee\":19000,\"shippingFeeX\":19000,\"ecommerceDetails\":[{\"productId\":251322,\"key\":251322,\"isCombo\":false,\"product\":{\"id\":251322,\"name\":\"Set len hoa cuốn cao cấp - Đỏ\",\"weight\":0,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":\"/uploads/thoitrangcaocap6666.nobi.pro/product/cae36714e4704abf9f1bdaad260bec36-jpeg.jpg\",\"sku\":null,\"code\":\"SP8111716825\",\"price\":1180000,\"unit\":\"--\",\"inventoryBefore\":0,\"inventory\":28,\"productId\":140941,\"priceAvg\":780000,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":50,\"length\":1,\"width\":1,\"height\":1,\"price\":1180000,\"discount\":100000,\"isDiscountPrice\":true,\"totalAmount\":1080000,\"quantityX\":1},{\"productId\":7996,\"key\":7996,\"isCombo\":false,\"product\":{\"id\":7996,\"name\":\"Tiền ship\",\"weight\":0,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":\"/uploads/thoitrangcaocap6666.nobi.pro/product/550dbccfcb1a4f8daf24729361c24061-jpeg.jpg\",\"sku\":null,\"code\":\"SP077746\",\"price\":35000,\"unit\":\"--\",\"inventoryBefore\":0,\"inventory\":9339,\"productId\":17013,\"priceAvg\":35000,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":50,\"length\":1,\"width\":1,\"height\":1,\"price\":35000,\"discount\":0,\"isDiscountPrice\":true,\"totalAmount\":35000,\"quantityX\":1}],\"insuranceValue\":\"1115000.000\"},\"customer\":null,\"sourceId\":15,\"transporter\":\"GiaoHangTietKiem\",\"transporterId\":11,\"trackingCode\":null,\"weight\":999,\"salerId\":79,\"status\":1,\"checkingPolicy\":3,\"customerName\":\"Huế Bếp FA\",\"customerNotes\":\" Đơn này khách cần gấp a! Không tự ý xem hàng , có vấn đề gì phát sinh gọi shop , Không Tự Ý Sửa Cod ! Không tự Huỷ đơn. Khách KO lấy hàng thu 50k ship. SDT shop: 0763381393. MINH PHUONG PHUNG TKS shipper nhiều . KHÁCH MUỐN KHIẾU NẠI VUI LÒNG QUAY VIDEO Ạ\",\"customerPhoneNumber\":\"0372010101\",\"orderAddress\":{\"provinceId\":\"36\",\"districtId\":\"36361\",\"wardId\":\"3636113909\",\"addressLevel4\":\" \",\"shippingAddress\":\"Cổng chính nhà thờ chương nghĩa\",\"provinceName\":\"Nam Định\",\"districtName\":\"Huyện Nghĩa Hưng\",\"wardName\":\"Xã Hoàng Nam\"},\"orderExtra\":{\"weight\":999,\"flagsStr\":\"{}\",\"flags\":{}},\"orderFee\":{},\"transporterServiceId\":\"4974\",\"transportType\":0,\"sendToTransporterAfterSave\":false,\"isFreeShipping\":true,\"isCustomFee\":false,\"couponIds\":[],\"totalAmount\":1115000,\"conversationId\":\"105844335585735_8109826499130583\",\"createdFrom\":\"nobichat\"}"