[步骤]
select top 200 * from RB_ReportApply_Task (nolock) where TaskType=221 order by AddTime desc ;[10:04:23] -------------------------------------------------------------
CODE:N1004232
Error:11_-2_0_-2146232060
SQL:SELECT ros.OrderSourceName '订单来源渠道',
al.AddAdminName '建单人员',
Isnull(outWh.WareHouseName, '') '调出仓库',
Isnull(inWh.WareHouseName, '') '调入仓库',
al.OrginNumber '关联单号',
'D' + Cast(rpo.PackageID AS VARCHAR) '发货包裹号',
Isnull(rt.TransportName, '') '运输方式',
al.AllocationNumber '调拨单号',
case
when ISNULL(al.CreateSourceType,0)=0 THEN '直接创建'
when ISNULL(al.CreateSourceType,0)=1 THEN '调仓任务'
else '-' end '数据来源',
al.AddTime '调拨单生成时间',
al.Remark '单据备注',
( CASE
WHEN al.Status = 0 THEN '在途中'
WHEN al.Status = 1 THEN '部分入库'
WHEN al.Status = 2 THEN '已入库'
WHEN al.Status = 3 THEN '作废'
WHEN al.Status = 4 THEN '待审核'
WHEN al.Status = 5 THEN '审核通过'
WHEN al.Status = 6 THEN '审核失败'
WHEN al.Status = 7 THEN '撤销'
WHEN al.Status = 11 THEN '异常收货'
ELSE '未识别状态'
END ) '调拨单状态',
( CASE
WHEN ald.Status = 0 THEN '在途中'
WHEN ald.Status = 1 THEN '部分入库'
WHEN ald.Status = 2 THEN '已入库'
WHEN ald.Status = 3 THEN '作废'
WHEN ald.Status = 4 THEN '待审核'
WHEN ald.Status = 5 THEN '审核通过'
WHEN ald.Status = 6 THEN '审核失败'
WHEN ald.Status = 7 THEN '撤销'
WHEN ald.Status = 11 THEN '异常收货'
ELSE '未识别状态'
END ) '调拨明细状态',
ald.SKU '系统SKU',
rpd.ClientSKU '自定义SKU',
ald.OrderSourceSKU '海外仓SKU',
rpd.ProductNameCN '产品名',
ald.BuyPrice '采购价',
ald.ShipNum '发货数量',
ald.ReceiveNum '收货数量',
( CASE
WHEN Isnull(rid.Status, 0) = 0 THEN '待处理'
WHEN Isnull(H.ID, -1) = -1 THEN '未生成差异'
WHEN H.Status = 4 THEN '待审核'
WHEN H.Status = 5 THEN '审核通过'
WHEN H.Status = 6 THEN '审核失败'
END ) '差异结果',
Isnull(H.Number, 0) '差异数量',
al.TrackNumber '物流单号',
ald.Remark as '备注'
FROM RB_Inventory_AllocationBill al WITH(nolock)
LEFT JOIN RB_Inventory_AllocationDetailBill ald WITH(NOLOCK)
ON al.CustomerID = ald.CustomerID
AND al.ID = ald.AllocationBillID
LEFT JOIN RB_Product rpd WITH(NOLOCK)
ON ald.CustomerID = rpd.CustomerID
AND ald.SKU = rpd.SKU
LEFT JOIN RB_WareHouse outWh WITH(nolock)
ON al.CustomerID = outWh.CustomerID
AND al.OutWareHouseID = outWh.ID
LEFT JOIN RB_WareHouse inWh WITH(nolock)
ON al.CustomerID = outWh.CustomerID
AND al.InWareHouseID = inWh.ID
LEFT JOIN RB_Transport rt WITH(nolock)
ON al.CustomerID = rt.CustomerID
AND rt.ID = al.TransportID
LEFT JOIN RB_OrderList rol WITH(NOLOCK)
ON rol.CustomerID = ald.CustomerID
AND rol.ID = ald.OrderListID
LEFT JOIN RB_OrderInfo ri WITH(NOLOCK)
ON rol.CustomerID = ri.CustomerID
AND rol.OrderCode = ri.OrderCode
LEFT JOIN RB_OrderSource ros WITH(NOLOCK)
ON ri.CustomerID = ros.CustomerID
AND ri.OrderSourceID = ros.ID
LEFT JOIN RB_Procurement_Order_Package_OrderDetail rpo WITH(NOLOCK)
ON ri.CustomerID = rpo.CustomerID
AND rol.ID = rpo.OrderListID
LEFT JOIN RB_Inventory_DifferentiationBill rid WITH(NOLOCK)
ON rid.CustomerID = ald.CustomerID
AND ald.ID = rid.RelationID
LEFT JOIN RB_Inventory_InOutBallance H WITH(NOLOCK)
ON rid.CustomerID = H.CustomerID
AND rid.BallanceNumber = H.BallanceNumber
WHERE al.CustomerID = @CustomerID AND inWh.WareHouseType = @WareHouseType AND al.AddTime>=@AddTimeBegin AND al.AddTime<DATEADD(DAY,1,@AddTimeEnd)
PARAMS:@CustomerID = 1 ,@WareHouseType = 1 ,@AddTimeBegin = 2025/5/9 0:00:00 ,@AddTimeEnd = 2025/6/9 0:00:00 ,
MESSAGE:执行超时已过期。完成操作之前已超时或服务器未响应。
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.SqlDataReader.TryConsumeMetaData()
在 System.Data.SqlClient.SqlDataReader.get_MetaData()
在 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.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
在 RB.DAL.DBOperator.Query(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB) 在 RB.DAL.DBOperator.toCommonTipException(SqlException ex, String sql, SqlParameter[] cmdParms)
在 RB.DAL.DBOperator.Query(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB)
在 RB.DALExtend.Generate.RB_Inventory_AllocationBillExtend.ExportDataInventoryAllocationCurrentFilter(RB_Inventory_AllocationBill_PSParameters parameters)
在 Biz.TaskApply.ReportTaskMethods.GetDataInventoryAllocationCurrentFilter(InventoryAllocationReportParameter parameter)
在 System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
在 Biz.TaskApply.ReportTaskApply.ReportTaskExecute(RB_ReportApply_Task task)
在 Biz.TaskApply.ReportTaskApply.ProcessExportExcel(RB_ReportApply_Task task)
在 RB.Utility.TaskSmartManager`1.execute(Func`2 execFunction)
在 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()
-------------------------------------------------------------
[结果]
[期望]
排查问题,提升导出效率
关联表太多 1分半左右 延长一下时间