主頁 > .NET開發 > SQLServer按重疊10天間隔分組

SQLServer按重疊10天間隔分組

2022-01-14 13:40:45 .NET開發

我有一張表格,記錄了在數臺生產機器上生產的每一件作品,可以追溯到幾年前。定期(例如每周一次)我想檢查此表以建立每個機器和產品組合的“最佳性能”記錄,并根據以下規則將它們存盤在新表中;

  • 機器必須在 10 天內至少生產 10,000 個零件 - 如果在 10 天內僅生產 9000 個零件,則此記錄無效
  • 機器必須在整個期間都在運行相同的產品而沒有更換,即如果在第 5 天更換了產品,這是一個無效記錄

性能資料表如下所示 [VisionMachineResults]

ID MCSAP 約會時間 產品名稱 檢查結果
1 123456 2020-01-01 08:29:34:456 產品A 0
2 123456 2020-01-01 08:45:50:456 產品B 1
3 844214 2020-01-01 08:34:48:456 產品A 2
4 978415 2020-01-02 09:29:26:456 產品C 0
5 985633 2020-01-04 23:29:11:456 產品A 2

我能夠生成一個結果,其中列出了每個 SAP / 產品組合的各個天的性能串列,但是我需要在 SQL 之外的復雜回圈中處理資料以建立 10 天組。

我目前的查詢是:

SELECT CAST(DateTime AS date) AS InputDate,
       MCSAP,
       ZAssetRegister.LocalName,
       ProductName,
       SUM(CASE WHEN InspectionResult = 0 THEN 1 END) AS OKParts,
       COUNT(CASE WHEN InspectionResult > 0 THEN 1 END) AS NGParts
FROM [VisionMachineResults]
     INNER JOIN ZAssetRegister ON VisionMachineResults.MCSAP = ZAssetRegister.SAP_Number
GROUP BY CAST(DateTime AS date),
         MCSAP,
         ProductName,
         ZAssetRegister.LocalName
ORDER BY InputDate,
         ZAssetRegister.LocalName;

是否有可能讓 SQL 查詢以 10 天組的形式給出結果,而不是每天,即

01-01-2021 to 11-01-2021 | Machine 1 | Product 1 | 20,000 | 5,000
02-01-2021 to 12-01-2021 | Machine 1 | Product 1 | 22,000 | 1,000
03-01-2021 to 13-01-2021 | Machine 1 | Product 1 | 18,000 | 4,000
etc...

然后,我將遍歷這些行以找到 OK 部分百分比最高的行。任何想法表示贊賞!

uj5u.com熱心網友回復:

我想到的一個選項是使用數字表(谷歌 Jeff Moden 在 SQL Server Central 上了解更多背景資訊)。

然后,數字表使用開始日期(來自要調查的日期范圍),除了生成要鏈接到的日期外,還會生成一個“桶”,之后根據該“桶”進行分組。

如同:

-- generate date frame from and to
DECLARE
  @date_start  date = Convert( date, '20211110', 112 ),
  @date_end    date = Convert( date, '20220110', 112 )
;
WITH
  cteN
(
  Number
)
AS
( -- build a list of 10 single digit numbers
  SELECT Cast( 0 AS int ) AS Number UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9
)
,
  cteNumbers
(
  Number
)
AS
( -- splice single digit numbers to list from 0 to 99999
  SELECT
    cN10000.Number * 10000   cN1000.Number * 1000   cN100.Number * 100   cN10.Number * 10   cN1.Number
  FROM
    cteN AS cN10000
    CROSS JOIN cteN AS cN1000
    CROSS JOIN cteN AS cN100
    CROSS JOIN cteN AS cN10
    CROSS JOIN cteN AS cN1
)
,
  cteBucketOffset
( 
  DatediffNum,
  Offset
)
AS
( -- determine the offset in datediffs to number buckets later correctly
  SELECT
    Cast( Datediff( dd, @date_start, @date_end ) AS int ) - 1 AS DatediffNum,
    Cast( Datediff( dd, @date_start, @date_end ) % 10 AS tinyint ) - 1 AS Offset
)
,
  cteDates
