Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
evExpress WinForm擁有180+組件和UI庫(kù),能為Windows Forms平臺(tái)創(chuàng)建具有影響力的業(yè)務(wù)解決方案。DevExpress WinForm能完美構(gòu)建流暢、美觀且易于使用的應(yīng)用程序,無(wú)論是Office風(fēng)格的界面,還是分析處理大批量的業(yè)務(wù)數(shù)據(jù),它都能輕松勝任!
注意:目前基于HTML & CSS的控件正在積極研發(fā)中,可以作為技術(shù)預(yù)覽提供,如果需要使用請(qǐng)下載最新版組件體驗(yàn)哦~
DevExpress WinForms Subscription官方最新版免費(fèi)下載試用,歷史版本下載,在線(xiàn)文檔和幫助文件下載-慧都網(wǎng)
一組控件和組件允許開(kāi)發(fā)人員構(gòu)建HTML格式的UI,并使用CSS樣式自定義UI元素的外觀設(shè)置、大小、填充和布局選項(xiàng),不再需要處理自定義繪制事件或更改大量屬性來(lái)修改控件以匹配UI規(guī)范,可以使用HTML和CSS標(biāo)記的知識(shí)為桌面應(yīng)用程序構(gòu)建布局。
在上文中(點(diǎn)擊這里回顧:用DevExpress實(shí)現(xiàn)基于HTML&CSS的桌面應(yīng)用程序的UI(二)),我們?yōu)榇蠹医榻B了HTML-CSS標(biāo)記的動(dòng)態(tài)自定義項(xiàng)目、數(shù)據(jù)綁定等,本文將繼續(xù)為大家介紹如何使用外部控件和就地編輯器、按鈕的使用等,歡迎持續(xù)關(guān)注這個(gè)系列的文章哦~
<input>標(biāo)記允許開(kāi)發(fā)者向基于HTML的UI添加就地編輯器或外部控件,標(biāo)簽支持以下控件:
HtmlContentControl
使用<input>標(biāo)記作為想要在布局中顯示的外部控件和存儲(chǔ)庫(kù)項(xiàng)(就地編輯器)的占位符。
Data Grid Views (ItemsView, TileView和 WinExplorerView)
使用<input>標(biāo)記作為Repository Items(就地編輯器)的占位符,不能使用此標(biāo)記在數(shù)據(jù)網(wǎng)格視圖中顯示外部控件。
HTML
<input name="textEditEmail" class="field-input"/>
<input name="repositoryItemPictureEdit1" value="${ImageData}" class="editor"/>
按照下面的步驟渲染一個(gè)按鈕:
下面的示例使用<div> 標(biāo)記來(lái)定義一個(gè)按鈕:
HTML
<div id="uploadBtn" class="centered button">Upload</div>
<div id="removeBtn" class="centered button">Remove</div>
CSS
.centered{
align-self:center;
}
.button {
width: 70px;
height: 20px;
min-width: 20px;
padding: 8px;
margin-left: 2px;
opacity: 0.5;
}
.button:hover {
border-radius: 4px;
background-color: #F2F2F2;
}
開(kāi)發(fā)者可以再控制級(jí)、HTML標(biāo)記級(jí)和使用Fluent API時(shí)響應(yīng)HTML UI元素上的鼠標(biāo)操作。
控件的鼠標(biāo)事件
支持HTML的控件公開(kāi)可以處理的事件,以響應(yīng)HTML UI元素上的鼠標(biāo)動(dòng)作,這些事件通常被稱(chēng)為:
C#
void htmlContentControl1_ElementMouseClick(object sender, DevExpress.Utils.Html.DxHtmlElementMouseEventArgs e) {
if(e.ElementId=="btnSend") {
//...
}
}
VB.NET
Sub HtmlContentControl1_ElementMouseClick(sender As Object, e As DevExpress.Utils.Html.DxHtmlElementMouseEventArgs) Handles HtmlContentControl1.ElementMouseClick
If e.ElementId="btnSend" Then
'...
End If
End Sub
HTML鼠標(biāo)事件
HTML標(biāo)記中支持以下鼠標(biāo)事件:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove和onmouseout,開(kāi)發(fā)者可以通過(guò)以下方式訂閱這些事件:
C#
void <MethodName>(object sender, DxHtmlElementMouseEventArgs args)
VB.NET
Sub <MethodName>(ByVal sender As Object, ByVal args As DxHtmlElementMouseEventArgs)
HTML
<img onclick="<MethodName>" ... />
示例:
C#
void OnPhoneClick(object sender, DxHtmlElementMouseEventArgs args) {
XtraMessageBox.Show("Phone!");
}
VB.NET
Sub OnPhoneClick(ByVal sender As Object, ByVal args As DxHtmlElementMouseEventArgs)
XtraMessageBox.Show("Phone!")
End Sub
HTML
<div class='buttonPanel'>
<img onclick="OnPhoneClick" src="PhoneCall" class="button" />
</div>
Fluent API
開(kāi)發(fā)者可以使用Fluent API訂閱元素的鼠標(biāo)單擊事件。
C#
var fluent=context.OfType<ViewModel>();
fluent.BindCommandToElement(htmlContentControl, "btnPhone", x=> x.Phone);
//...
public class ViewModel {
public void Phone() {
//...
}
//...
}
VB.NET
Dim fluent=context.OfType(Of ViewModel)()
fluent.BindCommandToElement(htmlContentControl, "btnPhone", Sub(x) x.Phone())
'...
Public Class ViewModel
Public Sub Phone()
'...
End Sub
End Class
'...
HTML
<img id="btnPhone" src="PhoneCall" class="button" />
天的高溫和冬季的寒潮不僅讓人難受,也會(huì)影響石油化工企業(yè)的生產(chǎn)。面對(duì)自然災(zāi)害,美國(guó)化學(xué)工程師學(xué)會(huì)提出了應(yīng)對(duì)方法。
哈維颶風(fēng)期間由于儲(chǔ)罐頂部倒塌,埃克森美孚煉油廠排放了超過(guò)84噸的污染物。
雖然有許多跡象和言論表明,石油化工行業(yè)的碳排放對(duì)大氣溫室效應(yīng)產(chǎn)生了重大影響,但這些行業(yè)也同樣受到極端氣象事件的影響,在自然災(zāi)害面前損失慘重。
極端高溫影響電力和生產(chǎn)
隨著夏季越來(lái)越長(zhǎng)、溫度越來(lái)越高,熱浪席卷全球,電力需求增加導(dǎo)致許多地區(qū)停電,公用事業(yè)公司不得不關(guān)閉不同地區(qū)的電力來(lái)防止電網(wǎng)過(guò)載。此外,極端高溫還會(huì)使輸電線(xiàn)路內(nèi)部金屬膨脹,出現(xiàn)電線(xiàn)下垂的問(wèn)題。近期美國(guó)杜克能源公司宣布,北卡羅來(lái)納州和南卡羅來(lái)納州的客戶(hù)電力消耗創(chuàng)下歷史新高,在2022年6月15日達(dá)到21,086兆瓦,對(duì)電網(wǎng)構(gòu)成了嚴(yán)峻考驗(yàn)。
大部分電網(wǎng)已經(jīng)老化,更容易受到熱浪期間輪流停電的影響。
無(wú)獨(dú)有偶,得克薩斯州的電網(wǎng)運(yùn)營(yíng)商也多次發(fā)出節(jié)能警告,該州的監(jiān)管機(jī)構(gòu)還預(yù)測(cè)能源儲(chǔ)備將出現(xiàn)短缺,ERCOT(得克薩斯州電力可靠性委員會(huì))預(yù)測(cè)得克薩斯州的電力需求將達(dá)到79,671兆瓦。根據(jù)研究,自2000年以來(lái),極端天氣導(dǎo)致美國(guó)的大停電次數(shù)增加了67%。與此同時(shí),強(qiáng)勁的電力消耗讓電網(wǎng)官員要求大型工業(yè)用戶(hù)在高峰時(shí)段減少需求,雪上加霜的是電價(jià)也在增長(zhǎng),截至7月24日,ERCOT北部樞紐日前節(jié)點(diǎn)邊際電價(jià)平均為170.50美元/兆瓦時(shí),是2021年同期的3倍以上。在此期間,得克薩斯州的化工行業(yè)整體生產(chǎn)水平雖然有所上升,但生產(chǎn)指數(shù)(衡量州制造業(yè)狀況的關(guān)鍵指標(biāo))遠(yuǎn)低于平均水平。
暴雨讓企業(yè)措手不及
2017年8月,颶風(fēng)哈維給得克薩斯州墨西哥灣沿岸帶來(lái)強(qiáng)降雨,導(dǎo)致10家煉油廠關(guān)閉停產(chǎn),其中埃克森美孚大型儲(chǔ)罐的罐頂?shù)顾虼税l(fā)生的污染物排放超過(guò)84噸,污染物中含有苯等致癌化合物。根據(jù)2022年環(huán)境和消費(fèi)者權(quán)利非營(yíng)利組織德克薩斯州公共公民的一份新報(bào)告,如果這些儲(chǔ)罐的設(shè)計(jì)是為了應(yīng)對(duì)氣候變化帶來(lái)的強(qiáng)降雨事件,那么其中許多事故都可以避免。該報(bào)告認(rèn)為,國(guó)家法規(guī)和行業(yè)標(biāo)準(zhǔn)使用過(guò)時(shí)的降雨數(shù)據(jù)作為建造儲(chǔ)罐和其他石化設(shè)備的最低門(mén)檻。報(bào)告稱(chēng),隨著氣候引發(fā)的風(fēng)暴帶來(lái)更頻繁和更大的降雨,這些設(shè)施更容易發(fā)生故障并將有毒化學(xué)物質(zhì)釋放到空氣和水中。
休斯頓航道兩旁是煉油廠和其他工業(yè)設(shè)施,其中許多設(shè)施在收到有關(guān)哈維颶風(fēng)的警告后等待很久才關(guān)閉,推遲停工和糟糕的規(guī)劃導(dǎo)致危險(xiǎn)的空氣污染物釋放到附近居民區(qū)。
墨西哥灣沿岸的極端天氣事件幾乎總是伴隨著工業(yè)事故和污染。由于颶風(fēng)而不得不關(guān)停的工廠除了會(huì)因?yàn)楸┯険p壞設(shè)備而產(chǎn)生污染,還會(huì)在開(kāi)停工時(shí)都產(chǎn)生大量排放。報(bào)告指出:“得克薩斯州的石化行業(yè)對(duì)強(qiáng)降雨毫無(wú)準(zhǔn)備,因?yàn)槲覀兊姆煞ㄒ?guī)沒(méi)有跟上我們新的氣候現(xiàn)實(shí)……得克薩斯州是時(shí)候重新定義極端天氣了。”
極寒風(fēng)暴讓石化行業(yè)陷入癱瘓
2021年2月14日,極寒風(fēng)暴降臨美國(guó)墨西哥灣沿岸,給得克薩斯州的許多地區(qū)帶來(lái)前所未有的長(zhǎng)期低溫,擾亂石化供應(yīng)。美國(guó)市場(chǎng)研究和咨詢(xún)服務(wù)公司Vertical Research Partners發(fā)現(xiàn),100%的環(huán)氧氯丙烷、約90%的乙二醇、70%以上的聚丙烯、60%以上的環(huán)氧樹(shù)脂、約40%的丙烯,一度陷入停產(chǎn)。雖然很難估算這些裝置停工兩周的影響,但由于休斯敦是世界上最大的石化綜合體,這里生產(chǎn)美國(guó)40%以上的化學(xué)品和約25%的燃料,會(huì)造成相當(dāng)大的損失。
由于得克薩斯州通常沒(méi)有這種極端天氣,因此該州沒(méi)有準(zhǔn)備好響應(yīng)措施。
麥肯錫報(bào)告中解釋說(shuō),該州和路易斯安娜州附近的許多化工廠并非為了在如此極端的條件下運(yùn)行而設(shè)計(jì),因此設(shè)備故障和凍結(jié)的工藝線(xiàn)會(huì)降低運(yùn)行的可靠性。由于許多裝置依賴(lài)于鄰近工廠的電力、原料、中間體供應(yīng),不利的網(wǎng)絡(luò)效應(yīng)可能會(huì)加劇這種情況。此外,風(fēng)暴的持續(xù)低溫還導(dǎo)致得克薩斯州的電力中斷,該州不得不輪流停電來(lái)保障電力供應(yīng)。
極端天氣事件的破壞性影響通常會(huì)導(dǎo)致計(jì)劃外的停電和因生產(chǎn)不足而造成的經(jīng)濟(jì)損失。此外,還有與相互關(guān)聯(lián)的商業(yè)服務(wù)相關(guān)的二級(jí)和三級(jí)影響,包括社會(huì)和環(huán)境影響。
許多石化裝置出于戰(zhàn)略性考慮,建立在沿海和內(nèi)陸水道附近,這使得它們?nèi)菀酌媾R颶風(fēng)和洪水的襲擊,尤其是墨西哥灣沿岸、大西洋沿岸和密西西比河附近的那些工廠。而且在美國(guó)西部的大部分地區(qū)和其他已知斷層的地區(qū),地震風(fēng)險(xiǎn)也是一個(gè)令人擔(dān)憂(yōu)的問(wèn)題。
颶風(fēng)引起的火災(zāi)
2017年8月,哈維颶風(fēng)造成的暴雨引發(fā)了五百年一遇的洪水,導(dǎo)致電力系統(tǒng)出現(xiàn)故障,位于得克薩斯州克羅斯比的阿科瑪工廠生產(chǎn)有機(jī)過(guò)氧化物,該產(chǎn)品需要低溫儲(chǔ)存,工廠制冷系統(tǒng)因洪水而癱瘓,缺乏低溫保護(hù)的反應(yīng)性化學(xué)品發(fā)生燃燒,由此產(chǎn)生的火災(zāi)以工廠為中心形成了半徑為2.4km的禁區(qū),附近居住的200多名居民被迫撤離,事故還造成多人受傷。
美國(guó)CSB(化學(xué)安全委員會(huì))針對(duì)此事故的調(diào)查提出了許多建議,并制定了廣泛而全面的指南,來(lái)減輕潛在極端天氣事件的風(fēng)險(xiǎn),包括:
·裝置應(yīng)進(jìn)行分析并確定其對(duì)極端天氣事件的敏感性;
·應(yīng)進(jìn)行風(fēng)險(xiǎn)評(píng)估來(lái)確定極端天氣事件對(duì)工藝安全的影響,最終應(yīng)接受保守的風(fēng)險(xiǎn)管理方法;
·應(yīng)對(duì)洪水事件采取關(guān)鍵保障措施。
受到這起火災(zāi)事件啟發(fā),AlChE(美國(guó)化學(xué)工程師學(xué)會(huì))基于各政府、保險(xiǎn)機(jī)構(gòu)和CCPS(化學(xué)工藝安全中心)提供的指導(dǎo),出版了一份專(zhuān)刊,著重討論自然災(zāi)害的評(píng)估和規(guī)劃,希望為企業(yè)提供一些指導(dǎo)。
在專(zhuān)刊中,自然災(zāi)害的評(píng)估和規(guī)劃包括圖中的幾個(gè)步驟。
識(shí)別災(zāi)害
為自然災(zāi)害事件做準(zhǔn)備的第一步是確定可能發(fā)生的自然災(zāi)害。可以根據(jù)氣象地質(zhì)災(zāi)害的基本定義制作初步篩選清單,例如洪水、極端溫度、颶風(fēng)、閃電、冰雹、干旱等氣象災(zāi)害,和地震、滑坡、海嘯、火山爆發(fā)、大壩斷裂等地質(zhì)災(zāi)害。并根據(jù)規(guī)范和標(biāo)準(zhǔn)、保險(xiǎn)報(bào)告和場(chǎng)地經(jīng)驗(yàn)等來(lái)確定自然災(zāi)害是否與場(chǎng)地相關(guān)。雖然分析人員可能沒(méi)有經(jīng)歷過(guò)特定類(lèi)型的自然災(zāi)害,但不能低估災(zāi)害發(fā)生的潛力。
收集數(shù)據(jù)
一旦確定了與裝置相關(guān)的潛在自然災(zāi)害,下一步就是收集有關(guān)自然災(zāi)害的數(shù)據(jù)。數(shù)據(jù)也可以從第三方、自然災(zāi)害專(zhuān)家顧問(wèn)或保險(xiǎn)公司處獲得。
收集的數(shù)據(jù)必須針對(duì)每個(gè)現(xiàn)場(chǎng)位置,包括發(fā)生概率和嚴(yán)重程度(例如水位高度、風(fēng)速、地震帶)。還需要了解具體的場(chǎng)地地形,為潛在的風(fēng)險(xiǎn)緩解措施提供信息。
收集的數(shù)據(jù)應(yīng)與描述場(chǎng)地條件的其他重要原始數(shù)據(jù)一起保存。每個(gè)現(xiàn)場(chǎng)的數(shù)據(jù)應(yīng)以潛在緊急情況下現(xiàn)場(chǎng)人員可打開(kāi)的格式進(jìn)行維護(hù),并且還應(yīng)進(jìn)行備份,便于遠(yuǎn)程訪問(wèn)。
確定在自然災(zāi)害評(píng)估中要處理的設(shè)備
現(xiàn)場(chǎng)包括許多可能對(duì)支持運(yùn)營(yíng)至關(guān)重要的設(shè)備和系統(tǒng),其中一些可能對(duì)保護(hù)工廠免受自然災(zāi)害很重要。例如,應(yīng)急電源系統(tǒng)對(duì)于自然災(zāi)害期間的持續(xù)運(yùn)行可能很重要,但維修車(chē)間設(shè)備可能不重要。應(yīng)識(shí)別安全操作所需的所有設(shè)備或操作,或者如果受到損害可能導(dǎo)致的工藝安全事件、對(duì)附近居民或環(huán)境造成危害的設(shè)備或操作。安全操作可能需要的其他設(shè)備包括:氮?dú)獍l(fā)生器、消防水泵、冷卻系統(tǒng)、工藝控制和安全儀表系統(tǒng)以及廢水泵。
根據(jù)設(shè)計(jì)標(biāo)準(zhǔn)進(jìn)行評(píng)估
應(yīng)將上一小節(jié)中確定的設(shè)備和操作與之前收集的所有自然災(zāi)害發(fā)生的可能性和嚴(yán)重性數(shù)據(jù)進(jìn)行比較。如果當(dāng)前或計(jì)劃的設(shè)計(jì)低于設(shè)計(jì)標(biāo)準(zhǔn),則存在應(yīng)解決的差距。解決差距的方法有:
· 使設(shè)備/操作達(dá)到設(shè)計(jì)標(biāo)準(zhǔn);
· 進(jìn)行風(fēng)險(xiǎn)評(píng)估來(lái)了解風(fēng)險(xiǎn)并制定保障措施;
· 通過(guò)應(yīng)急響應(yīng)計(jì)劃解決差距。
在決定最佳的方案時(shí),應(yīng)牢記工藝安全層次結(jié)構(gòu)。最好先消除差距,再設(shè)計(jì)解決方案,最后提供應(yīng)急響應(yīng)。
恢復(fù)運(yùn)行
災(zāi)難過(guò)去后,需要進(jìn)行善后管理和恢復(fù)運(yùn)行。可能會(huì)有損壞的設(shè)備需要修復(fù)、污染需要解決、隱藏的故障、與舊設(shè)備相關(guān)的新危險(xiǎn)以及典型的開(kāi)工挑戰(zhàn)。此時(shí),確定由特殊情況導(dǎo)致的擔(dān)憂(yōu)和需求至關(guān)重要。比如員工很可能在處理家庭損失,并對(duì)福利有所擔(dān)憂(yōu)。在管理安全運(yùn)行恢復(fù)時(shí),巨大的壓力和注意力分散是需要高度關(guān)注的問(wèn)題。此外,現(xiàn)場(chǎng)的新工人(例如來(lái)自其他工廠的員工、不熟悉現(xiàn)場(chǎng)或工作流程的承包商)可能會(huì)被請(qǐng)來(lái)完成維修工作。所以新員工管理應(yīng)該也是一個(gè)重點(diǎn)領(lǐng)域。
重新調(diào)試
自然災(zāi)害后裝置的重新調(diào)試計(jì)劃必須至少與新裝置的首次開(kāi)車(chē)一樣全面。在開(kāi)始操作之前,應(yīng)對(duì)開(kāi)工負(fù)責(zé)人進(jìn)行適當(dāng)培訓(xùn),確保設(shè)備已準(zhǔn)備好接收化學(xué)品、連接公用工程,并且所有操作和安全系統(tǒng)都應(yīng)正常運(yùn)行。
重新調(diào)試包括為運(yùn)營(yíng)設(shè)施相關(guān)的所有任務(wù)準(zhǔn)備設(shè)備和人員。應(yīng)制定重新調(diào)試計(jì)劃,以便從特定的自然災(zāi)害影響(例如颶風(fēng)和洪水帶來(lái)的危害)中恢復(fù)。在災(zāi)難發(fā)生之前正常工作的設(shè)備在災(zāi)難之后可能會(huì)出現(xiàn)故障。不要假設(shè)設(shè)備會(huì)按預(yù)期運(yùn)行,應(yīng)當(dāng)對(duì)它們一一確認(rèn)。
自然災(zāi)害固然非常可怕,但是根據(jù)同行分享的經(jīng)驗(yàn)和學(xué)習(xí)有助于降低風(fēng)險(xiǎn)和提高績(jī)效,希望CCPS的指導(dǎo)可以在符合法規(guī)要求的前提下,為企業(yè)帶來(lái)一些參考。
引用
1. ASCE 2014, Flood Resistant Design and Construction, ASCE/SEI 24-14, American Society of Civil Engineers.
2. ASCE 2016, Minimum Design Loads and Associated Criteria for Buildings and Other Structures, ASCE /SEI 7-16, American Society of Civil Engineers
3. CCPS 1995, Guidelines for Safe Storage and Handling of Reactive Materials, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
4. CCPS 1995, Guidelines for Technical Planning for On-Site Emergencies, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
5. CCPS 1998, Guidelines for Safe Warehousing of Chemicals, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
6. CCPS 1999, Guidelines for Chemical Process Quantitative Risk Analysis, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
7. CCPS 2007, Guidelines for Risk Based Process Safety, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
8. CCPS 2007, Guidelines for Performing Effective Pre-Startup Safety Reviews, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
9. CCPS 2009, Guidelines for Developing Quantitative Safety Risk Criteria, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
10. CCPS 2018, Guidelines for Siting and Layout of Facilities, Center for Chemical Process Safety of the American Institute of Chemical Engineers, New York, NY.
11. Cowley, Lessons Learned from Natural Disasters, OECD Workshop Natech Risk Management, May 23-25, 2012, Dresden, Germany.
12. CSB 2005, After Katrina: Precautions Needed During Oil and Chemical Facility Startup, Bulletin No. 2005-01- S, Chemical Safety and Hazard Investigation Board, September.
13. CSB 2018, Organic Peroxide Decomposition, Release, and Fire at Arkema Crosby Following Hurricane Harvey Flooding, Report Number 2017-08-I-TX, Chemical Safety and Hazard Investigation Board, May.
14. DHS, Department of Homeland Security, https://www.dhs.gov/cisa/government-emergency- telecommunications-service-gets
15. FEMA 2014, Emergency Power Systems or Critical Facilities: A Best Practices Approach to Improving Reliability, FEA P-1019, Federal Emergency Management Agency, September.
16. FEMA 2019a, Federal Emergency Management Agency, https://www.fema.gov/flood-zones
17. FEMA 2019b, Federal Emergency Management Agency, https://www.fema.gov/media-library-data/14685042016723c52280b1b1d936e8d23e26f12816017/Flood_Hazard_Mapping_Updates_Over view_Fact_Sheet.pdf
18. FM Global 2004, Flood Emergency Response Plan, https://www.fmglobal.com/~/media/Files/FMGlobal/Nat Haz Toolkit/P0589.pdf
19. FM Global 2012, Property Loss Prevention Data Sheet 1-2 Earthquakes, FM Global, Hartford, Connecticut.
20. FM Global 2010, Property Loss Prevention Data Sheet 1-11 Fire Following Earthquake, FM Global, Hartford, Connecticut.
21. FM Global 2010a, Property Loss Prevention Data Sheet 1-29 Roof Deck Securement and Above-Deck Roof Components, FM Global, Hartford, Connecticut.
22. FM Global 2019, Property Loss Prevention Data Sheet 1-34 Hail Damage, FM Global, Hartford, Connecticut.
23. FM Global 2019a, Property Loss Prevention Data Sheet FM 1-40 Flood, FM Global, Hartford, Connecticut.
24. MW 2019, Merriam-Webster, https://www.merriam-webster.com/dictionary/monograph
25. NHC 2019a, National Hurricane Center, https://www.nhc.noaa.gov/surge/ (NHC 2019a)
26. NOAA 2019a, National Oceanic and Atmospheric Administration,
https://noaa.maps.arcgis.com/apps/MapSeries/index.html?appid=d9ed7904dbec441a9c4dd7b2779 35fad&entry=1
27. NOAA 2019b, National Oceanic and Atmospheric Administration, https://www.noaa.gov/explainers/severe-storms
28. NOAA 2019c, National Oceanic and Atmospheric Administration, https://oceanservice.noaa.gov/facts/hurricane.html
29. NOAA 2019d, National Oceanic and Atmospheric Administration, https://www.nhc.noaa.gov/aboutsshws.php
30. NOAA 2019e, National Oceanic and Atmospheric Administration, https://oceanservice.noaa.gov/facts/stormsurge-stormtide.html
31. NOAA 2019f, National Oceanic and Atmospheric Administration, https://www.nhc.noaa.gov/aboutgloss.shtml
32. NOAA 2019g, National Oceanic and Atmospheric Administration, https://oceanservice.noaa.gov/facts/tsunami.html
33. NPRA 2006, White Paper: Hurricane Security Operations, National Petrochemical & Refiners Association, NPRA, May.
34. NRCS 2019 https://www.nrcs.usda.gov/wps/portal/nrcs/detail/wi/about/?cid=nrcs142p2_020752
35. OSHA, Hurricane eMatrix—Hazard Exposure and Risk Assessment Matrix for Hurricane Response & Recovery Work, US. Department of Labor, Occupational Safety and Health Administration, http://www.osha.gov/SLTC/etools/hurricane/index.html
36. SPC 2019, https://www.spc.noaa.gov/faq/tornado/ef-scale.html
37. UKEA 2015, Preparing for Flooding – A guide for sites regulated under EPR and COMAH, United Kingdom Environment Agency, https://www.gov.uk/government/publications/preparing-for-flooding-a-guide- for-regulated-sites
38. USGS 2018, U.S. Geological Survey, https://www.usgs.gov/news/post-harvey-report-provides- inundation-maps-and-flood-details-largest-rainfall-event-recorded
39. USGS 2019, U.S. Geological Survey,
https://www.usgs.gov/special-topic/water-science-school/science/100-year-flood?qt- science_center_objects=0#qt-science_center_objects
40. USGS 2019b, U.S. Geological Survey, https://earthquake.usgs.gov/learn/topics/mercalli.php
41. USGS 2019c, U.S. Geological Survey, https://earthquake.usgs.gov/learn/glossary/?term=Richter%20scale
42. Weather 2019, National Weather Service,
https://w1.weather.gov/glossary/index.php?word=beaufort+scale
43. Weather 2019a, National Weather Service https://www.weather.gov/mfl/beaufort
44. https://www.cnbc.com/2022/05/17/natural-gas-prices-have-already-doubled-this-year-a-hot-summer-could-push-them-even-higher.html
45. https://www.spglobal.com/commodityinsights/en/market-insights/latest-news/electric-power/072522-texas-factories-stay-on-slow-growth-path-despite-heat-wave-induced-curtailments
46. https://www.cnbc.com/2022/
07/11/ercot-tells-texans-to-curb-power-use-as-extreme-heat-strains-the-grid.html
47. https://www.bloomberg.com/news/articles/2022-05-14/texas-faces-another-day-of-extreme-heat-straining-power-grid
48. https://cnr.ncsu.edu/news/2022/07/extreme-heat-power-grid/
49. https://edition.cnn.com/2022/07/11/weather/record-heat-texas-power-grid-wxn/index.html
50. https://grist.org/extreme-weather/texas-petrochemical-regulation-rainfall-hurricane-public-citzen-report/
51. https://www.chemistryworld.com/news/polar-storm-paralyses-us-gulf-coast-petrochemical-sector/4013306.article
52. https://www.hydrocarbonprocessing.com/news/2021/03/texas-deep-freeze-lingering-impacts-on-us-petrochemical-industry
53. https://www.abs-group.com/Knowledge-Center/Insights/How-the-Petrochemical-Industry-Can-Enhance-Extreme-Weather-Resilience-/
54. https://www.csb.gov/arkema-inc-chemical-plant-fire-/
55. https://www.aiche.org/sites/default/files/html/536181/files/downloads/Assessment%20of%20and%20planning%20for%20Natural%20Hazards.pdf
56. https://www.aiche.org/sites/default/files/html/536181/NaturalDisaster-CCPSmonograph.html
57. https://www.hosemaster.com/severe-weather-effect-refining/
58. https://www.hengyitek.com/how-is-the-impact-of-power-limit-on-the-chemical-industry/
59. https://www.dallasfed.org/research/surveys/tmos/2022/2207.aspx#tab-report
60. https://money.cnn.com/2017/08/28/news/companies/exxon-refinery-baytown-harvey-damage/index.html
61. https://grist.org/science/raining-harder-new-research-says-climate-change-to-blame/
62. https://www.csb.gov/arkema-inc-chemical-plant-fire-/
本文來(lái)自上海漢潔,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,如有需要請(qǐng)聯(lián)系marketing@haaenclean.com。
前段時(shí)間寫(xiě)了個(gè)小說(shuō)線(xiàn)上采集閱讀(猛戳這里:https://www.cnblogs.com/huanzi-qch/p/9817831.html),當(dāng)我們?nèi)ゲ杉瘘c(diǎn)網(wǎng)的小說(shuō)目錄時(shí)發(fā)現(xiàn)目錄數(shù)據(jù)沒(méi)有在html里面,數(shù)據(jù)是頁(yè)面加載時(shí),用ajax請(qǐng)求獲取,且對(duì)應(yīng)的div是隱藏的,需要點(diǎn)擊“目錄”,才看到目錄,雖然經(jīng)過(guò)研究最終我們還是找到了接口URL,并通過(guò)HttpClient構(gòu)造post請(qǐng)求獲取到了數(shù)據(jù),但這種方式太麻煩,成本太大,那有沒(méi)有其他的方式呢?
通過(guò)查找資料發(fā)現(xiàn)一個(gè)神器:HtmlUnit 官網(wǎng)入口,猛戳這里:http://htmlunit.sourceforge.net
以下介紹摘自官網(wǎng):
HtmlUnit is a "GUI-Less browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser.
It has fairly good JavaScript support (which is constantly improving) and is able to work even with quite complex AJAX libraries, simulating Chrome, Firefox or Internet Explorer depending on the configuration used.
It is typically used for testing purposes or to retrieve information from web sites.
HtmlUnit is not a generic unit testing framework. It is specifically a way to simulate a browser for testing purposes and is intended to be used within another testing framework such as JUnit or TestNG. Refer to the document "Getting Started with HtmlUnit" for an introduction.
HtmlUnit is used as the underlying "browser" by different Open Source tools like Canoo WebTest, JWebUnit, WebDriver, JSFUnit, WETATOR, Celerity, Spring MVC Test HtmlUnit, ...
HtmlUnit was originally written by Mike Bowler of Gargoyle Software and is released under the Apache 2 license. Since then, it has received many contributions from other developers, and would not be where it is today without their assistance.
HtmlUnit provides excellent JavaScript support, simulating the behavior of the configured browser (Firefox or Internet Explorer). It uses the Rhino JavaScript engine for the core language (plus workarounds for some Rhino bugs) and provides the implementation for the objects specific to execution in a browser.
中文翻譯:
HtmlUnit是一個(gè)“Java程序的無(wú)界面瀏覽器”。它為HTML文檔建模,并提供一個(gè)API,允許您調(diào)用頁(yè)面、填寫(xiě)表單、單擊鏈接等……就像你在“普通”瀏覽器中所做的一樣。
它有相當(dāng)好的JavaScript支持(不斷改進(jìn)),甚至可以使用非常復(fù)雜的AJAX庫(kù),根據(jù)使用的配置模擬Chrome、Firefox或Internet Explorer。
它通常用于測(cè)試或從web站點(diǎn)檢索信息。
HtmlUnit不是一個(gè)通用的單元測(cè)試框架。它是一種專(zhuān)門(mén)用于測(cè)試目的的模擬瀏覽器的方法,并打算在其他測(cè)試框架(如JUnit或TestNG)中使用。請(qǐng)參閱“開(kāi)始使用HtmlUnit”文檔以獲得介紹。
HtmlUnit被不同的開(kāi)源工具用作底層的“瀏覽器”,比如Canoo WebTest, JWebUnit, WebDriver, JSFUnit, WETATOR, Celerity, Spring MVC Test HtmlUnit…
HtmlUnit最初是由石像鬼軟件的Mike Bowler編寫(xiě)的,在Apache 2許可證下發(fā)布。從那以后,它收到了其他開(kāi)發(fā)者的許多貢獻(xiàn),如果沒(méi)有他們的幫助,它就不會(huì)有今天的成就。
HtmlUnit提供了出色的JavaScript支持,模擬了配置好的瀏覽器(Firefox或Internet Explorer)的行為。它使用Rhino JavaScript引擎作為核心語(yǔ)言(加上一些Rhino bug的解決方案),并為特定于在瀏覽器中執(zhí)行的對(duì)象提供實(shí)現(xiàn)。
快速上手,猛戳這里:http://htmlunit.sourceforge.net/gettingStarted.html
maven引包:
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.32</version>
</dependency>
那對(duì)應(yīng)我們之前獲取目錄,我們可以這樣做:
try {
//創(chuàng)建一個(gè)WebClient,并模擬特定的瀏覽器
WebClient webClient=new WebClient(BrowserVersion.FIREFOX_52);
//幾個(gè)重要配置
webClient.getOptions().setJavaScriptEnabled(true);//激活js
webClient.setAjaxController(new NicelyResynchronizingAjaxController());//設(shè)置Ajax異步
webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);//拋出失敗的狀態(tài)碼
webClient.getOptions().setThrowExceptionOnScriptError(true);//拋出js異常
webClient.getOptions().setCssEnabled(false);//禁用css,無(wú)頁(yè)面,無(wú)需渲染
webClient.getOptions().setTimeout(10000); //設(shè)置連接超時(shí)時(shí)間
//獲取起點(diǎn)中文網(wǎng)書(shū)本詳情、目錄頁(yè)面
HtmlPage page=webClient.getPage("https://book.qidian.com/info/1209977");
//設(shè)置等待js響應(yīng)時(shí)間
webClient.waitForBackgroundJavaScript(5000);
//模擬點(diǎn)擊“目錄”
page=page.getHtmlElementById("j_catalogPage").click();
//獲取頁(yè)面源代碼
System.out.println(page.asXml());
} catch (IOException e) {
e.printStackTrace();
}
未執(zhí)行js之前
經(jīng)過(guò)執(zhí)行js請(qǐng)求渲染數(shù)據(jù),再獲取頁(yè)面源代碼,這樣我們就能拿到帶有目錄數(shù)據(jù)的html了
簡(jiǎn)單的幾行代碼就可以看出htmlUnit的強(qiáng)大,理論上,瀏覽器能做的它都能模擬;在這里先記錄下來(lái),等有空了再加到小說(shuō)線(xiàn)上采集閱讀(猛戳這里:https://www.cnblogs.com/huanzi-qch/p/9817831.html)
HtmlPage常用的篩選出我們想要的元素
HtmlPage page;
//根據(jù)id查詢(xún)?cè)?
HtmlElement id=page.getHtmlElementById("id");
//根據(jù)元素標(biāo)簽名
DomNodeList<DomElement> input=page.getElementsByTagName("input");
//根據(jù)attribute查詢(xún)?cè)兀鏲lass
List<HtmlElement> elements=page.getDocumentElement().getElementsByAttribute("div", "class", "list-content");
2020-12-03更新
我們之前htmlutil的版本一直是2.32,最近在抓取一個(gè)Vue頁(yè)面,程序一直報(bào)錯(cuò),無(wú)法繼續(xù)抓取頁(yè)面
更新到2.45.0(目前是最新版),程序可以繼續(xù)抓取頁(yè)面
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.45.0</version>
</dependency>
同時(shí)記錄一下,如果等待頁(yè)面js渲染頁(yè)面
我們先寫(xiě)一個(gè)簡(jiǎn)單的Vue頁(yè)面進(jìn)行測(cè)試
<template>
<div class="main">
<p v-if="isShow">數(shù)據(jù)加載中...</p>
<div v-else="isShow">
<span class="item" v-for="item in items">{{item}}</span>
</div>
</div>
</template>
<script>
//引入
import AxiosUtil from "@/utils/axiosUtil.js"
var vue;
export default {
data(){
return {
isShow:true,
items:[]
}
},
created() {
vue=this;
console.log("5秒后調(diào)用后臺(tái)查詢(xún)數(shù)據(jù)!");
setTimeout(function () {
console.log("調(diào)用后臺(tái)接口!");
//請(qǐng)求后臺(tái)服務(wù),獲取數(shù)據(jù)
AxiosUtil.post("http://localhost:8081/test",{},function (response) {
vue.items=response;
vue.isShow=false;
console.log(response);
})
},5000);
}
}
</script>
<style scoped>
</style>
htmlutil進(jìn)行抓取
這個(gè)是我們封裝好的工具類(lèi)
/**
* WebClient工具類(lèi)
*/
@Slf4j
public class WebClientUtil {
/**
* 獲取一個(gè)WebClient
*/
public static WebClient getWebClient() {
//創(chuàng)建一個(gè)WebClient,并隨機(jī)初始化一個(gè)瀏覽器模型
BrowserVersion[] versions={BrowserVersion.INTERNET_EXPLORER, BrowserVersion.CHROME, BrowserVersion.EDGE};
WebClient webClient=new WebClient(versions[(int) (versions.length * Math.random())]);
//幾個(gè)重要配置
webClient.getCookieManager().setCookiesEnabled(true);//啟用cookie
webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);//拋出失敗的狀態(tài)碼
webClient.getOptions().setThrowExceptionOnScriptError(true);//拋出js異常
webClient.getOptions().setUseInsecureSSL(true);//忽略ssl認(rèn)證
webClient.getOptions().setJavaScriptEnabled(true);//啟用js
webClient.getOptions().setRedirectEnabled(true);//啟用重定向
webClient.getOptions().setCssEnabled(true);//啟用css
webClient.getOptions().setTimeout(10000); //設(shè)置連接超時(shí)時(shí)間
webClient.waitForBackgroundJavaScript(3000);//設(shè)置等待js響應(yīng)時(shí)間
webClient.waitForBackgroundJavaScriptStartingBefore(3000);//設(shè)置等待js響應(yīng)時(shí)間
webClient.setAjaxController(new NicelyResynchronizingAjaxController());//設(shè)置Ajax異步
webClient.getOptions().setAppletEnabled(true);//啟用小程序
webClient.getOptions().setGeolocationEnabled(true);//啟用定位
return webClient;
}
/**
* 設(shè)置cookie
*/
public static void setCookie(WebClient webClient,String domain,String cookieString){
//設(shè)置cookie
for (String value : cookieString.split(";")) {
String[] split=value.trim().split("=");
if(split.length <=0){
continue;
}
//域名、key、value
Cookie cookie=new Cookie(domain,split[0],split[1]);
webClient.getCookieManager().addCookie(cookie);
}
}
/**
* 根據(jù)一個(gè)url發(fā)起get請(qǐng)求
*/
public static Page gatherForGet(WebClient webClient, String url, String refererUrl, Map<String, String> headers) throws IOException {
//Referer,默認(rèn)百度 https://www.baidu.com
webClient.removeRequestHeader("Referer");
webClient.addRequestHeader("Referer", refererUrl);
//是否還要其他的Header,不可以直接在http請(qǐng)求的head里面攜帶cookie,需要這樣設(shè)置:webClient.getCookieManager().addCookie(cookie);
if (!StringUtils.isEmpty(headers)) {
headers.forEach((key, value) -> {
webClient.removeRequestHeader(key);
webClient.addRequestHeader(key, value);
});
}
//get訪問(wèn)
WebRequest request=new WebRequest(new URL(url), HttpMethod.GET);
request.setProxyHost(webClient.getOptions().getProxyConfig().getProxyHost());
request.setProxyPort(webClient.getOptions().getProxyConfig().getProxyPort());
return webClient.getPage(request);
}
/**
* 根據(jù)一個(gè)url發(fā)起post請(qǐng)求
*/
public static Page gatherForPost(WebClient webClient, String url, String refererUrl, Map<String, String> headers,Map<String,Object> paramMap) throws IOException {
//Referer,默認(rèn)百度 https://www.baidu.com
webClient.removeRequestHeader("Referer");
webClient.addRequestHeader("Referer", refererUrl);
//是否還要其他的Header,可以直接在http請(qǐng)求的head里面攜帶cookie,或者這樣設(shè)置:webClient.getCookieManager().addCookie(cookie);
if (!StringUtils.isEmpty(headers)) {
headers.forEach((key, value) -> {
webClient.removeRequestHeader(key);
webClient.addRequestHeader(key, value);
});
}
//post訪問(wèn)
WebRequest request=new WebRequest(new URL(url), HttpMethod.POST);
request.setProxyHost(webClient.getOptions().getProxyConfig().getProxyHost());
request.setProxyPort(webClient.getOptions().getProxyConfig().getProxyPort());
/*
服務(wù)端有@RequestBody,請(qǐng)求頭需要設(shè)置Content-type=application/json; charset=UTF-8,同時(shí)請(qǐng)求參數(shù)要放在body里
*/
// request.setRequestBody(JSONObject.fromObject(paramMap).toString());
// webClient.removeRequestHeader("Content-Type");
// webClient.addRequestHeader("Content-Type","application/json;charset=UTF-8");
/*
服務(wù)端沒(méi)有@RequestBody,請(qǐng)求頭需要設(shè)置Content-type=application/x-www-form-urlencoded; charset=UTF-8,同時(shí)請(qǐng)求參數(shù)要放在URL參數(shù)里
*/
ArrayList<NameValuePair> list=new ArrayList<>();
for (int i=0; i < paramMap.size(); i++) {
String key=(String) paramMap.keySet().toArray()[i];
list.add(new NameValuePair(key, (String) paramMap.get(key)));
}
request.setRequestParameters(list);
webClient.removeRequestHeader("Content-Type");
webClient.addRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
webClient.removeRequestHeader("Accept");
webClient.addRequestHeader("Accept", "*/*");
return webClient.getPage(request);
}
}
main測(cè)試
/**
* main測(cè)試
*/
public static void main(String[] args) {
try (WebClient webClient=WebClientUtil.getWebClient()) {
Page page=WebClientUtil.gatherForGet(webClient, "http://localhost:8080/#/test", "", null);
//解析html格式的字符串成一個(gè)Document
HtmlPage htmlPage=(HtmlPage) page;
//根據(jù)attribute查詢(xún)?cè)兀鏲lass
List<HtmlElement> elementss=htmlPage.getDocumentElement().getElementsByAttribute("span", "class", "item");
for (int i=0; i < 20; i++) {
if (elementss.size() > 0) {
log.info("ajax執(zhí)行完畢");
break;
}
synchronized (htmlPage) {
log.info("wait等待...");
//繼續(xù)等待
htmlPage.wait(500);
//重新分析
elementss=htmlPage.getDocumentElement().getElementsByAttribute("span", "class", "item");
}
}
elementss.forEach((htmlElement)->{
log.info(htmlElement.asText());
});
} catch (Exception e) {
e.printStackTrace();
}
}
結(jié)果
瀏覽器直接訪問(wèn)Vue頁(yè)面
htmlutil抓取
代碼已經(jīng)開(kāi)源、托管到我的GitHub、碼云:
GitHub:https://github.com/huanzi-qch/spider
碼云:https://gitee.com/huanzi-qch/spider
作者:huanzi-qch
出處:https://www.cnblogs.com/huanzi-qch
若標(biāo)題中有“轉(zhuǎn)載”字樣,則本文版權(quán)歸原作者所有。若無(wú)轉(zhuǎn)載字樣,本文版權(quán)歸作者所有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁(yè)面明顯位置給出原文鏈接,否則保留追究法律責(zé)任的權(quán)利.
*請(qǐng)認(rèn)真填寫(xiě)需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。