重现步骤

[步骤]



[13:17:19]  -------------------------------------------------------------
CODE:N1317191
Error:11_-2_0_-2146232060
SQL:
             SELECT pop.ID ,
                    pop.CustomerID ,
                    pop.MergerPackageNo ,
                    pop.TrackNumber ,
                    pop.TurnNumber,
                    pop.LogisticsOrderNo ,
                    pop.PackageState ,
                    pop.SystemWeight ,
                    pop.PrintBatchNo ,
                    pop.TransportID ,
                    pop.GetPackageTraceTime,
                    pop.PrintType,
                    pop.OvertimeTagType,
                    oi.OrderSourceID,
                    oi.ClientOrderCode,
                    oi.ShipMemo,
                    ISNULL(pop.GetTrackNumberTime, oi.SaveTrackNumbersTime) TrackNumberTime,
                    t.PrintType TransportPrintType,
                    t.TransportState,
                    t.TrackingNumberValidDays,
                    oi.OrderStatus,
                    oi.OrderState,
                    os.OrderSourceType,
                    os.IsPrintNote,
                    pop.Country Shorthand,
                    ISNULL(api.Transport_API_Class, -1) Transport_API_Class ,
                    t.AllowPrint,
                    t.AllowLogistPrint,
                    t.AllowTurnPrint,
                    pop.PackagePositionCode,
                    pop.PrintAddressState,
                    pop.AddTime,
                    cse.IsMergeLabelAliExpress,
                    cse.LimitTransports,
                    oi.AmazonShipmentId,
                    oi.Token OrderInfoToken,oi.AliExpressTrusteeType,pop.VirtuallyFastType
            FROM    RB_Procurement_Order_Package pop ( NOLOCK )
            
                    Left JOIN dbo.RB_OrderInfo oi ( NOLOCK ) ON oi.CustomerID = pop.CustomerID
AND oi.OrderCode = pop.MergerPackageNo
                    Left JOIN RB_Transport t( NOLOCK ) ON t.CustomerID = pop.CustomerID 
  AND t.ID = pop.TransportID
                    Left JOIN RB_Transport_API api ( NOLOCK ) ON api.CustomerID = pop.CustomerID
                                                              AND api.ID = t.Transport_API_ID
                    LEFT JOIN RB_OrderSource os ( NOLOCK ) ON os.CustomerID = pop.CustomerID
                                                              AND os.ID = oi.OrderSourceID
                    LEFT JOIN RB_Customer_Setting_Extend cse ( NOLOCK ) ON cse.CustomerID = pop.CustomerID
                    
            WHERE pop.ID IN (SELECT ID
                               FROM RB_Procurement_Order_Package (NOLOCK)
                               WHERE CustomerID = @CustomerID
                               AND  (TrackNumber=@track OR LogisticsOrderNo=@track ) )
AND pop.CustomerID = @CustomerID
AND pop.WareHouseID = @WareHouseID
                AND 
                  (  
                      ( 
                          pop.TrackNumber <> '' 
                          AND
                          (
                              ISNULL(t.TrackingNumberValidDays, 0) = 0
                              OR
                              (
                                  pop.GetTrackNumberTime IS NOT NULL
                                  AND Isnull(t.TrackingNumberValidDays, 0) > 0
                                  AND Datediff(SECOND, Getdate(), ( Dateadd(day, t.TrackingNumberValidDays, pop.GetTrackNumberTime) )) >= 0 
                              )
                          )
                         AND
     (
       t.AllowTurnPrint = 0
       OR
       (t.AllowTurnPrint = 1 AND ISNULL(pop.TurnNumber, '') != '')
     )
                      )
                      OR 
                      ( 
                          pop.TrackNumber = ''
                          AND t.AllowPrint = 1
                          AND ISNULL(pop.LogisticsOrderNo, '') != '' 
                          AND
                          ( 
                               ISNULL(t.TrackingNumberValidDays, 0) = 0 
                               OR 
                               ( 
                                   pop.GetTrackNumberTime IS NOT NULL
                                   AND Isnull(t.TrackingNumberValidDays, 0) > 0
                                   AND Datediff(SECOND, Getdate(), ( Dateadd(day, t.TrackingNumberValidDays, pop.GetTrackNumberTime) )) >= 0 
                               )
                          )
                      )
                      OR 
                      ( 
                          pop.TrackNumber = ''
                          AND t.AllowPrint = 1
                          AND ISNULL(pop.LogisticsOrderNo, '') = ''
                          AND t.AllowLogistPrint = 1 
                          AND ISNULL(pop.TurnNumber, '') = ''
                          AND t.AllowTurnPrint = 0 
                      ) 
                  )
            
