{"data":{"exception":"DbUpdateException","message":"An error occurred while saving the entity changes. See the inner exception for details.","helpLink":null,"data":{},"source":"Npgsql.EntityFrameworkCore.PostgreSQL","stackTrace":" at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)\n at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)\n 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 E:\\redsand\\BaseV2-Net6\\Data\\ApplicationDbContext.cs:line 257\n at Redsand.Site.Api.OrdersEcommerceController.Create(EcommerceOrderBody model, String conversationId) in E:\\redsand\\BaseV2-Net6\\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 \"PK_EcommerceInvoiceDetails\"\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 \"PK_EcommerceInvoiceDetails\"","detail":"Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.","schemaName":"public","tableName":"EcommerceInvoiceDetails","constraintName":"PK_EcommerceInvoiceDetails","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.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)","inner":null}},"status":400,"statusText":"","headers":{"access-control-allow-origin":"*","cache-control":"no-store","content-type":"application/json; charset=utf-8","date":"Sun, 11 Jan 2026 13:07:47 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.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjE0IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6IjAzMzczOTY3NjIiLCJBc3BOZXQuSWRlbnRpdHkuU2VjdXJpdHlTdGFtcCI6IkRUWVdSSkQyRVJYUUxFWUZGMzNNNUNPSlZZVlRBN1JPIiwic3ViIjoiMDMzNzM5Njc2MiIsImp0aSI6IjM3OWNhNzcwLWFiOWUtNGZkOC1iMTZjLTMzOWI3Yjg1ZTc5ZiIsImlhdCI6MTc2ODEyODMzMywiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9yb2xlIjpbIjMtbGVhZGVyLXNhbGUiLCI1LW5oYW4tdmllbi1raG8iLCI1LW5oYW4tdmllbi12YW4tZG9uIiwiMy1zYWxlLXRydWMtcGFnZSJdLCJuYmYiOjE3NjgxMjgzMzMsImV4cCI6MTc2ODIxNDczMywiaXNzIjoiUlMiLCJhdWQiOiJSUyJ9.MucAzBl2ieoArmJL9DwhUwOAJeHqtVcHn-uLH6W6b0Q","ContentType":"application/json","x-hour-offset":"7","BranchId":"1","Locale":"vi"},"baseURL":"https://gaongoc.nobi.pro","paramsSerializer":{},"method":"post","url":"/api/orders","data":"{\"invoice\":{\"type\":1,\"customerId\":28891,\"isDiscountPrice\":true,\"discount\":0,\"relatedCustomerId\":null,\"details\":null,\"warehouseId\":1,\"notes\":null,\"vat\":0,\"total\":74.99,\"shippingFee\":0,\"shippingFeeX\":0,\"ecommerceDetails\":[{\"id\":97956,\"productId\":89,\"nProductId\":null,\"price\":28,\"quantity\":2,\"discount\":2,\"isDiscountPrice\":true,\"notes\":null,\"inventory\":-23525,\"weight\":11360,\"isCombo\":false,\"product\":{\"id\":89,\"sku\":\"8936087310065\",\"unit\":\"Bao\",\"name\":\"Gạo ST25 Long Châu 66 BAO 11.36kg\",\"code\":\"001.1\",\"weight\":11360,\"length\":null,\"width\":null,\"height\":null,\"primaryImage\":null,\"inventories\":[{\"warehouseId\":1,\"inventory\":-23525}],\"metas\":[],\"model_id\":null,\"item_id\":null},\"length\":null,\"width\":null,\"height\":null,\"totalAmount\":54,\"quantityX\":2},{\"productId\":473,\"key\":473,\"isCombo\":false,\"product\":{\"id\":473,\"name\":\"Mì Omachi Bò THÙNG\",\"weight\":2300,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":null,\"sku\":\"005.32-30\",\"code\":\"005.84\",\"price\":23.99,\"unit\":\"THÙNG\",\"inventoryBefore\":0,\"inventory\":-1116,\"productId\":473,\"priceAvg\":0,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":2300,\"length\":1,\"width\":1,\"height\":1,\"price\":23.99,\"discount\":3,\"isDiscountPrice\":true,\"totalAmount\":20.99,\"quantityX\":1}]},\"customer\":null,\"transporter\":null,\"weight\":25020,\"salerId\":14,\"status\":1,\"checkingPolicy\":1,\"customerName\":\"Phạm Văn Toàn\",\"customerNotes\":\"\",\"customerPhoneNumber\":\"0845777888\",\"orderAddress\":{\"provinceId\":null,\"districtId\":null,\"wardId\":null,\"shippingAddress\":null,\"provinceName\":null,\"districtName\":null,\"wardName\":null},\"orderExtra\":{\"weight\":25020,\"flagsStr\":\"{}\",\"flags\":{}},\"orderFee\":{},\"transporterServiceId\":null,\"transportType\":0,\"isFreeShipping\":false,\"isCustomFee\":false,\"couponIds\":[],\"totalAmount\":74.99,\"conversationId\":\"101589914693427_25835168946091271\",\"createdFrom\":\"nobichat\"}"},"request":{}}
"{\"invoice\":{\"type\":1,\"customerId\":28891,\"isDiscountPrice\":true,\"discount\":0,\"relatedCustomerId\":null,\"details\":null,\"warehouseId\":1,\"notes\":null,\"vat\":0,\"total\":74.99,\"shippingFee\":0,\"shippingFeeX\":0,\"ecommerceDetails\":[{\"id\":97956,\"productId\":89,\"nProductId\":null,\"price\":28,\"quantity\":2,\"discount\":2,\"isDiscountPrice\":true,\"notes\":null,\"inventory\":-23525,\"weight\":11360,\"isCombo\":false,\"product\":{\"id\":89,\"sku\":\"8936087310065\",\"unit\":\"Bao\",\"name\":\"Gạo ST25 Long Châu 66 BAO 11.36kg\",\"code\":\"001.1\",\"weight\":11360,\"length\":null,\"width\":null,\"height\":null,\"primaryImage\":null,\"inventories\":[{\"warehouseId\":1,\"inventory\":-23525}],\"metas\":[],\"model_id\":null,\"item_id\":null},\"length\":null,\"width\":null,\"height\":null,\"totalAmount\":54,\"quantityX\":2},{\"productId\":473,\"key\":473,\"isCombo\":false,\"product\":{\"id\":473,\"name\":\"Mì Omachi Bò THÙNG\",\"weight\":2300,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":null,\"sku\":\"005.32-30\",\"code\":\"005.84\",\"price\":23.99,\"unit\":\"THÙNG\",\"inventoryBefore\":0,\"inventory\":-1116,\"productId\":473,\"priceAvg\":0,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":2300,\"length\":1,\"width\":1,\"height\":1,\"price\":23.99,\"discount\":3,\"isDiscountPrice\":true,\"totalAmount\":20.99,\"quantityX\":1}]},\"customer\":null,\"transporter\":null,\"weight\":25020,\"salerId\":14,\"status\":1,\"checkingPolicy\":1,\"customerName\":\"Phạm Văn Toàn\",\"customerNotes\":\"\",\"customerPhoneNumber\":\"0845777888\",\"orderAddress\":{\"provinceId\":null,\"districtId\":null,\"wardId\":null,\"shippingAddress\":null,\"provinceName\":null,\"districtName\":null,\"wardName\":null},\"orderExtra\":{\"weight\":25020,\"flagsStr\":\"{}\",\"flags\":{}},\"orderFee\":{},\"transporterServiceId\":null,\"transportType\":0,\"isFreeShipping\":false,\"isCustomFee\":false,\"couponIds\":[],\"totalAmount\":74.99,\"conversationId\":\"101589914693427_25835168946091271\",\"createdFrom\":\"nobichat\"}"