{"data":{"exception":"InvalidOperationException","message":"The instance of entity type 'EcommerceOrder' cannot be tracked because another instance with the key value '{Id: 1701}' is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached.","helpLink":null,"data":{},"source":"Microsoft.EntityFrameworkCore","stackTrace":" at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.ThrowIdentityConflict(InternalEntityEntry entry)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.Add(TKey key, InternalEntityEntry entry, Boolean updateDuplicate)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking(InternalEntityEntry entry)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges, Boolean modifyProperties)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction(EntityEntryGraphNode`1 node)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)\n at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph(InternalEntityEntry rootEntry, EntityState targetState, EntityState storeGeneratedWithKeySetTargetState, Boolean forceStateWhenUnknownKey)\n at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.Attach(TEntity entity)\n at Redsand.Site.Services.OrderService.EcommerceUpdateInventoryAsync(EcommerceOrder order, String message, Boolean reInclude, ApplicationDbContext _db) in D:\\WORKSPACE\\ECRM-NOBI-R2\\Services\\Order\\OrderService.cs:line 398\n at Redsand.Site.Api.OrdersEcommerceController.Update(Int32 id, EcommerceOrderBody model) in D:\\WORKSPACE\\ECRM-NOBI-R2\\Api\\EcommerceOrder\\OrderController.cs:line 3382\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":null},"status":400,"statusText":"","headers":{"access-control-allow-origin":"*","cache-control":"no-store","content-type":"application/json; charset=utf-8","date":"Fri, 09 Jan 2026 10:23:04 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.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjIiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZ2lhbWRvYyIsIkFzcE5ldC5JZGVudGl0eS5TZWN1cml0eVN0YW1wIjoiUEJSRlU0UU1SMlRNNTNMQ0k1SUFYTlFKWERENUk3QVoiLCJzdWIiOiJnaWFtZG9jIiwianRpIjoiY2EwODQwYzQtODk3OS00YWQwLWE5NmUtYzEzMzJiZDQyZjgzIiwiaWF0IjoxNzY3MzQ3MDU5LCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3JvbGUiOlsiQWRtaW5pc3RyYXRvcnMiLCIxLWdpYW0tZG9jIl0sIm5iZiI6MTc2NzM0NzA1OSwiZXhwIjoxNzY4NjQzMDU5LCJpc3MiOiJSUyIsImF1ZCI6IlJTIn0.ALw8pxgvx4aFM-Ufw5Z041DmPTcA2KkgzFvUCKYnmBc","ContentType":"application/json","x-hour-offset":"7","BranchId":"1","Locale":"vi"},"baseURL":"https://zinworkshop.dcso.pro","paramsSerializer":{},"method":"put","url":"/api/orders/1701","data":"{\"invoice\":{\"type\":1,\"customerId\":3278,\"isDiscountPrice\":false,\"relatedCustomerId\":null,\"id\":2029,\"code\":\"XB001178\",\"userId\":3,\"couponCode\":null,\"discount\":35,\"createDate\":\"2026-01-09T10:21:18.806752Z\",\"notes\":\"\",\"reason\":null,\"vat\":0,\"cod\":0,\"posOrderId\":null,\"posSyncDate\":null,\"warehouseId\":1,\"branchId\":1,\"depositAmount\":null,\"shippingFee\":47000,\"shippingFeeX\":47000,\"transferAmount\":null,\"total\":71500,\"insuranceValue\":\"110000.000\",\"status\":1,\"branchName\":\"Chi nhánh chính\",\"isEmpty\":false,\"ecommerceDetails\":[{\"productId\":126,\"key\":126,\"isCombo\":false,\"product\":{\"id\":126,\"name\":\"TINH MÀU GỐC DẦU(100ml - 12)\",\"weight\":150,\"length\":15,\"width\":15,\"height\":15,\"isCombo\":false,\"url\":null,\"sku\":null,\"code\":\"BP1124203\",\"price\":150000,\"unit\":\"LỌ\",\"inventoryBefore\":0,\"inventory\":9,\"productId\":67,\"priceAvg\":49133,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":150,\"length\":15,\"width\":15,\"height\":15,\"price\":110000,\"discount\":0,\"isDiscountPrice\":false,\"totalAmount\":110000,\"quantityX\":1}],\"returnFee\":0,\"coupons\":[],\"details\":null},\"customer\":null,\"transporter\":null,\"id\":1701,\"createDate\":\"2026-01-09T10:21:18.813677Z\",\"campaignId\":null,\"campaignName\":null,\"code\":\"DH001177\",\"invoiceId\":2029,\"salerId\":3,\"shop\":null,\"status\":1,\"customerName\":\"Dầu Lau Gỗ Osmo\",\"customerNotes\":\"Hàng chất lỏng\",\"customerPhoneNumber\":\"0977248812\",\"buyerPriceTotal\":-71500,\"customerAvatar\":\"https://s120-ava-talk.zadn.vn/d/a/4/5/3/120/525491773c380a9604c22ec1bc544ce9.jpg\",\"customerPageScopeId\":\"\",\"deliveringNote\":null,\"totalAmount\":71500,\"discountTotal\":269500,\"priceTotal\":770000,\"country\":null,\"wardId\":\"4041216705\",\"provinceId\":\"40\",\"districtId\":\"40412\",\"shippingAddress\":\"địa chỉ: Cty TNHH Lam Sơn Bách Mộc số 68 đường 72M, Xã Hưng Đông, Thành phố Vinh, Nghệ An\",\"districtName\":\"Thành phố Vinh\",\"provinceName\":\"Nghệ An\",\"addressLevel4\":null,\"wardName\":\"Xã Hưng Đông\",\"shippingStatus\":1,\"packageId\":null,\"totalVat\":0,\"transporterId\":null,\"transporterServiceId\":null,\"trackingCode\":null,\"sendTransporterDate\":null,\"expectedDeliveryTime\":null,\"customerReceivedDate\":null,\"isFreeShipping\":false,\"transportType\":0,\"weight\":150,\"length\":null,\"height\":null,\"width\":null,\"adId\":null,\"conversationId\":null,\"checkingPolicy\":3,\"orderFee\":{\"id\":1701,\"discountVoucher\":0,\"discountVoucherPlatform\":0,\"discountShopeeCoin\":0,\"discountWallet\":0,\"shippingFeeSeller\":0,\"shippingFeePlatform\":0,\"originalShippingFee\":0,\"priceExcel\":0,\"transactionFee\":0,\"affiliateCommission\":0,\"platformCommission\":0,\"previousRevenue\":0,\"settlementRevenue\":null,\"tikTokDiscountFee\":0,\"settlementAmount\":0,\"settlementInfo\":null,\"settlementInfoObj\":null,\"salePrice\":-88000,\"customerPrice\":-71500,\"customerPriceCod\":null},\"orderAddress\":{\"id\":1782,\"shippingAddress\":\"địa chỉ: Cty TNHH Lam Sơn Bách Mộc số 68 đường 72M, Xã Hưng Đông, Thành phố Vinh, Nghệ An\",\"provinceId\":\"40\",\"districtId\":\"40412\",\"wardId\":\"4041216705\",\"wardName\":\"Xã Hưng Đông\",\"provinceName\":\"Nghệ An\",\"districtName\":\"Thành phố Vinh\"},\"orderExtra\":{\"id\":1701,\"userCrossCheckedId\":null,\"userCrossChecked\":null,\"userConfirmReturnedId\":null,\"userConfirmReturned\":null,\"cancelReason\":null,\"crossCheckedStatus\":null,\"currentWarehouseName\":null,\"numberOfPackages\":null,\"isInfoFromChat\":false,\"unLockDate\":null,\"sendTransporterDate\":null,\"expectedDeliveryTime\":null,\"customerReceivedDate\":null,\"lastUpdateTime\":null,\"cancelTime\":null,\"confirmReturnedDate\":null,\"crossCheckedDate\":null,\"flags\":{},\"flagsStr\":\"{}\",\"sortLine\":null,\"weight\":150,\"length\":null,\"width\":null,\"height\":null},\"type\":4,\"flags\":{\"isFood\":false,\"isFragile\":false,\"isSealBox\":false,\"noStack\":false,\"arranged\":false,\"bbseco\":false,\"partialDelivery\":false,\"orderServiceAdd\":null},\"transporterName\":null,\"isCustomFee\":false,\"sourceName\":null,\"salerName\":\"Trưởng Bùi Quốc\",\"salerPhoneNumber\":\"0336864994\",\"customerBuy\":{\"address\":\"địa chỉ: Cty TNHH Lam Sơn Bách Mộc số 68 đường 72M, Xã Hưng Đông, Thành phố Vinh, Nghệ An\",\"fullName\":\"Dầu Lau Gỗ Osmo\",\"phone\":\"0977248812\",\"location\":{\"provinceId\":null,\"districtId\":null,\"wardId\":null,\"wardName\":\"Xã Hưng Đông\",\"provinceName\":\"Nghệ An\",\"districtName\":\"Thành phố Vinh\"}},\"tags\":[],\"couponIds\":[],\"orderAddressId\":1782,\"orderExtraId\":1701,\"orderFeeId\":1701}"},"request":{}}
"{\"invoice\":{\"type\":1,\"customerId\":3278,\"isDiscountPrice\":false,\"relatedCustomerId\":null,\"id\":2029,\"code\":\"XB001178\",\"userId\":3,\"couponCode\":null,\"discount\":35,\"createDate\":\"2026-01-09T10:21:18.806752Z\",\"notes\":\"\",\"reason\":null,\"vat\":0,\"cod\":0,\"posOrderId\":null,\"posSyncDate\":null,\"warehouseId\":1,\"branchId\":1,\"depositAmount\":null,\"shippingFee\":47000,\"shippingFeeX\":47000,\"transferAmount\":null,\"total\":71500,\"insuranceValue\":\"110000.000\",\"status\":1,\"branchName\":\"Chi nhánh chính\",\"isEmpty\":false,\"ecommerceDetails\":[{\"productId\":126,\"key\":126,\"isCombo\":false,\"product\":{\"id\":126,\"name\":\"TINH MÀU GỐC DẦU(100ml - 12)\",\"weight\":150,\"length\":15,\"width\":15,\"height\":15,\"isCombo\":false,\"url\":null,\"sku\":null,\"code\":\"BP1124203\",\"price\":150000,\"unit\":\"LỌ\",\"inventoryBefore\":0,\"inventory\":9,\"productId\":67,\"priceAvg\":49133,\"ecommerceFloorVariationId\":null},\"quantity\":1,\"weight\":150,\"length\":15,\"width\":15,\"height\":15,\"price\":110000,\"discount\":0,\"isDiscountPrice\":false,\"totalAmount\":110000,\"quantityX\":1}],\"returnFee\":0,\"coupons\":[],\"details\":null},\"customer\":null,\"transporter\":null,\"id\":1701,\"createDate\":\"2026-01-09T10:21:18.813677Z\",\"campaignId\":null,\"campaignName\":null,\"code\":\"DH001177\",\"invoiceId\":2029,\"salerId\":3,\"shop\":null,\"status\":1,\"customerName\":\"Dầu Lau Gỗ Osmo\",\"customerNotes\":\"Hàng chất lỏng\",\"customerPhoneNumber\":\"0977248812\",\"buyerPriceTotal\":-71500,\"customerAvatar\":\"https://s120-ava-talk.zadn.vn/d/a/4/5/3/120/525491773c380a9604c22ec1bc544ce9.jpg\",\"customerPageScopeId\":\"\",\"deliveringNote\":null,\"totalAmount\":71500,\"discountTotal\":269500,\"priceTotal\":770000,\"country\":null,\"wardId\":\"4041216705\",\"provinceId\":\"40\",\"districtId\":\"40412\",\"shippingAddress\":\"địa chỉ: Cty TNHH Lam Sơn Bách Mộc số 68 đường 72M, Xã Hưng Đông, Thành phố Vinh, Nghệ An\",\"districtName\":\"Thành phố Vinh\",\"provinceName\":\"Nghệ An\",\"addressLevel4\":null,\"wardName\":\"Xã Hưng Đông\",\"shippingStatus\":1,\"packageId\":null,\"totalVat\":0,\"transporterId\":null,\"transporterServiceId\":null,\"trackingCode\":null,\"sendTransporterDate\":null,\"expectedDeliveryTime\":null,\"customerReceivedDate\":null,\"isFreeShipping\":false,\"transportType\":0,\"weight\":150,\"length\":null,\"height\":null,\"width\":null,\"adId\":null,\"conversationId\":null,\"checkingPolicy\":3,\"orderFee\":{\"id\":1701,\"discountVoucher\":0,\"discountVoucherPlatform\":0,\"discountShopeeCoin\":0,\"discountWallet\":0,\"shippingFeeSeller\":0,\"shippingFeePlatform\":0,\"originalShippingFee\":0,\"priceExcel\":0,\"transactionFee\":0,\"affiliateCommission\":0,\"platformCommission\":0,\"previousRevenue\":0,\"settlementRevenue\":null,\"tikTokDiscountFee\":0,\"settlementAmount\":0,\"settlementInfo\":null,\"settlementInfoObj\":null,\"salePrice\":-88000,\"customerPrice\":-71500,\"customerPriceCod\":null},\"orderAddress\":{\"id\":1782,\"shippingAddress\":\"địa chỉ: Cty TNHH Lam Sơn Bách Mộc số 68 đường 72M, Xã Hưng Đông, Thành phố Vinh, Nghệ An\",\"provinceId\":\"40\",\"districtId\":\"40412\",\"wardId\":\"4041216705\",\"wardName\":\"Xã Hưng Đông\",\"provinceName\":\"Nghệ An\",\"districtName\":\"Thành phố Vinh\"},\"orderExtra\":{\"id\":1701,\"userCrossCheckedId\":null,\"userCrossChecked\":null,\"userConfirmReturnedId\":null,\"userConfirmReturned\":null,\"cancelReason\":null,\"crossCheckedStatus\":null,\"currentWarehouseName\":null,\"numberOfPackages\":null,\"isInfoFromChat\":false,\"unLockDate\":null,\"sendTransporterDate\":null,\"expectedDeliveryTime\":null,\"customerReceivedDate\":null,\"lastUpdateTime\":null,\"cancelTime\":null,\"confirmReturnedDate\":null,\"crossCheckedDate\":null,\"flags\":{},\"flagsStr\":\"{}\",\"sortLine\":null,\"weight\":150,\"length\":null,\"width\":null,\"height\":null},\"type\":4,\"flags\":{\"isFood\":false,\"isFragile\":false,\"isSealBox\":false,\"noStack\":false,\"arranged\":false,\"bbseco\":false,\"partialDelivery\":false,\"orderServiceAdd\":null},\"transporterName\":null,\"isCustomFee\":false,\"sourceName\":null,\"salerName\":\"Trưởng Bùi Quốc\",\"salerPhoneNumber\":\"0336864994\",\"customerBuy\":{\"address\":\"địa chỉ: Cty TNHH Lam Sơn Bách Mộc số 68 đường 72M, Xã Hưng Đông, Thành phố Vinh, Nghệ An\",\"fullName\":\"Dầu Lau Gỗ Osmo\",\"phone\":\"0977248812\",\"location\":{\"provinceId\":null,\"districtId\":null,\"wardId\":null,\"wardName\":\"Xã Hưng Đông\",\"provinceName\":\"Nghệ An\",\"districtName\":\"Thành phố Vinh\"}},\"tags\":[],\"couponIds\":[],\"orderAddressId\":1782,\"orderExtraId\":1701,\"orderFeeId\":1701}"