[步骤]
CODE:N0027014Error:15_102_1_-2146232060
SQL:
SELECT Count(1) FROM dbo.RB_OrderInfo oi (NOLOCK)
INNER JOIN RB_OrderInfo_BeikuExpand ep (NOLOCK)
ON oi.CustomerID = ep.CustomerID
AND oi.OrderCode = ep.OrderCode
LEFT OUTER JOIN RB_OrderSource (NOLOCK) os
ON oi.OrderSourceID = os.ID
AND oi.CustomerID = os.CustomerID
LEFT OUTER JOIN RB_Transport (NOLOCK) ts
ON oi.TransportID = ts.ID
AND oi.CustomerID = ts.CustomerID
LEFT JOIN RB_Transport (NOLOCK) secondts
ON secondts.ID = ep.SecondTransportID AND secondts.CustomerID=ep.CustomerID
LEFT JOIN dbo.RB_WareHouse (NOLOCK) wh
ON oi.CustomerID = wh.CustomerID
AND oi.WareHouseID = wh.ID
LEFT JOIN dbo.RB_WareHouse (NOLOCK) towh
ON oi.CustomerID = towh.CustomerID
AND oi.ToWareHouseID = towh.ID
LEFT JOIN RB_OrderInfo_Beiku (NOLOCK) beiku
ON beiku.CustomerID = oi.CustomerID
AND beiku.OrderCode = oi.OrderCode
LEFT JOIN RB_RestockOrder_ApprovalExecutor(NOLOCK) ae ON ae.CustomerId = oi.CustomerID AND ae.OrderCode = oi.OrderCode
LEFT JOIN RB_Admin rba WITH(nolock) ON rba.CustomerID = os.CustomerID AND rba.ID = os.SaleAdminID
LEFT JOIN RB_BusinessTeam bt WITH(nolock) ON bt.CustomerID = os.CustomerID AND bt.ID = rba.BusinessTeamID
WHERE oi.CustomerID = @CustomerID
AND oi.IsSystem = 0
AND oi.IsStockOrder = 1 AND ep.OrderBuildType=3 AND towh.WareHouseType <>1 AND towh.WareHouseType <>3 AND wh.WareHouseType =1 AND oi.AddTime >=@StartTime AND oi.AddTime<=@EndTime AND ep.IsShipOnReceipt = 1 AND ep.IsShipOnReceipt = 1 AND oi.OrderStatus IN ( 订单状态(可多选) ) AND oi.OrderCode IN ( SELECT d.MergerPackageNo
FROM RB_Procurement_Order_Package d WITH (NOLOCK)
WHERE d.CustomerID = @CustomerID AND d.ID in (SELECT item FROM dbo.CharSplitForIn(@KeyWordStr,',')) ) option(recompile,maxdop 16)
PARAMS:@CustomerID = 1 ,@StartTime = 2023/7/6 0:00:00 ,@EndTime = 2024/3/5 23:59:59 ,@KeyWordStr = 46627290,46158076,45939682,45777727,45739520,45717167,45710704,45624402,46995839,46221187,46135142,46135137,46009872,46010075,45939689,45939684,45918119,45799730,45739916,45739895,45566717,45339625,45275038 ,
MESSAGE:Incorrect syntax near '('.
TRACE: 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
在 System.Data.SqlClient.SqlInternalConnection.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.ExecuteScalar()
在 RB.DAL.DBOperator.GetSingle(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB) 在 RB.DAL.DBOperator.toCommonTipException(SqlException ex, String sql, SqlParameter[] cmdParms)
在 RB.DAL.DBOperator.GetSingle(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB)
在 RB.DALExtendV2.RB_OrderInfoExtendV2.GetOverseaModelListForReStock(CM_OverSeaOrderListParam param, Int32& recordCount)
在 PandaBuy.ERP.Web.IrobotBox.Restock.OverSea.OverSeaOrderList.Page_Load(Object sender, EventArgs e)
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest()
在 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
在 System.Web.UI.Page.ProcessRequest(HttpContext context)
在 ASP.irobotbox_restock_oversea_overseaorderlist_aspx.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)
[结果]
[期望]
修复 错误
正式环境按着客户操作没有问题
针对订单状态拼接sql导致报错 有一个一个优化