(
  Dated,
  Bucket,
  BucketNumber,
  BucketOffset,
  DatediffNum
)
AS
( -- generate list of dates with bucket batches and numbers
  SELECT 
    Dateadd( dd, cN.Number * -1, @date_end ) AS Dated,
    Cast( ( cBO.Offset   cN.Number ) / 10 AS int ) AS Bucket,
    Cast( ( cBO.Offset   cN.Number ) % 10 AS tinyint ) AS BucketNumber,
    cBO.Offset,
    cBO.DatediffNum
  FROM
    cteNumbers AS cN
    CROSS JOIN cteBucketOffset AS cBO
  WHERE
      cN.Number <= Datediff( dd, @date_start, @date_end )
)
SELECT
  *
FROM
  cteDates AS cD
ORDER BY
  cD.Dated ASC
;

因展示每一步而啰嗦。結果是一個可用于連接原始資料的動態表。然后可以使用“桶”而不是日期本身來對原始資料進行分組。

一旦構建了這些資料,就可以根據分組條件做出決策,例如具有最少的行數。

uj5u.com熱心網友回復:

這個程序需要從多個層面考慮。首先,您提到連續 10 天。我們不知道那些日子是否包括周末,機器是否 24/7 運行。如果運行的日期也可以跳過假期?所以,10 天可能是 1 月 1 日到 1 月 10 日。但如果你跳過周末,你只有 6 個實際的 WEEKDAYS。

接下來,考慮一臺機器處理多個產品,例如在日期之間切換,甚至在一天內切換。

正如評論者所指出的,列名與保留字(例如 DateTime)相同,這是一種不好的做法,并嘗試查看是否有任何新列是可能引起混淆的常見關鍵字并避免使用它們。

您還提到您必須進行復雜的回圈檢查,以及如何處理加入到 10 天、拆分等。我想我有一個有點優雅的方法來做這件事,應該證明在事情的計劃中相當簡單。

您正在使用 SQL-Server,因此我將通過“#”表名使用 TEMP 表來執行此操作。這樣,當您完成連接或呼叫使其成為存盤程序時,您不必繼續洗掉和重新創建它們。也就是說,讓我一步一步地帶你走。

首先,我正在創建一個與您的結構相匹配的簡單表,即使使用 DateTime 背景關系也是如此。