PARAMS:@CustomerID = 1 ,@WareHouseID = 333 ,@track =  ,
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.RB_Procurement_Order_PackagePrintExtend.GetPackagePrintInfoByScanBarCode(CM_GetScanPackParam model)
   在 Biz.Irobotbox.Delivery.CsPackagePrint.PackagePrintClass.GetPackagePrintInfoByScanBarCode(CM_GetScanPackParam model)
   在 RB.WebApi.ApiCode.WmsCs.CsPrint.GetPackagePrintUrl(GetPackagePrintUrlRequest request, Int32 adminId, String userName)
   在 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)
   在 RB.WebApi.ApiCode.API_CsEntrance.ProcessRequest(HttpContext context)
   在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   在 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
   在 System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
   在 System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
   在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
   在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   在 System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
   在 System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
   在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

-------------------------------------------------------------
查看了语句 非常慢,返回的数据量也很大 1133856 条记录

[结果]


[期望]

改造SQL 添加核心条件 提升SQL 性能
历史记录  
  1. 2025-05-26 14:04:25, 由 袁慧斌 创建。
  2. 2025-05-26 14:06:06, 由 李乐同 指派给 程伟。
    修改了 指派给,旧值为 "liletong",新值为 "chengwei"。
  3. 2025-05-26 14:24:13, 由 程伟 指派给 朱思文。
    修改了 指派给,旧值为 "chengwei",新值为 "zhusiwen"。

  4. 2025-05-26 21:52:45, 由 朱思文 确认Bug。
    修改了 Bug类型 ,旧值为 "",新值为 "dingdinggaojin"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    1.已处理
  5. 2025-05-26 21:53:08, 由 朱思文 解决,方案为 性能问题 。
    修改了 解决方案,旧值为 "",新值为 "performance"。
    修改了 解决日期,旧值为 "",新值为 "2025-05-26 21:52:46"。
    修改了 指派给 ,旧值为 "zhusiwen",新值为 "yuanhuibin"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 解决者 ,旧值为 "",新值为 "zhusiwen"。
  6. 2025-05-28 15:30:30, 由 朱思文 编辑。
    修改了 解决时效,旧值为 "0",新值为 "7.81"。
    修改了 解决方案,旧值为 "performance",新值为 "history"。
  7. 2025-06-03 15:19:29, 由 袁慧斌 编辑。
    修改了 测试责任人,旧值为 "",新值为 "admin"。
  8. 2025-06-03 15:19:31, 由 袁慧斌 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "yuanhuibin",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "yuanhuibin"。
    修改了 关闭日期,旧值为 "",新值为 "2025-06-03 15:19:31"。
所属项目 技术中心-需求池
所属模块 供应链   仓储物流   仓储
所属计划
所属迭代
Bug类型 钉钉告警
严重程度 一般
优先级 P2
Bug状态 已关闭
业务部门 亚马逊平台运营中心
影响功能
开发责任人 朱思文
测试责任人 admin
解决时效 7.81
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2025-06-03 15:19:31
截止日期 0000-00-00
上线时间 0000-00-00 00:00:00
上线时效 -1
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 袁慧斌 于 2025-05-26 14:04:25
影响环境 生产环境-线上测试
由谁解决 朱思文 于 2025-05-26 21:52:46
解决版本
解决方案 历史bug(180天以上)
由谁关闭 袁慧斌 于 2025-06-03 15:19:31
最后修改 袁慧斌 于 2025-06-03 15:19:31
相关Bug