{"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\\Data\\ApplicationDbContext.cs:line 257\n at Redsand.Site.Api.OrdersEcommerceController.Create(EcommerceOrderBody model, String conversationId) in D:\\WORKSPACE\\ECRM-NOBI-R2\\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":"Sat, 10 Jan 2026 07:02:59 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.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ4IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6Im5oYW52aWVudGh1eWR1b25nIiwiQXNwTmV0LklkZW50aXR5LlNlY3VyaXR5U3RhbXAiOiJUQUhRTUZBVDJBT1M3R1JZSEJTRFVMRzNHVERHUk1NRiIsInN1YiI6Im5oYW52aWVudGh1eWR1b25nIiwianRpIjoiOTI5Y2QzMDEtYTNlZi00ZGFiLWFhNTctMDdjNTAwZDVjMTliIiwiaWF0IjoxNzY3MjM2MzM1LCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3JvbGUiOlsiMS1naWFtLWRvYyIsIjMtc2FsZS10cnVjLXBhZ2UiLCI2LW5oYW4tdmllbi1iYW4taGFuZyJdLCJuYmYiOjE3NjcyMzYzMzUsImV4cCI6MTc2OTgyODMzNSwiaXNzIjoiUlMiLCJhdWQiOiJSUyJ9.3cwJhjuPswHUtGW5JP03jff_DbmCjk7VEF-QtccHMhE","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\":345154,\"isDiscountPrice\":true,\"discount\":0,\"relatedCustomerId\":null,\"details\":null,\"warehouseId\":1,\"notes\":null,\"vat\":0,\"total\":450000,\"shippingFee\":18000,\"shippingFeeX\":18000,\"ecommerceDetails\":[{\"productId\":253491,\"key\":253491,\"isCombo\":false,\"product\":{\"id\":253491,\"name\":\"A Serum chống nắng nâng tone hàn S98\",\"weight\":0,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":\"/uploads/thoitrangcaocap6666.nobi.pro/product/44ee5a9f35ef4acb9b3eda0b669bd012-jpeg.jpg\",\"sku\":null,\"code\":\"SP8111718984\",\"price\":550000,\"unit\":\"--\",\"inventoryBefore\":0,\"inventory\":177,\"productId\":143109,\"priceAvg\":248000,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":50,\"length\":1,\"width\":1,\"height\":1,\"price\":550000,\"discount\":100000,\"isDiscountPrice\":true,\"totalAmount\":450000,\"quantityX\":1}],\"insuranceValue\":\"450000.000\"},\"customer\":null,\"sourceId\":15,\"transporter\":null,\"transporterId\":null,\"trackingCode\":null,\"weight\":999,\"salerId\":48,\"status\":1,\"checkingPolicy\":3,\"customerName\":\"Tran Tran\",\"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\":\"0913601467\",\"orderAddress\":{\"provinceId\":\"75\",\"districtId\":\"75732_X\",\"wardId\":\"7573226080_X\",\"addressLevel4\":\" \",\"shippingAddress\":\"6 nguyễn bình khiêm\",\"provinceName\":\"Đồng Nai\",\"districtName\":\"Thị xã Long Khánh\",\"wardName\":\"Phường Xuân An\"},\"orderExtra\":{\"weight\":999,\"flagsStr\":\"{}\",\"flags\":{}},\"orderFee\":{},\"transporterServiceId\":null,\"transportType\":0,\"isFreeShipping\":true,\"isCustomFee\":false,\"couponIds\":[],\"totalAmount\":450000,\"conversationId\":\"105844335585735_24602444679416054\",\"createdFrom\":\"nobichat\"}"},"request":{}}
"{\"invoice\":{\"type\":1,\"customerId\":345154,\"isDiscountPrice\":true,\"discount\":0,\"relatedCustomerId\":null,\"details\":null,\"warehouseId\":1,\"notes\":null,\"vat\":0,\"total\":450000,\"shippingFee\":18000,\"shippingFeeX\":18000,\"ecommerceDetails\":[{\"productId\":253491,\"key\":253491,\"isCombo\":false,\"product\":{\"id\":253491,\"name\":\"A Serum chống nắng nâng tone hàn S98\",\"weight\":0,\"length\":null,\"width\":null,\"height\":null,\"isCombo\":false,\"url\":\"/uploads/thoitrangcaocap6666.nobi.pro/product/44ee5a9f35ef4acb9b3eda0b669bd012-jpeg.jpg\",\"sku\":null,\"code\":\"SP8111718984\",\"price\":550000,\"unit\":\"--\",\"inventoryBefore\":0,\"inventory\":177,\"productId\":143109,\"priceAvg\":248000,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":50,\"length\":1,\"width\":1,\"height\":1,\"price\":550000,\"discount\":100000,\"isDiscountPrice\":true,\"totalAmount\":450000,\"quantityX\":1}],\"insuranceValue\":\"450000.000\"},\"customer\":null,\"sourceId\":15,\"transporter\":null,\"transporterId\":null,\"trackingCode\":null,\"weight\":999,\"salerId\":48,\"status\":1,\"checkingPolicy\":3,\"customerName\":\"Tran Tran\",\"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\":\"0913601467\",\"orderAddress\":{\"provinceId\":\"75\",\"districtId\":\"75732_X\",\"wardId\":\"7573226080_X\",\"addressLevel4\":\" \",\"shippingAddress\":\"6 nguyễn bình khiêm\",\"provinceName\":\"Đồng Nai\",\"districtName\":\"Thị xã Long Khánh\",\"wardName\":\"Phường Xuân An\"},\"orderExtra\":{\"weight\":999,\"flagsStr\":\"{}\",\"flags\":{}},\"orderFee\":{},\"transporterServiceId\":null,\"transportType\":0,\"isFreeShipping\":true,\"isCustomFee\":false,\"couponIds\":[],\"totalAmount\":450000,\"conversationId\":\"105844335585735_24602444679416054\",\"createdFrom\":\"nobichat\"}"