CREATE TABLE VisionMachineResults
(
    ID int IDENTITY(1,1) NOT NULL,
    MCSAP nvarchar(6) NOT NULL,
    DateTime datetime NOT NULL,
    ProductName nvarchar(10) NOT NULL,
    InspectionResult int NOT NULL,
    CONSTRAINT ID PRIMARY KEY CLUSTERED 
    (
        [ID] ASC
    ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

現在,我正在插入資料,類似于您擁有的資料,但不是數百萬行。你提到你正在尋找 10 天的時間,所以我只是在結尾處添加了一些額外的東西來模擬它。我還在 1 月 5 日明確強制一臺機器對產品進行間隙更改。此外,我在 1 月 7 日添加了一項產品更改,以在您的 10 天考慮中觸發此“中斷”。稍后您會看到結果。

insert into VisionMachineResults
    (MCSAP, [DateTime], ProductName, InspectionResult )
values
( '123456', '2020-01-01 08:29:34.456', 'Product A', 0 ),
( '123456', '2020-01-01 08:29:34.456', 'Product B', 1 ),
( '844214', '2020-01-01 08:29:34.456', 'Product A', 2 ),
( '978415', '2020-01-02 08:29:34.456', 'Product C', 0 ),
( '985633', '2020-01-04 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-05 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-05 08:29:34.456', 'Product B', 0 ),
( '985633', '2020-01-06 08:29:34.456', 'Product A', 2 ),
( '985633', '2020-01-07 08:29:34.456', 'Product B', 0 ),
( '985633', '2020-01-08 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-09 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-10 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-11 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-12 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-13 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-14 08:29:34.456', 'Product A', 1 ),
( '985633', '2020-01-15 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-16 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-17 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-18 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-19 08:29:34.456', 'Product A', 0 ),
( '985633', '2020-01-20 08:29:34.456', 'Product A', 0 )
go

所以現在,將其視為您的生產資料的基線。我的第一個查詢將做很多事情,但將預聚合存盤到 #tmpPartDailyCounts 結果表中。通過這種方式,您可以在不同階段查看它們,以便對我的方法進行健全性檢查。

在這里,在每臺機器 (MCSAP) 和日期(沒有時間部分)上,我正在抓取某些聚合,并將它們按機器和日期分組。

select
        VMR.MCSAP,
        cast(VMR.DateTime as Date) as InputDate,
        min( VMR.ProductName ) ProductName,
        max( VMR.ProductName ) LastProductName,
        count( distinct VMR.ProductName ) as MultipleProductsSameDay,
        sum( case when VMR.InspectionResult = 0 then 1 else 0 end ) OKParts,
        sum( case when NOT VMR.InspectionResult = 0 then 1 else 0 end ) BadParts,
        count(*) TotalParts
    into
        #tmpPartDailyCounts
    from
        VisionMachineResults VMR
    group by
        VMR.MCSAP,
        cast(VMR.DateTime as Date)

您正在加入資產表,但不認為您真的需要它。如果機器制造了產品,最終組裝是否完成是否重要?不知道,你會知道的更好。

現在,聚合和為什么。min( VMR.ProductName ) ProductName和,max( VMR.ProductName ) LastProductName只是為了結轉在相關日期創建的產品名稱以用于任何最終輸出。如果在某一天,只生產一種產品,無論如何它都是一樣的,只要選擇一種。但是,如果在任何一天有多個產品,則 MIN() 和 MAX() 將具有不同的值。如果所有構建的產品都是相同的,那么兩個值將是相同的——在任何一個給定的日期。

The rest are simple aggregates of OK parts, BAD parts (something was wrong), but also the TOTAL Parts created, regardless of any inspection failure. This is the primary qualifier for you to hit you 10,000, but if you wanted to change to 10,000 GOOD parts, change accordingly.

select
        VMR.MCSAP,
        cast(VMR.DateTime as Date) as InputDate,
        min( VMR.ProductName ) ProductName,
        max( VMR.ProductName ) LastProductName,
        count( distinct VMR.ProductName ) as MultipleProductsSameDay,
        sum( case when VMR.InspectionResult = 0 then 1 else 0 end ) OKParts,
        sum( case when NOT VMR.InspectionResult = 0 then 1 else 0 end ) BadParts,
        count(*) TotalParts
    into
        #tmpPartDailyCounts
    from
        VisionMachineResults VMR
    group by
        VMR.MCSAP,
        cast(VMR.DateTime as Date)

Now, at this point, I have a pre-aggregation done on a per machine and date basis. Now, I want to get some counter that is sequentially applied on a per date that a product was done. I will pull this result into a temp table #tmpPartDays. By using the over/partition, this will create a result that first puts the records in order of MCSAP, then by the date and dumps an output with whatever the ROW_NUMBER() is to that. So, if there is no activity for a given machine such as over a weekend or holiday that the machine is not running, the SEQUENTIAL counter via OVER/PARTITION will keep them sequentially 1 through however many days... Again, query the result of this table and you'll see it.

By querying against the pre-aggregated table, that may account for 500k records and results down to say 450 via per machine/day, This query is now only querying against the 450 and will be very quick.

   SELECT 
            PDC.MCSAP,
            PDC.InputDate,
            MultipleProductsSameDay,
            ROW_NUMBER() OVER(PARTITION BY MCSAP 
                            ORDER BY [InputDate] ) 
                AS CapDay
        into
            #tmpPartDays
        FROM 
            #tmpPartDailyCounts PDC
        ORDER BY 
            PDC.MCSAP;  

Now, is the kicker, tying this all together. I'm starting with just the #tmpPartDays JOINED to itself on the same MCSAP AND a MUST-HAVE matching record 10 days out... So this resolves issues of weekend / holidays since serial consecutive.

This now give me the begin/end date range such as 1-10, 2-11, 3-12, 4-13, etc.

I then join to the tmpPartDailyCounts result on the same part AND the date is at the respective begin (PD.InputDate) and END (PD2.InputDate). I re-apply the same aggregates to get the total counts WITHIN EACH Part 10 day period. Run this query WITHOUT the "HAVING" clause to see what is coming out.

select
        PD.MCSAP,
        PD.InputDate BeginDate,
        PD2.InputDate EndDate,
        SUM( PDC.MultipleProductsSameDay ) as TotalProductsMade,
        sum( PDC.OKParts ) OKParts,
        sum( PDC.BadParts ) BadParts,
        sum( PDC.TotalParts ) TotalParts,
        min( PDC.ProductName ) ProductName,
        max( PDC.LastProductName ) LastProductName
    from
        #tmpPartDays PD
            -- join again to get 10 days out for the END cycle
            JOIN #tmpPartDays PD2
                on PD.MCSAP = PD2.MCSAP
                AND PD.CapDay  9 = PD2.CapDay
                -- Now join to daily counts for same machine and within the 10 day period
                JOIN #tmpPartDailyCounts PDC
                    on PD.MCSAP = PDC.MCSAP
                    AND PDC.InputDate >= PD.InputDate
                    AND PDC.InputDate <= PD2.InputDate
    group by
        PD.MCSAP,
        PD.InputDate,
        PD2.InputDate
    having
            SUM( PDC.MultipleProductsSameDay ) = 10
        AND min( PDC.ProductName ) = max( PDC.LastProductName ) 
        AND SUM( PDC.TotalParts ) >= 10
    

Finally, the elimination of the records you DONT want. Since I dont have millions of records to simulate, just follow along. I am doing a HAVING on

  1. SUM( PDC.TotalParts ) >= 10

    1. SUM( PDC.MultipleProductsSameDay ) = 10

If on ANY day there are MORE than 1 product created, the count would be 11 or more, thus indicating not the same product, so that would cause an exclusion. But also, if at the tail-end of data such as only 7 days of production, it would never HIT 10 which was your 10-day qualifier also.

2.   AND min( PDC.ProductName ) = max( PDC.LastProductName ) 

Here, since we are spanning back to the DAILY context, if ANY product changes on any date, the Product Name (via min) and LastProductName (via max) will change, regardless of the day, and regardless of the name context. So, by making sure both the min() and max() are the same, you know it is the same product across the entire span.

3.  AND SUM( PDC.TotalParts ) >= 10

Finally, the count of things made. In this case, I did >= 10 because I was only testing with 1 item per day, thus 10 days = 10 items. In your scenario, you may have 987 in one day, but 1100 in another, thus balancing low and high production days to get to that 10,000, but for sample of data, just change YOUR context to the 10,000 limit minimum.

This SQLFiddle shows the results as it gets down to the per machine/day and showing the sequential activity. The last MCSAP machine starts on Jan 4th, but has a sequential day row assignment starting at 1 to give proper context to the 1-10, 2-11, etc.

First SQL Fiddle showing machine/day

第二個小提琴顯示了沒有 HAVING 子句的最終查詢,您可以看到 TotalProductsMade 的前幾行是 11,這意味著有問題的任何一天跨度上的 SOMETHING 創建了不同的產品,并將被排除在最終結果之外。對于 1 月 6 日至 15 日和 1 月 7 日至 16 日的開始和結束日期,您將看到顯示產品 A 和產品 B 的 MIN/MAX 產品,因此表明產品在其 10 天跨度內的某個地方切換了......這些也是將被排除在外。

FINAL 查詢 此查詢顯示應用了 HAVING 子句的結果。

uj5u.com熱心網友回復:

似乎只是按年份和日期除以 10 分組的問題。

SELECT 
  CONCAT(CONVERT(VARCHAR(10),MIN([DateTime]),105), ' to ', CONVERT(VARCHAR(10), MAX([DateTime]), 105)) AS InputDateRange
, MCSAP
, MAX(ZAssetRegister.LocalName) AS LocalName
, ProductName
, SUM(CASE WHEN InspectionResult = 0 THEN 1 END) AS OKParts
, COUNT(CASE WHEN InspectionResult > 0 THEN 1 END) AS NGParts
, COUNT(DISTINCT CAST([Datetime] AS DATE)) AS total_days
FROM VisionMachineResults
JOIN ZAssetRegister
  ON VisionMachineResults.MCSAP = ZAssetRegister.SAP_Number
GROUP BY 
  DATEPART(YEAR, [DateTime]), 
  CEILING(DATEPART(DAYOFYEAR, [DateTime])/10.0), 
  MCSAP,
  ProductName
ORDER BY 
  MIN([DateTime]),
  MAX(ZAssetRegister.LocalName);

db<>fiddle的簡化測驗在這里

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/410531.html

標籤:

上一篇:如何用另一個表中的值串列更新一個表中列的每一行?

下一篇:如何從SQLServer2019(v15)中的XML中提取屬性值?

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • WebAPI簡介

    Web體系結構: 有三個核心:資源(resource),URL(統一資源識別符號)和表示 他們的關系是這樣的:一個資源由一個URL進行標識,HTTP客戶端使用URL定位資源,表示是從資源回傳資料,媒體型別是資源回傳的資料格式。 接下來我們說下HTTP. HTTP協議的系統是一種無狀態的方式,使用請求/ ......

    uj5u.com 2020-09-09 22:07:47 more
  • asp.net core 3.1 入口:Program.cs中的Main函式

    本文分析Program.cs 中Main()函式中代碼的運行順序分析asp.net core程式的啟動,重點不是剖析原始碼,而是理清程式開始時執行的順序。到呼叫了哪些實體,哪些法方。asp.net core 3.1 的程式入口在專案Program.cs檔案里,如下。ususing System; us ......

    uj5u.com 2020-09-09 22:07:49 more
  • asp.net網站作為websocket服務端的應用該如何寫

    最近被websocket的一個問題困擾了很久,有一個需求是在web網站中搭建websocket服務。客戶端通過網頁與服務器建立連接,然后服務器根據ip給客戶端網頁發送資訊。 其實,這個需求并不難,只是剛開始對websocket的內容不太了解。上網搜索了一下,有通過asp.net core 實作的、有 ......

    uj5u.com 2020-09-09 22:08:02 more
  • ASP.NET 開源匯入匯出庫Magicodes.IE Docker中使用

    Magicodes.IE在Docker中使用 更新歷史 2019.02.13 【Nuget】版本更新到2.0.2 【匯入】修復單列匯入的Bug,單元測驗“OneColumnImporter_Test”。問題見(https://github.com/dotnetcore/Magicodes.IE/is ......

    uj5u.com 2020-09-09 22:08:05 more
  • 在webform中使用ajax

    如果你用過Asp.net webform, 說明你也算是.NET 開發的老兵了。WEBform應該是2011 2013左右,當時還用visual studio 2005、 visual studio 2008。后來基本都用的是MVC。 如果是新開發的專案,估計沒人會用webform技術。但是有些舊版 ......

    uj5u.com 2020-09-09 22:08:50 more
  • iis添加asp.net網站,訪問提示:由于擴展配置問題而無法提供您請求的

    今天在iis服務器配置asp.net網站,遇到一個問題,記錄一下: 問題:由于擴展配置問題而無法提供您請求的頁面。如果該頁面是腳本,請添加處理程式。如果應下載檔案,請添加 MIME 映射。 WindowServer2012服務器,添加角色安裝完.netframework和iis之后,運行aspx頁面 ......

    uj5u.com 2020-09-09 22:10:00 more
  • WebAPI-處理架構

    帶著問題去思考,大家好! 問題1:HTTP請求和回傳相應的HTTP回應資訊之間發生了什么? 1:首先是最底層,托管層,位于WebAPI和底層HTTP堆疊之間 2:其次是 訊息處理程式管道層,這里比如日志和快取。OWIN的參考是將訊息處理程式管道的一些功能下移到堆疊下端的OWIN中間件了。 3:控制器處理 ......

    uj5u.com 2020-09-09 22:11:13 more
  • 微信門戶開發框架-使用指導說明書

    微信門戶應用管理系統,采用基于 MVC + Bootstrap + Ajax + Enterprise Library的技術路線,界面層采用Boostrap + Metronic組合的前端框架,資料訪問層支持Oracle、SQLServer、MySQL、PostgreSQL等資料庫。框架以MVC5,... ......

    uj5u.com 2020-09-09 22:15:18 more
  • WebAPI-HTTP編程模型

    帶著問題去思考,大家好!它是什么?它包含什么?它能干什么? 訊息 HTTP編程模型的核心就是訊息抽象,表示為:HttPRequestMessage,HttpResponseMessage.用于客戶端和服務端之間交換請求和回應訊息。 HttpMethod類包含了一組靜態屬性: private stat ......

    uj5u.com 2020-09-09 22:15:23 more
  • 部署WebApi隨筆

    一、跨域 NuGet參考Microsoft.AspNet.WebApi.Cors WebApiConfig.cs中配置: // Web API 配置和服務 config.EnableCors(new EnableCorsAttribute("*", "*", "*")); 二、清除默認回傳XML格式 ......

    uj5u.com 2020-09-09 22:15:48 more
最新发布
  • C#多執行緒學習(二) 如何操縱一個執行緒

    <a href="https://www.cnblogs.com/x-zhi/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/2943582/20220801082530.png" alt="" /></...

    uj5u.com 2023-04-19 09:17:20 more
  • C#多執行緒學習(二) 如何操縱一個執行緒

    C#多執行緒學習(二) 如何操縱一個執行緒 執行緒學習第一篇:C#多執行緒學習(一) 多執行緒的相關概念 下面我們就動手來創建一個執行緒,使用Thread類創建執行緒時,只需提供執行緒入口即可。(執行緒入口使程式知道該讓這個執行緒干什么事) 在C#中,執行緒入口是通過ThreadStart代理(delegate)來提供的 ......

    uj5u.com 2023-04-19 09:16:49 more
  • 記一次 .NET某醫療器械清洗系統 卡死分析

    <a href="https://www.cnblogs.com/huangxincheng/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/214741/20200614104537.png" alt="" /&g...

    uj5u.com 2023-04-18 08:39:04 more
  • 記一次 .NET某醫療器械清洗系統 卡死分析

    一:背景 1. 講故事 前段時間協助訓練營里的一位朋友分析了一個程式卡死的問題,回過頭來看這個案例比較經典,這篇稍微整理一下供后來者少踩坑吧。 二:WinDbg 分析 1. 為什么會卡死 因為是表單程式,理所當然就是看主執行緒此時正在做什么? 可以用 ~0s ; k 看一下便知。 0:000> k # ......

    uj5u.com 2023-04-18 08:33:10 more
  • SignalR, No Connection with that ID,IIS

    <a href="https://www.cnblogs.com/smartstar/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/u36196.jpg" alt="" /></a>...

    uj5u.com 2023-03-30 17:21:52 more
  • 一次對pool的誤用導致的.net頻繁gc的診斷分析

    <a href="https://www.cnblogs.com/dotnet-diagnostic/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/3115652/20230225090434.png" alt=""...

    uj5u.com 2023-03-28 10:15:33 more
  • 一次對pool的誤用導致的.net頻繁gc的診斷分析

    <a href="https://www.cnblogs.com/dotnet-diagnostic/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/3115652/20230225090434.png" alt=""...

    uj5u.com 2023-03-28 10:13:31 more
  • C#遍歷指定檔案夾中所有檔案的3種方法

    <a href="https://www.cnblogs.com/xbhp/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/957602/20230310105611.png" alt="" /></a&...

    uj5u.com 2023-03-27 14:46:55 more
  • C#/VB.NET:如何將PDF轉為PDF/A

    <a href="https://www.cnblogs.com/Carina-baby/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/2859233/20220427162558.png" alt="" />...

    uj5u.com 2023-03-27 14:46:35 more
  • 武裝你的WEBAPI-OData聚合查詢

    <a href="https://www.cnblogs.com/podolski/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/616093/20140323000327.png" alt="" /><...

    uj5u.com 2023-03-27 14:46:16 more