|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526 |
- using BPASmartClient.AGV;
- using BPASmartClient.AGV.Enums;
- using BPASmartClient.AGV.Feedback;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.Helper;
- using BPASmartClient.HubHelper;
- using FryPot_DosingSystem.Model;
- using FryPot_DosingSystem.ViewModel;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Media;
- using System.Windows;
- using FryPot_DosingSystem.AGV;
- using FryPot_DosingSystem.FryPotStatus;
- using System.IO;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Diagnostics;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.CustomResource.UserControls;
- using Renci.SshNet.Messages;
-
- namespace FryPot_DosingSystem.Control
- {
- internal class DosingLogicControl
- {
- public static DosingLogicControl _instance;
- public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
-
- public ushort[] RollerNum = new ushort[] { 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 207, 208, 301, 302, 303, 304, 305, 306, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 501, 502, 503, 504, 505, 506, 507, 508 };
-
-
- /// <summary>
- /// 桶净重
- /// </summary>r
- public ushort RollerNetweight = 19;//19公斤
-
- /// <summary>
- /// 滚筒线PLC数据
- /// </summary>
- public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
-
- public ConcurrentDictionary<string, object> FryOneData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryTwoData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryThreeData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryFourData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryFiveData = new ConcurrentDictionary<string, object>();
- /// <summary>
- /// 线体1配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 线体2配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> LTwoRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 线体3配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> LThreeRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 线体1进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体2进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LTwoInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体3进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LThreeInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体1出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体2出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LTwoOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体3出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LThreeOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 全局变量对象声明
- /// </summary>
- GlobalVariable globalVar;
- /// <summary>
- /// 线体状态对象声明
- /// </summary>
- HardWareStatusViewModel hardWareStatusModel;
- ///// <summary>
- ///// 炒锅1状态
- ///// </summary>
- //PotOneStatus fryOne;
- ///// <summary>
- ///// 炒锅2状态
- ///// </summary>
- //PotTwoStatus fryTwo;
- ///// <summary>
- ///// 炒锅3状态
- ///// </summary>
- //PotThreeStatus fryThree;
- ///// <summary>
- ///// 炒锅4状态
- ///// </summary>
- //PotFourStatus fryFour;
- ///// <summary>
- ///// 炒锅5状态
- ///// </summary>
- //PotFiveStatus fryFive;
- /// <summary>
- /// 报警信息对象声明
- /// </summary>
- #region 上位机内部变量
- int FryPotAlarm = 0;//炒锅1滚筒故障信号 1:无故障 -1:故障
- int FryPotTwoAlarm = 0;//炒锅2滚筒故障信号 1:无故障 -1:故障
- int FryPotThreeAlarm = 0;//炒锅3滚筒故障信号 1:无故障 -1:故障
- int FryPotFourAlarm = 0;//炒锅4滚筒故障信号 1:无故障 -1:故障
- int FryPotFiveAlarm = 0;//炒锅5滚筒故障信号 1:无故障 -1:故障
- int ReicpeNum = 0;//记录接收到的配方数
- bool ErrorRecipe;//线体1错误配方标识
- bool LTwoErrorRecipe;//线体2错误配方标识
- bool LThreeErrorRecipe;//线体3错误配方标识
- string fryOneRecipe = string.Empty;
- string fryTwoRecipe = string.Empty;
- string fryThreeRecipe = string.Empty;
- string fryFourRecipe = string.Empty;
- string fryFiveRecipe = string.Empty;
- #endregion
- #region agv临时变量
- //bool agvArriveUpLoad = false;//agv是否到达线体1上料位置
- //bool agvArriveLTwoUpLoad = false;//agv是否到达线体2上料位置
- //bool agvArriveLThreeUpLoad = false;//agv是否到达线体3上料位置
-
- //bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置
- //bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置
- //bool LThreeagvArriveUnLoad = false;//线体3 agv是否到达炒锅送料位置
-
- //bool agvFryPotEmptyRollerArrive = false;// 线体1的agv是否拿到炒锅空桶
- //bool LTwoagvFryPotEmptyRollerArrive = false; //线体2的agv是否拿到炒锅空桶
- //bool LThreeagvFryPotEmptyRollerArrive = false;//线体3的agv是否拿到炒锅空桶
-
- string LOnerobotJobId = string.Empty;//线体1当前上游系统任务号,全局唯一 从线体1到炒锅路径
- string LTworobotJobId = string.Empty;//线体2当前上游系统任务号,全局唯一 从线体2到炒锅路径
- string LThreerobotJobId = string.Empty;//线体3当前上游系统任务号,全局唯一 从线体3到炒锅路径
- string LFourrobotJobId = string.Empty;//线体4当前上游系统任务号,全局唯一 从炒锅1、4到线体4路径
- string LFiverobotJobId = string.Empty; //从炒锅2、5到线体4路径
- string LSixrobotJobId = string.Empty; //从炒锅3到线体4路径
- List<string> LSevenrobotJobId = new List<string>(); //从线体1到清洗台路径
- List<string> LEightrobotJobId = new List<string>();//从线体2到清洗台路径
- List<string> LNinerobotJobId = new List<string>(); //从线体3到清洗台路径
- List<string> LTenrobotJobId = new List<string>(); //从清洗台到线体4路径
-
- Dictionary<string, int> agvCode = new Dictionary<string, int>() { { "ZT11-21", 1 }, { "ZT11-22", 2 }, { "ZT11-23", 3 }, { "ZT11-24", 4 } };//agv小车的编号对AGV动画小车编号
-
- private static readonly object Obj_Lock = new object();//3条滚筒线洗桶线程互斥锁
-
- private static readonly object Pot_Lock = new object();//炒股工艺工艺下发锁
- public int CleanNum = 0;//当前清洗台桶数
-
- ushort LOneCurrentRollerNum = 0;//当前线体1的空桶桶号
- ushort LTwoCurrentRollerNum = 0;//当前线体2的空桶桶号
- ushort LThreeCurrentRollerNum = 0;//当前线体3的空桶桶号
-
-
- public NewRecipeModel potOneCurrentRecipe = null;
- public NewRecipeModel potTwoCurrentRecipe = null;
- public NewRecipeModel potThreeCurrentRecipe = null;
- public NewRecipeModel potFourCurrentRecipe = null;
- public NewRecipeModel potFiveCurrentRecipe = null;
-
- #endregion
- /// <summary>
- /// 调试命令注册
- /// </summary>
- public void CommandRegist()
- {
-
- #region 线体空桶清洗及回收调试
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineOneLoadEmptyRoller = true;
-
- }), "AgvArriveLineOneEmptyRollerLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineTwoLoadEmptyRoller = true;
-
- }), "AgvArriveLineTwoEmptyRollerLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineThreeLoadEmptyRoller = true;
-
- }), "AgvArriveLineThreeEmptyRollerLoc");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.CleanComplete = 1;
-
- //}), "CleanPlateCallAgv");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位
- // globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;
- // globalVar.rollerLineThree.agvArriveCleanUnLoad = true;
-
- //}), "AgvArriveCleanPlateLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位
-
- }), "AgvArriveCleanPlateLocLoad");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.agvArriveLineFour = true;
- // globalVar.rollerLineOne.agvArriveLineFour = true;
- // globalVar.rollerLineTwo.agvArriveLineFour = true;
- // globalVar.rollerLineThree.agvArriveLineFour = true;
- //}), "AgvArriveLineFourLoc");
-
-
- #endregion
- //接口调试
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // string id = Guid.NewGuid().ToString("D");
- // string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
- // if (errorCode == "SUCCESS")
- // {
- // MessageNotify.GetInstance.ShowRunLog($"AGV任务下发成功");
- // }
- // else if (errorCode == "Analysis Error")
- // {
- // MessageNotify.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文");
- // }
- // else
- // {
- // MessageNotify.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
- // }
- //}), "AgvDebug");
-
- //ActionManage.GetInstance.Register(() =>
- //{
- // MessageNotify.GetInstance.ShowRunLog("清洗台卸桶完成");
-
- //}, "AgvArriveCleanPlateLocCom");
-
- //ActionManage.GetInstance.Register(() =>
- //{
- // MessageNotify.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成");
- // MessageNotify.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成");
- // MessageNotify.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成");
- // MessageNotify.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成");
-
- //}, "AgvArriveLineFourLocCom");
- //ActionManage.GetInstance.Register(() =>
- //{
- // MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成");
-
- //}, "AgvArriveCleanPlateLocLoadCom");
-
- //ActionManage.GetInstance.Register(() =>
- //{
- // // globalVar.rollerLineOne.RecipeCompleteSingle = 1;
-
- //}, "LineOneRecipeComSignal");
- //ActionManage.GetInstance.Register(() =>
- //{
- // // globalVar.rollerLineTwo.RecipeCompleteSingle = 1;
-
- //}, "LineTwoRecipeComSignal");
- //ActionManage.GetInstance.Register(() =>
- //{
- // // globalVar.rollerLineThree.RecipeCompleteSingle = 1;
-
- //}, "LineThreeRecipeComSignal");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.agvArriveLineOneLoadCom = true;
- //}), "AgvLineOneLoadEmptyCom");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.agvArriveLineTwoLoadCom = true;
- //}), "AgvLineTwoLoadEmptyCom");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.agvArriveLineThreeLoadCom = true;
- //}), "AgvLineThreeLoadEmptyCom");
-
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineOne.CanRun = true;
- //}), "AGVLineOneLoadCom");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineTwo.CanRun = true;
- //}), "AGVLineTwoLoadCom");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineThree.CanRun = true;
- //}), "AGVLineThreeLoadCom");
-
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineOne.OutMaterialingSingle = 1;
- //}), "RollerLineRunning");
- //ActionManage.GetInstance.Register(new Action<object>((obj) =>
- //{
- // globalVar.rollerLineOne.StationEight = (ushort)obj;
- //}), "EightWorkLoc");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.fryPotOne.InputMaterialArrivedSingle = 1;
- // globalVar.fryPotFour.InputMaterialArrivedSingle = 1;
- //}), "FryPotInputArrive");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1;
- // globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1;
- //}), "FryPotEmptyRollerArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveUpLoad = true;
- }), "AGVLOneArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveUnLoad = true;
- }), "AGVFryPotDownArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveUpLoad = true;
- }), "AGVFryPotUpArrive");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.agvFryPotEmptyRollerArrive = true;
-
- //}), "AGVFryPotGetEmptyRoller");
- //滚筒线2
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineTwo.OutMaterialingSingle = 1;
- //}), "RollerLineTwoRunning");
- //ActionManage.GetInstance.Register(new Action<object>((obj) =>
- //{
- // globalVar.rollerLineTwo.StationEight = (ushort)obj;
- //}), "TwoEightWorkLoc");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.fryPotTwo.InputMaterialArrivedSingle = 1;
- // globalVar.fryPotFive.InputMaterialArrivedSingle = 1;
- //}), "FryPotTwoInputArrive");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1;
- // globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1;
- //}), "FryPotTwoEmptyRollerArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLTwoUpLoad = true;
- }), "AGVLTwoArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.LTwoagvArriveUnLoad = true;
- }), "AGVFryPotTwoDownArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLTwoUpLoad = true;
- }), "AGVFryPotTwoUpArrive");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.LTwoagvFryPotEmptyRollerArrive = true;
-
- //}), "AGVFryPotTwoGetEmptyRoller");
- //滚筒线3
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.rollerLineThree.OutMaterialingSingle = 1;
- //}), "RollerLineThreeRunning");
- //ActionManage.GetInstance.Register(new Action<object>((obj) =>
- //{
- // globalVar.rollerLineThree.StationEight = (ushort)obj;
- //}), "ThreeEightWorkLoc");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.fryPotThree.InputMaterialArrivedSingle = 1;
- //}), "FryPotThreeInputArrive");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1;
- //}), "FryPotThreeEmptyRollerArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLThreeUpLoad = true;
- }), "AGVLThreeArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.LThreeagvArriveUnLoad = true;
- }), "AGVFryPotThreeDownArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLThreeUpLoad = true;
- }), "AGVFryPotThreeUpArrive");
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // globalVar.LThreeagvFryPotEmptyRollerArrive = true;
-
- //}), "AGVFryPotThreeGetEmptyRoller");
- }
- public DosingLogicControl()
- {
- globalVar = new GlobalVariable();
- //fryOne = new PotOneStatus();
- //fryTwo = new PotTwoStatus();
- //fryThree = new PotThreeStatus();
- //fryFour = new PotFourStatus();
- //fryFive = new PotFiveStatus();
- hardWareStatusModel = HardWareStatusViewModel.GetInstance;
- DateTimeJudge();
- FileRegClean();
- ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
- //ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
- ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
- ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes");
- ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes");
- //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
- //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.ExitLineOneTask = true;
- LineOneEmptyRollerCleanTaskRestart();
-
- }), "EmptyRollerCleanTaskRestart");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.ExitLineTwoTask = true;
- LineTwoEmptyRollerCleanTaskRestart();
-
- }), "LineTwoEmptyRollerCleanTaskRestart");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.ExitLineThreeTask = true;
- LineThreeEmptyRollerCleanTaskRestart();
-
- }), "LineThreeEmptyRollerCleanTaskRestart");
- HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
- HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
- //ResetProgram();
- ReadPlcData();
- // HeatBeatToPlc();
- SaveFryPotData();
- MainTask();
- CommandRegist();
- }
-
- private void HeatBeatToPlc()
- {
- ThreadManage.GetInstance().StartLong(new Action(() => {
- DeviceOperate.GetInstance.WritePlcData("D0001", 1);
- Thread.Sleep(500);
- DeviceOperate.GetInstance.WritePlcData("D0001", 0);
- Thread.Sleep(500);
- }), "上位机心跳下发滚筒线", true);
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- DeviceOperate.GetInstance.WritePotOnePlcData("D0001", 1);
- Thread.Sleep(500);
- DeviceOperate.GetInstance.WritePotOnePlcData("D0001", 0);
- Thread.Sleep(500);
- }), "上位机心跳下发1号炒锅", true);
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- DeviceOperate.GetInstance.WritePotTwoPlcData("D0001", 1);
- Thread.Sleep(500);
- DeviceOperate.GetInstance.WritePotTwoPlcData("D0001", 0);
- Thread.Sleep(500);
- }), "上位机心跳下发2号炒锅", true);
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- DeviceOperate.GetInstance.WritePotThreePlcData("D0001", 1);
- Thread.Sleep(500);
- DeviceOperate.GetInstance.WritePotThreePlcData("D0001", 0);
- Thread.Sleep(500);
- }), "上位机心跳下发3号炒锅", true);
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- DeviceOperate.GetInstance.WritePotFourPlcData("D0001", 1);
- Thread.Sleep(500);
- DeviceOperate.GetInstance.WritePotFourPlcData("D0001", 0);
- Thread.Sleep(500);
- }), "上位机心跳下发4号炒锅", true);
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- DeviceOperate.GetInstance.WritePotFivePlcData("D0001", 1);
- Thread.Sleep(500);
- DeviceOperate.GetInstance.WritePotFivePlcData("D0001", 0);
- Thread.Sleep(500);
- }), "上位机心跳下发5号炒锅", true);
- }
-
-
- /// <summary>
- /// 文件数据定期清理
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void FileRegClean()
- {
- try
- {
- int days = 5; //清除期限
- string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
- if (filesOne.Count() > 0)
- {
- foreach (var item in filesOne)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
- if (filesTwo.Count() > 0)
- {
- foreach (var item in filesTwo)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
- if (filesThree.Count() > 0)
- {
- foreach (var item in filesThree)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
- if (filesFour.Count() > 0)
- {
- foreach (var item in filesFour)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
- if (filesFive.Count() > 0)
- {
- foreach (var item in filesFive)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- /// <summary>
- /// 时间差计算
- /// </summary>
- /// <param name="t">当前时间</param>
- /// <param name="t2">创建时间</param>
- /// <returns></returns>
- private int TimeDiff(DateTime t, DateTime t2)
- {
- long lReturn = -1;
- System.TimeSpan NowValue = new TimeSpan(t.Ticks);
- System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
- System.TimeSpan DateDiff = TimeSpan.Zero;
- try
- {
- //计算时间差
- //DateDiff = TimeValue.Subtract(NowValue).Duration();
- DateDiff = NowValue.Subtract(TimeValue);
- int h = DateDiff.Hours;
- int m = DateDiff.Minutes;
- return DateDiff.Days;
- }
- catch
- {
- return -1;
- }
- }
- /// <summary>
- /// 炒锅数据实时保存
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void SaveFryPotData()
- {
- Task.Run(new Action(() =>
- {
- while (true)
- {
- FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
- }
- }));
- }
-
- /// <summary>
- /// 时间判断,数据处理
- /// </summary>
- private void DateTimeJudge()
- {
- #region sqlite数据库保存
- //if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
- // if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
- // if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
- // if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
- // if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
-
- //if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
- // if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- #endregion
- string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
- string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
- string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
- string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
- string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
- if (!Directory.Exists("AccessFile//" + "Statistic"))
- Directory.CreateDirectory("AccessFile//" + "Statistic");
- if (File.Exists(p1))
- {
- using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p2))
- {
- using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p3))
- {
- using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p4))
- {
- using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p5))
- {
- using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- }
-
- /// <summary>
- /// AGV上下料上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvFeedBackUpReportDataAnalysis(object obj)
- {
- //if (obj != null && obj is byte[] datas)
- //{
- //string strData = Encoding.UTF8.GetString(datas);
- EventData objData = JsonConvert.DeserializeObject<EventData>(obj.ToString());
- if (objData != null)
- {
- AGVHelper.GetInstance.UpDownFeedBack(objData.agvCode, objData.jobId, objData.msgId);
- #region 线体到炒锅请求上下料
- //线体1请求上下料
- if (objData.equipmentId == 1 && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【1】号滚筒线上料请求");
- }
- if ((objData.equipmentId == 5 || objData.equipmentId == 8) && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveUnLoad = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【{globalVar.LOneFryPotSerial}】号炒锅下料请求");
- }
- //线体2请求上下料
- if (objData.equipmentId == 2 && objData.command == "LOAD")
- {
- globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【2】号滚筒线上料请求");
- }
- if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.LTwoagvArriveUnLoad = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【{globalVar.LTwoFryPotSerial}】号炒锅下料请求");
- }
- //线体3请求上下料
- if (objData.equipmentId == 3 && objData.command == "LOAD")
- {
- globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【3】号滚筒线上料请求");
- }
- if (objData.equipmentId == 7 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.LThreeagvArriveUnLoad = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【{globalVar.LThreeFryPotSerial}】号炒锅下料请求");
- }
- #endregion
- #region 炒锅到线体4请求上下料
- //炒锅1,4到线体4
- if ((objData.equipmentId == 5 || objData.equipmentId == 8) && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.agvCode}】AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//发送AGV到位信号
- }
- if (objData.equipmentId == 40 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
- }
- //炒锅2,5到线体4
- if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "LOAD")
- {
- globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.agvCode}】AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//发送AGV到位信号
-
- }
- if (objData.equipmentId == 41 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
- }
- //炒锅3到线体4
- if (objData.equipmentId == 7 && objData.command == "LOAD")
- {
- globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.agvCode}】AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//发送AGV到位信号
- }
- if (objData.equipmentId == 42 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
- }
- #endregion
- #region 线体123到清洗台请求上下料
- //线体1到清洗台
- if (objData.equipmentId == 11 && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【1】号滚筒线上料请求");
- }
- if (objData.equipmentId == 10 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机下料请求");
- }
- //线体2到清洗台
- if (objData.equipmentId == 22 && objData.command == "LOAD")
- {
- globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【2】号滚筒线上料请求");
-
- }
- if (objData.equipmentId == 20 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
-
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机下料请求");
- }
-
- if (objData.equipmentId == 33 && objData.command == "LOAD")
- {
- globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【3】号滚筒线上料请求");
- }
- if (objData.equipmentId == 30 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
-
- globalVar.rollerLineThree.agvArriveCleanUnLoad = true;//AGV到达下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机下料请求");
- }
- #endregion
- #region 清洗台到线体4请求上下料
- if (objData.equipmentId == 10 && objData.command == "LOAD")
- {
- globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机上料请求");
- }
- if (objData.equipmentId == 44 && objData.command == "UNLOAD")
- {
- globalVar.agvArriveLineFour = true;//agv到达线体4下料位置
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
- }
- #endregion
- }
-
- }
-
- /// <summary>
- /// AGV搬运任务上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvTaskUpReportDataAnalysis(object obj)
- {
- TaskEventData objData;
- try
- {
- objData = JsonConvert.DeserializeObject<TaskEventData>(obj.ToString());
- }
- catch (Exception)
- {
-
- MessageNotify.GetInstance.ShowRunLog("Agv任务回报数据异常");
- objData = null;
- }
- if (objData != null)
- {
- if (objData.state == "ABNORMAL_COMPLETED")
- {
- if (objData.robotJobId == LOnerobotJobId)
- {
- globalVar.LineOneRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
- }
- if (objData.robotJobId == LTworobotJobId)
- {
- globalVar.LineTwoRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
- }
- if (objData.robotJobId == LThreerobotJobId)
- {
- globalVar.LineThreeRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
-
- }
- if (objData.robotJobId == LFourrobotJobId)
- {
- globalVar.LineFourRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
- }
- if (objData.robotJobId == LFiverobotJobId)
- {
- globalVar.LineFiveRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
- }
- if (objData.robotJobId == LSixrobotJobId)
- {
- globalVar.LineSixRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
- }
- if (LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
- {
- globalVar.LineSevenRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
-
- }
- if (LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
- {
- globalVar.LineEightRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
-
- }
- if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
- {
- globalVar.LineNineRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
-
- }
- if (LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
- {
- globalVar.LineTenRobotTaskError = true;
- MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
-
- }
-
- }
- #region 线体上下料任务信息回报
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "sTEwzw")// AGV正在上料,指线体上料
- {
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "PChS6R")// AGV正在上料,指线体上料
- {
- //日志
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "HHif8Z")// AGV正在上料,指线体上料
- {
- //日志
- }
-
- //线体1任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "sTEwzw")//指定上料点上料完成,这里指线体上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1052", 0);
- globalVar.agvLineOneLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
- if (globalVar.LOneFryPotSerial == 1)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_1);
- }
- else if (globalVar.LOneFryPotSerial == 4)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_4);
- }
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体1→炒锅【{globalVar.LOneFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
- }
-
- //线体2任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "PChS6R")//指定上料点上料完成,这里指线体上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1053", 0);
- globalVar.agvLineTwoLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
- if (globalVar.LTwoFryPotSerial == 2)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_2);
- }
- else if (globalVar.LTwoFryPotSerial == 5)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_5);
- }
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体2→炒锅【{globalVar.LTwoFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体3任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "HHif8Z")//指定上料点上料完成,这里指线体上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1054", 0);
- globalVar.agvLineThreeLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_3_3);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体3→炒锅【{globalVar.LThreeFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体1任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && (objData.jobData.targetPointCode == "DXDnMJ" || objData.jobData.targetPointCode == "naFssQ"))//指定下料点正在下料,指线体到炒锅下料
- {
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && (objData.jobData.targetPointCode == "PChS6R" || objData.jobData.targetPointCode == "sxSX88"))//指定下料点正在下料,指线体到炒锅下料
- {
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "biZG87")//指定下料点正在下料,指线体到炒锅下料
- {
-
- }
- //线体1任务上报
- if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && (objData.jobData.targetPointCode == "DXDnMJ" || objData.jobData.targetPointCode == "naFssQ"))//指定下料位置下料完成,指线体到炒锅下料
- {
- if (objData.jobData.targetPointCode == "DXDnMJ")
- {
- DeviceOperate.GetInstance.WritePlcData("D1055", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1058", 0);
- }
-
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LOneFryPotSerial}】下料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体2任务上报
- if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && (objData.jobData.targetPointCode == "CDPGde" || objData.jobData.targetPointCode == "sxSX88"))//指定下料位置下料完成,指线体到炒锅下料
- {
- if (objData.jobData.targetPointCode == "CDPGde")
- {
- DeviceOperate.GetInstance.WritePlcData("D1056", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1059", 0);
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LTwoFryPotSerial}】下料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体3任务上报
- if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "biZG87")//指定下料位置下料完成,指线体到炒锅下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1057", 0);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LThreeFryPotSerial}】下料完成信号,任务号【{objData.robotJobId}】");
- }
- #endregion
- #region 炒锅空桶上下料任务信息回报
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFourrobotJobId && (objData.jobData.startPointCode == "DXDnMJ" || objData.jobData.startPointCode == "naFssQ"))// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFiverobotJobId && (objData.jobData.startPointCode == "CDPGde" || objData.jobData.startPointCode == "sxSX88"))// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "biZG87")// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
-
- //线体1任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LFourrobotJobId && (objData.jobData.startPointCode == "DXDnMJ" || objData.jobData.startPointCode == "naFssQ"))//指定上料点上料完成,这里指炒锅空桶上料
- {
- if (objData.jobData.startPointCode == "DXDnMJ")
- {
- DeviceOperate.GetInstance.WritePlcData("D1060", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1063", 0);
- }
-
- globalVar.agvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- if (globalVar.LOneFryPotSerial == 1)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_1);
- }
- else if (globalVar.LOneFryPotSerial == 4)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);
- }
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LOneFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体2任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LFiverobotJobId && (objData.jobData.startPointCode == "CDPGde" || objData.jobData.startPointCode == "sxSX88"))//指定上料点上料完成,这里指炒锅空桶上料
- {
-
- if (objData.jobData.startPointCode == "CDPGde")
- {
- DeviceOperate.GetInstance.WritePlcData("D1061", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1064", 0);
- }
-
- globalVar.LTwoagvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- if (globalVar.LTwoFryPotSerial == 2)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_2);
- }
- else if (globalVar.LTwoFryPotSerial == 5)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_5);
- }
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LTwoFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体3任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "biZG87")//指定上料点上料完成,这里指炒锅空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1062", 0);
- globalVar.LThreeagvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_3);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LThreeFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
- }
-
-
- //线体1任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
-
- }
- //线体1任务上报
- if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
- {
- MessageNotify.GetInstance.ShowRunLog("1号线炒锅空桶在4号线卸桶完成");
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LOneFryPotSerial}】→回桶线下料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体2任务上报
- if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
- {
- MessageNotify.GetInstance.ShowRunLog("2号线炒锅空桶在4号线卸桶完成");
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV【{globalVar.LTwoFryPotSerial}】→回桶线下料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体3任务上报
- if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
- {
- MessageNotify.GetInstance.ShowRunLog("3号线炒锅空桶在4号线卸桶完成");
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV【{globalVar.LThreeFryPotSerial}】→回桶线下料完成信号,任务号【{objData.robotJobId}】");
- }
- #endregion
- #region 线体123空桶到清戏台
- //线体1任务上报
- if (objData.state == "LOAD_COMPLETED" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "sTEwzw")//指定上料点上料完成,这里指线体1空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1052", 0);
- globalVar.agvArriveLineOneLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_1);
- //到清洗处
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体1→洗桶机上料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体2任务上报
- if (objData.state == "LOAD_COMPLETED" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "PChS6R")//指定上料点上料完成,这里指线体2空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1053", 0);
- globalVar.agvArriveLineTwoLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_2);
- //到清洗处
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体2→洗桶机上料完成信号,任务号【{objData.robotJobId}】");
- }
- //线体3任务上报
- if (objData.state == "LOAD_COMPLETED" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "HHif8Z")//指定上料点上料完成,这里指线体3空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1054", 0);
- globalVar.agvArriveLineThreeLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_3);
- //到清洗处
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体3→洗桶机上料完成信号,任务号【{objData.robotJobId}】");
- }
-
-
- if (objData.state == "DONE" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体1到清戏台空桶下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1065", 0);
- LSevenrobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("线体【1】空桶在清洗台卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体1→洗桶机下料完成信号,任务号【{objData.robotJobId}】");
- }
- if (objData.state == "DONE" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体2到清戏台空桶下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1065", 0);
- LEightrobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("线体【2】空桶在清洗台卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体2→洗桶机下料完成信号,任务号【{objData.robotJobId}】");
- }
- if (objData.state == "DONE" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体3到清戏台空桶下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1065", 0);
- LNinerobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("线体【3】空桶在清洗台卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体3→洗桶机下料完成信号,任务号【{objData.robotJobId}】");
- }
- #endregion
- #region 清洗台到线体4
- if (objData.state == "LOAD_COMPLETED" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "TitRYC")//指定上料位置上料完成,指清戏台空桶到上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1066", 0);
- // globalVar.AllowNextEmptyRollerToClean = true;//AGV到滚筒线搬运空桶的允许标志
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_4);//去四号空桶线
- AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV洗桶机上料完成信号,任务号【{objData.robotJobId}】");
- }
- if (objData.state == "ROLLER_UNLOAD_DOING" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料点正在下料,指清洗台空桶到线体4下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV回桶线下料完成信号,任务号【{objData.robotJobId}】");
- }
-
- if (objData.state == "DONE" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指清戏台空桶到线体4下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- LTenrobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("【4】号线空桶回桶完成");
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
-
- }
- #endregion
-
-
-
- }
-
- }
-
- /// <summary>
- /// 主任务重启
- /// </summary>
- private void ResetProgram()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
- {
- MessageNotify.GetInstance.ShowUserLog("主任务正在重启");
-
- ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
- {
- //ActionManage.GetInstance.CancelRegister("RecipeSetDown");
- //ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
- // ActionManage.GetInstance.Send("ClearRecipes");
- ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
- {
- ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
- {
- ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
- {
- globalVar = null;
- globalVar = new GlobalVariable();
- ReicpeNum = 0;
- ReadPlcData();
- MainTask();
- MessageNotify.GetInstance.ShowUserLog("主任务重启完成");
- }));
- }));
-
- }));
- }));
- }
-
- Thread.Sleep(10);
- }), "ResetProgram");
- }
-
- public void LineOneTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
- {
- WritePlcData("D1101", 0);//复位开始执行指令
- ActionManage.GetInstance.Send("ClearOneRecipes");
- //globalVar.rollerLineOne = null;
- //globalVar.rollerLineOne = new RollerLineOne();
- //globalVar.fryPotOne = null;
- //globalVar.fryPotOne = new FryPotOne();
- //globalVar.fryPotFour = null;
- //globalVar.fryPotFour = new FryPotFour();
-
- globalVar.rollerLineOne.RecipeComMidSingle = 1;
- globalVar.rollerLineOne.LowSignalJude = false;
- globalVar.rollerLineOne.NextStart = false;
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- globalVar.rollerLineOne.CanRun = true;
-
- globalVar.ExitLineOneTask = false;
-
- globalVar.LOneCurrentRecipeName = string.Empty;
-
- globalVar.AllowAgvToLineLoadRoller = true;
- globalVar.InOrOutputLock = false;
- globalVar.LoadRoller = false;
- globalVar.AgvToFryPot = false;
- globalVar.PotOneInputMaterialArrive = false;
- globalVar.PotOneOutputRollerArrive = false;
- globalVar.AgvArrivePot = false;
-
- globalVar.LOneMaterialNum = 0;
- globalVar.LOneCurrentCookingStep = 0;
- globalVar.LFourCurrentCookingStep = 0;
-
-
- globalVar.agvArriveUpLoad = false;
- globalVar.agvArriveUnLoad = false;
- globalVar.agvFryPotEmptyRollerArrive = false;
- globalVar.rollerLineOne.agvArriveLineFour = false;
- globalVar.agvLineOneLoadCom = false;
- ErrorRecipe = false;
-
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
-
- }));
- }
- public void LineTwoTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
- {
- WritePlcData("D1102", 0);//复位开始执行指令
- ActionManage.GetInstance.Send("ClearTwoRecipes");
- //globalVar.rollerLineTwo = null;
- //globalVar.rollerLineTwo = new RollerLineTwo();
- //globalVar.fryPotTwo = null;
- //globalVar.fryPotTwo = new FryPotTwo();
- //globalVar.fryPotFive = null;
- //globalVar.fryPotFive = new FryPotFive();
- globalVar.rollerLineTwo.RecipeComMidSingle = 1;
- globalVar.rollerLineTwo.LowSignalJude = false;
- globalVar.rollerLineTwo.NextStart = false;
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- globalVar.rollerLineTwo.CanRun = true;
-
-
- globalVar.ExitLineTwoTask = false;
-
- globalVar.LTwoCurrentRecipeName = string.Empty;
-
- globalVar.AllowAgvToLineTwoLoadRoller = true;
- globalVar.LTwoInOrOutputLock = false;
-
- globalVar.LTwoLoadRoller = false;
- globalVar.LTwoAgvToFryPot = false;
- globalVar.LTwoPotInputMaterialArrive = false;
- globalVar.LTwoPotOutputRollerArrive = false;
- globalVar.LTwoAgvArrivePot = false;
-
- globalVar.LTwoMaterialNum = 0;
- globalVar.LTwoCurrentCookingStep = 0;
- globalVar.LFiveCurrentCookingStep = 0;
-
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoagvArriveUnLoad = false;
- globalVar.LTwoagvFryPotEmptyRollerArrive = false;
- globalVar.rollerLineTwo.agvArriveLineFour = false;
- globalVar.agvLineTwoLoadCom = false;
- LTwoErrorRecipe = false;
-
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
- }));
- }
- public void LineThreeTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
- {
- WritePlcData("D1103", 0);//复位开始执行指令
- ActionManage.GetInstance.Send("ClearThreeRecipes");
- //globalVar.rollerLineThree = null;
- //globalVar.rollerLineThree = new RollerLineThree();
- //globalVar.fryPotThree = null;
- //globalVar.fryPotThree = new FryPotThree();
- globalVar.rollerLineTwo.RecipeComMidSingle = 1;
- globalVar.rollerLineTwo.LowSignalJude = false;
- globalVar.rollerLineTwo.NextStart = false;
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- globalVar.rollerLineTwo.CanRun = true;
-
- globalVar.ExitLineThreeTask = false;
-
- globalVar.AllowAgvToLineThreeLoadRoller = true;
- globalVar.LThreeInOrOutputLock = false;
-
- globalVar.LThreeCurrentRecipeName = string.Empty;
-
- globalVar.LThreeLoadRoller = false;
- globalVar.LThreeAgvToFryPot = false;
- globalVar.LThreePotInputMaterialArrive = false;
- globalVar.LThreePotOutputRollerArrive = false;
- globalVar.LThreeAgvArrivePot = false;
-
- globalVar.LThreeMaterialNum = 0;
- globalVar.LThreeCurrentCookingStep = 0;
-
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeagvArriveUnLoad = false;
- globalVar.LThreeagvFryPotEmptyRollerArrive = false;
- globalVar.rollerLineThree.agvArriveLineFour = false;
- globalVar.agvLineThreeLoadCom = false;
- LThreeErrorRecipe = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
- }));
- }
-
- public void LineOneEmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线1空桶清洗任务线程", new Action(() =>
- {
- globalVar.rollerLineOne.StationEight = 0;
- globalVar.ExitLineOneTask = false;
- //globalVar.rollerLineOne.EmptyRollerNums.Clear();
-
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- globalVar.rollerLineOne.CanRun = true;
-
- globalVar.agvArriveLineFour = false;
- globalVar.agvArriveCleanLoad = false;
- globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineOneLoadEmptyRoller = false;
- globalVar.agvArriveLineOneLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【1】空桶清洗任务重启成功");
- }));
- }
-
-
- public void LineTwoEmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线2空桶清洗任务线程", new Action(() =>
- {
-
- globalVar.rollerLineTwo.StationEight = 0;
- globalVar.ExitLineTwoTask = false;
- // globalVar.rollerLineTwo.EmptyRollerNums.Clear();
-
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- globalVar.rollerLineTwo.CanRun = true;
-
-
- globalVar.agvArriveLineFour = false;
- globalVar.agvArriveCleanLoad = false;
-
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineTwoLoadEmptyRoller = false;
- globalVar.agvArriveLineTwoLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【2】空桶清洗任务重启成功");
- }));
- }
-
- public void LineThreeEmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线3空桶清洗任务线程", new Action(() =>
- {
- globalVar.rollerLineThree.StationEight = 0;
- globalVar.ExitLineThreeTask = false;
- // globalVar.rollerLineThree.EmptyRollerNums.Clear();
-
- globalVar.rollerLineThree.IsEpmtyBefore = false;
- globalVar.rollerLineThree.CanRun = true;
-
- globalVar.agvArriveLineFour = false;
- globalVar.agvArriveCleanLoad = false;
- globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineThreeLoadEmptyRoller = false;
- globalVar.agvArriveLineThreeLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【3】空桶清洗任务重启成功");
- }));
- }
- /// <summary>
- /// 实时获取plc数据
- /// </summary>
- public void ReadPlcData()
- {
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GetAddressData("D0000", new Action<ushort[]>((data) =>
- // {
- // try
- // {
- // if (data.Count() > 0)
- // {
- // //globalVar.rollerLineOne.StationOne = data[0];
- // if (globalVar.LineHeartBeat!= data[0])
- // {
- // if (globalVar.LBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", false);
- // MessageNotify.GetInstance.ShowRunLog("滚筒线心跳恢复");
- // }
- // globalVar.CanPlaceOrder = true;//允许下单
- // globalVar.LBeatStopTimes = 0;
- // globalVar.LineHeartBeat = data[0];
- // }
- // else
- // {
-
- // globalVar.LBeatStopTimes++;
- // if (globalVar.LBeatStopTimes >= 10)
- // {
- // globalVar.CanPlaceOrder = false;//不允许下单
- // ActionManage.GetInstance.Send("HeartBeatCheck", true);
- // if(globalVar.LBeatStopTimes>=10&& globalVar.LBeatStopTimes<13)
- // MessageNotify.GetInstance.ShowRunLog("滚筒线心跳心跳异常");
- // }
-
-
- // }
- // }
- // }
- // catch (Exception)
- // {
-
- // // throw;
- // }
- // }));
- // Thread.Sleep(500);
- //}), "滚筒线心跳检测");
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GetFryOneData("D0000", new Action<ushort[]>((data) =>
- // {
- // try
- // {
- // if (data.Count() > 0)
- // {
- // //globalVar.rollerLineOne.StationOne = data[0];
- // if (globalVar.PotOneHeartBeat != data[0])
- // {
- // if (globalVar.POneBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", false);
- // MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳恢复");
- // }
- // globalVar.POneBeatStopTimes = 0;
- // globalVar.PotOneHeartBeat = data[0];
- // }
- // else
- // {
-
- // globalVar.POneBeatStopTimes++;
- // if (globalVar.POneBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", true);
- // if (globalVar.POneBeatStopTimes >= 10 && globalVar.POneBeatStopTimes < 13)
- // MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳异常");
- // }
-
- // //不允许下单
- // }
- // }
- // }
- // catch (Exception)
- // {
-
- // // throw;
- // }
- // }));
- // Thread.Sleep(500);
- //}), "炒锅1心跳检测");
-
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GetFryTwoData("D0000", new Action<ushort[]>((data) =>
- // {
- // try
- // {
- // if (data.Count() > 0)
- // {
- // //globalVar.rollerLineOne.StationOne = data[0];
- // if (globalVar.PotTwoHeartBeat != data[0])
- // {
- // if (globalVar.PTwoBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", false);
- // MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳恢复");
- // }
- // globalVar.PTwoBeatStopTimes = 0;
- // globalVar.PotTwoHeartBeat = data[0];
- // }
- // else
- // {
-
- // globalVar.PTwoBeatStopTimes++;
- // if (globalVar.PTwoBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", true);
- // if (globalVar.PTwoBeatStopTimes >= 10 && globalVar.PTwoBeatStopTimes < 13)
- // MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳异常");
- // }
-
- // //不允许下单
- // }
- // }
- // }
- // catch (Exception)
- // {
-
- // // throw;
- // }
- // }));
- // Thread.Sleep(500);
- //}), "炒锅2心跳检测");
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GetFryThreeData("D0000", new Action<ushort[]>((data) =>
- // {
- // try
- // {
- // if (data.Count() > 0)
- // {
- // //globalVar.rollerLineOne.StationOne = data[0];
- // if (globalVar.PotThreeHeartBeat != data[0])
- // {
- // if (globalVar.PThreeBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", false);
- // MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳恢复");
- // }
- // globalVar.PThreeBeatStopTimes = 0;
- // globalVar.PotThreeHeartBeat = data[0];
- // }
- // else
- // {
-
- // globalVar.PThreeBeatStopTimes++;
- // if (globalVar.PThreeBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", true);
- // if (globalVar.PThreeBeatStopTimes >= 10 && globalVar.PThreeBeatStopTimes < 13)
- // MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳异常");
- // }
-
- // //不允许下单
- // }
- // }
- // }
- // catch (Exception)
- // {
-
- // // throw;
- // }
- // }));
- // Thread.Sleep(500);
- //}), "炒锅3心跳检测");
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GetFryFourData("D0000", new Action<ushort[]>((data) =>
- // {
- // try
- // {
- // if (data.Count() > 0)
- // {
- // //globalVar.rollerLineOne.StationOne = data[0];
- // if (globalVar.PotFourHeartBeat != data[0])
- // {
- // if (globalVar.PFourBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", false);
- // MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳恢复");
- // }
- // globalVar.PFourBeatStopTimes = 0;
- // globalVar.PotFourHeartBeat = data[0];
- // }
- // else
- // {
- // globalVar.PFourBeatStopTimes++;
- // if (globalVar.PFourBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", true);
- // if (globalVar.PFourBeatStopTimes >= 10 && globalVar.PFourBeatStopTimes < 13)
- // MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳异常");
- // }
-
- // //不允许下单
- // }
- // }
- // }
- // catch (Exception)
- // {
-
- // // throw;
- // }
- // }));
- // Thread.Sleep(500);
- //}), "炒锅4心跳检测");
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GetFryFiveData("D0000", new Action<ushort[]>((data) =>
- // {
- // try
- // {
- // if (data.Count() > 0)
- // {
- // //globalVar.rollerLineOne.StationOne = data[0];
- // if (globalVar.PotFiveHeartBeat != data[0])
- // {
- // if (globalVar.PFiveBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", false);
- // MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳恢复");
- // }
- // globalVar.PFiveBeatStopTimes = 0;
- // globalVar.PotFiveHeartBeat = data[0];
- // }
- // else
- // {
-
- // globalVar.PFiveBeatStopTimes++;
- // if (globalVar.PFiveBeatStopTimes >= 10)
- // {
- // ActionManage.GetInstance.Send("HeartBeatCheck", true);
- // if (globalVar.PFiveBeatStopTimes >= 10 && globalVar.PFiveBeatStopTimes < 13)
- // MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳异常");
- // }
-
- // //不允许下单
- // }
- // }
- // }
- // catch (Exception)
- // {
-
- // // throw;
- // }
- // }));
- // Thread.Sleep(500);
- //}), "炒锅5心跳检测");
- //PLC数据读取
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- GetAddressData("D2001", new Action<ushort[]>((data) =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.rollerLineOne.StationOne = data[0];
- globalVar.rollerLineOne.StationTwo = data[1];
- globalVar.rollerLineOne.StationThree = data[2];
- globalVar.rollerLineOne.StationFour = data[3];
- globalVar.rollerLineOne.StationFive = data[4];
- globalVar.rollerLineOne.StationSix = data[5];
- globalVar.rollerLineOne.StationSeven = data[6];
- globalVar.rollerLineOne.StationEight = data[7];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetAddressData("D2011", new Action<ushort[]>((data) =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.rollerLineTwo.StationOne = data[0];
- globalVar.rollerLineTwo.StationTwo = data[1];
- globalVar.rollerLineTwo.StationThree = data[2];
- globalVar.rollerLineTwo.StationFour = data[3];
- globalVar.rollerLineTwo.StationFive = data[4];
- globalVar.rollerLineTwo.StationSix = data[5];
- globalVar.rollerLineTwo.StationSeven = data[6];
- globalVar.rollerLineTwo.StationEight = data[7];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetAddressData("D2021", new Action<ushort[]>((data) =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.rollerLineThree.StationOne = data[0];
- globalVar.rollerLineThree.StationTwo = data[1];
- globalVar.rollerLineThree.StationThree = data[2];
- globalVar.rollerLineThree.StationFour = data[3];
- globalVar.rollerLineThree.StationFive = data[4];
- globalVar.rollerLineThree.StationSix = data[5];
- globalVar.rollerLineThree.StationSeven = data[6];
- globalVar.rollerLineThree.StationEight = data[7];
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetAddressData("D2031", new Action<ushort[]>((data) =>
- {
- //globalVar.rollerLineOne.OutMaterialingSingle = data[3];
- //globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
- //globalVar.rollerLineThree.OutMaterialingSingle = data[5];
-
- //AlarmHelper<AlarmInfo>.GetInstance().LineOneRollerRunning = data[3];
- //AlarmHelper<AlarmInfo>.GetInstance().LineTwoRollerRunning = data[4];
- //AlarmHelper<AlarmInfo>.GetInstance().LineThreeRollerRunning = data[5];
-
- try
- {
- if (data.Count() > 0)
- {
- AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble = data[6];
- AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble = data[7];
- AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble = data[8];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
-
- }));
- //GetAddressData("D2040", new Action<ushort[]>((data) =>
- //{
- // globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
- // globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
- // globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
- // globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
- // globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
-
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotOneRollerRunning = data[0];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoRollerRunning = data[1];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerRunning = data[2];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFourRollerRunning = data[3];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveRollerRunning = data[4];
-
- //}));
- GetAddressData("D2045", new Action<ushort[]>((data) =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
- globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
- globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
- globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
- globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetAddressData("D2050", new Action<ushort[]>((data) =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
- globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
- globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
- globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
- globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- //GetAddressData("D2065", new Action<ushort[]>((data) =>
- //{
- // globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
- // globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
- // globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
- // globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
- // globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
-
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotOneEmptyRollerRunning = data[0];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoEmptyRollerRunning = data[1];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeEmptyRollerRunning = data[2];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFourEmptyRollerRunning = data[3];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveEmptyRollerRunning = data[4];
- //}));
- GetAddressData("D2070", new Action<ushort[]>((data) =>
- {
- //globalVar.fryPotOne.RollerTroubleSingle = data[0];
- //globalVar.fryPotTwo.RollerTroubleSingle = data[1];
- //globalVar.fryPotThree.RollerTroubleSingle = data[2];
- //globalVar.fryPotFour.RollerTroubleSingle = data[3];
- //globalVar.fryPotFive.RollerTroubleSingle = data[4];
- try
- {
- if (data.Count() > 0)
- {
- AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble = data[0];
- AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble = data[1];
- AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble = data[2];
- AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble = data[3];
- AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble = data[4];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- //GetAddressData("D2078", new Action<ushort[]>(data =>
- //{
- // //globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
- // //globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
- // //globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
- //}));
- GetAddressData("D2075", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning = data[0];
- globalVar.CleadBarrelEnterSingle = data[0];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetAddressData("D2076", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号
- }
- catch (Exception)
- {
-
- //throw;
- }
-
- }));
- GetAddressData("D2077", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning = data[0];
- globalVar.CleadBarrelExitSingle = data[0];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
-
- //滚筒线123开始信号
- GetAddressData("D2101", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.rollerLineOne.ExcuteIsConfirm = data[0];
- globalVar.rollerLineTwo.ExcuteIsConfirm = data[1];
- globalVar.rollerLineThree.ExcuteIsConfirm = data[2];
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetAddressData("D4400", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.rollerLineOne.EmptyRollerNum = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetAddressData("D4410", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.rollerLineTwo.EmptyRollerNum = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetAddressData("D4420", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.rollerLineThree.EmptyRollerNum = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
-
- GetAddressData("D2111", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- globalVar.rollerLineOne.WashEmptyRollerModel = data[0];
- globalVar.rollerLineTwo.WashEmptyRollerModel = data[1];
- globalVar.rollerLineThree.WashEmptyRollerModel = data[2];
-
- globalVar.rollerLineOne.WashRollerArriveSignal = data[3];
- globalVar.rollerLineTwo.WashRollerArriveSignal = data[4];
- globalVar.rollerLineThree.WashRollerArriveSignal = data[5];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
-
- //炒锅1状态数据
- GetFryOneData("D0258", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.Temperature = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryOneData("D0510", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.SmallFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryOneData("D0512", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.MidFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryOneData("D0514", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.BigFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryOneData("D0516", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.StrongFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryOneData("D2500", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.Speed = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryOneData("D0600", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryOne.FryPotWeight = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryOneData("D3000", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- FryPotMonitorManage.GetInstance.fryOne.Step = data[0];
- globalVar.fryPotOne.ProcessStep = data[0];
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryOneData("D3301", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.fryPotOne.RecipeCompleteSingle = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- ////炒锅2状态数据
- GetFryTwoData("D0258", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.Temperature = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryTwoData("D0510", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.SmallFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryTwoData("D0512", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.MidFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryTwoData("D0514", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.BigFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryTwoData("D0516", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.StrongFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryTwoData("D2500", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.Speed = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryTwoData("D0600", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryTwoData("D3000", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- FryPotMonitorManage.GetInstance.fryTwo.Step = data[0];
- globalVar.fryPotTwo.ProcessStep = data[0];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryTwoData("D3301", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.fryPotTwo.RecipeCompleteSingle = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
-
- ////炒锅3状态数据
- GetFryThreeData("D0258", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.Temperature = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryThreeData("D0510", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.SmallFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryThreeData("D0512", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.MidFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryThreeData("D0514", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.BigFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryThreeData("D0516", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.StrongFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryThreeData("D2500", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.Speed = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryThreeData("D0600", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryThree.FryPotWeight = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryThreeData("D3000", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- FryPotMonitorManage.GetInstance.fryThree.Step = data[0];
- globalVar.fryPotThree.ProcessStep = data[0];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryThreeData("D3301", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.fryPotThree.RecipeCompleteSingle = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- //}));
- ////炒锅4状态数据
- GetFryFourData("D0258", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.Temperature = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFourData("D0510", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.SmallFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryFourData("D0512", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.MidFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFourData("D0514", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.BigFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFourData("D0516", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.StrongFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryFourData("D2500", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryFourData("D0600", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.FryPotWeight = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFourData("D3000", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- FryPotMonitorManage.GetInstance.fryFour.Step = data[0];
- globalVar.fryPotFour.ProcessStep = data[0];
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFourData("D3301", new Action<ushort[]>(data =>
- {
- try
- {
- if(data.Count()>0)
- globalVar.fryPotFour.RecipeCompleteSingle = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- //}));
- ////炒锅5状态数据
- GetFryFiveData("D0258", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFive.Temperature = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFiveData("D0510", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFive.SmallFire = data[0];
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryFiveData("D0512", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFive.MidFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFiveData("D0514", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFive.BigFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFiveData("D0516", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFive.StrongFire = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFiveData("D2500", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryFiveData("D0600", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- FryPotMonitorManage.GetInstance.fryFive.FryPotWeight = data[0] / 10.0;
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- GetFryFiveData("D3000", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- {
- FryPotMonitorManage.GetInstance.fryFive.Step = data[0];
- globalVar.fryPotFive.ProcessStep = data[0];
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }));
- GetFryFiveData("D3301", new Action<ushort[]>(data =>
- {
- try
- {
- if (data.Count() > 0)
- globalVar.fryPotFive.RecipeCompleteSingle = data[0];
- }
- catch (Exception)
- {
-
- //throw;
- }
- }));
- //}));
- //线体上放空桶
- if (globalVar.rollerLineOne.EmptyRollerNum != 0)
- {
- if (RollerNum.Contains(globalVar.rollerLineOne.EmptyRollerNum))
- {
- if (!globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.EmptyRollerNum))
- {
- globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
- ++globalVar.LOneMaterialNum;
- }
- }
-
- //是否手动复位PLC
- }
- if (globalVar.rollerLineTwo.EmptyRollerNum != 0)
- {
-
- if (RollerNum.Contains(globalVar.rollerLineTwo.EmptyRollerNum))
- {
- if (!globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.EmptyRollerNum))
- {
- globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum);
- ++globalVar.LTwoMaterialNum;
- }
- }
- //是否手动复位PLC
- }
- if (globalVar.rollerLineThree.EmptyRollerNum != 0)
- {
-
- if (RollerNum.Contains(globalVar.rollerLineThree.EmptyRollerNum))
- {
- if (!globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.EmptyRollerNum))
- {
- globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
- ++globalVar.LThreeMaterialNum;
- }
- }
- //是否手动复位PLC
- }
- ////炒锅状态数据
- //if (globalVar.fryPotOne.OilConfirm == 1)
- //{
- // FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
- // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity;
- //}
- //if (globalVar.fryPotTwo.OilConfirm == 1)
- //{
- // FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity;
- // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity;
- //}
- //if (globalVar.fryPotThree.OilConfirm == 1)
- //{
- // FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity;
- // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity;
- //}
- //if (globalVar.fryPotFour.OilConfirm == 1)
- //{
- // FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity;
- // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity;
- //}
- //if (globalVar.fryPotFive.OilConfirm == 1)
- //{
- // FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
- // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
- //}
- //炒锅状态实时显示
- FryPotStatusDisplay();
- RollerLineStatusDisplay();
- Thread.Sleep(10);
- }), "MainViewReadPlcData");
-
- }
-
-
-
- /// <summary>
- /// 炒锅状态实时显示
- /// </summary>
- private void FryPotStatusDisplay()
- {
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.SmallFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.MidFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.BigFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.StrongFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Step.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.SmallFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.MidFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.BigFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.StrongFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Step.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.SmallFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.MidFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.BigFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.StrongFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Step.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.SmallFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.MidFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.BigFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.StrongFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Step.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.SmallFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.MidFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.BigFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.StrongFire.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Step.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();
-
- //FryPotMonitorManage.GetInstance.fryFive.Temperature = 10;
- //FryPotMonitorManage.GetInstance.fryFive.HotPower = "9";
- //FryPotMonitorManage.GetInstance.fryFive.Speed = 8;
- //FryPotMonitorManage.GetInstance.fryFive.FryPotWeight=7;
- //FryPotMonitorManage.GetInstance.fryFive.OilCapacity = 6;
- //FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = 5;
- //FryPotMonitorManage.GetInstance.fryFive.TotalProduct = 4;
- }
- /// <summary>
- /// 炒锅状态数据保存到二进制文件
- /// </summary>
- public void FryPotDataSaveToBinaryFile()
- {
- #region 炒锅1状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryOne.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryOne.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryOne.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryOne.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryOne.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryOne.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryOne.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryOne.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅2状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryTwo.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryTwo.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryTwo.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryTwo.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryTwo.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryTwo.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryTwo.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryTwo.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅3状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryThree.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryThree.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryThree.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryThree.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryThree.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryThree.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryThree.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryThree.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅4状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFour.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFour.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFour.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFour.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFourStatus p1 = new PotFourStatus
- {
- Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature,
- SmallFire = FryPotMonitorManage.GetInstance.fryFour.SmallFire,
- MidFire = FryPotMonitorManage.GetInstance.fryFour.MidFire,
- BigFire = FryPotMonitorManage.GetInstance.fryFour.BigFire,
- StrongFire = FryPotMonitorManage.GetInstance.fryFour.StrongFire,
- Speed = FryPotMonitorManage.GetInstance.fryFour.Speed,
- FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight,
- OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity,
- TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy,
- TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct,
- RecipeName = fryFourRecipe,
- Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm")
- };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅5状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFive.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFive.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFive.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFive.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFive.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFive.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFive.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFive.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- }
- /// <summary>
- /// 滚筒线运行状态显示
- /// </summary>
- private void RollerLineStatusDisplay()
- {
- hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
- hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
- hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
- hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
- hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
- hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
- hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
- hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
- if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)
- {
-
- hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
-
- hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
- {
-
- hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
- }
- else
- {
-
- hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
- hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
- hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
- hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
- hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
- hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
- hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
- hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
- if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)
- {
- hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
- hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
- {
-
- hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
-
- }
- else
- {
- hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
- hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
- hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
- hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
- hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
- hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
- hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
- hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
- if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)
- {
- hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
- hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
- {
- hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
- }
- else
- {
- hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- //滚筒线4
-
- }
- /// <summary>
- /// 返回滚筒线PLC指定地址指定长度的数据
- /// </summary>
- /// <param name="address"></param>
- /// <returns></returns>
- public void GetAddressData(string address, Action<ushort[]> action)
- {
- PlcReadData = DeviceOperate.GetInstance.GetAllData();
- if (PlcReadData.ContainsKey(address))
- {
- action((ushort[])(PlcReadData[address]));
- }
- }
- public void GetFryOneData(string address, Action<ushort[]> action)
- {
- FryOneData = DeviceOperate.GetInstance.GetFryOneData();
- if (FryOneData.ContainsKey(address))
- {
- action((ushort[])(FryOneData[address]));
- }
- }
- public void GetFryTwoData(string address, Action<ushort[]> action)
- {
- FryTwoData = DeviceOperate.GetInstance.GetFryTwoData();
- if (FryTwoData.ContainsKey(address))
- {
- action((ushort[])(FryTwoData[address]));
- }
- }
- public void GetFryThreeData(string address, Action<ushort[]> action)
- {
- FryThreeData = DeviceOperate.GetInstance.GetFryThreeData();
- if (FryThreeData.ContainsKey(address))
- {
- action((ushort[])(FryThreeData[address]));
- }
- }
- public void GetFryFourData(string address, Action<ushort[]> action)
- {
- FryFourData = DeviceOperate.GetInstance.GetFryFourData();
- if (FryFourData.ContainsKey(address))
- {
- action((ushort[])(FryFourData[address]));
- }
- }
- public void GetFryFiveData(string address, Action<ushort[]> action)
- {
- FryFiveData = DeviceOperate.GetInstance.GetFryFiveData();
- if (FryFiveData.ContainsKey(address))
- {
- action((ushort[])(FryFiveData[address]));
- }
- }
- /// <summary>
- /// 滚筒线写Plc数据
- /// </summary>
- /// <param name="address"></param>
- /// <param name="Value"></param>
- public void WritePlcData(string address, ushort Value)
- {
- DeviceOperate.GetInstance.WritePlcData(address, Value);
- }
-
- /// <summary>
- /// 炒锅写Plc数据
- /// </summary>
- /// <param name="potNum"></param>
- /// <param name="address"></param>
- /// <param name="value"></param>
- public void WritePotData(int potNum, string address, ushort value)
- {
- switch (potNum)
- {
- case 1: DeviceOperate.GetInstance.WritePotOnePlcData(address, value); break;
- case 2: DeviceOperate.GetInstance.WritePotTwoPlcData(address, value); break;
- case 3: DeviceOperate.GetInstance.WritePotThreePlcData(address, value); break;
- case 4: DeviceOperate.GetInstance.WritePotFourPlcData(address, value); break;
- case 5: DeviceOperate.GetInstance.WritePotFivePlcData(address, value); break;
-
- }
-
- }
- /// <summary>
- /// 炒锅写float类型Plc数据
- /// </summary>
- public void WritePotRealData(int potNum, string address, float value)
- {
- switch (potNum)
- {
- case 1: DeviceOperate.GetInstance.WritePotOneRealPlcData(address, value); break;
- case 2: DeviceOperate.GetInstance.WritePotTwoRealPlcData(address, value); break;
- case 3: DeviceOperate.GetInstance.WritePotThreeRealPlcData(address, value); break;
- case 4: DeviceOperate.GetInstance.WritePotFourRealPlcData(address, value); break;
- case 5: DeviceOperate.GetInstance.WritePotFiveRealPlcData(address, value); break;
-
- }
-
- }
-
- /// <summary>
- /// 配方数据接收
- /// </summary>
- public void RecipeDataParse(object obj)
- {
- Task.Run(new Action(() =>
- {
- if (obj != null && obj is NewRecipeModel[] recipes)
- {
- ReicpeNum = ReicpeNum + recipes.Length;
- MessageNotify.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方");
- for (int i = 0; i < recipes.Length; i++)
- {
- int? res = recipes[i].materialCollection.ElementAt(0).MaterialLoc / 100;
- if (res != null)
- {
- switch (res)
- {
- case 1:
- case 4: RecipeQuene.Enqueue(recipes[i]); break;
- case 3: LThreeRecipeQuene.Enqueue(recipes[i]); break;
- case 2:
- case 5: LTwoRecipeQuene.Enqueue(recipes[i]); break;
- }
- }
- }
- }
-
- }));
-
- }
- /// <summary>
- /// 开启主任务
- /// </summary>
- public void MainTask()
- {
- ////RecipeDataToPlc();
- //LOneRecipeDataToPlc();
- //LTwoRecipeDataToPlc();
- //LThreeRecipeDataToPlc();
- ////AgvLoadRoller();
- //LOneLoadRoller();
- //LTwoAgvLoadRoller();
- //LThreeAgvLoadRoller();
- //// FryPotInputMaterial();
- //LOneFryPotInputMaterial();
- //LTwoFryPotInputMaterial();
- //LThreeFryPotInputMaterial();
- ////FryPotOutputMaterial();
- //LOneFryPotOutputMaterial();
- //LTwoFryPotOutputMaterial();
- //LThreeFryPotOutputMaterial();
-
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { ToLineFourFromCleanPlate(); Thread.Sleep(10); }), "清洗台空桶回桶任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { EmptyRollerToLinFourFromPot(); Thread.Sleep(10); }), "炒锅空桶回桶任务线程");
-
- }
-
- /// <summary>
- /// 线体1的执行流程
- /// </summary>
- public void LineOneProcessExecute()
- {
- LOneFryPotStepDisplay();
- LOneRecipeDataToPlc();
- LineOneRecipeExecuteConfirm();
- LOneLoadRoller();
- LOneFryPotInputMaterial();
- LOneFallMaterial();
- LOneFryPotOutputMaterial();
- LOneEmptyOperate();
- // globalVar.LOneTaskLock = false;
- //}
-
- }
- /// <summary>
- /// 线体2的执行流程
- /// </summary>
- public void LineTwoProcessExecute()
- {
- LTwoFryPotStepDisplay();
- LTwoRecipeDataToPlc();
- LineTwoRecipeExecuteConfirm();
- LTwoAgvLoadRoller();
- LTwoFryPotInputMaterial();
- LTwoFallMaterial();
- LTwoFryPotOutputMaterial();
- LTwoEmptyOperate();
- // globalVar.LTwoTaskLock = false;
-
- //}
- }
- /// <summary>
- /// 线体3的执行流程
- /// </summary>
- public void LineThreeProcessExecute()
- {
- LThreeFryPotStepDisplay();
- LThreeRecipeDataToPlc();
- LineThreeRecipeExecuteConfirm();
- LThreeAgvLoadRoller();
- LThreeFryPotInputMaterial();
- LThreeFallMaterial();
- LThreeFryPotOutputMaterial();
- LThreeEmptyOperate();
- // globalVar.LThreeTaskLock = false;
-
- //}
- }
- private void LineOneToCleanProcessExecute()
- {
- //线体1到清洗台
- AgvFromLineOneToCleanPlate();
- AgvArriveCleanPlateFromLineOne();
- }
- public void LineTwoToCleanProcessExecute()
- {
- //线体2到清洗台
- AgvFromLineTwoToCleanPlate();
- AgvArriveCleanPlateFromLineTwo();
-
- }
- public void LineThreeToCleanProcessExecute()
- {
- //线体3到清洗台
- AgvFromLineThreeToCleanPlate();
- AgvArriveCleanPlateFromLineThree();
-
- }
- private void ToLineFourFromCleanPlate()
- {
- //空桶到线体4
- CallAgvToLineFour();
- CleanPlateUpLoad();
- EmptyRollerToLinFourFromClean();
- }
- private void CleanPlateUpLoad()
- {
- if (globalVar.agvArriveCleanLoad)
- {
- globalVar.agvArriveCleanLoad = false;
- MessageNotify.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置");
- //plc交互
- WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
- //erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 0)
- // {
- // //plc交互
- // WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
-
- // }
- // else//有故障
- // {
- // while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 1)
- // {
- // Thread.Sleep(1000);
- // if (globalVar.ExitLineOneTask)
- // return;
- // }
- // MessageNotify.GetInstance.ShowRunLog("清洗台空桶出桶滚筒重新运行!!");
- // goto erp;
- // }
- }
- }
-
- /// <summary>
- /// 线体1到清洗台
- /// </summary>
- private void AgvFromLineOneToCleanPlate()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障
- {
- if (TTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel)))
- {
- MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为普通洗桶模式");
- }
-
- if (globalVar.rollerLineOne.WashEmptyRollerModel == 0)
- {
-
- try
- {
- lock (Obj_Lock)
- {
-
- //线体1到清洗台
- if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineOne.EmptyRollerNums.Count > 0)
- {
-
- var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
- if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.StationEight) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.StationEight)))//一种情况工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶,另一种在没有下单的情况下,线体上的桶都认为是空桶
- {
- LOneCurrentRollerNum = globalVar.rollerLineOne.StationEight;
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
- LSevenrobotJobId.Add(id);
- // Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功
- {
- WritePlcData("D1250", LOneCurrentRollerNum);//下发空桶桶号到洗桶机
- globalVar.rollerLineOne.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LSevenrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
- }
- // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
-
- }
- else
- {
- AgvFromLineOneToClean(LOneCurrentRollerNum);//AGV从线体1到清洗处
- }
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else //统一洗桶模式
- {
- if (RTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel)))
- MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为统一洗桶模式");
- lock (Obj_Lock)
- {
- if (globalVar.rollerLineOne.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
- LSevenrobotJobId.Add(id);
- // Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功
- {
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LSevenrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
- }
-
- else
- {
- AgvFromLineOneToClean();//AGV从线体1到清洗处
- }
- }
-
- }
-
- }
-
- }
-
- /// <summary>
- /// 线体2到清洗台
- /// </summary>
- private void AgvFromLineTwoToCleanPlate()
- {
-
- // 线体2到清洗台
- if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障
- {
- if (TTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel)))
- {
- MessageNotify.GetInstance.ShowRunLog($"2号滚筒线切换为普通洗桶模式");
- }
- if (globalVar.rollerLineTwo.WashEmptyRollerModel == 0)
- {
-
- try
- {
- lock (Obj_Lock)
- {
- if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0)
- {
-
- var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
- if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.StationEight) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.StationEight)))//工位8上面有桶且不是配方上的原料桶,即空桶
- {
- LTwoCurrentRollerNum = globalVar.rollerLineTwo.StationEight;
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
- LEightrobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2))
- {
- WritePlcData("D1250", LTwoCurrentRollerNum);//下发空桶桶号到洗桶机
- globalVar.rollerLineTwo.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LEightrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
-
- //AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
- }
- }
-
- else
- {
- AgvFromLineTwoToClean(LTwoCurrentRollerNum);//AGV从线体1到清洗处
- }
- }
-
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else
- {
- if (RTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel)))
- MessageNotify.GetInstance.ShowRunLog($"2号滚筒线切换为统一洗桶模式");
- lock (Obj_Lock)
- {
- if (globalVar.rollerLineTwo.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
- LEightrobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2))
- {
-
-
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LEightrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
- }
-
-
- else
- {
-
- AgvFromLineTwoToClean();//AGV从线体1到清洗处
- }
- }
- }
- }
-
-
- }
- /// <summary>
- /// 线体3到清洗台
- /// </summary>
- private void AgvFromLineThreeToCleanPlate()
- {
- //线体3到清洗台
- if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障
- {
- if (TTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel)))
- {
- MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为普通洗桶模式");
- }
- if (globalVar.rollerLineThree.WashEmptyRollerModel == 0)
- {
-
- try
- {
- lock (Obj_Lock)
- {
- if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineThree.EmptyRollerNums.Count > 0)
- {
-
- var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
- if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.StationEight) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.StationEight)))//工位8上面有桶且不是配方上的原料桶,即空桶
- {
- LThreeCurrentRollerNum = globalVar.rollerLineThree.StationEight;
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
- LNinerobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功
- {
- WritePlcData("D1250", LThreeCurrentRollerNum);//下发空桶桶号到洗桶机
- globalVar.rollerLineThree.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else//呼叫失败
- {
- LNinerobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
-
- //AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- }
-
- }
- else
- {
- AgvFromLineThreeToClean(LThreeCurrentRollerNum);//AGV从线体3到清洗处
- }
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else
- {
- if (RTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel)))
- MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为统一洗桶模式");
- lock (Obj_Lock)
- {
- if (globalVar.rollerLineThree.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
- LNinerobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功
- {
-
- globalVar.rollerLineThree.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else//呼叫失败
- {
- LNinerobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
-
- }
- else
- {
- AgvFromLineThreeToClean();//AGV从线体3到清洗处
- }
- }
- }
- }
- }
-
- /// <summary>
- /// AGV从线体1到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlateFromLineOne()
- {
- if (globalVar.rollerLineOne.agvArriveCleanUnLoad || globalVar.LineSevenRobotTaskError)
- {
- globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
- MessageNotify.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶");
-
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
- {
- globalVar.LineSevenRobotTaskError = false;//AGV故障信号复位
- //plc交互
- WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
- goto erp;
- }
- }
-
- }
-
- /// <summary>
- /// AGV从线体2到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlateFromLineTwo()
- {
-
- if (globalVar.rollerLineTwo.agvArriveCleanUnLoad || globalVar.LineEightRobotTaskError)
- {
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
- MessageNotify.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶");
-
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
- {
- globalVar.LineEightRobotTaskError = false;//AGV故障信号复位
- //plc交互
- WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
- goto erp;
- }
- }
-
-
- }
- /// <summary>
- /// AGV从线体3到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlateFromLineThree()
- {
-
- if (globalVar.rollerLineThree.agvArriveCleanUnLoad || globalVar.LineNineRobotTaskError)
- {
- globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
- MessageNotify.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶");
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
- {
- globalVar.LineNineRobotTaskError = false;//AGV故障信号复位
- //plc交互
- WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
- goto erp;
- }
- ////plc交互
- //WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
- //if (globalVar.CleadBarrelEnterSingle == 0)
- //{
- // MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!");
- //}
-
- }
-
- }
- /// <summary>
- /// 呼叫Agv从清洗台运洗好的空桶到四号线体
- /// </summary>
- public void CallAgvToLineFour()
- {
- if (RTrig.GetInstance("呼叫AGV").Start(Convert.ToBoolean(globalVar.CleanComplete)))
- {
-
- globalVar.AllowNextEmptyRollerToClean = true;//AGV到滚筒线搬运空桶的允许标志
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id);
- LTenrobotJobId.Add(id);
- //Thread.Sleep(500);
- MessageNotify.GetInstance.ShowRunLog("清洗台呼叫AGV取桶");
- if (!CleanToLineCarryTaskErrorCodeAnalysis(info, 4))
- {
- LTenrobotJobId.Remove(id);
- MessageNotify.GetInstance.ShowRunLog("清洗台呼叫AGV取桶失败");
- }
- }
- }
- /// <summary>
- /// 3号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void LThreeRecipeDataToPlc()
- {
- if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe)
- {
- globalVar.rollerLineThree.RecipeComMidSingle = 1;
- if (globalVar.LThreeCurrentRecipeName != string.Empty)
- {
- MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方所有料桶已送达炒锅");
- // ResetPotData(3);
- WritePlcData("D2103", 0);
- WritePlcData("D1103", 0);//复位开始执行指令
- PlcLineThreeRecipeDataReset();
- if (globalVar.LThreeFryPotSerial == 3)
- {
- FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryThree.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryThree.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
- }
- globalVar.LThreeCurrentRecipeName = string.Empty;
- // Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
- }
- }
- if (RTrig.GetInstance("炒锅3配方完成").Start(Convert.ToBoolean(globalVar.fryPotThree.RecipeCompleteSingle)))
- {
- ResetPotData(3);
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
- ActionManage.GetInstance.Send("炒锅工艺流程更新", 3);
- MessageNotify.GetInstance.ShowRunLog("炒锅3配方制作完成");
- AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
- Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
- }
-
- if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.WashEmptyRollerModel == 0)//后续添加其它限制条件
- {
- if (globalVar.fryPotThree.RecipeCompleteSingle == 1 || globalVar.fryPotThree.ProcessStep == 0)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
- ResetPotData(3);
- WritePlcData("D2103", 0);
- WritePlcData("D1103", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineThreeRecipeDataReset();//PLC复位
- Thread.Sleep(800);
-
- if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- potThreeCurrentRecipe = result;
- LThreeErrorRecipe = false;
- int headNum = result.materialCollection[0].MaterialLoc / 100;
- globalVar.LThreeMaterialNum = result.materialCollection.Count;
- globalVar.LThreeFryPotSerial = headNum;
- globalVar.LThreeCurrentRecipeName = result.RecipeName;
-
- AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
- MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
- fryThreeRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; }));
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3)
- {
-
- //将配方中原料加入新的队列
- LThreeInputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- LThreeInputMaterialQuene.Clear();
- LThreeRecipeQuene.Clear();
- LThreeErrorRecipe = true;
- return;
- }
- }
- #region 炒股用油量记录
- try
- {
- if (result.FlowProcess.fpModels.Count > 0)
- {
- FryPotMonitorManage.GetInstance.fryThree.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
- FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryThree.OilCapacity;
- FryPotRecipeSetDown(headNum, result);//炒锅工艺数据下发
- }
- else
- {
- MessageNotify.GetInstance.ShowUserLog($"3号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
- LThreeRecipeQuene.Clear();
- LThreeInputMaterialQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
- return;
- }
- }
- catch (Exception)
- {
- LThreeRecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
- return;
-
- //throw;
- }
- #endregion
- DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
- // globalVar.rollerLineThree.RecipeComMidSingle = 0;
- WritePlcData("D1103", 1);//配方开始执行命令
- globalVar.rollerLineThree.LowSignalJude = true;
- globalVar.LThreeCurrentCookingStep = 0;
- PotThreestep = 0;
- if (LThreeRecipeQuene.Count > 0)
- LThreeRecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }));
- }
- }
- else
- {
- LThreeRecipeQuene.Clear();
- MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线配方完成前禁止再次下发订单");
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线配方完成前禁止再次下发订单"); }));
- }
- }
- else if (globalVar.rollerLineThree.WashEmptyRollerModel == 1 && LThreeRecipeQuene.Count > 0)
- {
- MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线处于集中洗桶模式,无法下发配方");
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线处于集中洗桶模式,无法下发配方"); }));
- LThreeRecipeQuene.Clear();
-
- }
- else if(LThreeRecipeQuene.Count > 0)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
- LThreeRecipeQuene.Clear();
-
- }
-
- }
- /// <summary>
- /// 2号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void LTwoRecipeDataToPlc()
- {
- if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe)
- {
- globalVar.rollerLineTwo.RecipeComMidSingle = 1;
- if (globalVar.LTwoCurrentRecipeName != string.Empty)
- {
- MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方所有料桶已送达炒锅");
- // ResetPotData(globalVar.LTwoFryPotSerial);
- WritePlcData("D2102", 0);
- WritePlcData("D1102", 0);//复位开始执行指令
- PlcLineTwoRecipeDataReset();
- if (globalVar.LTwoFryPotSerial == 2)
- {
- FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryTwo.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryTwo.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
- }
- if (globalVar.LTwoFryPotSerial == 5)
- {
- FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFive.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFive.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
- }
- globalVar.LTwoCurrentRecipeName = string.Empty;
- // Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
- }
- }
- if (RTrig.GetInstance("炒锅2配方完成").Start(Convert.ToBoolean(globalVar.fryPotTwo.RecipeCompleteSingle)))
- {
- ResetPotData(2);
-
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
- ActionManage.GetInstance.Send("炒锅工艺流程更新", 2);
- MessageNotify.GetInstance.ShowRunLog("炒锅2配方制作完成");
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
- Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; });
- }
-
- if (RTrig.GetInstance("炒锅5配方完成").Start(Convert.ToBoolean(globalVar.fryPotFive.RecipeCompleteSingle)))
- {
- ResetPotData(5);
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
- ActionManage.GetInstance.Send("炒锅工艺流程更新", 5);
- MessageNotify.GetInstance.ShowRunLog("炒锅5配方制作完成");
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
- Task.Run(() => { Thread.Sleep(1500); fryFiveRecipe = string.Empty; });
- }
-
- if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.WashEmptyRollerModel == 0)//后续添加其它限制条件
- {
-
- if ((LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 2 && globalVar.fryPotTwo.RecipeCompleteSingle == 1) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 5 && globalVar.fryPotFive.RecipeCompleteSingle == 1) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 2 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 5 && globalVar.fryPotTwo.ProcessStep == 0) || (globalVar.LTwoFryPotSerial == 0 && globalVar.fryPotTwo.ProcessStep == 0 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 5 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 2 && globalVar.fryPotTwo.ProcessStep == 0))
- {
- if (globalVar.LTwoFryPotSerial == 2)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
-
- Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; });
- }
- if (globalVar.LTwoFryPotSerial == 5)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
-
- Task.Run(() => { Thread.Sleep(1500); fryFiveRecipe = string.Empty; });
- }
- //if (globalVar.LTwoCurrentRecipeName != string.Empty)
- // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
-
-
- WritePlcData("D2102", 0);
- WritePlcData("D1102", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineTwoRecipeDataReset();//PLC复位
-
- if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- LTwoErrorRecipe = false;
- int headNum = result.materialCollection[0].MaterialLoc / 100;
- globalVar.LTwoMaterialNum = result.materialCollection.Count;
- globalVar.LTwoFryPotSerial = headNum;
- globalVar.LTwoCurrentRecipeName = result.RecipeName;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString());
- MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
- if (headNum == 2)//炒锅2
- {
- potTwoCurrentRecipe = result;
- globalVar.LTwoCurrentCookingStep = 0;
- PotTwostep = 0;
- fryTwoRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; }));
- }
- else//炒锅5
- {
- potFiveCurrentRecipe = result;
- PotFivestep = 0;
- globalVar.LFiveCurrentCookingStep = 0;
- fryFiveRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; }));
- }
- ResetPotData(globalVar.LTwoFryPotSerial);
- Thread.Sleep(800);
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5))
- {
-
- //将配方中原料加入新的队列
- LTwoInputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发
-
-
-
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- LTwoInputMaterialQuene.Clear();
- LTwoRecipeQuene.Clear();
- LTwoErrorRecipe = true;
- return;
- }
- }
- #region 炒股用油量记录
- if (headNum == 2)
- {
- try
- {
- if (result.FlowProcess.fpModels.Count > 0)
- {
- FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
- FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryTwo.OilCapacity;
- FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
- }
- else
- {
- MessageNotify.GetInstance.ShowUserLog($"2号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
- LTwoRecipeQuene.Clear();
- LTwoInputMaterialQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
- return;
- }
- }
- catch (Exception)
- {
- LTwoRecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
- return;
- // throw;
- }
- }
- else
- {
- try
- {
- if (result.FlowProcess.fpModels.Count > 0)
- {
- FryPotMonitorManage.GetInstance.fryFive.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
- FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFive.OilCapacity;
- FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
- }
- else
- {
- MessageNotify.GetInstance.ShowUserLog($"2号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
- LTwoRecipeQuene.Clear();
- LTwoInputMaterialQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
- return;
- }
- }
- catch (Exception)
- {
- LTwoRecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
- return;
- // throw;
- }
- }
- #endregion
- DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据
- //globalVar.rollerLineTwo.RecipeComMidSingle = 0;
- WritePlcData("D1102", 1);//配方开始执行命令
- globalVar.rollerLineTwo.LowSignalJude = true;
- if (LTwoRecipeQuene.Count > 0)
- LTwoRecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }));
- }
-
- }
- else
- {
- LTwoRecipeQuene.Clear();
- MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线配方完成前禁止再次下发订单");
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线配方完成前禁止再次下发订单"); }));
- }
- }
- else if (globalVar.rollerLineTwo.WashEmptyRollerModel == 1 && LTwoRecipeQuene.Count > 0)
- {
- MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线处于集中洗桶模式,无法下发配方");
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); }));
- LTwoRecipeQuene.Clear();
- }
- else if(LTwoRecipeQuene.Count > 0)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
- LTwoRecipeQuene.Clear();
- }
- }
-
- /// <summary>
- /// 1号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- private void LOneRecipeDataToPlc()
- {
- if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe)
- {
- globalVar.rollerLineOne.RecipeComMidSingle = 1;
- if (globalVar.LOneCurrentRecipeName != string.Empty)
- {
- MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方所有料桶已送达炒锅");
- // ResetPotData(globalVar.LOneFryPotSerial);
- WritePlcData("D2101", 0);
- WritePlcData("D1101", 0);//复位开始执行指令
- PlcLineOneRecipeDataReset();
-
- if (globalVar.LOneFryPotSerial == 1)
- {
- FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryOne.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryOne.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
- }
- if (globalVar.LOneFryPotSerial == 4)
- {
- FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFour.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFour.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
- }
- globalVar.LOneCurrentRecipeName = string.Empty;
- // Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; });
- }
- }
- if (RTrig.GetInstance("炒锅1配方完成").Start(Convert.ToBoolean(globalVar.fryPotOne.RecipeCompleteSingle)))
- {
- ResetPotData(1);
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
- ActionManage.GetInstance.Send("炒锅工艺流程更新", 1);
- MessageNotify.GetInstance.ShowRunLog("炒锅1配方制作完成");
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
- Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; });
- }
-
- if (RTrig.GetInstance("炒锅4配方完成").Start(Convert.ToBoolean(globalVar.fryPotFour.RecipeCompleteSingle)))
- {
- ResetPotData(4);
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
- ActionManage.GetInstance.Send("炒锅工艺流程更新", 4);
- MessageNotify.GetInstance.ShowRunLog("炒锅4配方制作完成");
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
- Task.Run(() => { Thread.Sleep(1500); fryFourRecipe = string.Empty; });
- }
- if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.WashEmptyRollerModel == 0)//后续添加其它限制条件
- {
- if ((RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 1 && globalVar.fryPotOne.RecipeCompleteSingle == 1) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 4 && globalVar.fryPotFour.RecipeCompleteSingle == 1) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 1 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 4 && globalVar.fryPotOne.ProcessStep == 0) || (globalVar.LOneFryPotSerial == 0 && globalVar.fryPotOne.ProcessStep == 0 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 4 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 1 && globalVar.fryPotOne.ProcessStep == 0)) //炒锅空闲才能下配方
- {
- if (globalVar.LOneFryPotSerial == 1)
- {
- globalVar.LOneCurrentCookingStep = 0;
- PotOnestep = 0;
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
-
- Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; });
- }
- if (globalVar.LOneFryPotSerial == 4)
- {
- globalVar.LFourCurrentCookingStep = 0;
- PotFourstep = 0;
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
-
- Task.Run(() => { Thread.Sleep(1500); fryFourRecipe = string.Empty; });
- }
-
- WritePlcData("D2101", 0);
- WritePlcData("D1101", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineOneRecipeDataReset();//PLC复位
-
- if (RecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- ErrorRecipe = false;
- int headNum = result.materialCollection[0].MaterialLoc / 100;
- globalVar.LOneMaterialNum = result.materialCollection.Count;
- globalVar.LOneFryPotSerial = headNum;
- globalVar.LOneCurrentRecipeName = result.RecipeName;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString());
- MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
- if (headNum == 1)//炒锅1
- {
- potOneCurrentRecipe = result;
- fryOneRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; }));
- }
- else//炒锅4
- {
- potFourCurrentRecipe = result;
- fryFourRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; }));
- }
- ResetPotData(globalVar.LOneFryPotSerial);
- Thread.Sleep(800);
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
- {
-
- //将配方中原料加入新的队列
- InputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- InputMaterialQuene.Clear();
- RecipeQuene.Clear();
- ErrorRecipe = true;
- return;
- }
- }
- #region 炒股用油量记录及工艺下发
- if (headNum == 1)
- {
- try
- {
- if (result.FlowProcess.fpModels.Count > 0)
- {
-
- FryPotMonitorManage.GetInstance.fryOne.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
- FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryOne.OilCapacity;
- FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
- }
- else
- {
- MessageNotify.GetInstance.ShowUserLog($"1号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
- RecipeQuene.Clear();
- InputMaterialQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
- return;
- }
- }
- catch (Exception)
- {
- RecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒股工艺异常,配方下发失败"); }));
- return;
- // throw;
- }
- }
- else
- {
- try
- {
- if (result.FlowProcess.fpModels.Count > 0)
- {
- FryPotMonitorManage.GetInstance.fryFour.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
- FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFour.OilCapacity;
- FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
- }
- else
- {
- MessageNotify.GetInstance.ShowUserLog($"1号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
- RecipeQuene.Clear();
- InputMaterialQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
- return;
- }
- }
- catch (Exception)
- {
- RecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
- return;
- //throw;
- }
- }
- #endregion
- DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据
- WritePlcData("D1101", 1);//线体1配方开始执行命令
- globalVar.rollerLineOne.LowSignalJude = true;
- if (RecipeQuene.Count > 0)
- RecipeQuene.Clear();
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }));
- }
- }
- else
- {
- RecipeQuene.Clear();
- MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线配方完成前禁止再次下发订单");
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线配方完成前禁止再次下发订单"); }));
- }
- }
- else if (globalVar.rollerLineOne.WashEmptyRollerModel == 1 && RecipeQuene.Count > 0)
- {
- MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线处于集中洗桶模式,无法下发配方");
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线处于集中洗桶模式,无法下发配方"); }));
- RecipeQuene.Clear();
- }
- else if (RecipeQuene.Count>0)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
- RecipeQuene.Clear();
-
- }
-
- }
-
-
-
- /// <summary>
- /// 线体1配方执行等待下位确认
- /// </summary>
- public void LineOneRecipeExecuteConfirm()
- {
- if (globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.LowSignalJude)
- {
- if (globalVar.rollerLineOne.ExcuteIsConfirm == 1) //收到下位执行信号
- {
- WritePlcData("D2101", 0);
- globalVar.rollerLineOne.NextStart = true;
- globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0
- globalVar.rollerLineOne.LowSignalJude = false;
- }
- else if (globalVar.rollerLineOne.ExcuteIsConfirm == 2) //收到下位取消执行命令
- {
- RecipeQuene.Clear();
- OutputMaterialQuene.Clear();
- globalVar.rollerLineOne.NextStart = false;
- ResetPotData(globalVar.LOneFryPotSerial);
- WritePlcData("D2101", 0);
- WritePlcData("D1101", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineOneRecipeDataReset();//PLC复位
- InputMaterialQuene.Clear();
- MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【1】号线体【{globalVar.LOneCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowRunLog($"1号滚筒线所有配方已清除");
- MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【1】号线体【{globalVar.LOneCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowUserLog($"1号滚筒线所有配方已清除");
- globalVar.LOneCurrentRecipeName = string.Empty;
- globalVar.rollerLineOne.LowSignalJude = false;
-
- }
- else //未收到下位执行信号
- {
- globalVar.rollerLineOne.NextStart = false;
- }
- }
- }
-
- /// <summary>
- /// 线体2配方执行等待下位确认
- /// </summary>
- public void LineTwoRecipeExecuteConfirm()
- {
- if (globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.LowSignalJude)
- {
- if (globalVar.rollerLineTwo.ExcuteIsConfirm == 1) //收到下位执行信号
- {
- WritePlcData("D2102", 0);
- globalVar.rollerLineTwo.NextStart = true;
- globalVar.rollerLineTwo.RecipeComMidSingle = 0;//配方完成的中转信号置0
- globalVar.rollerLineTwo.LowSignalJude = false;
- }
- else if (globalVar.rollerLineTwo.ExcuteIsConfirm == 2) //收到下位取消执行命令
- {
- LTwoRecipeQuene.Clear();
- LTwoOutputMaterialQuene.Clear();
- globalVar.rollerLineTwo.NextStart = false;
- ResetPotData(globalVar.LTwoFryPotSerial);
- WritePlcData("D2102", 0);
- WritePlcData("D1102", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineTwoRecipeDataReset();//PLC复位
- LTwoInputMaterialQuene.Clear();
- MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【2】号线体【{globalVar.LTwoCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowRunLog($"2号滚筒线所有配方已清除");
- MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【2】号线体【{globalVar.LTwoCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowUserLog($"2号滚筒线所有配方已清除");
- globalVar.LTwoCurrentRecipeName = string.Empty;
- globalVar.rollerLineTwo.LowSignalJude = false;
- }
- else //未收到下位执行信号
- {
- globalVar.rollerLineTwo.NextStart = false;
- }
- }
- }
- /// <summary>
- /// 线体3配方执行等待下位确认
- /// </summary>
- public void LineThreeRecipeExecuteConfirm()
- {
- if (globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.LowSignalJude)
- {
-
- if (globalVar.rollerLineThree.ExcuteIsConfirm == 1) //收到下位执行信号
- {
- WritePlcData("D2103", 0);
- globalVar.rollerLineThree.NextStart = true;
- globalVar.rollerLineThree.RecipeComMidSingle = 0;//配方完成的中转信号置0
- globalVar.rollerLineThree.LowSignalJude = false;
- }
- else if (globalVar.rollerLineThree.ExcuteIsConfirm == 2) //收到下位取消执行命令
- {
- LThreeRecipeQuene.Clear();
- LThreeOutputMaterialQuene.Clear();
- globalVar.rollerLineThree.NextStart = false;
- ResetPotData(globalVar.LThreeFryPotSerial);
- WritePlcData("D2103", 0);
- WritePlcData("D1103", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineThreeRecipeDataReset();//PLC复位
- LThreeInputMaterialQuene.Clear();
- MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【3】号线体【{globalVar.LThreeCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowRunLog($"3号滚筒线所有配方已清除");
- MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【3】号线体【{globalVar.LThreeCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowUserLog($"3号滚筒线所有配方已清除");
-
- globalVar.LThreeCurrentRecipeName = string.Empty;
- globalVar.rollerLineThree.LowSignalJude = false;
- }
- else //未收到下位执行信号
- {
- globalVar.rollerLineThree.NextStart = false;
- }
- }
- }
-
- /// <summary>
- /// AGV到配方线体1装桶以及出料到炒锅
- /// </summary>
- public void LOneLoadRoller()
- {
- if (InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.NextStart)
- {
- AgvToLineOneLoadRoller();
- AgvFromLineOneToFryPot();//AGV到1号线体装桶
- }
- AgvLineOneLoadRollerCom();
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void AgvLineOneLoadRollerCom()
- {
- if ((globalVar.agvLineOneLoadCom || globalVar.LineOneRobotTaskError)&& globalVar.AgvToFryPot)
- {
- if (globalVar.LineOneRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1052", 0);//就位信号复位
- globalVar.rollerLineOne.CanRun = true;
- globalVar.agvLineOneLoadCom = false;
- MessageNotify.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
- }
- }
-
- /// <summary>
- /// AGV到配方线体2装桶以及出料到炒锅
- /// </summary>
- public void LTwoAgvLoadRoller()
- {
- if (LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.NextStart)
- {
- AgvToLineTwoLoadRoller();
- AgvFromLineTwoToFryPot();//AGV到2号线体装桶
- }
- AgvLineTwoLoadRollerCom();
- }
- /// <summary>
- /// 判断agv在2号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- private void AgvLineTwoLoadRollerCom()
- {
- if ((globalVar.agvLineTwoLoadCom || globalVar.LineTwoRobotTaskError)&&globalVar.LTwoAgvToFryPot)
- {
- if (globalVar.LineTwoRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1053", 0);
- globalVar.rollerLineTwo.CanRun = true;
- globalVar.agvLineTwoLoadCom = false;
- MessageNotify.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
- }
- }
-
- /// <summary>
- /// AGV到配方线体3装桶以及出料到炒锅
- /// </summary>
- public void LThreeAgvLoadRoller()
- {
- if (LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.NextStart)
- {
-
- AgvToLineThreeLoadRoller();
- AgvFromLineThreeToFryPot();//AGV到2号线体装桶
-
- }
- AgvLineThreeLoadRollerCom();
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- private void AgvLineThreeLoadRollerCom()
- {
- if ((globalVar.agvLineThreeLoadCom || globalVar.LineThreeRobotTaskError)&&globalVar.LThreeAgvToFryPot)
- {
- if (globalVar.LineThreeRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1054", 0);
- globalVar.rollerLineThree.CanRun = true;
- globalVar.agvLineThreeLoadCom = false;
- MessageNotify.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成");
- }
- }
- /// <summary>
- /// AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- //public void FryPotInputMaterial()
- //{
- // if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
- // {
- // while (!agvArriveUnLoad)//等待agv到达炒锅位置
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // AgvArriveFryPotSingleSetDown();
- // FryPotRollerTroubleCheck();
- // if (FryPotAlarm == 1)//炒锅滚筒无故障
- // {
- // //炒锅滚筒进料运行到位处理
- // FryPotInputMaterialRollerOperate();
- // globalVar.InOrOutputLock = true;
- // }
-
- // }
-
- //}
- /// <summary>
- /// 线体1的AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void LOneFryPotInputMaterial()
- {
- if (OutputMaterialQuene.Count > 0 && (globalVar.agvArriveUnLoad || globalVar.LineOneRobotTaskError) && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive)
- {
- //if (globalVar.LOneFryPotSerial == 1)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1);
- //}
- //else if (globalVar.LOneFryPotSerial == 4)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4);
- //}
-
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
- AgvArriveFryPotOneOrFourSingleSetDown();
- globalVar.agvArriveUnLoad = false;
- globalVar.PotOneInputMaterialArrive = true;
- globalVar.LineOneRobotTaskError = false;//AGV故障信号复位
- FryPotOneRollerTroubleCheck();
- }
- }
-
- public void LOneFallMaterial()
- {
-
- if (!globalVar.InOrOutputLock && ((globalVar.fryPotOne.InputMaterialArrivedSingle == 1 && globalVar.LOneFryPotSerial == 1) || (globalVar.fryPotFour.InputMaterialArrivedSingle == 1 && globalVar.LOneFryPotSerial == 4)) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
- {
-
-
- //FryPotOneRollerTroubleCheck();
- if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1) || (FryPotFourAlarm == 1 && globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障
- {
- if (globalVar.LOneFryPotSerial == 1)
- {
-
- DeviceOperate.GetInstance.WritePlcData("D1055", 0);
- //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
- }
- else
- {
-
- DeviceOperate.GetInstance.WritePlcData("D1058", 0);
- // Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
- }
-
- //炒锅滚筒进料运行到位处理
- FryPotOneOrFourInputMaterialRollerOperate();
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start);
- FryPotOneRollerTroubleCheck();
- globalVar.InOrOutputLock = true;
- globalVar.PotOneOutputRollerArrive = true;
-
-
- }
- }
-
- }
- /// <summary>
- /// 线体2的AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void LTwoFryPotInputMaterial()
- {
- if (LTwoOutputMaterialQuene.Count > 0 && (globalVar.LTwoagvArriveUnLoad || globalVar.LineTwoRobotTaskError) && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
- {
- //if (globalVar.LTwoFryPotSerial == 2)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
- //}
- //else if (globalVar.LTwoFryPotSerial == 5)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
- //}
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅下料位置");
- AgvArriveFryPotTwoOrFiveSingleSetDown();
- globalVar.LTwoagvArriveUnLoad = false;
- globalVar.LTwoPotInputMaterialArrive = true;
- globalVar.LineTwoRobotTaskError = false;//agv故障信号复位
- FryPotTwoRollerTroubleCheck();
- }
- }
- public void LTwoFallMaterial()
- {
- if (!globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 2) || (globalVar.fryPotFive.InputMaterialArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 5) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive))
- {
- //if (globalVar.LTwoFryPotSerial == 2)
- //{
- // Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- // Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
- //}
- //else
- //{
- // Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- // Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
- //}
-
- if ((FryPotTwoAlarm == 1 && globalVar.LTwoFryPotSerial == 2) || (FryPotFiveAlarm == 1 && globalVar.LTwoFryPotSerial == 5))//炒锅滚筒无故障
- {
- if (globalVar.LTwoFryPotSerial == 2)
- {
-
- DeviceOperate.GetInstance.WritePlcData("D1056", 0);
- //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
-
- }
- else
- {
-
- DeviceOperate.GetInstance.WritePlcData("D1059", 0);
- //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
- }
-
- //炒锅滚筒进料运行到位处理
- FryPotTwoOrFiveInputMaterialRollerOperate();
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start);
- FryPotTwoRollerTroubleCheck();
- globalVar.LTwoInOrOutputLock = true;
- globalVar.LTwoPotOutputRollerArrive = true;
-
-
- }
- }
- }
- /// <summary>
- /// 线体3的AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void LThreeFryPotInputMaterial()
- {
- if (LThreeOutputMaterialQuene.Count > 0 && (globalVar.LThreeagvArriveUnLoad || globalVar.LineThreeRobotTaskError) && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
- {
- // AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
- MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置");
- AgvArriveFryPotThreeSingleSetDown();
- globalVar.LThreeagvArriveUnLoad = false;
- globalVar.LThreePotInputMaterialArrive = true;
- globalVar.LineThreeRobotTaskError = false;//agv故障信号复位
- FryPotThreeRollerTroubleCheck();
- }
- }
-
- public void LThreeFallMaterial()
- {
- if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
- {
- //Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
-
- if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
- {
-
- DeviceOperate.GetInstance.WritePlcData("D1057", 0);
- //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
-
- //炒锅滚筒进料运行到位处理
- FryPotThreeInputMaterialRollerOperate();
-
- AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start);
- FryPotThreeRollerTroubleCheck();
- globalVar.LThreeInOrOutputLock = true;
- globalVar.LThreePotOutputRollerArrive = true;
-
-
- }
- }
- }
- /// <summary>
- /// 炒锅出桶
- /// </summary>
- //public void FryPotOutputMaterial()
- //{
- // if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
- // {
- // AgvFromFryPotToClean();//上游下发搬运任务给AGV
- // while (!agvArriveUpLoad)//等待agv到达炒锅位置
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // agvArriveUpLoad = false;
- // AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
- // FryPotRollerTroubleCheck();
- // if (FryPotAlarm == 1)//无故障
- // {
- // FryPotOutEmpetyRollerOperate();
- // if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- // {
- // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
- // {
- // Thread.Sleep(5);agvFryPotEmptyRollerArrive
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- // globalVar.AllowAgvToLineLoadRoller = true;
- // globalVar.InOrOutputLock = false;
- // }
- // }
-
- // }
- //}
- /// <summary>
- /// 线体1对应炒锅出桶
- /// </summary>
- public void LOneFryPotOutputMaterial()
- {
- if (((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 && globalVar.LOneFryPotSerial == 1) || (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1 && globalVar.LOneFryPotSerial == 4)) && OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
- {
- //上游下发搬运任务给AGV
- if (AgvFromFryPotOneOrFourToClean())
- {
- globalVar.AgvArrivePot = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
-
- }
- }
- public void LOneEmptyOperate()
- {
-
- if ((globalVar.agvArriveUpLoad || globalVar.LineFourRobotTaskError) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot)
- {
- if (globalVar.agvFryPotEmptyRollerArrive || globalVar.LineFourRobotTaskError)//炒锅上料完成
- {
- if (globalVar.LineFourRobotTaskError)
- {
- if (globalVar.LOneFryPotSerial == 1)
- {
- DeviceOperate.GetInstance.WritePlcData("D1060", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1063", 0);
- }
- }
- FryPotOneOrFourOutEmpetyRollerOperate();
- if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
- //if (globalVar.LOneFryPotSerial == 1)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1);
- //}
- //else if (globalVar.LOneFryPotSerial == 4)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4);
- //}
- globalVar.agvArriveUpLoad = false;
- globalVar.agvFryPotEmptyRollerArrive = false;
- globalVar.InOrOutputLock = false;
- MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineLoadRoller = true;
- globalVar.LoadRoller = false;
- globalVar.AgvToFryPot = false;
- globalVar.PotOneInputMaterialArrive = false;
- globalVar.PotOneOutputRollerArrive = false;
- globalVar.AgvArrivePot = false;
-
- }
- }
- //}
- }
-
-
- }
-
- /// <summary>
- /// 线体2对应炒锅出桶
- /// </summary>
- public void LTwoFryPotOutputMaterial()
- {
- if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 2) || (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 5)) && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
- {
- //上游下发搬运任务给AGV
- if (AgvFromFryPotTwoOrFiveToClean())
- {
- globalVar.LTwoAgvArrivePot = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
-
-
- }
- }
-
- public void LTwoEmptyOperate()
- {
- if ((globalVar.agvArriveLTwoUpLoad || globalVar.LineFiveRobotTaskError) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
- {
-
-
- //if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障
- //{
- if (globalVar.LTwoagvFryPotEmptyRollerArrive || globalVar.LineFiveRobotTaskError)
- {
- if (globalVar.LineFiveRobotTaskError)
- {
- if (globalVar.LTwoFryPotSerial == 2)
- {
- DeviceOperate.GetInstance.WritePlcData("D1061", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1064", 0);
- }
- }
- FryPotTwoOrFiveOutEmpetyRollerOperate();
- if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
- //if (globalVar.LTwoFryPotSerial == 2)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
- //}
- //else if (globalVar.LTwoFryPotSerial == 5)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
- //}
-
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoagvFryPotEmptyRollerArrive = false;
- globalVar.LTwoInOrOutputLock = false;
-
- MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineTwoLoadRoller = true;
- globalVar.LTwoLoadRoller = false;
- globalVar.LTwoAgvToFryPot = false;
- globalVar.LTwoPotInputMaterialArrive = false;
- globalVar.LTwoPotOutputRollerArrive = false;
- globalVar.LTwoAgvArrivePot = false;
-
- }
- }
- //}
- }
-
- }
- /// <summary>
- /// 线体3对应炒锅出桶
- /// </summary>
- public void LThreeFryPotOutputMaterial()
- {
- if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
- {
- //上游下发搬运任务给AGV
- if (AgvFromFryPotThreeToClean())
- {
- globalVar.LThreeAgvArrivePot = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
- }
- }
-
- public void LThreeEmptyOperate()
- {
- if ((globalVar.agvArriveLThreeUpLoad || globalVar.LineSixRobotTaskError) && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
- {
- //if (FryPotThreeAlarm == 1)//无故障
- //{
- if (globalVar.LThreeagvFryPotEmptyRollerArrive || globalVar.LineSixRobotTaskError)
- {
- if (globalVar.LineSixRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1062", 0);
- //FryPotThreeOutEmpetyRollerOperate();
- MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成");
- if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
- //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
-
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeagvFryPotEmptyRollerArrive = false;
- globalVar.LThreeInOrOutputLock = false;
-
- MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineThreeLoadRoller = true;
- globalVar.LThreeLoadRoller = false;
- globalVar.LThreeAgvToFryPot = false;
- globalVar.LThreePotInputMaterialArrive = false;
- globalVar.LThreePotOutputRollerArrive = false;
- globalVar.LThreeAgvArrivePot = false;
-
- }
- }
- // }
- }
-
- }
-
- /// <summary>
- /// 清洗台到4号线体下料
- /// </summary>
- public void EmptyRollerToLinFourFromClean()
- {
-
- if (globalVar.agvArriveLineFour || globalVar.LineTenRobotTaskError)//agv到达线体4下料位置
- {
- if (globalVar.LineTenRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1066", 0);
- globalVar.agvArriveLineFour = false;
- globalVar.LineTenRobotTaskError = false;//AGV故障信号复位
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- MessageNotify.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
-
- }
-
- public void EmptyRollerToLinFourFromPot()
- {
- if (globalVar.rollerLineOne.agvArriveLineFour || globalVar.LineFourRobotTaskError)//agv到达线体4下料位置
- {
- globalVar.rollerLineOne.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- globalVar.LineFourRobotTaskError = false;//AGV故障信号复位
- MessageNotify.GetInstance.ShowRunLog($"AGV从【{globalVar.LOneFryPotSerial}】号炒锅到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
- if (globalVar.rollerLineTwo.agvArriveLineFour || globalVar.LineFiveRobotTaskError)//agv到达线体4下料位置
- {
- globalVar.rollerLineTwo.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- globalVar.LineFiveRobotTaskError = false;//AGV故障信号复位
- MessageNotify.GetInstance.ShowRunLog($"AGV从【{globalVar.LTwoFryPotSerial}】炒锅到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
- if (globalVar.rollerLineThree.agvArriveLineFour || globalVar.LineSixRobotTaskError)//agv到达线体4下料位置
- {
- globalVar.rollerLineThree.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- globalVar.LineSixRobotTaskError = false;//AGV故障信号复位
- MessageNotify.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
- }
- ///// <summary>
- ///// 线体1对应炒锅到4号线体下料
- ///// </summary>
- //public void EmptyRollerToLinFourFromLineOne()
- //{
-
-
- // if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置
- // {
- // globalVar.rollerLineOne.agvArriveLineFour = false;
- // //线体四信号交互
- // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- // MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶");
- // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- // }
-
-
- //}
-
- ///// <summary>
- /////线体2对应炒锅到4号线体下料
- ///// </summary>
- //public void EmptyRollerToLinFourFromLineTwo()
- //{
- // if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置
- // {
- // globalVar.rollerLineTwo.agvArriveLineFour = false;
- // //线体四信号交互
- // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- // MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶");
- // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- // }
-
- //}
- ///// <summary>
- ///// 线体3对应炒锅到4号线体下料
- ///// </summary>
- //public void EmptyRollerToLinFourFromLineThree()
- //{
- // if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置
- // {
- // globalVar.rollerLineThree.agvArriveLineFour = false;
- // //线体四信号交互
- // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- // MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
- // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- // }
-
- //}
- /// <summary>
- /// 炒锅1,4滚筒进料运行到位处理
- /// </summary>
- public void FryPotOneOrFourInputMaterialRollerOperate()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- //while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【1】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- case 4:
- //while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【4】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- }
- }
- /// <summary>
- /// 炒锅2,5滚筒进料运行到位处理
- /// </summary>
- public void FryPotTwoOrFiveInputMaterialRollerOperate()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- //while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【2】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- case 5:
- //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【5】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- }
- }
- public void FryPotThreeInputMaterialRollerOperate()
- {
- //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【3】:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料");
- }
- /// <summary>
- /// 炒锅滚筒空桶出桶处理
- /// </summary>
- //public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
- //{
- // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 2:
- // while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 3:
- // while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 4:
- // while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 5:
- // while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
-
- // }
- //}
- /// <summary>
- /// 炒锅1,4滚筒空桶出桶处理
- /// </summary>
- public void FryPotOneOrFourOutEmpetyRollerOperate()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- //while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
- case 4:
- //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
- }
- }
- /// <summary>
- /// 炒锅2,5滚筒空桶出桶处理
- /// </summary>
- public void FryPotTwoOrFiveOutEmpetyRollerOperate()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- //while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
- case 5:
- //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
- }
- }
- /// <summary>
- /// 炒锅3滚筒空桶出桶处理
- /// </summary>
- public void FryPotThreeOutEmpetyRollerOperate()
- {
- //while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成");
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体到炒锅)
- /// </summary>
- public void AgvArriveFryPotSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
- {
- switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
- case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
- case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体1到炒锅)
- /// </summary>
- public void AgvArriveFryPotOneOrFourSingleSetDown()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体2到炒锅)
- /// </summary>
- public void AgvArriveFryPotTwoOrFiveSingleSetDown()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体3到炒锅)
- /// </summary>
- public void AgvArriveFryPotThreeSingleSetDown()
- {
- DeviceOperate.GetInstance.WritePlcData("D1057", 1); //agv到炒锅3送料就位信号
- }
- /// <summary>
- /// 发送agv回桶就位信号至PLC
- /// </summary>
- public void AgvArriveFryPotOutEmptyRollerSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
- {
- switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
- case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
- case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
- }
- }
-
- public void AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
- }
- }
- public void AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
- }
- }
- public void AgvArriveFryPotThreeOutEmptyRollerSingleSetDown()
- {
- DeviceOperate.GetInstance.WritePlcData("D1062", 1);//agv到炒锅3送料就位信号
- }
- ///// <summary>
- ///// AGV离开炒锅运送空桶任务
- ///// </summary>
- //public void AgvFromFryPotToClean(ConcurrentQueue<MaterialInfo> queue)
- //{
- // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // erp: string id = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId)
- // {
- // goto erp;
- // }
- // string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
- // LOnerobotJobId = id;
- // FryCarryTaskErrorCodeAnalysis(info, 1); break;
- // case 2:
- // erp1: string id1 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id1 == LTworobotJobId)
- // {
- // goto erp1;
- // }
- // string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
- // LTworobotJobId = id1;
- // FryCarryTaskErrorCodeAnalysis(info1, 2); break;
- // case 3:
- // erp2: string id2 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id2 == LThreerobotJobId)
- // {
- // goto erp2;
- // }
- // string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
- // LThreerobotJobId = id2;
- // FryCarryTaskErrorCodeAnalysis(info2, 3); break;
- // case 4:
- // erp3: string id3 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id3 == LOnerobotJobId)
- // {
- // goto erp3;
- // }
- // string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
- // LOnerobotJobId = id3;
- // FryCarryTaskErrorCodeAnalysis(info3, 4); break;
- // case 5:
- // erp4: string id4 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id4 == LTworobotJobId)
- // {
- // goto erp4;
- // }
- // string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- // LTworobotJobId = id4;
- // FryCarryTaskErrorCodeAnalysis(info4, 5); break;
- // }
- //}
- /// <summary>
- /// AGV离开炒锅1,4运送空桶任务
- /// </summary>
- public bool AgvFromFryPotOneOrFourToClean()
- {
- bool result = true;
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- erp: string id = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- {
- goto erp;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务");
- string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
- LFourrobotJobId = id;
-
- if (!FryCarryTaskErrorCodeAnalysis(info, 1))
- {
- id = String.Empty;
- result = false;
- }
- break;
- case 4:
- erp3: string id3 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id3) != null || LEightrobotJobId.FirstOrDefault(p => p == id3) != null || LNinerobotJobId.FirstOrDefault(p => p == id3) != null || LTenrobotJobId.FirstOrDefault(p => p == id3) != null)
- {
- goto erp3;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务");
- string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
- LFourrobotJobId = id3;
- if (!FryCarryTaskErrorCodeAnalysis(info3, 4))
- {
- id3 = String.Empty;
- result = false;
- }
-
- break;
- }
- return result;
- }
- /// <summary>
- /// AGV离开炒锅2,5运送空桶任务
- /// </summary>
- public bool AgvFromFryPotTwoOrFiveToClean()
- {
- bool result = true;
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- erp1: string id1 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id1) != null || LEightrobotJobId.FirstOrDefault(p => p == id1) != null || LNinerobotJobId.FirstOrDefault(p => p == id1) != null || LTenrobotJobId.FirstOrDefault(p => p == id1) != null)
- {
- goto erp1;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务");
- string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
- LFiverobotJobId = id1;
-
- if (!FryCarryTaskErrorCodeAnalysis(info1, 2))
- {
- id1 = String.Empty;
- result = false;
- }
- break;
- case 5:
- erp4: string id4 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id4) != null || LEightrobotJobId.FirstOrDefault(p => p == id4) != null || LNinerobotJobId.FirstOrDefault(p => p == id4) != null || LTenrobotJobId.FirstOrDefault(p => p == id4) != null)
- {
- goto erp4;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务");
- string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- LFiverobotJobId = id4;
-
- if (!FryCarryTaskErrorCodeAnalysis(info4, 5))
- {
- id4 = String.Empty;
- result = false;
- }
- break;
- }
- return result;
- }
- /// <summary>
- /// AGV离开炒锅3运送空桶任务
- /// </summary>
- public bool AgvFromFryPotThreeToClean()
- {
- bool result = true;
- erp2: string id2 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id2) != null || LEightrobotJobId.FirstOrDefault(p => p == id2) != null || LNinerobotJobId.FirstOrDefault(p => p == id2) != null || LTenrobotJobId.FirstOrDefault(p => p == id2) != null)
- {
- goto erp2;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务");
- string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
- LSixrobotJobId = id2;
-
- if (!FryCarryTaskErrorCodeAnalysis(info2, 3))
- {
- id2 = string.Empty;
- result = false;
- }
- return result;
- }
- /// <summary>
- /// 处理agv从线体1到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineOneToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)
- {
- if ((globalVar.agvArriveUpLoad || globalVar.LineOneRobotTaskError) && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
- {
-
- MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(InputMaterialQuene);
- if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
- //if (materialInfo.materialType.MaterialLoc / 100 == 1)
- //{
- // globalVar.LOneCurrentCookingStep++;
- //}
- //else
- //{
- // globalVar.LFourCurrentCookingStep++;
- //}
- OutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveUpLoad = false;
- globalVar.AgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
-
-
-
- }
- }
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从1号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineOneToClean(ushort emptyRollerNum = 0)
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
-
-
- globalVar.agvArriveLineOneLoadEmptyRoller = false;
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineOneLoadCom || globalVar.LineSevenRobotTaskError)//上料完成
- {
- if (globalVar.LineSevenRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1052", 0);
- if (emptyRollerNum != 0)
- globalVar.rollerLineOne.EmptyRollerNums.Remove(emptyRollerNum);
- globalVar.agvArriveLineOneLoadCom = false;
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV在【1】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 处理agv从线体2到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineTwoToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障
- {
- if ((globalVar.agvArriveLTwoUpLoad || globalVar.LineTwoRobotTaskError) && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
- if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
- //if (materialInfo.materialType.MaterialLoc / 100 == 2)
- //{
- // globalVar.LTwoCurrentCookingStep++;
- //}
- //else
- //{
- // globalVar.LFiveCurrentCookingStep++;
- //}
- LTwoOutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoAgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
-
- }
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从2号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineTwoToClean(ushort emptyRollerNum = 0)
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
-
-
- globalVar.agvArriveLineTwoLoadEmptyRoller = false;
-
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineTwoLoadCom || globalVar.LineEightRobotTaskError)//上料完成
- {
- if (globalVar.LineEightRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1053", 0);
- if (emptyRollerNum != 0)
- globalVar.rollerLineTwo.EmptyRollerNums.Remove(emptyRollerNum);
- globalVar.agvArriveLineTwoLoadCom = false;
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 处理agv从线体3到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineThreeToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障
- {
- if ((globalVar.agvArriveLThreeUpLoad || globalVar.LineThreeRobotTaskError) && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
- if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
- // globalVar.LThreeCurrentCookingStep++;
- LThreeOutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeAgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
-
- }
-
- }
- else //有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从3号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineThreeToClean(ushort emptyRollerNum = 0)
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
-
-
- globalVar.agvArriveLineThreeLoadEmptyRoller = false;
- // globalVar.rollerLineThree.IsEpmtyBefore = false;
-
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineThreeLoadCom || globalVar.LineNineRobotTaskError)//上料完成
- {
- if (globalVar.LineNineRobotTaskError)
- DeviceOperate.GetInstance.WritePlcData("D1054", 0);
- if (emptyRollerNum != 0)
- globalVar.rollerLineThree.EmptyRollerNums.Remove(emptyRollerNum);
- globalVar.agvArriveLineThreeLoadCom = false;
- globalVar.rollerLineThree.IsEpmtyBefore = false;
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 线体到炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- return false;
- }
- }
- /// <summary>
- /// 线体到清洗台搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装空桶");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- return false;
- }
- }
- /// <summary>
- /// 清洗台到线体搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV从清洗台到{num}号滚筒线卸桶");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV从清洗台到{num}号滚筒线API调用失败,请检查请求报文");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV从清洗台到{num}号滚筒线失败,错误码:{errorCode}");
- return false;
- }
- }
- /// <summary>
- /// 炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号炒锅");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号炒锅接口调用失败,请检查");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号炒锅失败,错误码:{errorCode}");
- return false;
- }
- }
-
- public void AgvToLineOneLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障
- {
- if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && !globalVar.LoadRoller)
- {
- if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
- {
- globalVar.rollerLineOne.CanRun = false;
- e: string id = Guid.NewGuid().ToString("D");//32位
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
- string info;
- if (globalVar.LOneFryPotSerial == 1)
- {
- if (InputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
- info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id,2);
- else
- info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
- }
- else
- {
- if (InputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
- info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id,2);
- else
- info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id);
- }
- LOnerobotJobId = id;
- if (LineCarryTaskErrorCodeAnalysis(info, 1))
- {
- globalVar.AllowAgvToLineLoadRoller = false;
- globalVar.LoadRoller = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
- }
- //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
- //{
- // globalVar.rollerLineOne.CanRun = true;
- //}
- //else // 工位8上面不是配方料桶或没有桶时
- //{
- // if (!globalVar.rollerLineOne.IsEpmtyBefore)
- // {
- // var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
- // if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
- // {
- // //下发AGV去空桶线洗桶任务
- // e: string id = Guid.NewGuid().ToString("D");
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- // goto e;
-
- // string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
- // LFourrobotJobId = id;
- // Thread.Sleep(500);
- // LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
- // globalVar.rollerLineOne.IsEpmtyBefore = true;
- // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- // }
- // }
- // else
- // {
- // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- // }
- //}
-
- }
- }
- //else
- //{
- // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
- // // lineAlarm = -1;
- //}
- //// lineAlarm = 1;
- }
- public void AgvToLineTwoLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障
- {
- if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && !globalVar.LTwoLoadRoller)
- {
- if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
- {
-
- globalVar.rollerLineTwo.CanRun = false;
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
- string info;
- if (globalVar.LTwoFryPotSerial == 2)
- {
- if (LTwoInputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
- info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id, 2);
- else
- info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
- }
- else
- {
- if (LTwoInputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
- info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id,2);
- else
- info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id);
- }
- LTworobotJobId = id;
- //Thread.Sleep(500);
- if (LineCarryTaskErrorCodeAnalysis(info, 2))
- {
- globalVar.LTwoLoadRoller = true;
- globalVar.AllowAgvToLineTwoLoadRoller = false;
- }
- else
- {
- Thread.Sleep(5000);
- }
- }
- //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
- //{
- // globalVar.rollerLineTwo.CanRun = true;
- //}
- }
- //else// 工位8上面不是配方料桶或没有桶时
- //{
- // if (!globalVar.rollerLineTwo.IsEpmtyBefore)
- // {
- // var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
- // if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
- // {
- // //下发AGV去空桶线洗桶任务
- // e: string id = Guid.NewGuid().ToString("D");
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- // goto e;
-
- // string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
- // LFiverobotJobId = id;
- // Thread.Sleep(500);
- // LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
- // globalVar.rollerLineTwo.IsEpmtyBefore = true;
- // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
- // }
- // }
- // else
- // {
- // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- // }
- //}
- }
- }
- public void AgvToLineThreeLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障
- {
- if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && !globalVar.LThreeLoadRoller)
- {
- if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
- {
- globalVar.rollerLineThree.CanRun = false;
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
- string info = string.Empty;
- if (LThreeInputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
- info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id,2);
- else
- info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
- LThreerobotJobId = id;
- //Thread.Sleep(500);
- if (LineCarryTaskErrorCodeAnalysis(info, 3))
- {
- globalVar.LThreeLoadRoller = true;
- globalVar.AllowAgvToLineThreeLoadRoller = false;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
- }
- //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
- //{
- // globalVar.rollerLineThree.CanRun = true;
- //}
- //else // 工位8上面不是配方料桶或没有桶时
- //{
- // if (!globalVar.rollerLineThree.IsEpmtyBefore)
- // {
- // var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
- // if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
- // {
- // //下发AGV去空桶线洗桶任务
- // e: string id = Guid.NewGuid().ToString("D");
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- // goto e;
-
- // string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
- // LSixrobotJobId = id;
- // Thread.Sleep(500);
- // LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
- // globalVar.rollerLineThree.IsEpmtyBefore = true;
- // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- // }
- // }
- // else
- // {
- // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- // }
- //}
- }
- }
-
- //if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
- //{
- // if (LThreeInputMaterialQuene.Count > 0)
- // {
- // while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // g: string id = Guid.NewGuid().ToString();
- // if (id == LThreerobotJobId)
- // goto g;
- // string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
- // // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
- // LThreerobotJobId = id;
- // Thread.Sleep(500);
- // LineCarryTaskErrorCodeAnalysis(info, 3);
- // }
-
- //}
- //else
- //{
- // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
- // // lineAlarm = -1;
- //}
-
- }
- /// <summary>
- /// 1号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶1重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1200", materialOffset);//桶重1量偏差
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1202", materialOffset);//桶2重量偏差
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1204", materialOffset);//桶3重量偏差
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1206", materialOffset);//桶4重量偏差
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1208", materialOffset);//桶5重量偏差
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1210", materialOffset);//桶6重量偏差
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1212", materialOffset);//桶7重量偏差
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1214", materialOffset);//桶8重量偏差
- break;
-
- }
- }
- /// <summary>
- /// 2号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1216", materialOffset);//桶重1量偏差
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1218", materialOffset);//桶重2量偏差
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1220", materialOffset);//桶重3量偏差
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1222", materialOffset);//桶重4量偏差
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1224", materialOffset);//桶重5量偏差
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1226", materialOffset);//桶重6量偏差
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1228", materialOffset);//桶重7量偏差
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1230", materialOffset);//桶重8量偏差
- break;
-
- }
- }
- /// <summary>
- /// 3号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶1重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1232", materialOffset);//桶重1量偏差
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1234", materialOffset);//桶重2量偏差
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1236", materialOffset);//桶重3量偏差
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1238", materialOffset);//桶重4量偏差
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1240", materialOffset);//桶重5量偏差
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1242", materialOffset);//桶重6量偏差
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1244", materialOffset);//桶重7量偏差
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1246", materialOffset);//桶重8量偏差
- break;
-
- }
-
- }
- /// <summary>
- /// AGV线体进料就位信号下发至PLC
- /// </summary>
- public void AgvArriveLineSingelSetDown(ConcurrentQueue<MaterialInfo> queue)
- {
- switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
- case 2:
- case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
- case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
- }
-
- }
-
- /// <summary>
- /// 炒锅滚筒信号检测
- /// </summary>
- //public void FryPotRollerTroubleCheck()
- //{
- // FryPotAlarm = 0;
- // FryPotTwoAlarm = 0;
- // FryPotThreeAlarm = 0;
- // FryPotFourAlarm = 0;
- // FryPotFiveAlarm = 0;
- // switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- // FryPotAlarm = 1; break;
- // case 2:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
- // FryPotTwoAlarm = 1; break;
- // case 3:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
- // FryPotThreeAlarm = 1; break;
- // case 4:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- // FryPotFourAlarm = 1; break;
- // case 5:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
- // FryPotFiveAlarm = 1; break;
-
- // }
- //}
- /// <summary>
- /// 炒锅1,4滚筒信号检测
- /// </summary>
- public void FryPotOneRollerTroubleCheck()
- {
- FryPotAlarm = 0;
- FryPotFourAlarm = 0;
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- if (AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble == 1)
- {
- FryPotAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障");
- }
- else
- {
- FryPotAlarm = 1; return;
-
- }
- while (AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 4:
- if (AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- FryPotFourAlarm = 1; break;
- }
-
- }
- /// <summary>
- /// 炒锅2,5滚筒信号检测
- /// </summary>
- public void FryPotTwoRollerTroubleCheck()
- {
- FryPotTwoAlarm = 0;
- FryPotFiveAlarm = 0;
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- if (AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotTwoAlarm = 1; break;
- case 5:
- if (AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- FryPotFiveAlarm = 1; break;
- }
- }
- /// <summary>
- /// 炒锅3滚筒信号检测
- /// </summary>
- public void FryPotThreeRollerTroubleCheck()
- {
- FryPotThreeAlarm = 0;
- if (AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
- FryPotThreeAlarm = 1;
- }
-
- /// <summary>
- /// PLC线体1配方数据复位功能
- /// </summary>
- public void PlcLineOneRecipeDataReset()
- {
-
- //复位桶号,桶重,,工序
- WritePlcData("D1001", 0);
- WritePlcData("D1002", 0);
- WritePlcData("D1003", 0);
- WritePlcData("D1004", 0);
- WritePlcData("D1005", 0);
- WritePlcData("D1006", 0);
- WritePlcData("D1007", 0);
- WritePlcData("D1008", 0);
- WritePlcData("D1009", 0);
- WritePlcData("D1010", 0);
- WritePlcData("D1011", 0);
- WritePlcData("D1012", 0);
- WritePlcData("D1013", 0);
- WritePlcData("D1014", 0);
- WritePlcData("D1015", 0);
- WritePlcData("D1016", 0);
- WritePlcData("D1017", 0);
- //桶偏差
- DeviceOperate.GetInstance.WriteRealPlcData("D1200", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1202", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1204", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1206", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1208", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1210", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1212", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1214", 0.0F);
- }
- /// <summary>
- /// PLC线体2配方数据复位功能
- /// </summary>
- public void PlcLineTwoRecipeDataReset()
- {
- WritePlcData("D1018", 0);
- WritePlcData("D1019", 0);
- WritePlcData("D1020", 0);
- WritePlcData("D1021", 0);
- WritePlcData("D1022", 0);
- WritePlcData("D1023", 0);
- WritePlcData("D1024", 0);
- WritePlcData("D1025", 0);
- WritePlcData("D1026", 0);
- WritePlcData("D1027", 0);
- WritePlcData("D1028", 0);
- WritePlcData("D1029", 0);
- WritePlcData("D1030", 0);
- WritePlcData("D1031", 0);
- WritePlcData("D1032", 0);
- WritePlcData("D1033", 0);
- WritePlcData("D1034", 0);
-
- DeviceOperate.GetInstance.WriteRealPlcData("D1216", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1218", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1220", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1222", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1224", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1226", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1228", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1230", 0.0F);
- }
- /// <summary>
- /// PLC线体3配方数据复位功能
- /// </summary>
- public void PlcLineThreeRecipeDataReset()
- {
- WritePlcData("D1035", 0);
- WritePlcData("D1036", 0);
- WritePlcData("D1037", 0);
- WritePlcData("D1038", 0);
- WritePlcData("D1039", 0);
- WritePlcData("D1040", 0);
- WritePlcData("D1041", 0);
- WritePlcData("D1042", 0);
- WritePlcData("D1043", 0);
- WritePlcData("D1044", 0);
- WritePlcData("D1045", 0);
- WritePlcData("D1046", 0);
- WritePlcData("D1047", 0);
- WritePlcData("D1048", 0);
- WritePlcData("D1049", 0);
- WritePlcData("D1050", 0);
- WritePlcData("D1051", 0);
-
- DeviceOperate.GetInstance.WriteRealPlcData("D1232", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1234", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1236", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1238", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1240", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1242", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F);
- }
- ///// <summary>
- ///// 累加重量计算
- ///// </summary>
- ///// <param name="collect"></param>
- //public ushort SumAllTargetWeight(ObservableCollection<FlowProcessModel> collect,int length)
- //{
- // ushort total = 0;
- // if (collect.Count >= length)
- // {
- // for (int i = 0; i < length; i++)
- // {
- // total += collect.ElementAt(i).TargeWeight;
-
- // }
- // }
- // return total;
- //}
-
-
- /// <summary>
- /// 炒锅配方下发
- /// </summary>
- /// <param name="PotNum"></param>
- /// <param name="result"></param>
- public void FryPotRecipeSetDown(int potNum, NewRecipeModel result)
- {
- lock (Pot_Lock)
- {
- Json<FlowProcessNames>.Read();
- #region 炒锅工艺下发
- int length = 0;
- WritePotData(potNum,"D3920",Convert.ToUInt16(result.FlowProcess.targetWeightOffset*10));//目标重量偏差下发
-
- WritePotData(potNum, "D3143", Convert.ToUInt16(result.FlowProcess.StirTime));//秘制配方搅拌时间下发
- if (result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == "清洗") != null)
- {
- WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count - 1));//工序数量
- if (result.FlowProcess.fpModels.Count < 12)
- {
- length = result.FlowProcess.fpModels.Count - 1;
- WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryTemperature * 10));
- WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime));
- WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryWeight * 10));//炒制重量
- WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).SmallFirePercent));
- WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).MidFirePercent));
- WritePotData(potNum, "D3117", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).BigFirePercent));
- WritePotData(potNum, "D3118", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).StrongFirePercent));
- WritePotData(potNum, "D3119", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FrySpeed * 10));
- WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight*10)));//清洗目标重量
-
- }
- else
- {
- length = result.FlowProcess.fpModels.Count;
- }
- }
- else//没有编辑清洗
- {
- length = result.FlowProcess.fpModels.Count;
- WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count));//工序数量
-
- }
-
-
- for (int i = 0; i < length; i++)
- {
- bool can = ushort.TryParse(result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum, out ushort res);
- //按工序下发数据
-
- #region 工序1
- if (i == 0)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3001", 2); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3001", 3); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3001", 4); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3001", 5); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3001", 6); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3001", 7); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3001", 8); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3001", 9); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
- }
- }
- else
- {
-
- WritePotData(potNum, "D3001", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3004", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
-
- }
-
- WritePotData(potNum, "D3002", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3005", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3006", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3007", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3008", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3009", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4011", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序1目标重量
-
- continue;
- }
-
- #endregion
- #region 工序2
- if (i == 1)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3011", 2); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3011", 3); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3011", 4); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3011", 5); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3011", 6); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3011", 7); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3011", 8); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3011", 9); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3011", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3014", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3012", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3015", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3016", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3017", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3018", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3019", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4021", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序2目标重量
-
- continue;
- }
-
- #endregion
- #region 工序3
- if (i == 2)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3021", 2); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3021", 3); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3021", 4); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3021", 5); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3021", 6); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3021", 7); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3021", 8); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3021", 9); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3021", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3024", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3022", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3025", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3026", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3027", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3028", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3029", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4031", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序3目标重量
-
- continue;
- }
-
- #endregion
- #region 工序4
- if (i == 3)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3031", 2); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3031", 3); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3031", 4); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3031", 5); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3031", 6); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3031", 7); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3031", 8); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3031", 9); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3031", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3034", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3032", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3035", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3036", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3037", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3038", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3039", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4041", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序4目标重量
-
- continue;
- }
-
- #endregion
- #region 工序5
- if (i == 4)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3041", 2); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3041", 3); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3041", 4); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3041", 5); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3041", 6); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3041", 7); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3041", 8); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3041", 9); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3041", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3044", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3042", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3045", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3046", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3047", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3048", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3049", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4051", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序5目标重量
-
- continue;
- }
-
- #endregion
- #region 工序6
- if (i == 5)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3051", 2); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3051", 3); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3051", 4); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3051", 5); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3051", 6); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3051", 7); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3051", 8); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3051", 9); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3051", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3054", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3052", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3055", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3056", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3057", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3058", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3059", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4061", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序6目标重量
-
- continue;
- }
-
- #endregion
- #region 工序7
- if (i == 6)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3061", 2); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3061", 3); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3061", 4); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3061", 5); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3061", 6); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3061", 7); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3061", 8); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3061", 9); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3061", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3064", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3062", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3065", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3066", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3067", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3068", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3069", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4071", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序7目标重量
-
- continue;
- }
-
- #endregion
- #region 工序8
- if (i == 7)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3071", 2); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3071", 3); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3071", 4); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3071", 5); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3071", 6); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3071", 7); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3071", 8); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3071", 9); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3071", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3074", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3072", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3075", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3076", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3077", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3078", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3079", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4081", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序8目标重量
-
- continue;
- }
-
- #endregion
- #region 工序9
- if (i == 8)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3081", 2); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3081", 3); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3081", 4); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3081", 5); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3081", 6); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3081", 7); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3081", 8); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3081", 9); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
-
- }
- }
- else
- {
-
- WritePotData(potNum, "D3081", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3084", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3082", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3085", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3086", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3087", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3088", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3089", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4091", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序9目标重量
-
- continue;
- }
-
- #endregion
- #region 工序10
- if (i == 9)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3091", 2); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3091", 3); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3091", 4); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3091", 5); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3091", 6); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3091", 7); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3091", 8); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3091", 9); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
- }
- }
- else
- {
-
- WritePotData(potNum, "D3091", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3094", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- }
-
- WritePotData(potNum, "D3092", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3095", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3096", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3097", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3098", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3099", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4101", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序10目标重量
-
- continue;
- }
-
- #endregion
- #region 工序11
- if (i == 10)
- {
- if (can)//是桶号
- {
- //发送桶号对应的ID以及物料重量
- switch (res % 100)
- {
- case 1: WritePotData(potNum, "D3101", 2); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- case 2: WritePotData(potNum, "D3101", 3); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- case 3: WritePotData(potNum, "D3101", 4); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- case 4: WritePotData(potNum, "D3101", 5); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- case 5: WritePotData(potNum, "D3101", 6); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- case 6: WritePotData(potNum, "D3101", 7); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- case 7: WritePotData(potNum, "D3101", 8); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- case 8: WritePotData(potNum, "D3101", 9); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
- }
- }
- else
- {
-
- WritePotData(potNum, "D3101", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
- WritePotData(potNum, "D3104", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
-
- }
-
- WritePotData(potNum, "D3102", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
-
- WritePotData(potNum, "D3105", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3106", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3107", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3108", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3109", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
-
- WritePotData(potNum, "D4111", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序11目标重量
-
- continue;
- }
-
- #endregion
- #region 工序12
- if (i == 11)
- {
- //if (can)//是桶号
- //{
- // //发送桶号对应的ID以及物料重量
- // switch (res % 100)
- // {
- // case 1: WritePotData(potNum, "D3111", 2); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
- // case 2: WritePotData(potNum, "D3111", 3); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
- // case 3: WritePotData(potNum, "D3111", 4); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
- // case 4: WritePotData(potNum, "D3111", 5); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
- // case 5: WritePotData(potNum, "D3111", 6); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
- // case 6: WritePotData(potNum, "D3111", 7); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
- // case 7: WritePotData(potNum, "D3111", 8); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
- // case 8: WritePotData(potNum, "D3111", 9); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
- // }
- //}
- //else
- //{
-
-
- //}
- if (result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum == "清洗")
- {
- WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
- WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime));
- WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
- WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
- WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
- WritePotData(potNum, "D3117", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
- WritePotData(potNum, "D3118", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
- WritePotData(potNum, "D3119", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
- WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight * 10)));//清洗目标重量
-
- }
-
-
- continue;
- }
-
- #endregion
- }
-
- #endregion
- }
-
- }
-
- /// <summary>
- /// 清除炒锅工艺数据
- /// </summary>
- /// <param name="PotNum"></param>
- public void ResetPotData(int PotNum)
- {
- lock (this)
- {
- if (PotNum == 1 || PotNum == 2 || PotNum == 3 || PotNum == 4 || PotNum == 5)
- {
-
- for (int i = 1; i < 10; i++)
- {
- WritePotData(PotNum, "D300" + i, 0);
-
- }
- for (int i = 11; i < 20; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 21; i < 30; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 31; i < 40; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 41; i < 50; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 51; i < 60; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 61; i < 70; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 71; i < 80; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 81; i < 90; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 91; i < 100; i++)
- {
- WritePotData(PotNum, "D30" + i, 0);
- }
- for (int i = 101; i < 110; i++)
- {
- WritePotData(PotNum, "D3" + i, 0);
- }
-
- #region 目标重量清零
- for (int i = 1; i < 10; i++)
- {
- WritePotData(PotNum, "D40" + i + "1", 0);
- }
- for (int i = 0; i < 3; i++)
- {
- WritePotData(PotNum, "D41" + i + "1", 0);
- }
- #endregion
- WritePotData(PotNum, "D3120", 0);
- WritePotData(PotNum,"D3920",0);//目标重量清零
- WritePotData(PotNum, "D3143", 0);//秘制配方搅拌时间清零
- }
- }
-
- }
-
- int PotOnestep = 0;
- int PotFourstep = 0;
- int PotTwostep = 0;
- int PotFivestep = 0;
- int PotThreestep = 0;
-
- public void LOneFryPotStepDisplay()
- {
-
- try
- {
- if (PotOnestep != globalVar.fryPotOne.ProcessStep && globalVar.fryPotOne.ProcessStep != 0 && potOneCurrentRecipe != null)
- {
- if (globalVar.fryPotOne.ProcessStep == 20)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
-
- }
- else
- {
- if (potOneCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotOne.ProcessStep != 12 && globalVar.fryPotOne.ProcessStep != 13)
- {
- try
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = potOneCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotOne.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
-
- }
- catch (Exception)
- {
-
- //throw;
- }
- }
- else if (globalVar.fryPotOne.ProcessStep == 12)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
-
- }
- globalVar.LOneCurrentCookingStep++;
- }
-
- PotOnestep = globalVar.fryPotOne.ProcessStep;
- }
- if (PotFourstep != globalVar.fryPotFour.ProcessStep && globalVar.fryPotFour.ProcessStep != 0 && potFourCurrentRecipe != null)
- {
- if (globalVar.fryPotFour.ProcessStep == 20)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
-
- }
- else
- {
- if (potFourCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotFour.ProcessStep != 12 && globalVar.fryPotFour.ProcessStep != 13)
- {
- try
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = potFourCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotFour.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
-
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else if (globalVar.fryPotFour.ProcessStep == 12)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
-
-
- }
- globalVar.LFourCurrentCookingStep++;
-
- }
- PotFourstep = globalVar.fryPotFour.ProcessStep;
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- public void LTwoFryPotStepDisplay()
- {
-
- try
- {
- if (PotTwostep != globalVar.fryPotTwo.ProcessStep && globalVar.fryPotTwo.ProcessStep != 0 && potTwoCurrentRecipe != null)
- {
- if (globalVar.fryPotTwo.ProcessStep == 20)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
-
- }
- else
- {
- if (potTwoCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotTwo.ProcessStep != 12 && globalVar.fryPotTwo.ProcessStep != 13)
- {
- try
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = potTwoCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotTwo.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
-
- }
- catch (Exception)
- {
-
- //throw;
- }
- }
- else if (globalVar.fryPotTwo.ProcessStep == 12)
- {
-
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
-
- }
- globalVar.LTwoCurrentCookingStep++;
- }
- PotTwostep = globalVar.fryPotTwo.ProcessStep;
- }
- if (PotFivestep != globalVar.fryPotFive.ProcessStep && globalVar.fryPotFive.ProcessStep != 0 && potFiveCurrentRecipe != null)
- {
- if (globalVar.fryPotFive.ProcessStep == 20)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
-
- globalVar.LFiveCurrentCookingStep++;
- }
- else
- {
- if (potFiveCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotFive.ProcessStep != 12 && globalVar.fryPotFive.ProcessStep != 13)
- {
-
- try
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = potFiveCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotFive.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
-
- }
- catch (Exception)
- {
-
- //throw;
- }
- }
- else if (globalVar.fryPotFive.ProcessStep == 12)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
-
- }
- globalVar.LFiveCurrentCookingStep++;
- }
-
- PotFivestep = globalVar.fryPotFive.ProcessStep;
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
- }
- public void LThreeFryPotStepDisplay()
- {
-
- try
- {
-
- if (PotThreestep != globalVar.fryPotThree.ProcessStep && globalVar.fryPotThree.ProcessStep != 0 && potThreeCurrentRecipe != null)
- {
- if (globalVar.fryPotThree.ProcessStep == 20)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
-
- }
- else
- {
- if (potThreeCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotThree.ProcessStep != 12 && globalVar.fryPotThree.ProcessStep != 13)
- {
- try
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = potThreeCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotThree.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
-
- }
- catch (Exception)
- {
-
- //throw;
- }
- }
- else if (globalVar.fryPotThree.ProcessStep == 12)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
-
- }
- globalVar.LThreeCurrentCookingStep++;
- }
-
- PotThreestep = globalVar.fryPotThree.ProcessStep;
- }
- }
- catch (Exception)
- {
-
- //throw;
- }
-
- }
- }
- }
|