[步骤]
[16:30:51] -------------------------------------------------------------
CODE:N16305115
Error:21_596_1_-2146232060
SQL:UPDATE w
SET w.LockNum = tmp.OrderLockNum
FROM RB_WareHouse_Product w
INNER JOIN (SELECT whp.ID,
whp.LockNum,
Isnull((SELECT Sum(ol.LockNum)
FROM RB_OrderInfo oi (nolock)
LEFT JOIN RB_OrderInfo_BeikuExpand oibe (nolock)
ON oibe.CustomerID = oi.CustomerID
AND oibe.OrderCode = oi.OrderCode
LEFT JOIN RB_OrderList ol (nolock)
ON oi.CustomerID = ol.CustomerID
AND oi.OrderCode = ol.OrderCode
LEFT JOIN RB_WareHouse wh (nolock)
ON oi.WareHouseID = wh.ID
AND oi.CustomerID = wh.CustomerID
WHERE oi.CustomerID = whp.CustomerID
AND oi.WareHouseID = whp.WareHouseID
AND ol.SKU = whp.SKU
AND Isnull(ol.SKU, '') <> ''
AND ol.LockNum > 0
AND oi.OrderState = 0
AND ISNULL(oibe.OrderProductType,0) NOT IN (2,3)
--AND Isnull(wh.IsUseGroupSKU, 0) = 0
), 0) OrderLockNum
FROM RB_WareHouse_Product whp (nolock)
WHERE whp.CustomerID = @CustomerID
AND whp.WareHouseID = @WareHouseID
AND whp.LockNum <> 0
AND Isnull(whp.SKU, '') <> '') tmp
ON w.ID = tmp.ID
WHERE w.CustomerID = @CustomerID
AND tmp.LockNum <> tmp.OrderLockNum
PARAMS:@CustomerID = 1 ,@WareHouseID = 15429 ,
MESSAGE:Cannot continue the execution because the session is in the kill state.
当前命令发生了严重错误。应放弃任何可能产生的结果。
TRACE: 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
在 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)
在 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)
在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
在 RB.DAL.DBOperator.ExecuteSql(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms) 在 RB.DAL.DBOperator.toCommonTipException(SqlException ex, String sql, SqlParameter[] cmdParms)
在 RB.DAL.DBOperator.ExecuteSql(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms)
在 RB.DALExtendV2.Generate.Warehouse.RB_WareHouse_ProductExtendV2.UpdateErrLockStockByWareHouseID(UpdateErrLockStockByWareHouseID_PSParameters param)
在 OverseaManage.OverseaHelp.AsyncStockHelp.SyncEveryStockHelp(WareHouseStockInfo wareHouseStockParam, Boolean isUpdateStock)
在 OverseaManage.Allegro.AllegroStock.ExecSyncAllegroAvaliabelStockTask(CM_GetAllegroWarehouseResult warehouseModel)
在 OverseaManage.Allegro.AllegroStock.<>c__DisplayClass2_0.<SyncAllegroAvaliabelStock>b__5(CM_GetAllegroWarehouseResult aw)
在 System.Collections.Generic.List`1.ForEach(Action`1 action)
在 ChinaDownLoadImage.Task.Allegro.Task_SyncAllegroAvaliableStockServices.Execute()
在 RB.Utility.SystemTask.<doTask>b__43_0()
在 System.Threading.Tasks.Task.Execute()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
在 System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
在 System.Threading.ThreadPoolWorkQueue.Dispatch()
[结果]
[期望]
排查SQL 优化 ,建议先把结果 返回 然后根据条件 依次更新
开发报告
1.