终端一体化运控平台
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

DosingLogicControl.cs 231 KiB

2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150
  1. using BPASmartClient.AGV;
  2. using BPASmartClient.AGV.Enums;
  3. using BPASmartClient.AGV.Feedback;
  4. using BPASmartClient.CustomResource.Pages.Model;
  5. using BPASmartClient.Helper;
  6. using BPASmartClient.HubHelper;
  7. using FryPot_DosingSystem.Model;
  8. using FryPot_DosingSystem.ViewModel;
  9. using Newtonsoft.Json;
  10. using System;
  11. using System.Collections.Concurrent;
  12. using System.Collections.Generic;
  13. using System.Collections.ObjectModel;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Threading;
  17. using System.Threading.Tasks;
  18. using System.Windows.Media;
  19. using System.Windows;
  20. using FryPot_DosingSystem.AGV;
  21. using FryPot_DosingSystem.FryPotStatus;
  22. using System.IO;
  23. using System.Runtime.Serialization.Formatters.Binary;
  24. using System.Diagnostics;
  25. namespace FryPot_DosingSystem.Control
  26. {
  27. internal class DosingLogicControl
  28. {
  29. public static DosingLogicControl _instance;
  30. public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
  31. /// <summary>
  32. /// 滚筒线PLC数据
  33. /// </summary>
  34. public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
  35. public ConcurrentDictionary<string, object> FryOneData = new ConcurrentDictionary<string, object>();
  36. public ConcurrentDictionary<string, object> FryTwoData = new ConcurrentDictionary<string, object>();
  37. public ConcurrentDictionary<string, object> FryThreeData = new ConcurrentDictionary<string, object>();
  38. public ConcurrentDictionary<string, object> FryFourData = new ConcurrentDictionary<string, object>();
  39. public ConcurrentDictionary<string, object> FryFiveData = new ConcurrentDictionary<string, object>();
  40. /// <summary>
  41. /// 线体1配方队列
  42. /// </summary>
  43. public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  44. /// <summary>
  45. /// 线体2配方队列
  46. /// </summary>
  47. public ConcurrentQueue<NewRecipeModel> LTwoRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  48. /// <summary>
  49. /// 线体3配方队列
  50. /// </summary>
  51. public ConcurrentQueue<NewRecipeModel> LThreeRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  52. /// <summary>
  53. /// 线体1进料原料队列
  54. /// </summary>
  55. public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  56. /// <summary>
  57. /// 线体2进料原料队列
  58. /// </summary>
  59. public ConcurrentQueue<MaterialInfo> LTwoInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  60. /// <summary>
  61. /// 线体3进料原料队列
  62. /// </summary>
  63. public ConcurrentQueue<MaterialInfo> LThreeInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  64. /// <summary>
  65. /// 线体1出料原料队列
  66. /// </summary>
  67. public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  68. /// <summary>
  69. /// 线体2出料原料队列
  70. /// </summary>
  71. public ConcurrentQueue<MaterialInfo> LTwoOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  72. /// <summary>
  73. /// 线体3出料原料队列
  74. /// </summary>
  75. public ConcurrentQueue<MaterialInfo> LThreeOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  76. /// <summary>
  77. /// 全局变量对象声明
  78. /// </summary>
  79. GlobalVariable globalVar;
  80. /// <summary>
  81. /// 线体状态对象声明
  82. /// </summary>
  83. HardWareStatusViewModel hardWareStatusModel;
  84. ///// <summary>
  85. ///// 炒锅1状态
  86. ///// </summary>
  87. //PotOneStatus fryOne;
  88. ///// <summary>
  89. ///// 炒锅2状态
  90. ///// </summary>
  91. //PotTwoStatus fryTwo;
  92. ///// <summary>
  93. ///// 炒锅3状态
  94. ///// </summary>
  95. //PotThreeStatus fryThree;
  96. ///// <summary>
  97. ///// 炒锅4状态
  98. ///// </summary>
  99. //PotFourStatus fryFour;
  100. ///// <summary>
  101. ///// 炒锅5状态
  102. ///// </summary>
  103. //PotFiveStatus fryFive;
  104. /// <summary>
  105. /// 报警信息对象声明
  106. /// </summary>
  107. #region 上位机内部变量
  108. int FryPotAlarm = 0;//炒锅1滚筒故障信号 1:无故障 -1:故障
  109. int FryPotTwoAlarm = 0;//炒锅2滚筒故障信号 1:无故障 -1:故障
  110. int FryPotThreeAlarm = 0;//炒锅3滚筒故障信号 1:无故障 -1:故障
  111. int FryPotFourAlarm = 0;//炒锅4滚筒故障信号 1:无故障 -1:故障
  112. int FryPotFiveAlarm = 0;//炒锅5滚筒故障信号 1:无故障 -1:故障
  113. int ReicpeNum = 0;//记录接收到的配方数
  114. bool ErrorRecipe;//线体1错误配方标识
  115. bool LTwoErrorRecipe;//线体2错误配方标识
  116. bool LThreeErrorRecipe;//线体3错误配方标识
  117. string fryOneRecipe = string.Empty;
  118. string fryTwoRecipe = string.Empty;
  119. string fryThreeRecipe = string.Empty;
  120. string fryFourRecipe = string.Empty;
  121. string fryFiveRecipe = string.Empty;
  122. #endregion
  123. #region agv临时变量
  124. //bool agvArriveUpLoad = false;//agv是否到达线体1上料位置
  125. //bool agvArriveLTwoUpLoad = false;//agv是否到达线体2上料位置
  126. //bool agvArriveLThreeUpLoad = false;//agv是否到达线体3上料位置
  127. //bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置
  128. //bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置
  129. //bool LThreeagvArriveUnLoad = false;//线体3 agv是否到达炒锅送料位置
  130. //bool agvFryPotEmptyRollerArrive = false;// 线体1的agv是否拿到炒锅空桶
  131. //bool LTwoagvFryPotEmptyRollerArrive = false; //线体2的agv是否拿到炒锅空桶
  132. //bool LThreeagvFryPotEmptyRollerArrive = false;//线体3的agv是否拿到炒锅空桶
  133. string LOnerobotJobId = string.Empty;//线体1当前上游系统任务号,全局唯一 从线体1到炒锅路径
  134. string LTworobotJobId = string.Empty;//线体2当前上游系统任务号,全局唯一 从线体2到炒锅路径
  135. string LThreerobotJobId = string.Empty;//线体3当前上游系统任务号,全局唯一 从线体3到炒锅路径
  136. string LFourrobotJobId = string.Empty;//线体4当前上游系统任务号,全局唯一 从炒锅1、4到线体4路径
  137. string LFiverobotJobId = string.Empty; //从炒锅2、5到线体4路径
  138. string LSixrobotJobId = string.Empty; //从炒锅3到线体4路径
  139. string LSevenrobotJobId = string.Empty; //从线体1到清洗台路径
  140. string LEightrobotJobId = string.Empty; //从线体2到清洗台路径
  141. string LNinerobotJobId = string.Empty; //从线体3到清洗台路径
  142. string LTenrobotJobId = string.Empty; //从清洗台到线体4路径
  143. public int CleanNum = 0;//当前清洗台桶数
  144. #endregion
  145. /// <summary>
  146. /// 调试命令注册
  147. /// </summary>
  148. public void CommandRegist()
  149. {
  150. #region 线体空桶清洗及回收调试
  151. ActionManage.GetInstance.Register(new Action(() =>
  152. {
  153. globalVar.agvArriveLineOneLoadEmptyRoller = true;
  154. }), "AgvArriveLineOneEmptyRollerLoc");
  155. ActionManage.GetInstance.Register(new Action(() =>
  156. {
  157. globalVar.agvArriveLineTwoLoadEmptyRoller = true;
  158. }), "AgvArriveLineTwoEmptyRollerLoc");
  159. ActionManage.GetInstance.Register(new Action(() =>
  160. {
  161. globalVar.agvArriveLineThreeLoadEmptyRoller = true;
  162. }), "AgvArriveLineThreeEmptyRollerLoc");
  163. ActionManage.GetInstance.Register(new Action(() =>
  164. {
  165. globalVar.CleanComplete = 1;
  166. }), "CleanPlateCallAgv");
  167. ActionManage.GetInstance.Register(new Action(() =>
  168. {
  169. globalVar.agvArriveCleanUnLoad = true;//清洗台空桶下料就位
  170. }), "AgvArriveCleanPlateLoc");
  171. ActionManage.GetInstance.Register(new Action(() =>
  172. {
  173. globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位
  174. }), "AgvArriveCleanPlateLocLoad");
  175. ActionManage.GetInstance.Register(new Action(() =>
  176. {
  177. globalVar.agvArriveLineFour = true;
  178. }), "AgvArriveLineFourLoc");
  179. ActionManage.GetInstance.Register(new Action(() =>
  180. {
  181. EmptyRollerCleanTaskRestart();
  182. }), "EmptyRollerCleanTaskRestart");
  183. #endregion
  184. //接口调试
  185. ActionManage.GetInstance.Register(new Action(() =>
  186. {
  187. string id = Guid.NewGuid().ToString();
  188. string errorCode = AGVHelper._Instance.AgvToLineOneLoadRoller(id);
  189. if (errorCode == "SUCCESS")
  190. {
  191. MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功");
  192. }
  193. else if (errorCode == "Analysis Error")
  194. {
  195. MessageLog.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文");
  196. }
  197. else
  198. {
  199. MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
  200. }
  201. }), "AgvDebug");
  202. ActionManage.GetInstance.Register(new Action(() =>
  203. {
  204. globalVar.agvArriveLineOneLoadCom = true;
  205. }), "AgvLineOneLoadEmptyCom");
  206. ActionManage.GetInstance.Register(new Action(() =>
  207. {
  208. globalVar.agvArriveLineTwoLoadCom = true;
  209. }), "AgvLineTwoLoadEmptyCom");
  210. ActionManage.GetInstance.Register(new Action(() =>
  211. {
  212. globalVar.agvArriveLineThreeLoadCom = true;
  213. }), "AgvLineThreeLoadEmptyCom");
  214. ActionManage.GetInstance.Register(new Action(() =>
  215. {
  216. globalVar.rollerLineOne.CanRun = true;
  217. }), "AGVLineOneLoadCom");
  218. ActionManage.GetInstance.Register(new Action(() =>
  219. {
  220. globalVar.rollerLineTwo.CanRun = true;
  221. }), "AGVLineTwoLoadCom");
  222. ActionManage.GetInstance.Register(new Action(() =>
  223. {
  224. globalVar.rollerLineThree.CanRun = true;
  225. }), "AGVLineThreeLoadCom");
  226. ActionManage.GetInstance.Register(new Action(() =>
  227. {
  228. globalVar.rollerLineOne.OutMaterialingSingle = 1;
  229. }), "RollerLineRunning");
  230. ActionManage.GetInstance.Register(new Action<object>((obj) =>
  231. {
  232. globalVar.rollerLineOne.StationEight = (ushort)obj;
  233. }), "EightWorkLoc");
  234. ActionManage.GetInstance.Register(new Action(() =>
  235. {
  236. globalVar.fryPotOne.InputMaterialArrivedSingle = 1;
  237. globalVar.fryPotFour.InputMaterialArrivedSingle = 1;
  238. }), "FryPotInputArrive");
  239. ActionManage.GetInstance.Register(new Action(() =>
  240. {
  241. globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1;
  242. globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1;
  243. }), "FryPotEmptyRollerArrive");
  244. ActionManage.GetInstance.Register(new Action(() =>
  245. {
  246. globalVar.agvArriveUpLoad = true;
  247. }), "AGVLOneArrive");
  248. ActionManage.GetInstance.Register(new Action(() =>
  249. {
  250. globalVar.agvArriveUnLoad = true;
  251. }), "AGVFryPotDownArrive");
  252. ActionManage.GetInstance.Register(new Action(() =>
  253. {
  254. globalVar.agvArriveUpLoad = true;
  255. }), "AGVFryPotUpArrive");
  256. ActionManage.GetInstance.Register(new Action(() =>
  257. {
  258. globalVar.agvFryPotEmptyRollerArrive = true;
  259. }), "AGVFryPotGetEmptyRoller");
  260. //滚筒线2
  261. ActionManage.GetInstance.Register(new Action(() =>
  262. {
  263. globalVar.rollerLineTwo.OutMaterialingSingle = 1;
  264. }), "RollerLineTwoRunning");
  265. ActionManage.GetInstance.Register(new Action<object>((obj) =>
  266. {
  267. globalVar.rollerLineTwo.StationEight = (ushort)obj;
  268. }), "TwoEightWorkLoc");
  269. ActionManage.GetInstance.Register(new Action(() =>
  270. {
  271. globalVar.fryPotTwo.InputMaterialArrivedSingle = 1;
  272. globalVar.fryPotFive.InputMaterialArrivedSingle = 1;
  273. }), "FryPotTwoInputArrive");
  274. ActionManage.GetInstance.Register(new Action(() =>
  275. {
  276. globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1;
  277. globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1;
  278. }), "FryPotTwoEmptyRollerArrive");
  279. ActionManage.GetInstance.Register(new Action(() =>
  280. {
  281. globalVar.agvArriveLTwoUpLoad = true;
  282. }), "AGVLTwoArrive");
  283. ActionManage.GetInstance.Register(new Action(() =>
  284. {
  285. globalVar.LTwoagvArriveUnLoad = true;
  286. }), "AGVFryPotTwoDownArrive");
  287. ActionManage.GetInstance.Register(new Action(() =>
  288. {
  289. globalVar.agvArriveLTwoUpLoad = true;
  290. }), "AGVFryPotTwoUpArrive");
  291. ActionManage.GetInstance.Register(new Action(() =>
  292. {
  293. globalVar.LTwoagvFryPotEmptyRollerArrive = true;
  294. }), "AGVFryPotTwoGetEmptyRoller");
  295. //滚筒线3
  296. ActionManage.GetInstance.Register(new Action(() =>
  297. {
  298. globalVar.rollerLineThree.OutMaterialingSingle = 1;
  299. }), "RollerLineThreeRunning");
  300. ActionManage.GetInstance.Register(new Action<object>((obj) =>
  301. {
  302. globalVar.rollerLineThree.StationEight = (ushort)obj;
  303. }), "ThreeEightWorkLoc");
  304. ActionManage.GetInstance.Register(new Action(() =>
  305. {
  306. globalVar.fryPotThree.InputMaterialArrivedSingle = 1;
  307. }), "FryPotThreeInputArrive");
  308. ActionManage.GetInstance.Register(new Action(() =>
  309. {
  310. globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1;
  311. }), "FryPotThreeEmptyRollerArrive");
  312. ActionManage.GetInstance.Register(new Action(() =>
  313. {
  314. globalVar.agvArriveLThreeUpLoad = true;
  315. }), "AGVLThreeArrive");
  316. ActionManage.GetInstance.Register(new Action(() =>
  317. {
  318. globalVar.LThreeagvArriveUnLoad = true;
  319. }), "AGVFryPotThreeDownArrive");
  320. ActionManage.GetInstance.Register(new Action(() =>
  321. {
  322. globalVar.agvArriveLThreeUpLoad = true;
  323. }), "AGVFryPotThreeUpArrive");
  324. ActionManage.GetInstance.Register(new Action(() =>
  325. {
  326. globalVar.LThreeagvFryPotEmptyRollerArrive = true;
  327. }), "AGVFryPotThreeGetEmptyRoller");
  328. }
  329. public DosingLogicControl()
  330. {
  331. globalVar = new GlobalVariable();
  332. //fryOne = new PotOneStatus();
  333. //fryTwo = new PotTwoStatus();
  334. //fryThree = new PotThreeStatus();
  335. //fryFour = new PotFourStatus();
  336. //fryFive = new PotFiveStatus();
  337. hardWareStatusModel = HardWareStatusViewModel.GetInstance;
  338. DateTimeJudge();
  339. FileRegClean();
  340. ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
  341. //ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
  342. ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
  343. ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes");
  344. ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes");
  345. ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
  346. ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
  347. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit");
  348. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit");
  349. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit");
  350. HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
  351. HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
  352. // ResetProgram();
  353. ReadPlcData();
  354. SaveFryPotData();
  355. MainTask();
  356. CommandRegist();
  357. }
  358. /// <summary>
  359. /// 文件数据定期清理
  360. /// </summary>
  361. /// <exception cref="NotImplementedException"></exception>
  362. private void FileRegClean()
  363. {
  364. int days = 5; //清除期限
  365. string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
  366. if (filesOne.Count() > 0)
  367. {
  368. foreach (var item in filesOne)
  369. {
  370. FileInfo info = new FileInfo(item);
  371. DateTime createTime = info.CreationTime;
  372. DateTime timeNow = DateTime.Now;
  373. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  374. {
  375. Directory.Delete(item);
  376. }
  377. }
  378. }
  379. string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
  380. if (filesTwo.Count() > 0)
  381. {
  382. foreach (var item in filesTwo)
  383. {
  384. FileInfo info = new FileInfo(item);
  385. DateTime createTime = info.CreationTime;
  386. DateTime timeNow = DateTime.Now;
  387. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  388. {
  389. Directory.Delete(item);
  390. }
  391. }
  392. }
  393. string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
  394. if (filesThree.Count() > 0)
  395. {
  396. foreach (var item in filesThree)
  397. {
  398. FileInfo info = new FileInfo(item);
  399. DateTime createTime = info.CreationTime;
  400. DateTime timeNow = DateTime.Now;
  401. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  402. {
  403. Directory.Delete(item);
  404. }
  405. }
  406. }
  407. string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
  408. if (filesFour.Count() > 0)
  409. {
  410. foreach (var item in filesFour)
  411. {
  412. FileInfo info = new FileInfo(item);
  413. DateTime createTime = info.CreationTime;
  414. DateTime timeNow = DateTime.Now;
  415. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  416. {
  417. Directory.Delete(item);
  418. }
  419. }
  420. }
  421. string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
  422. if (filesFive.Count() > 0)
  423. {
  424. foreach (var item in filesFive)
  425. {
  426. FileInfo info = new FileInfo(item);
  427. DateTime createTime = info.CreationTime;
  428. DateTime timeNow = DateTime.Now;
  429. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  430. {
  431. Directory.Delete(item);
  432. }
  433. }
  434. }
  435. }
  436. /// <summary>
  437. /// 时间差计算
  438. /// </summary>
  439. /// <param name="t">当前时间</param>
  440. /// <param name="t2">创建时间</param>
  441. /// <returns></returns>
  442. private int TimeDiff(DateTime t, DateTime t2)
  443. {
  444. long lReturn = -1;
  445. System.TimeSpan NowValue = new TimeSpan(t.Ticks);
  446. System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
  447. System.TimeSpan DateDiff = TimeSpan.Zero;
  448. try
  449. {
  450. //计算时间差
  451. //DateDiff = TimeValue.Subtract(NowValue).Duration();
  452. DateDiff = NowValue.Subtract(TimeValue);
  453. int h = DateDiff.Hours;
  454. int m = DateDiff.Minutes;
  455. return DateDiff.Days;
  456. }
  457. catch
  458. {
  459. return -1;
  460. }
  461. }
  462. /// <summary>
  463. /// 炒锅数据实时保存
  464. /// </summary>
  465. /// <exception cref="NotImplementedException"></exception>
  466. private void SaveFryPotData()
  467. {
  468. Task.Run(new Action(() =>
  469. {
  470. while (true)
  471. {
  472. FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
  473. }
  474. }));
  475. }
  476. /// <summary>
  477. /// 时间判断,数据处理
  478. /// </summary>
  479. private void DateTimeJudge()
  480. {
  481. #region sqlite数据库保存
  482. //if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
  483. //{
  484. // string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
  485. // if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  486. // {
  487. // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  488. // FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
  489. // }
  490. //}
  491. //if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
  492. //{
  493. // string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
  494. // if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  495. // {
  496. // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  497. // FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
  498. // }
  499. //}
  500. //if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
  501. //{
  502. // string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
  503. // if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  504. // {
  505. // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  506. // FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
  507. // }
  508. //}
  509. //if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
  510. //{
  511. // string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
  512. // if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  513. // {
  514. // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  515. // FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
  516. // }
  517. //}
  518. //if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
  519. //{
  520. // string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
  521. // if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  522. // {
  523. // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  524. // FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
  525. // }
  526. //}
  527. #endregion
  528. string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
  529. string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
  530. string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
  531. string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
  532. string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
  533. if (!Directory.Exists("AccessFile//" + "Statistic"))
  534. Directory.CreateDirectory("AccessFile//" + "Statistic");
  535. if (File.Exists(p1))
  536. {
  537. using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
  538. {
  539. string time = sReader.ReadLine();
  540. string statistic = sReader.ReadLine();
  541. if (DateTime.Now.ToShortDateString() == time)
  542. {
  543. FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  544. FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  545. }
  546. }
  547. }
  548. if (File.Exists(p2))
  549. {
  550. using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
  551. {
  552. string time = sReader.ReadLine();
  553. string statistic = sReader.ReadLine();
  554. if (DateTime.Now.ToShortDateString() == time)
  555. {
  556. FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  557. FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  558. }
  559. }
  560. }
  561. if (File.Exists(p3))
  562. {
  563. using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
  564. {
  565. string time = sReader.ReadLine();
  566. string statistic = sReader.ReadLine();
  567. if (DateTime.Now.ToShortDateString() == time)
  568. {
  569. FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  570. FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  571. }
  572. }
  573. }
  574. if (File.Exists(p4))
  575. {
  576. using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
  577. {
  578. string time = sReader.ReadLine();
  579. string statistic = sReader.ReadLine();
  580. if (DateTime.Now.ToShortDateString() == time)
  581. {
  582. FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  583. FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  584. }
  585. }
  586. }
  587. if (File.Exists(p5))
  588. {
  589. using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
  590. {
  591. string time = sReader.ReadLine();
  592. string statistic = sReader.ReadLine();
  593. if (DateTime.Now.ToShortDateString() == time)
  594. {
  595. FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  596. FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  597. }
  598. }
  599. }
  600. }
  601. /// <summary>
  602. /// AGV上下料上报数据解析
  603. /// </summary>
  604. /// <param name="obj"></param>
  605. private void AgvFeedBackUpReportDataAnalysis(object obj)
  606. {
  607. //if (obj != null && obj is byte[] datas)
  608. //{
  609. //string strData = Encoding.UTF8.GetString(datas);
  610. Upstreamrequest objData = JsonConvert.DeserializeObject<Upstreamrequest>(obj.ToString());
  611. if (objData != null)
  612. {
  613. #region 线体到炒锅
  614. //线体1请求上下料
  615. if (objData.robotJobId == LOnerobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  616. {
  617. globalVar.agvArriveUpLoad = true;//AGV到达上料位置
  618. }
  619. if (objData.robotJobId == LOnerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  620. {
  621. globalVar.agvArriveUnLoad = true;//AGV到达下料位置
  622. }
  623. //线体2请求上下料
  624. if (objData.robotJobId == LTworobotJobId && objData.command == "LOAD")
  625. {
  626. globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
  627. }
  628. if (objData.robotJobId == LTworobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  629. {
  630. globalVar.LTwoagvArriveUnLoad = true;//AGV到达下料位置
  631. }
  632. //线体3请求上下料
  633. if (objData.robotJobId == LThreerobotJobId && objData.command == "LOAD")
  634. {
  635. globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
  636. }
  637. if (objData.robotJobId == LThreerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  638. {
  639. globalVar.LThreeagvArriveUnLoad = true;//AGV到达下料位置
  640. }
  641. #endregion
  642. #region 炒锅到线体4请求上下料
  643. if (objData.robotJobId == LFourrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  644. {
  645. globalVar.agvArriveUpLoad = true;//AGV到达上料位置
  646. }
  647. if (objData.robotJobId == LFourrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  648. {
  649. globalVar.agvArriveLineFour = true;//AGV到达下料位置
  650. }
  651. if (objData.robotJobId == LFiverobotJobId && objData.command == "LOAD")
  652. {
  653. globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
  654. }
  655. if (objData.robotJobId == LFiverobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  656. {
  657. globalVar.agvArriveLineFour = true;//AGV到达下料位置
  658. }
  659. if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD")
  660. {
  661. globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
  662. }
  663. if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  664. {
  665. globalVar.agvArriveLineFour = true;//AGV到达下料位置
  666. }
  667. #endregion
  668. #region 线体到清洗台
  669. if (objData.robotJobId == LSevenrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  670. {
  671. globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置
  672. }
  673. if (objData.robotJobId == LSevenrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  674. {
  675. globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置
  676. }
  677. if (objData.robotJobId == LEightrobotJobId && objData.command == "LOAD")
  678. {
  679. globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置
  680. }
  681. if (objData.robotJobId == LEightrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  682. {
  683. globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置
  684. }
  685. if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD")
  686. {
  687. globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置
  688. }
  689. if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  690. {
  691. globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置
  692. }
  693. #endregion
  694. if (objData.robotJobId == LTenrobotJobId && objData.command == "LOAD")
  695. {
  696. globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置
  697. }
  698. if (objData.robotJobId == LTenrobotJobId && objData.command == "UNLOAD")
  699. {
  700. globalVar.agvArriveLineFour = true;//agv到达线体4下料位置
  701. }
  702. }
  703. }
  704. /// <summary>
  705. /// AGV搬运任务上报数据解析
  706. /// </summary>
  707. /// <param name="obj"></param>
  708. private void AgvTaskUpReportDataAnalysis(object obj)
  709. {
  710. //if (obj != null && obj is byte[] datas)
  711. //{
  712. // string strData = Encoding.UTF8.GetString(datas);
  713. AGVToUpSystem objData = JsonConvert.DeserializeObject<AGVToUpSystem>(obj.ToString());
  714. if (objData != null)
  715. {
  716. #region 线体上下料任务信息回报
  717. //线体1任务上报
  718. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
  719. {
  720. }
  721. //线体2任务上报
  722. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
  723. {
  724. //日志
  725. }
  726. //线体3任务上报
  727. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
  728. {
  729. //日志
  730. }
  731. //---------------------空桶从线体去清洗-------------------------------//
  732. //线体1任务上报
  733. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料
  734. {
  735. // globalVar.rollerLineOne.IsEpmtyBefore = false;
  736. }
  737. //线体2任务上报
  738. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料
  739. {
  740. // globalVar.rollerLineTwo.IsEpmtyBefore = false;
  741. }
  742. //线体3任务上报
  743. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料
  744. {
  745. // globalVar.rollerLineThree.IsEpmtyBefore = false;
  746. }
  747. //线体1任务上报
  748. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
  749. {
  750. AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
  751. AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.Yes);
  752. if (globalVar.LOneFryPotSerial == 1)
  753. {
  754. AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1);
  755. }
  756. else if (globalVar.LOneFryPotSerial == 4)
  757. {
  758. AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4);
  759. }
  760. }
  761. //线体2任务上报
  762. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
  763. {
  764. AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
  765. AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.Yes);
  766. if (globalVar.LTwoFryPotSerial == 2)
  767. {
  768. AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
  769. }
  770. else if (globalVar.LTwoFryPotSerial == 5)
  771. {
  772. AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
  773. }
  774. }
  775. //线体3任务上报
  776. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
  777. {
  778. AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
  779. AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.Yes);
  780. AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
  781. }
  782. //线体1任务上报
  783. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料
  784. {
  785. globalVar.agvArriveLineOneLoadCom = true;
  786. AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
  787. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
  788. AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_1);
  789. //到清洗处
  790. }
  791. //线体2任务上报
  792. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料
  793. {
  794. globalVar.agvArriveLineTwoLoadCom = true;
  795. AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
  796. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
  797. AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_2);
  798. //到清洗处
  799. }
  800. //线体3任务上报
  801. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料
  802. {
  803. globalVar.agvArriveLineThreeLoadCom = true;
  804. AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
  805. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
  806. AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_3);
  807. //到清洗处
  808. }
  809. //线体1任务上报
  810. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
  811. {
  812. }
  813. //线体2任务上报
  814. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
  815. {
  816. }
  817. //线体3任务上报
  818. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
  819. {
  820. }
  821. //线体1任务上报
  822. if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料
  823. {
  824. }
  825. //线体2任务上报
  826. if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料
  827. {
  828. }
  829. //线体3任务上报
  830. if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料
  831. {
  832. }
  833. #endregion
  834. #region 空桶上下料任务信息回报
  835. //线体1任务上报
  836. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
  837. {
  838. //日志
  839. }
  840. //线体2任务上报
  841. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
  842. {
  843. //日志
  844. }
  845. //线体3任务上报
  846. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
  847. {
  848. //日志
  849. }
  850. //线体1任务上报
  851. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
  852. {
  853. globalVar.agvFryPotEmptyRollerArrive = true;
  854. AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
  855. if (globalVar.LOneFryPotSerial == 1)
  856. {
  857. AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1);
  858. }
  859. else if (globalVar.LOneFryPotSerial == 4)
  860. {
  861. AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4);
  862. }
  863. }
  864. //线体2任务上报
  865. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
  866. {
  867. globalVar.LTwoagvFryPotEmptyRollerArrive = true;
  868. AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
  869. if (globalVar.LTwoFryPotSerial == 2)
  870. {
  871. AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
  872. }
  873. else if (globalVar.LTwoFryPotSerial == 5)
  874. {
  875. AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
  876. }
  877. }
  878. //线体3任务上报
  879. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
  880. {
  881. globalVar.LThreeagvFryPotEmptyRollerArrive = true;
  882. AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
  883. AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
  884. }
  885. //线体1任务上报
  886. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
  887. {
  888. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  889. AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
  890. if (globalVar.LFourRollerNum >= 8)
  891. {
  892. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  893. }
  894. else
  895. {
  896. AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
  897. }
  898. }
  899. //线体2任务上报
  900. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
  901. {
  902. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  903. AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
  904. if (globalVar.LFourRollerNum >= 8)
  905. {
  906. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  907. }
  908. else
  909. {
  910. AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
  911. }
  912. }
  913. //线体3任务上报
  914. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
  915. {
  916. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  917. AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
  918. if (globalVar.LFourRollerNum >= 8)
  919. {
  920. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  921. }
  922. else
  923. {
  924. AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
  925. }
  926. }
  927. //线体1任务上报
  928. if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
  929. {
  930. // globalVar.EmptyRollerUnLoadcCom = true;
  931. AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hj"));
  932. AgvViewModel.GetInstance().Set小车停止(1);
  933. AgvViewModel.GetInstance().Set停车桩(1, IsBool.Yes);
  934. }
  935. //线体2任务上报
  936. if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
  937. {
  938. // globalVar.EmptyRollerUnLoadcCom = true;
  939. AgvViewModel.GetInstance().Set小车运动(2, AgvViewModel.GetInstance().GetCommandValue("hj"));
  940. AgvViewModel.GetInstance().Set小车停止(2);
  941. AgvViewModel.GetInstance().Set停车桩(2, IsBool.Yes);
  942. }
  943. //线体3任务上报
  944. if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
  945. {
  946. // globalVar.EmptyRollerUnLoadcCom = true;
  947. AgvViewModel.GetInstance().Set小车运动(3, AgvViewModel.GetInstance().GetCommandValue("hj"));
  948. AgvViewModel.GetInstance().Set小车停止(3);
  949. AgvViewModel.GetInstance().Set停车桩(3, IsBool.Yes);
  950. }
  951. if (objData.state == "DONE" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体1到清戏台空桶下料
  952. {
  953. AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
  954. AgvViewModel.GetInstance().Set小车停止(4);
  955. AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
  956. }
  957. if (objData.state == "DONE" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体2到清戏台空桶下料
  958. {
  959. AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
  960. AgvViewModel.GetInstance().Set小车停止(4);
  961. AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
  962. }
  963. if (objData.state == "DONE" && objData.robotJobId == LNinerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体3到清戏台空桶下料
  964. {
  965. AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
  966. AgvViewModel.GetInstance().Set小车停止(4);
  967. AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
  968. }
  969. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料位置上料完成,指清戏台空桶到上料
  970. {
  971. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
  972. AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.hs_4);//去四号空桶线
  973. }
  974. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTenrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指清洗台空桶到线体4下料
  975. {
  976. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  977. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No);
  978. if (globalVar.LFourRollerNum >= 8)
  979. {
  980. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  981. }
  982. else
  983. {
  984. AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
  985. }
  986. }
  987. if (objData.state == "DONE" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指清戏台空桶到线体4下料
  988. {
  989. AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
  990. AgvViewModel.GetInstance().Set小车停止(4);
  991. AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
  992. }
  993. #endregion
  994. }
  995. }
  996. /// <summary>
  997. /// 主任务重启
  998. /// </summary>
  999. private void ResetProgram()
  1000. {
  1001. ThreadManage.GetInstance().StartLong(new Action(() =>
  1002. {
  1003. if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
  1004. {
  1005. MessageLog.GetInstance.ShowUserLog("主任务正在重启");
  1006. ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
  1007. {
  1008. //ActionManage.GetInstance.CancelRegister("RecipeSetDown");
  1009. //ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
  1010. // ActionManage.GetInstance.Send("ClearRecipes");
  1011. ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
  1012. {
  1013. ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
  1014. {
  1015. ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
  1016. {
  1017. globalVar = null;
  1018. globalVar = new GlobalVariable();
  1019. ReicpeNum = 0;
  1020. ReadPlcData();
  1021. MainTask();
  1022. MessageLog.GetInstance.ShowUserLog("主任务重启完成");
  1023. }));
  1024. }));
  1025. }));
  1026. }));
  1027. }
  1028. Thread.Sleep(10);
  1029. }), "ResetProgram");
  1030. }
  1031. public void LineOneTaskRestart()
  1032. {
  1033. ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
  1034. {
  1035. ActionManage.GetInstance.Send("ClearOneRecipes");
  1036. globalVar.rollerLineOne = null;
  1037. globalVar.rollerLineOne = new RollerLineOne();
  1038. globalVar.fryPotOne = null;
  1039. globalVar.fryPotOne = new FryPotOne();
  1040. globalVar.fryPotFour = null;
  1041. globalVar.fryPotFour = new FryPotFour();
  1042. globalVar.ExitLineOneTask = false;
  1043. globalVar.AllowAgvToLineLoadRoller = true;
  1044. globalVar.InOrOutputLock = false;
  1045. globalVar.LOneCurrentRecipeName = string.Empty;
  1046. globalVar.LoadRoller = false;
  1047. globalVar.AgvToFryPot = false;
  1048. globalVar.PotOneInputMaterialArrive = false;
  1049. globalVar.PotOneOutputRollerArrive = false;
  1050. globalVar.AgvArrivePot = false;
  1051. globalVar.LOneMaterialNum = 0;
  1052. globalVar.LOneFryPotSerial = 1;
  1053. globalVar.LOneCurrentCookingStep = 0;
  1054. globalVar.agvArriveUpLoad = false;
  1055. globalVar.agvArriveUnLoad = false;
  1056. globalVar.agvFryPotEmptyRollerArrive = false;
  1057. globalVar.agvLineOneLoadCom = false;
  1058. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
  1059. MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
  1060. }));
  1061. }
  1062. public void LineTwoTaskRestart()
  1063. {
  1064. ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
  1065. {
  1066. ActionManage.GetInstance.Send("ClearTwoRecipes");
  1067. globalVar.rollerLineTwo = null;
  1068. globalVar.rollerLineTwo = new RollerLineTwo();
  1069. globalVar.fryPotTwo = null;
  1070. globalVar.fryPotTwo = new FryPotTwo();
  1071. globalVar.fryPotFive = null;
  1072. globalVar.fryPotFive = new FryPotFive();
  1073. globalVar.ExitLineTwoTask = false;
  1074. globalVar.AllowAgvToLineTwoLoadRoller = true;
  1075. globalVar.LTwoInOrOutputLock = false;
  1076. globalVar.LTwoCurrentRecipeName = string.Empty;
  1077. globalVar.LTwoLoadRoller = false;
  1078. globalVar.LTwoAgvToFryPot = false;
  1079. globalVar.LTwoPotInputMaterialArrive = false;
  1080. globalVar.LTwoPotOutputRollerArrive = false;
  1081. globalVar.LTwoAgvArrivePot = false;
  1082. globalVar.LTwoMaterialNum = 0;
  1083. globalVar.LTwoFryPotSerial = 2;
  1084. globalVar.LTwoCurrentCookingStep = 0;
  1085. globalVar.agvArriveLTwoUpLoad = false;
  1086. globalVar.LTwoagvArriveUnLoad = false;
  1087. globalVar.LTwoagvFryPotEmptyRollerArrive = false;
  1088. globalVar.agvLineTwoLoadCom = false;
  1089. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
  1090. MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
  1091. }));
  1092. }
  1093. public void LineThreeTaskRestart()
  1094. {
  1095. ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
  1096. {
  1097. ActionManage.GetInstance.Send("ClearThreeRecipes");
  1098. globalVar.rollerLineThree = null;
  1099. globalVar.rollerLineThree = new RollerLineThree();
  1100. globalVar.fryPotThree = null;
  1101. globalVar.fryPotThree = new FryPotThree();
  1102. globalVar.ExitLineThreeTask = false;
  1103. globalVar.AllowAgvToLineThreeLoadRoller = true;
  1104. globalVar.LThreeInOrOutputLock = false;
  1105. globalVar.LThreeCurrentRecipeName = string.Empty;
  1106. globalVar.LThreeLoadRoller = false;
  1107. globalVar.LThreeAgvToFryPot = false;
  1108. globalVar.LThreePotInputMaterialArrive = false;
  1109. globalVar.LThreePotOutputRollerArrive = false;
  1110. globalVar.LThreeAgvArrivePot = false;
  1111. globalVar.LThreeMaterialNum = 0;
  1112. globalVar.LThreeFryPotSerial = 3;
  1113. globalVar.LThreeCurrentCookingStep = 0;
  1114. globalVar.agvArriveLThreeUpLoad = false;
  1115. globalVar.LThreeagvArriveUnLoad = false;
  1116. globalVar.LThreeagvFryPotEmptyRollerArrive = false;
  1117. globalVar.agvLineThreeLoadCom = false;
  1118. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
  1119. MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
  1120. }));
  1121. }
  1122. public void EmptyRollerCleanTaskRestart()
  1123. {
  1124. ThreadManage.GetInstance().StopTask("空桶清洗任务线程", new Action(() =>
  1125. {
  1126. globalVar.rollerLineOne.StationEight = 0;
  1127. globalVar.rollerLineOne.EmptyRollerNums.Clear();
  1128. globalVar.rollerLineOne.EmptyRollerNums.Add(108);
  1129. globalVar.rollerLineOne.IsEpmtyBefore = false;
  1130. // globalVar.rollerLineOne.CanRun = true;
  1131. globalVar.rollerLineTwo.StationEight = 0;
  1132. globalVar.rollerLineTwo.EmptyRollerNums.Clear();
  1133. globalVar.rollerLineTwo.EmptyRollerNums.Add(208);
  1134. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  1135. //globalVar.rollerLineTwo.CanRun = true;
  1136. globalVar.rollerLineThree.StationEight = 0;
  1137. globalVar.rollerLineThree.EmptyRollerNums.Clear();
  1138. globalVar.rollerLineThree.EmptyRollerNums.Add(308);
  1139. globalVar.rollerLineThree.IsEpmtyBefore = false;
  1140. //globalVar.rollerLineThree.CanRun = true;
  1141. globalVar.agvArriveLineFour = false;
  1142. globalVar.agvArriveCleanLoad = false;
  1143. globalVar.agvArriveCleanUnLoad = false;
  1144. globalVar.agvArriveLineOneLoadEmptyRoller = false;
  1145. globalVar.agvArriveLineTwoLoadEmptyRoller = false;
  1146. globalVar.agvArriveLineThreeLoadEmptyRoller = false;
  1147. globalVar.agvArriveLineOneLoadCom = false;
  1148. globalVar.agvArriveLineTwoLoadCom = false;
  1149. globalVar.agvArriveLineThreeLoadCom = false;
  1150. ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程");
  1151. MessageLog.GetInstance.ShowUserLog("空桶清洗任务重启成功");
  1152. }));
  1153. }
  1154. /// <summary>
  1155. /// 实时获取plc数据
  1156. /// </summary>
  1157. public void ReadPlcData()
  1158. {
  1159. ThreadManage.GetInstance().StartLong(new Action(() =>
  1160. {
  1161. GetAddressData("D2001", new Action<ushort[]>((data) =>
  1162. {
  1163. globalVar.rollerLineOne.StationOne = data[0];
  1164. globalVar.rollerLineOne.StationTwo = data[1];
  1165. globalVar.rollerLineOne.StationThree = data[2];
  1166. globalVar.rollerLineOne.StationFour = data[3];
  1167. globalVar.rollerLineOne.StationFive = data[4];
  1168. globalVar.rollerLineOne.StationSix = data[5];
  1169. globalVar.rollerLineOne.StationSeven = data[6];
  1170. globalVar.rollerLineOne.StationEight = data[7];
  1171. }));
  1172. GetAddressData("D2011", new Action<ushort[]>((data) =>
  1173. {
  1174. globalVar.rollerLineTwo.StationOne = data[0];
  1175. globalVar.rollerLineTwo.StationTwo = data[1];
  1176. globalVar.rollerLineTwo.StationThree = data[2];
  1177. globalVar.rollerLineTwo.StationFour = data[3];
  1178. globalVar.rollerLineTwo.StationFive = data[4];
  1179. globalVar.rollerLineTwo.StationSix = data[5];
  1180. globalVar.rollerLineTwo.StationSeven = data[6];
  1181. globalVar.rollerLineTwo.StationEight = data[7];
  1182. }));
  1183. GetAddressData("D2021", new Action<ushort[]>((data) =>
  1184. {
  1185. globalVar.rollerLineThree.StationOne = data[0];
  1186. globalVar.rollerLineThree.StationTwo = data[1];
  1187. globalVar.rollerLineThree.StationThree = data[2];
  1188. globalVar.rollerLineThree.StationFour = data[3];
  1189. globalVar.rollerLineThree.StationFive = data[4];
  1190. globalVar.rollerLineThree.StationSix = data[5];
  1191. globalVar.rollerLineThree.StationSeven = data[6];
  1192. globalVar.rollerLineThree.StationEight = data[7];
  1193. }));
  1194. GetAddressData("D2031", new Action<ushort[]>((data) =>
  1195. {
  1196. globalVar.rollerLineOne.OutMaterialingSingle = data[3];
  1197. globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
  1198. globalVar.rollerLineThree.OutMaterialingSingle = data[5];
  1199. //globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
  1200. //globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
  1201. //globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
  1202. AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
  1203. AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
  1204. AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
  1205. }));
  1206. GetAddressData("D2040", new Action<ushort[]>((data) =>
  1207. {
  1208. globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
  1209. globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
  1210. globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
  1211. globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
  1212. globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
  1213. }));
  1214. GetAddressData("D2045", new Action<ushort[]>((data) =>
  1215. {
  1216. globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
  1217. globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
  1218. globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
  1219. globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
  1220. globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
  1221. }));
  1222. GetAddressData("D2050", new Action<ushort[]>((data) =>
  1223. {
  1224. globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
  1225. globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
  1226. globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
  1227. globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
  1228. globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
  1229. }));
  1230. GetAddressData("D2065", new Action<ushort[]>((data) =>
  1231. {
  1232. globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
  1233. globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
  1234. globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
  1235. globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
  1236. globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
  1237. }));
  1238. GetAddressData("D2070", new Action<ushort[]>((data) =>
  1239. {
  1240. //globalVar.fryPotOne.RollerTroubleSingle = data[0];
  1241. //globalVar.fryPotTwo.RollerTroubleSingle = data[1];
  1242. //globalVar.fryPotThree.RollerTroubleSingle = data[2];
  1243. //globalVar.fryPotFour.RollerTroubleSingle = data[3];
  1244. //globalVar.fryPotFive.RollerTroubleSingle = data[4];
  1245. AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble = data[0];
  1246. AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
  1247. AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
  1248. AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble = data[3];
  1249. AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble = data[4];
  1250. }));
  1251. GetAddressData("D2078", new Action<ushort[]>(data =>
  1252. {
  1253. globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
  1254. globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
  1255. globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
  1256. }));
  1257. GetAddressData("D2075", new Action<ushort[]>(data =>
  1258. {
  1259. globalVar.CleadBarrelEnterSingle = data[0];
  1260. }));
  1261. GetAddressData("D2077", new Action<ushort[]>(data =>
  1262. {
  1263. globalVar.CleadBarrelExitSingle = data[0];
  1264. }));
  1265. //炒锅1状态数据
  1266. GetFryOneData("D2001", new Action<ushort[]>(data =>
  1267. {
  1268. }));
  1269. //炒锅2状态数据
  1270. GetFryTwoData("D2001", new Action<ushort[]>(data =>
  1271. {
  1272. }));
  1273. //炒锅3状态数据
  1274. GetFryThreeData("D2001", new Action<ushort[]>(data =>
  1275. {
  1276. }));
  1277. //炒锅4状态数据
  1278. GetFryFourData("D2001", new Action<ushort[]>(data =>
  1279. {
  1280. }));
  1281. //炒锅5状态数据
  1282. GetFryFiveData("D2001", new Action<ushort[]>(data =>
  1283. {
  1284. }));
  1285. //线体上放空桶
  1286. if (globalVar.rollerLineOne.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0)
  1287. {
  1288. globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
  1289. }
  1290. if (globalVar.rollerLineTwo.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineTwo.EmptyRollerNum != 0)
  1291. {
  1292. globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum);
  1293. }
  1294. if (globalVar.rollerLineThree.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineThree.EmptyRollerNum != 0)
  1295. {
  1296. globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
  1297. }
  1298. //炒锅状态数据
  1299. if (globalVar.fryPotOne.OilConfirm == 1)
  1300. {
  1301. FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
  1302. FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity;
  1303. }
  1304. if (globalVar.fryPotTwo.OilConfirm == 1)
  1305. {
  1306. FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity;
  1307. FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity;
  1308. }
  1309. if (globalVar.fryPotThree.OilConfirm == 1)
  1310. {
  1311. FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity;
  1312. FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity;
  1313. }
  1314. if (globalVar.fryPotFour.OilConfirm == 1)
  1315. {
  1316. FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity;
  1317. FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity;
  1318. }
  1319. if (globalVar.fryPotFive.OilConfirm == 1)
  1320. {
  1321. FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
  1322. FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
  1323. }
  1324. //炒锅状态实时显示
  1325. FryPotStatusDisplay();
  1326. RollerLineStatusDisplay();
  1327. Thread.Sleep(10);
  1328. }), "MainViewReadPlcData");
  1329. }
  1330. private void FryPotStatusDisplay()
  1331. {
  1332. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString();
  1333. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOnePower").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.HotPower.ToString();
  1334. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString();
  1335. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString();
  1336. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString();
  1337. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString();
  1338. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString();
  1339. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString();
  1340. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoPower").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.HotPower.ToString();
  1341. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString();
  1342. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString();
  1343. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString();
  1344. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString();
  1345. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString();
  1346. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString();
  1347. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreePower").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.HotPower.ToString();
  1348. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString();
  1349. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString();
  1350. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString();
  1351. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString();
  1352. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString();
  1353. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString();
  1354. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourPower").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.HotPower.ToString();
  1355. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString();
  1356. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString();
  1357. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString();
  1358. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString();
  1359. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString();
  1360. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString();
  1361. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFivePower").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.HotPower.ToString();
  1362. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString();
  1363. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString();
  1364. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
  1365. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
  1366. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();
  1367. //FryPotMonitorManage.GetInstance.fryFive.Temperature = 10;
  1368. //FryPotMonitorManage.GetInstance.fryFive.HotPower = "9";
  1369. //FryPotMonitorManage.GetInstance.fryFive.Speed = 8;
  1370. //FryPotMonitorManage.GetInstance.fryFive.FryPotWeight=7;
  1371. //FryPotMonitorManage.GetInstance.fryFive.OilCapacity = 6;
  1372. //FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = 5;
  1373. //FryPotMonitorManage.GetInstance.fryFive.TotalProduct = 4;
  1374. }
  1375. /// <summary>
  1376. /// 炒锅状态数据保存到二进制文件
  1377. /// </summary>
  1378. public void FryPotDataSaveToBinaryFile()
  1379. {
  1380. #region 炒锅1状态数据保存
  1381. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据"))
  1382. {
  1383. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据");
  1384. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
  1385. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
  1386. if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
  1387. {
  1388. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1389. {
  1390. writeStream.Position = writeStream.Length;
  1391. PotOneStatus p1 = 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, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() };
  1392. BinaryFormatter bf = new BinaryFormatter();
  1393. bf.Serialize(writeStream, p1);
  1394. }
  1395. }
  1396. }
  1397. else
  1398. {
  1399. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
  1400. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
  1401. if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
  1402. {
  1403. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1404. {
  1405. writeStream.Position = writeStream.Length;
  1406. PotOneStatus p1 = 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, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() };
  1407. BinaryFormatter bf = new BinaryFormatter();
  1408. bf.Serialize(writeStream, p1);
  1409. }
  1410. }
  1411. }
  1412. #endregion
  1413. #region 炒锅2状态数据保存
  1414. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据"))
  1415. {
  1416. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据");
  1417. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
  1418. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
  1419. if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
  1420. {
  1421. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1422. {
  1423. PotTwoStatus p1 = 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, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
  1424. BinaryFormatter bf = new BinaryFormatter();
  1425. bf.Serialize(writeStream, p1);
  1426. }
  1427. }
  1428. }
  1429. else
  1430. {
  1431. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
  1432. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
  1433. if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
  1434. {
  1435. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1436. {
  1437. PotTwoStatus p1 = 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, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
  1438. BinaryFormatter bf = new BinaryFormatter();
  1439. bf.Serialize(writeStream, p1);
  1440. }
  1441. }
  1442. }
  1443. #endregion
  1444. #region 炒锅3状态数据保存
  1445. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据"))
  1446. {
  1447. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据");
  1448. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
  1449. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
  1450. if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
  1451. {
  1452. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1453. {
  1454. PotThreeStatus p1 = 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, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
  1455. BinaryFormatter bf = new BinaryFormatter();
  1456. bf.Serialize(writeStream, p1);
  1457. }
  1458. }
  1459. }
  1460. else
  1461. {
  1462. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
  1463. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
  1464. if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
  1465. {
  1466. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1467. {
  1468. PotThreeStatus p1 = 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, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
  1469. BinaryFormatter bf = new BinaryFormatter();
  1470. bf.Serialize(writeStream, p1);
  1471. }
  1472. }
  1473. }
  1474. #endregion
  1475. #region 炒锅4状态数据保存
  1476. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据"))
  1477. {
  1478. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据");
  1479. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
  1480. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
  1481. if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
  1482. {
  1483. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1484. {
  1485. writeStream.Position = writeStream.Length;
  1486. PotFourStatus p1 = 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, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() };
  1487. BinaryFormatter bf = new BinaryFormatter();
  1488. bf.Serialize(writeStream, p1);
  1489. }
  1490. }
  1491. }
  1492. else
  1493. {
  1494. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
  1495. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
  1496. if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
  1497. {
  1498. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1499. {
  1500. writeStream.Position = writeStream.Length;
  1501. PotFourStatus p1 = 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, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() };
  1502. BinaryFormatter bf = new BinaryFormatter();
  1503. bf.Serialize(writeStream, p1);
  1504. }
  1505. }
  1506. }
  1507. #endregion
  1508. #region 炒锅5状态数据保存
  1509. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据"))
  1510. {
  1511. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据");
  1512. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
  1513. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
  1514. if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
  1515. {
  1516. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1517. {
  1518. writeStream.Position = writeStream.Length;
  1519. PotFiveStatus p1 = 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, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() };
  1520. BinaryFormatter bf = new BinaryFormatter();
  1521. bf.Serialize(writeStream, p1);
  1522. }
  1523. }
  1524. }
  1525. else
  1526. {
  1527. if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
  1528. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
  1529. if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
  1530. {
  1531. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1532. {
  1533. writeStream.Position = writeStream.Length;
  1534. PotFiveStatus p1 = 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, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() };
  1535. BinaryFormatter bf = new BinaryFormatter();
  1536. bf.Serialize(writeStream, p1);
  1537. }
  1538. }
  1539. }
  1540. #endregion
  1541. }
  1542. /// <summary>
  1543. /// 滚筒线运行状态显示
  1544. /// </summary>
  1545. private void RollerLineStatusDisplay()
  1546. {
  1547. hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
  1548. hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
  1549. hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
  1550. hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
  1551. hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
  1552. hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
  1553. hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
  1554. hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
  1555. if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
  1556. {
  1557. hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  1558. }
  1559. else
  1560. {
  1561. hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  1562. }
  1563. if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
  1564. {
  1565. hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  1566. }
  1567. else
  1568. {
  1569. hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  1570. }
  1571. hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
  1572. hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
  1573. hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
  1574. hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
  1575. hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
  1576. hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
  1577. hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
  1578. hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
  1579. if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)
  1580. {
  1581. hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  1582. }
  1583. else
  1584. {
  1585. hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  1586. }
  1587. if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
  1588. {
  1589. hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  1590. }
  1591. else
  1592. {
  1593. hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  1594. }
  1595. hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
  1596. hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
  1597. hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
  1598. hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
  1599. hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
  1600. hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
  1601. hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
  1602. hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
  1603. if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)
  1604. {
  1605. hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  1606. }
  1607. else
  1608. {
  1609. hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  1610. }
  1611. if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
  1612. {
  1613. hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  1614. }
  1615. else
  1616. {
  1617. hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  1618. }
  1619. //滚筒线4
  1620. }
  1621. /// <summary>
  1622. /// 返回滚筒线PLC指定地址指定长度的数据
  1623. /// </summary>
  1624. /// <param name="address"></param>
  1625. /// <returns></returns>
  1626. public void GetAddressData(string address, Action<ushort[]> action)
  1627. {
  1628. PlcReadData = DeviceOperate.GetInstance.GetAllData();
  1629. if (PlcReadData.ContainsKey(address))
  1630. {
  1631. action((ushort[])(PlcReadData[address]));
  1632. }
  1633. }
  1634. public void GetFryOneData(string address, Action<ushort[]> action)
  1635. {
  1636. FryOneData = DeviceOperate.GetInstance.GetFryOneData();
  1637. if (FryOneData.ContainsKey(address))
  1638. {
  1639. action((ushort[])(FryOneData[address]));
  1640. }
  1641. }
  1642. public void GetFryTwoData(string address, Action<ushort[]> action)
  1643. {
  1644. FryTwoData = DeviceOperate.GetInstance.GetFryTwoData();
  1645. if (FryTwoData.ContainsKey(address))
  1646. {
  1647. action((ushort[])(FryTwoData[address]));
  1648. }
  1649. }
  1650. public void GetFryThreeData(string address, Action<ushort[]> action)
  1651. {
  1652. FryThreeData = DeviceOperate.GetInstance.GetFryThreeData();
  1653. if (FryThreeData.ContainsKey(address))
  1654. {
  1655. action((ushort[])(FryThreeData[address]));
  1656. }
  1657. }
  1658. public void GetFryFourData(string address, Action<ushort[]> action)
  1659. {
  1660. FryFourData = DeviceOperate.GetInstance.GetFryFourData();
  1661. if (FryFourData.ContainsKey(address))
  1662. {
  1663. action((ushort[])(FryFourData[address]));
  1664. }
  1665. }
  1666. public void GetFryFiveData(string address, Action<ushort[]> action)
  1667. {
  1668. FryFiveData = DeviceOperate.GetInstance.GetFryFiveData();
  1669. if (FryFiveData.ContainsKey(address))
  1670. {
  1671. action((ushort[])(FryFiveData[address]));
  1672. }
  1673. }
  1674. /// <summary>
  1675. /// 写Plc数据
  1676. /// </summary>
  1677. /// <param name="address"></param>
  1678. /// <param name="Value"></param>
  1679. public void WritePlcData(string address, ushort Value)
  1680. {
  1681. DeviceOperate.GetInstance.WritePlcData(address, Value);
  1682. }
  1683. /// <summary>
  1684. /// 初始化任务
  1685. /// </summary>
  1686. //public void IniteTask()
  1687. //{
  1688. // ThreadManage.GetInstance().StartLong(new Action(() =>
  1689. // {
  1690. // MainTask();
  1691. // }), "MainTask");
  1692. //}
  1693. /// <summary>
  1694. /// 配方数据接收
  1695. /// </summary>
  1696. public void RecipeDataParse(object obj)
  1697. {
  1698. Task.Run(new Action(() =>
  1699. {
  1700. if (obj != null && obj is NewRecipeModel[] recipes)
  1701. {
  1702. ReicpeNum = ReicpeNum + recipes.Length;
  1703. MessageLog.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方");
  1704. for (int i = 0; i < recipes.Length; i++)
  1705. {
  1706. int? res = recipes[i].materialCollection.ElementAt(0).MaterialLoc / 100;
  1707. if (res != null)
  1708. {
  1709. switch (res)
  1710. {
  1711. case 1:
  1712. case 4: RecipeQuene.Enqueue(recipes[i]); break;
  1713. case 3: LThreeRecipeQuene.Enqueue(recipes[i]); break;
  1714. case 2:
  1715. case 5: LTwoRecipeQuene.Enqueue(recipes[i]); break;
  1716. }
  1717. }
  1718. }
  1719. }
  1720. }));
  1721. }
  1722. /// <summary>
  1723. /// 开启主任务
  1724. /// </summary>
  1725. public void MainTask()
  1726. {
  1727. ////RecipeDataToPlc();
  1728. //LOneRecipeDataToPlc();
  1729. //LTwoRecipeDataToPlc();
  1730. //LThreeRecipeDataToPlc();
  1731. ////AgvLoadRoller();
  1732. //LOneLoadRoller();
  1733. //LTwoAgvLoadRoller();
  1734. //LThreeAgvLoadRoller();
  1735. //// FryPotInputMaterial();
  1736. //LOneFryPotInputMaterial();
  1737. //LTwoFryPotInputMaterial();
  1738. //LThreeFryPotInputMaterial();
  1739. ////FryPotOutputMaterial();
  1740. //LOneFryPotOutputMaterial();
  1741. //LTwoFryPotOutputMaterial();
  1742. //LThreeFryPotOutputMaterial();
  1743. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
  1744. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
  1745. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
  1746. ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程");
  1747. }
  1748. /// <summary>
  1749. /// 线体1的执行流程
  1750. /// </summary>
  1751. public void LineOneProcessExecute()
  1752. {
  1753. //if (!globalVar.LOneTaskLock)
  1754. //{
  1755. // globalVar.LOneTaskLock = true;
  1756. LOneRecipeDataToPlc();
  1757. LOneLoadRoller();
  1758. LOneFryPotInputMaterial();
  1759. LOneFallMaterial();
  1760. LOneFryPotOutputMaterial();
  1761. LOneEmptyOperate();
  1762. // globalVar.LOneTaskLock = false;
  1763. //}
  1764. }
  1765. /// <summary>
  1766. /// 线体2的执行流程
  1767. /// </summary>
  1768. public void LineTwoProcessExecute()
  1769. {
  1770. //if (!globalVar.LTwoTaskLock)
  1771. //{
  1772. // globalVar.LTwoTaskLock = true;
  1773. LTwoRecipeDataToPlc();
  1774. LTwoAgvLoadRoller();
  1775. LTwoFryPotInputMaterial();
  1776. LTwoFallMaterial();
  1777. LTwoFryPotOutputMaterial();
  1778. LTwoEmptyOperate();
  1779. // globalVar.LTwoTaskLock = false;
  1780. //}
  1781. }
  1782. /// <summary>
  1783. /// 线体3的执行流程
  1784. /// </summary>
  1785. public void LineThreeProcessExecute()
  1786. {
  1787. //if (!globalVar.LThreeTaskLock)
  1788. //{
  1789. // globalVar.LThreeTaskLock = true;
  1790. LThreeRecipeDataToPlc();
  1791. LThreeAgvLoadRoller();
  1792. LThreeFryPotInputMaterial();
  1793. LThreeFallMaterial();
  1794. LThreeFryPotOutputMaterial();
  1795. LThreeEmptyOperate();
  1796. // globalVar.LThreeTaskLock = false;
  1797. //}
  1798. }
  1799. private void LineFourProcessExecute()
  1800. {
  1801. //线体123到清洗台
  1802. AgvFromLineToCleanPlate();
  1803. AgvArriveCleanPlate();
  1804. //清洗台到线体4
  1805. CallAgvToLineFour();
  1806. CleanPlateUpLoad();
  1807. EmptyRollerToLinFour();
  1808. }
  1809. private void CleanPlateUpLoad()
  1810. {
  1811. if (globalVar.agvArriveCleanLoad)
  1812. {
  1813. globalVar.agvArriveCleanLoad = false;
  1814. MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置");
  1815. MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成");
  1816. AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum);
  1817. AgvViewModel.GetInstance().Set小车是否承载物品(4,IsBool.OnllYes);
  1818. AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_4);
  1819. }
  1820. }
  1821. /// <summary>
  1822. /// 线体到清洗台
  1823. /// </summary>
  1824. private void AgvFromLineToCleanPlate()
  1825. {
  1826. if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
  1827. {
  1828. //线体1到清洗台
  1829. if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun)
  1830. {
  1831. var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
  1832. if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
  1833. {
  1834. //下发AGV去空桶线洗桶任务
  1835. e: string id = Guid.NewGuid().ToString("N");
  1836. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  1837. goto e;
  1838. string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  1839. LFourrobotJobId = id;
  1840. Thread.Sleep(500);
  1841. LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
  1842. globalVar.rollerLineOne.IsEpmtyBefore = true;
  1843. //globalVar.rollerLineOne.CanRun = false;
  1844. AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  1845. }
  1846. }
  1847. else
  1848. {
  1849. AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  1850. }
  1851. }
  1852. // 线体2到清洗台
  1853. if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
  1854. {
  1855. if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun)
  1856. {
  1857. var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
  1858. if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
  1859. {
  1860. //下发AGV去空桶线洗桶任务
  1861. e: string id = Guid.NewGuid().ToString("N");
  1862. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  1863. goto e;
  1864. string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  1865. LFiverobotJobId = id;
  1866. Thread.Sleep(500);
  1867. LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
  1868. globalVar.rollerLineTwo.IsEpmtyBefore = true;
  1869. // globalVar.rollerLineTwo.CanRun = false;
  1870. AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
  1871. }
  1872. }
  1873. else
  1874. {
  1875. AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  1876. }
  1877. }
  1878. //线体3到清洗台
  1879. if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  1880. {
  1881. if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun)
  1882. {
  1883. var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
  1884. if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
  1885. {
  1886. //下发AGV去空桶线洗桶任务
  1887. e: string id = Guid.NewGuid().ToString("N");
  1888. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  1889. goto e;
  1890. string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  1891. LSixrobotJobId = id;
  1892. Thread.Sleep(500);
  1893. LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
  1894. globalVar.rollerLineThree.IsEpmtyBefore = true;
  1895. //globalVar.rollerLineThree.CanRun = false;
  1896. AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  1897. }
  1898. }
  1899. else
  1900. {
  1901. AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  1902. }
  1903. }
  1904. }
  1905. /// <summary>
  1906. /// AGV到达清洗台下料位置
  1907. /// </summary>
  1908. private void AgvArriveCleanPlate()
  1909. {
  1910. if (globalVar.agvArriveCleanUnLoad)
  1911. {
  1912. globalVar.agvArriveCleanUnLoad = false;
  1913. MessageLog.GetInstance.ShowRunLog("空桶到达清洗位置,准备卸桶");
  1914. MessageLog.GetInstance.ShowRunLog("卸桶完成");
  1915. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No);
  1916. AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_hj);
  1917. AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
  1918. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1919. //plc交互
  1920. }
  1921. }
  1922. /// <summary>
  1923. /// 呼叫Agv从清洗台运洗好的空桶到四号线体
  1924. /// </summary>
  1925. public void CallAgvToLineFour()
  1926. {
  1927. if (globalVar.CleanComplete == 1)
  1928. {
  1929. //是否需要手动给PLC置位??
  1930. globalVar.CleanComplete = 0;
  1931. e: string id = Guid.NewGuid().ToString("N");
  1932. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  1933. goto e;
  1934. string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id);
  1935. LTenrobotJobId = id;
  1936. Thread.Sleep(500);
  1937. MessageLog.GetInstance.ShowRunLog("清洗台呼叫AGV取桶");
  1938. CleanToLineCarryTaskErrorCodeAnalysis(info, 4);
  1939. }
  1940. }
  1941. /// <summary>
  1942. /// 3号滚筒线数据下发 2022/7/4 新增
  1943. /// </summary>
  1944. /// <exception cref="NotImplementedException"></exception>
  1945. private void LThreeRecipeDataToPlc()
  1946. {
  1947. if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe)
  1948. {
  1949. if (globalVar.LThreeCurrentRecipeName != string.Empty)
  1950. {
  1951. MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
  1952. if (globalVar.LThreeFryPotSerial == 3)
  1953. {
  1954. FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
  1955. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryThree.txt", false, Encoding.UTF8))
  1956. {
  1957. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  1958. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryThree.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy);//炒锅1产量以及总油量记录
  1959. }
  1960. //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() });//向表中新增数据
  1961. //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
  1962. }
  1963. globalVar.LThreeCurrentRecipeName = string.Empty;
  1964. Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
  1965. }
  1966. }
  1967. if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0)//后续添加其它限制条件
  1968. {
  1969. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; }));
  1970. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection<WorkflowModel>(); }));
  1971. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
  1972. //if (globalVar.LThreeCurrentRecipeName != string.Empty)
  1973. // MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
  1974. if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result))
  1975. {
  1976. LThreeErrorRecipe = false;
  1977. int headNum = result.materialCollection[0].MaterialLoc / 100;
  1978. globalVar.LThreeMaterialNum = result.materialCollection.Count;
  1979. globalVar.LThreeFryPotSerial = headNum;
  1980. globalVar.LThreeCurrentRecipeName = result.RecipeName;
  1981. AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
  1982. MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
  1983. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  1984. {
  1985. if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3)
  1986. {
  1987. fryThreeRecipe = result.RecipeName;//炒锅状态开始记录
  1988. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; }));
  1989. //将配方中原料加入新的队列
  1990. LThreeInputMaterialQuene.Enqueue(new MaterialInfo()
  1991. {
  1992. materialType = result.materialCollection[i],
  1993. materialId = result.RecipeId
  1994. });
  1995. RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//3号滚筒线桶号以及重量数据下发
  1996. }
  1997. else
  1998. {
  1999. MessageLog.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2000. MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2001. LThreeInputMaterialQuene.Clear();
  2002. LThreeErrorRecipe = true;
  2003. return;
  2004. }
  2005. }
  2006. DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
  2007. //AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LThreeFryPotSerial, IsRun.Stop);
  2008. }
  2009. }
  2010. }
  2011. /// <summary>
  2012. /// 2号滚筒线数据下发 2022/7/4 新增
  2013. /// </summary>
  2014. /// <exception cref="NotImplementedException"></exception>
  2015. private void LTwoRecipeDataToPlc()
  2016. {
  2017. if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe)
  2018. {
  2019. if (globalVar.LTwoCurrentRecipeName != string.Empty)
  2020. {
  2021. MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
  2022. if (globalVar.LTwoFryPotSerial == 2)
  2023. {
  2024. FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
  2025. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryTwo.txt", false, Encoding.UTF8))
  2026. {
  2027. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2028. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryTwo.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2029. }
  2030. //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() });//向表中新增数据
  2031. //Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
  2032. }
  2033. if (globalVar.LTwoFryPotSerial == 5)
  2034. {
  2035. FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
  2036. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFive.txt", false, Encoding.UTF8))
  2037. {
  2038. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2039. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFive.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2040. }
  2041. //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() });//向表中新增数据
  2042. //Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
  2043. }
  2044. globalVar.LTwoCurrentRecipeName = string.Empty;
  2045. Task.Run(() => { Thread.Sleep(2000); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
  2046. }
  2047. }
  2048. if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0)//后续添加其它限制条件
  2049. {
  2050. if (globalVar.LTwoFryPotSerial == 2)
  2051. {
  2052. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; }));
  2053. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection<WorkflowModel>(); }));
  2054. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  2055. }
  2056. if (globalVar.LTwoFryPotSerial == 5)
  2057. {
  2058. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; }));
  2059. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection<WorkflowModel>(); }));
  2060. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  2061. }
  2062. //if (globalVar.LTwoCurrentRecipeName != string.Empty)
  2063. // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
  2064. if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result))
  2065. {
  2066. LTwoErrorRecipe = false;
  2067. int headNum = result.materialCollection[0].MaterialLoc / 100;
  2068. globalVar.LTwoMaterialNum = result.materialCollection.Count;
  2069. globalVar.LTwoFryPotSerial = headNum;
  2070. globalVar.LTwoCurrentRecipeName = result.RecipeName;
  2071. AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString());
  2072. MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
  2073. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2074. {
  2075. if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5))
  2076. {
  2077. if (headNum == 1)//炒锅2
  2078. {
  2079. fryTwoRecipe = result.RecipeName;//炒锅状态开始记录
  2080. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; }));
  2081. }
  2082. else//炒锅5
  2083. {
  2084. fryFiveRecipe = result.RecipeName;//炒锅状态开始记录
  2085. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; }));
  2086. }
  2087. //将配方中原料加入新的队列
  2088. LTwoInputMaterialQuene.Enqueue(new MaterialInfo()
  2089. {
  2090. materialType = result.materialCollection[i],
  2091. materialId = result.RecipeId
  2092. });
  2093. RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//2号滚筒线桶号以及重量数据下发
  2094. }
  2095. else
  2096. {
  2097. MessageLog.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2098. MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2099. LTwoInputMaterialQuene.Clear();
  2100. LTwoErrorRecipe = true;
  2101. return;
  2102. }
  2103. }
  2104. DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据
  2105. }
  2106. }
  2107. }
  2108. /// <summary>
  2109. /// 1号滚筒线数据下发 2022/7/4 新增
  2110. /// </summary>
  2111. private void LOneRecipeDataToPlc()
  2112. {
  2113. if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe)
  2114. {
  2115. if (globalVar.LOneCurrentRecipeName != string.Empty)
  2116. {
  2117. MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成");
  2118. if (globalVar.LOneFryPotSerial == 1)
  2119. {
  2120. FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
  2121. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryOne.txt", false, Encoding.UTF8))
  2122. {
  2123. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2124. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryOne.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2125. }
  2126. //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() });//向表中新增数据
  2127. //Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
  2128. }
  2129. if (globalVar.LOneFryPotSerial == 4)
  2130. {
  2131. FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
  2132. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFour.txt", false, Encoding.UTF8))
  2133. {
  2134. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2135. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFour.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2136. }
  2137. //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() });//向表中新增数据
  2138. //Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
  2139. }
  2140. globalVar.LOneCurrentRecipeName = string.Empty;
  2141. Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; });
  2142. }
  2143. }
  2144. if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
  2145. {
  2146. if (globalVar.LOneFryPotSerial == 1)
  2147. {
  2148. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; }));
  2149. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection<WorkflowModel>(); }));
  2150. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  2151. }
  2152. if (globalVar.LOneFryPotSerial == 4)
  2153. {
  2154. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; }));
  2155. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection<WorkflowModel>(); }));
  2156. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  2157. }
  2158. if (RecipeQuene.TryDequeue(out NewRecipeModel result))
  2159. {
  2160. ErrorRecipe = false;
  2161. int headNum = result.materialCollection[0].MaterialLoc / 100;
  2162. globalVar.LOneMaterialNum = result.materialCollection.Count;
  2163. globalVar.LOneFryPotSerial = headNum;
  2164. globalVar.LOneCurrentRecipeName = result.RecipeName;
  2165. AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString());
  2166. MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
  2167. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2168. {
  2169. if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
  2170. {
  2171. if (headNum == 1)//炒锅1
  2172. {
  2173. fryOneRecipe = result.RecipeName;//炒锅状态开始记录
  2174. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; }));
  2175. }
  2176. else//炒锅4
  2177. {
  2178. fryFourRecipe = result.RecipeName;//炒锅状态开始记录
  2179. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; }));
  2180. }
  2181. //将配方中原料加入新的队列
  2182. InputMaterialQuene.Enqueue(new MaterialInfo()
  2183. {
  2184. materialType = result.materialCollection[i],
  2185. materialId = result.RecipeId
  2186. });
  2187. RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//1号滚筒线桶号以及重量数据下发
  2188. }
  2189. else
  2190. {
  2191. MessageLog.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2192. MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2193. InputMaterialQuene.Clear();
  2194. ErrorRecipe = true;
  2195. return;
  2196. }
  2197. }
  2198. DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据
  2199. }
  2200. }
  2201. }
  2202. /// <summary>
  2203. /// 数据下发PLC
  2204. /// </summary>
  2205. //public void RecipeDataToPlc()
  2206. //{
  2207. // if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
  2208. // {
  2209. // //NewRecipeModel newRecipe = new NewRecipeModel();
  2210. // //MaterialType material = new MaterialType();
  2211. // if (RecipeQuene.TryDequeue(out NewRecipeModel result))
  2212. // {
  2213. // //newRecipe = result;
  2214. // MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方");
  2215. // //for (int k = 0; k < newRecipe.materialCollection.Count - 1; k++)
  2216. // //{
  2217. // // for (int j = 0; j < newRecipe.materialCollection.Count - 1 - k; j++)
  2218. // // {
  2219. // // if (newRecipe.materialCollection[j].MaterialLoc > newRecipe.materialCollection[j + 1].MaterialLoc)
  2220. // // {
  2221. // // material = newRecipe.materialCollection[j];
  2222. // // // newRecipe.materialCollection[j] = null;
  2223. // // newRecipe.materialCollection[j] = newRecipe.materialCollection[j + 1];
  2224. // // // newRecipe.materialCollection[j + 1] = null;
  2225. // // newRecipe.materialCollection[j + 1] = material;
  2226. // // }
  2227. // // }
  2228. // //}
  2229. // for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2230. // {
  2231. // //将配方中原料加入新的队列
  2232. // InputMaterialQuene.Enqueue(new MaterialInfo()
  2233. // {
  2234. // materialType = result.materialCollection[i],
  2235. // materialId = result.RecipeId
  2236. // });
  2237. // ushort n = result.materialCollection[i].MaterialLoc;
  2238. // switch (n / 100)
  2239. // {
  2240. // case 1:
  2241. // case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发
  2242. // case 2:
  2243. // case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发
  2244. // case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发
  2245. // }
  2246. // }
  2247. // switch (result.materialCollection[0].MaterialLoc / 100)
  2248. // {
  2249. // case 1:
  2250. // DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据
  2251. // case 2:
  2252. // DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据
  2253. // case 3:
  2254. // DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据
  2255. // }
  2256. // }
  2257. // }
  2258. //}
  2259. /// <summary>
  2260. /// AGV到配方线体1装桶以及出料到炒锅
  2261. /// </summary>
  2262. //public void AgvLoadRoller()
  2263. //{
  2264. // //lineAlarm = 0;
  2265. // if (InputMaterialQuene.Count > 0)
  2266. // {
  2267. // switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2268. // {
  2269. // case 1:
  2270. // case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶
  2271. // case 2:
  2272. // case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶
  2273. // case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶
  2274. // }
  2275. // }
  2276. //}
  2277. /// <summary>
  2278. /// AGV到配方线体1装桶以及出料到炒锅
  2279. /// </summary>
  2280. public void LOneLoadRoller()
  2281. {
  2282. if (InputMaterialQuene.Count > 0)
  2283. {
  2284. AgvToLineOneLoadRoller();
  2285. AgvFromLineOneToFryPot();//AGV到1号线体装桶
  2286. AgvLineOneLoadRollerCom();
  2287. }
  2288. }
  2289. /// <summary>
  2290. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  2291. /// </summary>
  2292. /// <exception cref="NotImplementedException"></exception>
  2293. private void AgvLineOneLoadRollerCom()
  2294. {
  2295. if (globalVar.agvLineOneLoadCom)
  2296. {
  2297. globalVar.rollerLineOne.CanRun = true;
  2298. globalVar.agvLineOneLoadCom = false;
  2299. MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
  2300. }
  2301. }
  2302. /// <summary>
  2303. /// AGV到配方线体2装桶以及出料到炒锅
  2304. /// </summary>
  2305. public void LTwoAgvLoadRoller()
  2306. {
  2307. if (LTwoInputMaterialQuene.Count > 0)
  2308. {
  2309. AgvToLineTwoLoadRoller();
  2310. AgvFromLineTwoToFryPot();//AGV到2号线体装桶
  2311. AgvLineTwoLoadRollerCom();
  2312. }
  2313. }
  2314. /// <summary>
  2315. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  2316. /// </summary>
  2317. private void AgvLineTwoLoadRollerCom()
  2318. {
  2319. if (globalVar.agvLineTwoLoadCom)
  2320. {
  2321. globalVar.rollerLineTwo.CanRun = true;
  2322. globalVar.agvLineTwoLoadCom = false;
  2323. MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
  2324. }
  2325. }
  2326. /// <summary>
  2327. /// AGV到配方线体3装桶以及出料到炒锅
  2328. /// </summary>
  2329. public void LThreeAgvLoadRoller()
  2330. {
  2331. if (LThreeInputMaterialQuene.Count > 0)
  2332. {
  2333. AgvToLineThreeLoadRoller();
  2334. AgvFromLineThreeToFryPot();//AGV到2号线体装桶
  2335. AgvLineThreeLoadRollerCom();
  2336. }
  2337. }
  2338. /// <summary>
  2339. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  2340. /// </summary>
  2341. private void AgvLineThreeLoadRollerCom()
  2342. {
  2343. if (globalVar.agvLineThreeLoadCom)
  2344. {
  2345. globalVar.rollerLineThree.CanRun = true;
  2346. globalVar.agvLineThreeLoadCom = false;
  2347. MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成");
  2348. }
  2349. }
  2350. /// <summary>
  2351. /// AGV从炒锅送料位置到倒料过程处理
  2352. /// </summary>
  2353. //public void FryPotInputMaterial()
  2354. //{
  2355. // if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
  2356. // {
  2357. // while (!agvArriveUnLoad)//等待agv到达炒锅位置
  2358. // {
  2359. // Thread.Sleep(5);
  2360. // if (globalVar.ExitMainTask)
  2361. // return;
  2362. // }
  2363. // AgvArriveFryPotSingleSetDown();
  2364. // FryPotRollerTroubleCheck();
  2365. // if (FryPotAlarm == 1)//炒锅滚筒无故障
  2366. // {
  2367. // //炒锅滚筒进料运行到位处理
  2368. // FryPotInputMaterialRollerOperate();
  2369. // globalVar.InOrOutputLock = true;
  2370. // }
  2371. // }
  2372. //}
  2373. /// <summary>
  2374. /// 线体1的AGV从炒锅送料位置到倒料过程处理
  2375. /// </summary>
  2376. public void LOneFryPotInputMaterial()
  2377. {
  2378. if (OutputMaterialQuene.Count > 0 && globalVar.agvArriveUnLoad && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive)
  2379. {
  2380. //if (globalVar.LOneFryPotSerial == 1)
  2381. //{
  2382. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1);
  2383. //}
  2384. //else if (globalVar.LOneFryPotSerial == 4)
  2385. //{
  2386. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4);
  2387. //}
  2388. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
  2389. AgvArriveFryPotOneOrFourSingleSetDown();
  2390. globalVar.agvArriveUnLoad = false;
  2391. globalVar.PotOneInputMaterialArrive = true;
  2392. }
  2393. }
  2394. public void LOneFallMaterial()
  2395. {
  2396. if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
  2397. {
  2398. //if (globalVar.LOneFryPotSerial == 1)
  2399. //{
  2400. // 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() });//向表中新增数据
  2401. // Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
  2402. //}
  2403. //else
  2404. //{
  2405. // 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() });//向表中新增数据
  2406. // Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
  2407. //}
  2408. FryPotOneRollerTroubleCheck();
  2409. if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障
  2410. {
  2411. if (globalVar.LOneFryPotSerial == 1)
  2412. {
  2413. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2414. }
  2415. else
  2416. {
  2417. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2418. }
  2419. AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
  2420. //炒锅滚筒进料运行到位处理
  2421. FryPotOneOrFourInputMaterialRollerOperate();
  2422. AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV
  2423. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start);
  2424. globalVar.InOrOutputLock = true;
  2425. globalVar.PotOneOutputRollerArrive = true;
  2426. }
  2427. }
  2428. }
  2429. /// <summary>
  2430. /// 线体2的AGV从炒锅送料位置到倒料过程处理
  2431. /// </summary>
  2432. public void LTwoFryPotInputMaterial()
  2433. {
  2434. if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
  2435. {
  2436. //if (globalVar.LTwoFryPotSerial == 2)
  2437. //{
  2438. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
  2439. //}
  2440. //else if (globalVar.LTwoFryPotSerial == 5)
  2441. //{
  2442. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
  2443. //}
  2444. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅下料位置");
  2445. AgvArriveFryPotTwoOrFiveSingleSetDown();
  2446. globalVar.LTwoagvArriveUnLoad = false;
  2447. globalVar.LTwoPotInputMaterialArrive = true;
  2448. }
  2449. }
  2450. public void LTwoFallMaterial()
  2451. {
  2452. if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)
  2453. {
  2454. //if (globalVar.LTwoFryPotSerial == 2)
  2455. //{
  2456. // 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() });//向表中新增数据
  2457. // Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
  2458. //}
  2459. //else
  2460. //{
  2461. // 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() });//向表中新增数据
  2462. // Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
  2463. //}
  2464. FryPotTwoRollerTroubleCheck();
  2465. if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障
  2466. {
  2467. if (globalVar.LTwoFryPotSerial == 2)
  2468. {
  2469. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2470. }
  2471. else
  2472. {
  2473. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2474. }
  2475. AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
  2476. //炒锅滚筒进料运行到位处理
  2477. FryPotTwoOrFiveInputMaterialRollerOperate();
  2478. AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV
  2479. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start);
  2480. globalVar.LTwoInOrOutputLock = true;
  2481. globalVar.LTwoPotOutputRollerArrive = true;
  2482. }
  2483. }
  2484. }
  2485. /// <summary>
  2486. /// 线体3的AGV从炒锅送料位置到倒料过程处理
  2487. /// </summary>
  2488. public void LThreeFryPotInputMaterial()
  2489. {
  2490. if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
  2491. {
  2492. // AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
  2493. MessageLog.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置");
  2494. AgvArriveFryPotThreeSingleSetDown();
  2495. globalVar.LThreeagvArriveUnLoad = false;
  2496. globalVar.LThreePotInputMaterialArrive = true;
  2497. }
  2498. }
  2499. public void LThreeFallMaterial()
  2500. {
  2501. if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
  2502. {
  2503. //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() });//向表中新增数据
  2504. //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
  2505. FryPotThreeRollerTroubleCheck();
  2506. if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
  2507. {
  2508. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2509. AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
  2510. //炒锅滚筒进料运行到位处理
  2511. FryPotThreeInputMaterialRollerOperate();
  2512. AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV
  2513. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start);
  2514. globalVar.LThreeInOrOutputLock = true;
  2515. globalVar.LThreePotOutputRollerArrive = true;
  2516. }
  2517. }
  2518. }
  2519. /// <summary>
  2520. /// 炒锅出桶
  2521. /// </summary>
  2522. //public void FryPotOutputMaterial()
  2523. //{
  2524. // if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
  2525. // {
  2526. // AgvFromFryPotToClean();//上游下发搬运任务给AGV
  2527. // while (!agvArriveUpLoad)//等待agv到达炒锅位置
  2528. // {
  2529. // Thread.Sleep(5);
  2530. // if (globalVar.ExitMainTask)
  2531. // return;
  2532. // }
  2533. // agvArriveUpLoad = false;
  2534. // AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2535. // FryPotRollerTroubleCheck();
  2536. // if (FryPotAlarm == 1)//无故障
  2537. // {
  2538. // FryPotOutEmpetyRollerOperate();
  2539. // if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2540. // {
  2541. // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
  2542. // {
  2543. // Thread.Sleep(5);
  2544. // if (globalVar.ExitMainTask)
  2545. // return;
  2546. // }
  2547. // //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2548. // globalVar.AllowAgvToLineLoadRoller = true;
  2549. // globalVar.InOrOutputLock = false;
  2550. // }
  2551. // }
  2552. // }
  2553. //}
  2554. /// <summary>
  2555. /// 线体1对应炒锅出桶
  2556. /// </summary>
  2557. public void LOneFryPotOutputMaterial()
  2558. {
  2559. if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.agvArriveUpLoad && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
  2560. {
  2561. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置");
  2562. AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2563. globalVar.agvArriveUpLoad = false;
  2564. globalVar.AgvArrivePot = true;
  2565. }
  2566. }
  2567. public void LOneEmptyOperate()
  2568. {
  2569. if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot)
  2570. {
  2571. FryPotOneRollerTroubleCheck();
  2572. if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障
  2573. {
  2574. if (globalVar.agvFryPotEmptyRollerArrive)
  2575. {
  2576. FryPotOneOrFourOutEmpetyRollerOperate();
  2577. if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2578. {
  2579. //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
  2580. //if (globalVar.LOneFryPotSerial == 1)
  2581. //{
  2582. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1);
  2583. //}
  2584. //else if (globalVar.LOneFryPotSerial == 4)
  2585. //{
  2586. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4);
  2587. //}
  2588. globalVar.agvFryPotEmptyRollerArrive = false;
  2589. globalVar.InOrOutputLock = false;
  2590. globalVar.LOneMaterialNum--;
  2591. MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  2592. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2593. globalVar.AllowAgvToLineLoadRoller = true;
  2594. globalVar.LoadRoller = false;
  2595. globalVar.AgvToFryPot = false;
  2596. globalVar.PotOneInputMaterialArrive = false;
  2597. globalVar.PotOneOutputRollerArrive = false;
  2598. globalVar.AgvArrivePot = false;
  2599. }
  2600. }
  2601. }
  2602. }
  2603. }
  2604. /// <summary>
  2605. /// 线体2对应炒锅出桶
  2606. /// </summary>
  2607. public void LTwoFryPotOutputMaterial()
  2608. {
  2609. if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && globalVar.agvArriveLTwoUpLoad && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
  2610. {
  2611. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅空桶上料位置");
  2612. AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2613. globalVar.agvArriveLTwoUpLoad = false;
  2614. globalVar.LTwoAgvArrivePot = true;
  2615. }
  2616. }
  2617. public void LTwoEmptyOperate()
  2618. {
  2619. if ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
  2620. {
  2621. FryPotTwoRollerTroubleCheck();
  2622. if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障
  2623. {
  2624. if (globalVar.LTwoagvFryPotEmptyRollerArrive)
  2625. {
  2626. FryPotTwoOrFiveOutEmpetyRollerOperate();
  2627. if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2628. {
  2629. //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
  2630. //if (globalVar.LTwoFryPotSerial == 2)
  2631. //{
  2632. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
  2633. //}
  2634. //else if (globalVar.LTwoFryPotSerial == 5)
  2635. //{
  2636. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
  2637. //}
  2638. globalVar.LTwoagvFryPotEmptyRollerArrive = false;
  2639. globalVar.LTwoInOrOutputLock = false;
  2640. globalVar.LTwoMaterialNum--;
  2641. MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  2642. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2643. globalVar.AllowAgvToLineTwoLoadRoller = true;
  2644. globalVar.LTwoLoadRoller = false;
  2645. globalVar.LTwoAgvToFryPot = false;
  2646. globalVar.LTwoPotInputMaterialArrive = false;
  2647. globalVar.LTwoPotOutputRollerArrive = false;
  2648. globalVar.LTwoAgvArrivePot = false;
  2649. }
  2650. }
  2651. }
  2652. }
  2653. }
  2654. /// <summary>
  2655. /// 线体3对应炒锅出桶
  2656. /// </summary>
  2657. public void LThreeFryPotOutputMaterial()
  2658. {
  2659. if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock && globalVar.agvArriveLThreeUpLoad && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
  2660. {
  2661. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置");
  2662. AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2663. globalVar.agvArriveLThreeUpLoad = false;
  2664. globalVar.LThreeAgvArrivePot = true;
  2665. }
  2666. }
  2667. public void LThreeEmptyOperate()
  2668. {
  2669. if (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
  2670. {
  2671. FryPotThreeRollerTroubleCheck();
  2672. if (FryPotThreeAlarm == 1)//无故障
  2673. {
  2674. if (globalVar.LThreeagvFryPotEmptyRollerArrive)
  2675. {
  2676. FryPotThreeOutEmpetyRollerOperate();
  2677. if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2678. {
  2679. //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
  2680. //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
  2681. globalVar.LThreeagvFryPotEmptyRollerArrive = false;
  2682. globalVar.LThreeInOrOutputLock = false;
  2683. globalVar.LThreeMaterialNum--;
  2684. MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  2685. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2686. globalVar.AllowAgvToLineThreeLoadRoller = true;
  2687. globalVar.LThreeLoadRoller = false;
  2688. globalVar.LThreeAgvToFryPot = false;
  2689. globalVar.LThreePotInputMaterialArrive = false;
  2690. globalVar.LThreePotOutputRollerArrive = false;
  2691. globalVar.LThreeAgvArrivePot = false;
  2692. }
  2693. }
  2694. }
  2695. }
  2696. }
  2697. /// <summary>
  2698. /// 4号线体下料
  2699. /// </summary>
  2700. public void EmptyRollerToLinFour()
  2701. {
  2702. if (globalVar.agvArriveLineFour)//agv到达线体4下料位置
  2703. {
  2704. globalVar.agvArriveLineFour = false;
  2705. //线体四信号交互
  2706. MessageLog.GetInstance.ShowRunLog("AGV到达【4】号回收线体,准备卸桶");
  2707. MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2708. AgvViewModel.GetInstance().Set滚筒线状态(4,IsRun.Start);
  2709. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  2710. AgvViewModel.GetInstance().Set小车是否承载物品(4,IsBool.No);
  2711. AgvViewModel.GetInstance().Set小车运动(4,CartMotionTrajectory.hj);
  2712. AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
  2713. }
  2714. }
  2715. ///// <summary>
  2716. ///// 2号线体对应空桶清洗
  2717. ///// </summary>
  2718. //public void LTwoEmptyRollerToLineFour()
  2719. //{
  2720. // if (globalVar.LTwoEmptyRollerUnLoadcCom)//agv在4号线体下料完成
  2721. // {
  2722. // globalVar.AllowAgvToLineTwoLoadRoller = true;
  2723. // globalVar.LTwoLoadRoller = false;
  2724. // globalVar.LTwoAgvToFryPot = false;
  2725. // globalVar.LTwoPotInputMaterialArrive = false;
  2726. // globalVar.LTwoPotOutputRollerArrive = false;
  2727. // globalVar.LTwoAgvArrivePot = false;
  2728. // }
  2729. //}
  2730. ///// <summary>
  2731. ///// 3号线体对应空桶清洗
  2732. ///// </summary>
  2733. //public void LThreeEmptyRollerToLinFour()
  2734. //{
  2735. // if (globalVar.LThreeEmptyRollerUnLoadcCom)//agv在4号线体下料完成
  2736. // {
  2737. // globalVar.AllowAgvToLineThreeLoadRoller = true;
  2738. // globalVar.LThreeLoadRoller = false;
  2739. // globalVar.LThreeAgvToFryPot = false;
  2740. // globalVar.LThreePotInputMaterialArrive = false;
  2741. // globalVar.LThreePotOutputRollerArrive = false;
  2742. // globalVar.LThreeAgvArrivePot = false;
  2743. // }
  2744. //}
  2745. /// <summary>
  2746. /// 炒锅滚筒进料运行到位处理
  2747. /// </summary>
  2748. //public void FryPotInputMaterialRollerOperate(ConcurrentQueue<MaterialInfo> queue)
  2749. //{
  2750. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  2751. // {
  2752. // case 1:
  2753. // while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
  2754. // {
  2755. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2756. // return;
  2757. // }
  2758. // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
  2759. // case 2:
  2760. // while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
  2761. // {
  2762. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2763. // return;
  2764. // }
  2765. // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
  2766. // case 3:
  2767. // while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
  2768. // {
  2769. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2770. // return;
  2771. // }
  2772. // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
  2773. // case 4:
  2774. // while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
  2775. // {
  2776. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2777. // return;
  2778. // }
  2779. // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
  2780. // case 5:
  2781. // while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
  2782. // {
  2783. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2784. // return;
  2785. // }
  2786. // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
  2787. // }
  2788. //}
  2789. /// <summary>
  2790. /// 炒锅1,4滚筒进料运行到位处理
  2791. /// </summary>
  2792. public void FryPotOneOrFourInputMaterialRollerOperate()
  2793. {
  2794. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2795. {
  2796. case 1:
  2797. //while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
  2798. //{
  2799. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2800. // return;
  2801. //}
  2802. MessageLog.GetInstance.ShowRunLog($"炒锅【1】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  2803. case 4:
  2804. //while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
  2805. //{
  2806. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2807. // return;
  2808. //}
  2809. MessageLog.GetInstance.ShowRunLog($"炒锅【4】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  2810. }
  2811. }
  2812. /// <summary>
  2813. /// 炒锅2,5滚筒进料运行到位处理
  2814. /// </summary>
  2815. public void FryPotTwoOrFiveInputMaterialRollerOperate()
  2816. {
  2817. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2818. {
  2819. case 2:
  2820. //while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
  2821. //{
  2822. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2823. // return;
  2824. //}
  2825. MessageLog.GetInstance.ShowRunLog($"炒锅【2】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  2826. case 5:
  2827. //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
  2828. //{
  2829. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2830. // return;
  2831. //}
  2832. MessageLog.GetInstance.ShowRunLog($"炒锅【5】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  2833. }
  2834. }
  2835. public void FryPotThreeInputMaterialRollerOperate()
  2836. {
  2837. //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
  2838. //{
  2839. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2840. // return;
  2841. //}
  2842. MessageLog.GetInstance.ShowRunLog($"炒锅【3】:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料");
  2843. }
  2844. /// <summary>
  2845. /// 炒锅滚筒空桶出桶处理
  2846. /// </summary>
  2847. //public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
  2848. //{
  2849. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  2850. // {
  2851. // case 1:
  2852. // while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
  2853. // {
  2854. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2855. // return;
  2856. // }
  2857. // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  2858. // case 2:
  2859. // while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
  2860. // {
  2861. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2862. // return;
  2863. // }
  2864. // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  2865. // case 3:
  2866. // while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
  2867. // {
  2868. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2869. // return;
  2870. // }
  2871. // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  2872. // case 4:
  2873. // while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
  2874. // {
  2875. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2876. // return;
  2877. // }
  2878. // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  2879. // case 5:
  2880. // while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
  2881. // {
  2882. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2883. // return;
  2884. // }
  2885. // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  2886. // }
  2887. //}
  2888. /// <summary>
  2889. /// 炒锅1,4滚筒空桶出桶处理
  2890. /// </summary>
  2891. public void FryPotOneOrFourOutEmpetyRollerOperate()
  2892. {
  2893. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2894. {
  2895. case 1:
  2896. //while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
  2897. //{
  2898. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2899. // return;
  2900. //}
  2901. MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  2902. case 4:
  2903. //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
  2904. //{
  2905. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2906. // return;
  2907. //}
  2908. MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  2909. }
  2910. }
  2911. /// <summary>
  2912. /// 炒锅2,5滚筒空桶出桶处理
  2913. /// </summary>
  2914. public void FryPotTwoOrFiveOutEmpetyRollerOperate()
  2915. {
  2916. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2917. {
  2918. case 2:
  2919. //while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
  2920. //{
  2921. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2922. // return;
  2923. //}
  2924. MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  2925. case 5:
  2926. //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
  2927. //{
  2928. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2929. // return;
  2930. //}
  2931. MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  2932. }
  2933. }
  2934. /// <summary>
  2935. /// 炒锅3滚筒空桶出桶处理
  2936. /// </summary>
  2937. public void FryPotThreeOutEmpetyRollerOperate()
  2938. {
  2939. //while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
  2940. //{
  2941. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  2942. // return;
  2943. //}
  2944. MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成");
  2945. }
  2946. /// <summary>
  2947. /// 发送agv送料就位信号至PLC(线体到炒锅)
  2948. /// </summary>
  2949. public void AgvArriveFryPotSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
  2950. {
  2951. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  2952. {
  2953. case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
  2954. case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
  2955. case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
  2956. case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
  2957. case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
  2958. }
  2959. }
  2960. /// <summary>
  2961. /// 发送agv送料就位信号至PLC(线体1到炒锅)
  2962. /// </summary>
  2963. public void AgvArriveFryPotOneOrFourSingleSetDown()
  2964. {
  2965. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2966. {
  2967. case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
  2968. case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
  2969. }
  2970. }
  2971. /// <summary>
  2972. /// 发送agv送料就位信号至PLC(线体2到炒锅)
  2973. /// </summary>
  2974. public void AgvArriveFryPotTwoOrFiveSingleSetDown()
  2975. {
  2976. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2977. {
  2978. case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
  2979. case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
  2980. }
  2981. }
  2982. /// <summary>
  2983. /// 发送agv送料就位信号至PLC(线体3到炒锅)
  2984. /// </summary>
  2985. public void AgvArriveFryPotThreeSingleSetDown()
  2986. {
  2987. DeviceOperate.GetInstance.WritePlcData("D1057", 1); //agv到炒锅3送料就位信号
  2988. }
  2989. /// <summary>
  2990. /// 发送agv回桶就位信号至PLC
  2991. /// </summary>
  2992. public void AgvArriveFryPotOutEmptyRollerSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
  2993. {
  2994. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  2995. {
  2996. case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
  2997. case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
  2998. case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
  2999. case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
  3000. case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
  3001. }
  3002. }
  3003. public void AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown()
  3004. {
  3005. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3006. {
  3007. case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
  3008. case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
  3009. }
  3010. }
  3011. public void AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown()
  3012. {
  3013. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3014. {
  3015. case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
  3016. case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
  3017. }
  3018. }
  3019. public void AgvArriveFryPotThreeOutEmptyRollerSingleSetDown()
  3020. {
  3021. DeviceOperate.GetInstance.WritePlcData("D1062", 1);//agv到炒锅3送料就位信号
  3022. }
  3023. ///// <summary>
  3024. ///// AGV离开炒锅运送空桶任务
  3025. ///// </summary>
  3026. //public void AgvFromFryPotToClean(ConcurrentQueue<MaterialInfo> queue)
  3027. //{
  3028. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3029. // {
  3030. // case 1:
  3031. // erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
  3032. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId)
  3033. // {
  3034. // goto erp;
  3035. // }
  3036. // string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
  3037. // LOnerobotJobId = id;
  3038. // FryCarryTaskErrorCodeAnalysis(info, 1); break;
  3039. // case 2:
  3040. // erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
  3041. // if (id1 == LTworobotJobId)
  3042. // {
  3043. // goto erp1;
  3044. // }
  3045. // string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
  3046. // LTworobotJobId = id1;
  3047. // FryCarryTaskErrorCodeAnalysis(info1, 2); break;
  3048. // case 3:
  3049. // erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
  3050. // if (id2 == LThreerobotJobId)
  3051. // {
  3052. // goto erp2;
  3053. // }
  3054. // string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
  3055. // LThreerobotJobId = id2;
  3056. // FryCarryTaskErrorCodeAnalysis(info2, 3); break;
  3057. // case 4:
  3058. // erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
  3059. // if (id3 == LOnerobotJobId)
  3060. // {
  3061. // goto erp3;
  3062. // }
  3063. // string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
  3064. // LOnerobotJobId = id3;
  3065. // FryCarryTaskErrorCodeAnalysis(info3, 4); break;
  3066. // case 5:
  3067. // erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
  3068. // if (id4 == LTworobotJobId)
  3069. // {
  3070. // goto erp4;
  3071. // }
  3072. // string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
  3073. // LTworobotJobId = id4;
  3074. // FryCarryTaskErrorCodeAnalysis(info4, 5); break;
  3075. // }
  3076. //}
  3077. /// <summary>
  3078. /// AGV离开炒锅1,4运送空桶任务
  3079. /// </summary>
  3080. public void AgvFromFryPotOneOrFourToClean()
  3081. {
  3082. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3083. {
  3084. case 1:
  3085. erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
  3086. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3087. {
  3088. goto erp;
  3089. }
  3090. MessageLog.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务");
  3091. string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
  3092. LFourrobotJobId = id;
  3093. FryCarryTaskErrorCodeAnalysis(info, 1); break;
  3094. case 4:
  3095. erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
  3096. if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || id3 == LSevenrobotJobId || id3 == LEightrobotJobId || id3 == LNinerobotJobId || id3 == LTenrobotJobId)
  3097. {
  3098. goto erp3;
  3099. }
  3100. MessageLog.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务");
  3101. string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
  3102. LFourrobotJobId = id3;
  3103. FryCarryTaskErrorCodeAnalysis(info3, 4); break;
  3104. }
  3105. }
  3106. /// <summary>
  3107. /// AGV离开炒锅2,5运送空桶任务
  3108. /// </summary>
  3109. public void AgvFromFryPotTwoOrFiveToClean()
  3110. {
  3111. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3112. {
  3113. case 2:
  3114. erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
  3115. if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || id1 == LSevenrobotJobId || id1 == LEightrobotJobId || id1 == LNinerobotJobId || id1 == LTenrobotJobId)
  3116. {
  3117. goto erp1;
  3118. }
  3119. MessageLog.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务");
  3120. string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
  3121. LFiverobotJobId = id1;
  3122. FryCarryTaskErrorCodeAnalysis(info1, 2); break;
  3123. case 5:
  3124. erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
  3125. if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || id4 == LSevenrobotJobId || id4 == LEightrobotJobId || id4 == LNinerobotJobId || id4 == LTenrobotJobId)
  3126. {
  3127. goto erp4;
  3128. }
  3129. MessageLog.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务");
  3130. string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
  3131. LFiverobotJobId = id4;
  3132. FryCarryTaskErrorCodeAnalysis(info4, 5); break;
  3133. }
  3134. }
  3135. /// <summary>
  3136. /// AGV离开炒锅3运送空桶任务
  3137. /// </summary>
  3138. public void AgvFromFryPotThreeToClean()
  3139. {
  3140. erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
  3141. if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || id2 == LSevenrobotJobId || id2 == LEightrobotJobId || id2 == LNinerobotJobId || id2 == LTenrobotJobId)
  3142. {
  3143. goto erp2;
  3144. }
  3145. MessageLog.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务");
  3146. string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
  3147. LSixrobotJobId = id2;
  3148. FryCarryTaskErrorCodeAnalysis(info2, 3);
  3149. }
  3150. /// <summary>
  3151. /// 处理agv从线体1到送料到炒锅的条件
  3152. /// </summary>
  3153. /// <param name="lineAlarm"></param>
  3154. public void AgvFromLineOneToFryPot()
  3155. {
  3156. erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
  3157. {
  3158. if (globalVar.agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
  3159. {
  3160. MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
  3161. AgvArriveLineSingelSetDown(InputMaterialQuene);
  3162. if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  3163. {
  3164. MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  3165. AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
  3166. globalVar.LOneCurrentCookingStep++;
  3167. OutputMaterialQuene.Enqueue(materialInfo);
  3168. globalVar.agvArriveUpLoad = false;
  3169. globalVar.AgvToFryPot = true;
  3170. //原料到位,agv到位,agv自行运料到炒锅
  3171. }
  3172. }
  3173. }
  3174. else//有故障
  3175. {
  3176. while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
  3177. {
  3178. Thread.Sleep(5);
  3179. if (globalVar.ExitLineOneTask)
  3180. return;
  3181. }
  3182. MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
  3183. //lineAlarm = 1;
  3184. goto erp;
  3185. }
  3186. }
  3187. /// <summary>
  3188. /// Agv从1号线体运空桶到清洗处
  3189. /// </summary>
  3190. public void AgvFromLineOneToClean(ushort emptyRollerNum)
  3191. {
  3192. erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//无故障
  3193. {
  3194. if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
  3195. {
  3196. MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
  3197. DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
  3198. MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  3199. AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
  3200. globalVar.LOneMaterialNum--;
  3201. globalVar.agvArriveLineOneLoadEmptyRoller = false;
  3202. //原料到位,agv到位,agv自行运料到清洗处
  3203. }
  3204. if (globalVar.agvArriveLineOneLoadCom)//上料完成
  3205. {
  3206. globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0);
  3207. globalVar.agvArriveLineOneLoadCom = false;
  3208. globalVar.rollerLineOne.IsEpmtyBefore = false;
  3209. MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成{emptyRollerNum}号空料桶装载");
  3210. }
  3211. }
  3212. else//有故障
  3213. {
  3214. while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
  3215. {
  3216. Thread.Sleep(5);
  3217. if (globalVar.ExitLineOneTask)
  3218. return;
  3219. }
  3220. MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
  3221. //lineAlarm = 1;
  3222. goto erp;
  3223. }
  3224. }
  3225. /// <summary>
  3226. /// 处理agv从线体2到送料到炒锅的条件
  3227. /// </summary>
  3228. /// <param name="lineAlarm"></param>
  3229. public void AgvFromLineTwoToFryPot()
  3230. {
  3231. erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
  3232. {
  3233. if (globalVar.agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
  3234. {
  3235. MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
  3236. AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
  3237. if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  3238. {
  3239. MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  3240. AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
  3241. globalVar.LTwoCurrentCookingStep++;
  3242. LTwoOutputMaterialQuene.Enqueue(materialInfo);
  3243. globalVar.agvArriveLTwoUpLoad = false;
  3244. globalVar.LTwoAgvToFryPot = true;
  3245. //原料到位,agv到位,agv自行运料到炒锅
  3246. }
  3247. }
  3248. }
  3249. else//有故障
  3250. {
  3251. while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
  3252. {
  3253. Thread.Sleep(5);
  3254. if (globalVar.ExitLineTwoTask)
  3255. return;
  3256. }
  3257. MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
  3258. // lineAlarm = 1;
  3259. goto erp;
  3260. }
  3261. }
  3262. /// <summary>
  3263. /// Agv从2号线体运空桶到清洗处
  3264. /// </summary>
  3265. public void AgvFromLineTwoToClean(ushort emptyRollerNum)
  3266. {
  3267. erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
  3268. {
  3269. if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
  3270. {
  3271. MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
  3272. DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
  3273. MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  3274. AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
  3275. globalVar.LTwoMaterialNum--;
  3276. globalVar.agvArriveLineTwoLoadEmptyRoller = false;
  3277. //原料到位,agv到位,agv自行运料到清洗处
  3278. }
  3279. if (globalVar.agvArriveLineTwoLoadCom)//上料完成
  3280. {
  3281. globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0);
  3282. globalVar.agvArriveLineTwoLoadCom = false;
  3283. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  3284. MessageLog.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
  3285. }
  3286. }
  3287. else//有故障
  3288. {
  3289. while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
  3290. {
  3291. Thread.Sleep(5);
  3292. if (globalVar.ExitLineOneTask)
  3293. return;
  3294. }
  3295. MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
  3296. //lineAlarm = 1;
  3297. goto erp;
  3298. }
  3299. }
  3300. /// <summary>
  3301. /// 处理agv从线体3到送料到炒锅的条件
  3302. /// </summary>
  3303. /// <param name="lineAlarm"></param>
  3304. public void AgvFromLineThreeToFryPot()
  3305. {
  3306. erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
  3307. {
  3308. if (globalVar.agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
  3309. {
  3310. MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
  3311. AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
  3312. if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  3313. {
  3314. MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  3315. AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
  3316. globalVar.LThreeCurrentCookingStep++;
  3317. LThreeOutputMaterialQuene.Enqueue(materialInfo);
  3318. globalVar.agvArriveLThreeUpLoad = false;
  3319. globalVar.LThreeAgvToFryPot = true;
  3320. //原料到位,agv到位,agv自行运料到炒锅
  3321. }
  3322. }
  3323. }
  3324. else //有故障
  3325. {
  3326. while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
  3327. {
  3328. Thread.Sleep(5);
  3329. if (globalVar.ExitLineThreeTask)
  3330. return;
  3331. }
  3332. MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
  3333. // lineAlarm = 1;
  3334. goto erp;
  3335. }
  3336. }
  3337. /// <summary>
  3338. /// Agv从3号线体运空桶到清洗处
  3339. /// </summary>
  3340. public void AgvFromLineThreeToClean(ushort emptyRollerNum)
  3341. {
  3342. erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
  3343. {
  3344. if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
  3345. {
  3346. MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
  3347. DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
  3348. MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  3349. AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
  3350. globalVar.LThreeMaterialNum--;
  3351. globalVar.agvArriveLineThreeLoadEmptyRoller = false;
  3352. // globalVar.rollerLineThree.IsEpmtyBefore = false;
  3353. //原料到位,agv到位,agv自行运料到清洗处
  3354. }
  3355. if (globalVar.agvArriveLineThreeLoadCom)//上料完成
  3356. {
  3357. globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0);
  3358. globalVar.agvArriveLineThreeLoadCom = false;
  3359. globalVar.rollerLineThree.IsEpmtyBefore = false;
  3360. MessageLog.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
  3361. }
  3362. }
  3363. else//有故障
  3364. {
  3365. while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
  3366. {
  3367. Thread.Sleep(5);
  3368. if (globalVar.ExitLineOneTask)
  3369. return;
  3370. }
  3371. MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
  3372. //lineAlarm = 1;
  3373. goto erp;
  3374. }
  3375. }
  3376. /// <summary>
  3377. /// 线体到炒锅搬运任务错误码分析
  3378. /// </summary>
  3379. /// <param name="errorCode"></param>
  3380. /// <param name="num"></param>
  3381. public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3382. {
  3383. if (errorCode == "SUCCESS")
  3384. {
  3385. AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
  3386. AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No);
  3387. AgvViewModel.GetInstance().Set小车运动(num, AgvViewModel.GetInstance().GetCommandValue($"qc_{num}"));
  3388. MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
  3389. globalVar.AllowAgvToLineLoadRoller = false;
  3390. }
  3391. else if (errorCode == "Analysis Error")
  3392. {
  3393. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  3394. }
  3395. else
  3396. {
  3397. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  3398. }
  3399. }
  3400. /// <summary>
  3401. /// 线体到清洗台搬运任务错误码分析
  3402. /// </summary>
  3403. /// <param name="errorCode"></param>
  3404. /// <param name="num"></param>
  3405. public void LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3406. {
  3407. if (errorCode == "SUCCESS")
  3408. {
  3409. AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
  3410. AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No);
  3411. AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue($"tqx_{num}"));
  3412. MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
  3413. }
  3414. else if (errorCode == "Analysis Error")
  3415. {
  3416. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  3417. }
  3418. else
  3419. {
  3420. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  3421. }
  3422. }
  3423. /// <summary>
  3424. /// 清洗台到线体搬运任务错误码分析
  3425. /// </summary>
  3426. /// <param name="errorCode"></param>
  3427. /// <param name="num"></param>
  3428. public void CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3429. {
  3430. if (errorCode == "SUCCESS")
  3431. {
  3432. AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
  3433. AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No);
  3434. AgvViewModel.GetInstance().Set小车运动(num, CartMotionTrajectory.jtqx);
  3435. MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线卸桶");
  3436. }
  3437. else if (errorCode == "Analysis Error")
  3438. {
  3439. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  3440. }
  3441. else
  3442. {
  3443. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  3444. }
  3445. }
  3446. /// <summary>
  3447. /// 炒锅搬运任务错误码分析
  3448. /// </summary>
  3449. /// <param name="errorCode"></param>
  3450. /// <param name="num"></param>
  3451. public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3452. {
  3453. if (errorCode == "SUCCESS")
  3454. {
  3455. MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
  3456. }
  3457. else if (errorCode == "Analysis Error")
  3458. {
  3459. MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
  3460. }
  3461. else
  3462. {
  3463. MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
  3464. }
  3465. }
  3466. public void AgvToLineOneLoadRoller()
  3467. {
  3468. if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
  3469. {
  3470. if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && globalVar.rollerLineOne.OutMaterialingSingle == 1 && !globalVar.LoadRoller)
  3471. {
  3472. if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
  3473. {
  3474. globalVar.rollerLineOne.CanRun = false;
  3475. e: string id = Guid.NewGuid().ToString("N");
  3476. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3477. goto e;
  3478. string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
  3479. LOnerobotJobId = id;
  3480. Thread.Sleep(500);
  3481. LineCarryTaskErrorCodeAnalysis(info, 1);
  3482. globalVar.LoadRoller = true;
  3483. }
  3484. //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  3485. //{
  3486. // globalVar.rollerLineOne.CanRun = true;
  3487. //}
  3488. //else // 工位8上面不是配方料桶或没有桶时
  3489. //{
  3490. // if (!globalVar.rollerLineOne.IsEpmtyBefore)
  3491. // {
  3492. // var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
  3493. // if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
  3494. // {
  3495. // //下发AGV去空桶线洗桶任务
  3496. // e: string id = Guid.NewGuid().ToString("N");
  3497. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3498. // goto e;
  3499. // string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  3500. // LFourrobotJobId = id;
  3501. // Thread.Sleep(500);
  3502. // LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
  3503. // globalVar.rollerLineOne.IsEpmtyBefore = true;
  3504. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  3505. // }
  3506. // }
  3507. // else
  3508. // {
  3509. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  3510. // }
  3511. //}
  3512. }
  3513. }
  3514. //else
  3515. //{
  3516. // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
  3517. // // lineAlarm = -1;
  3518. //}
  3519. //// lineAlarm = 1;
  3520. }
  3521. public void AgvToLineTwoLoadRoller()
  3522. {
  3523. if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
  3524. {
  3525. if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && globalVar.rollerLineTwo.OutMaterialingSingle == 1 && !globalVar.LTwoLoadRoller)
  3526. {
  3527. if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
  3528. {
  3529. globalVar.rollerLineTwo.CanRun = false;
  3530. e: string id = Guid.NewGuid().ToString("N");
  3531. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3532. goto e;
  3533. string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
  3534. LTworobotJobId = id;
  3535. Thread.Sleep(500);
  3536. LineCarryTaskErrorCodeAnalysis(info, 2);
  3537. globalVar.LTwoLoadRoller = true;
  3538. }
  3539. //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  3540. //{
  3541. // globalVar.rollerLineTwo.CanRun = true;
  3542. //}
  3543. }
  3544. //else// 工位8上面不是配方料桶或没有桶时
  3545. //{
  3546. // if (!globalVar.rollerLineTwo.IsEpmtyBefore)
  3547. // {
  3548. // var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
  3549. // if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
  3550. // {
  3551. // //下发AGV去空桶线洗桶任务
  3552. // e: string id = Guid.NewGuid().ToString("N");
  3553. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3554. // goto e;
  3555. // string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  3556. // LFiverobotJobId = id;
  3557. // Thread.Sleep(500);
  3558. // LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
  3559. // globalVar.rollerLineTwo.IsEpmtyBefore = true;
  3560. // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
  3561. // }
  3562. // }
  3563. // else
  3564. // {
  3565. // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  3566. // }
  3567. //}
  3568. }
  3569. }
  3570. public void AgvToLineThreeLoadRoller()
  3571. {
  3572. if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  3573. {
  3574. if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && globalVar.rollerLineThree.OutMaterialingSingle == 1 && !globalVar.LThreeLoadRoller)
  3575. {
  3576. if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
  3577. {
  3578. globalVar.rollerLineThree.CanRun = false;
  3579. e: string id = Guid.NewGuid().ToString("N");
  3580. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3581. goto e;
  3582. string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
  3583. LThreerobotJobId = id;
  3584. Thread.Sleep(500);
  3585. LineCarryTaskErrorCodeAnalysis(info, 3);
  3586. globalVar.LThreeLoadRoller = true;
  3587. }
  3588. //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  3589. //{
  3590. // globalVar.rollerLineThree.CanRun = true;
  3591. //}
  3592. //else // 工位8上面不是配方料桶或没有桶时
  3593. //{
  3594. // if (!globalVar.rollerLineThree.IsEpmtyBefore)
  3595. // {
  3596. // var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
  3597. // if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
  3598. // {
  3599. // //下发AGV去空桶线洗桶任务
  3600. // e: string id = Guid.NewGuid().ToString("N");
  3601. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3602. // goto e;
  3603. // string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  3604. // LSixrobotJobId = id;
  3605. // Thread.Sleep(500);
  3606. // LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
  3607. // globalVar.rollerLineThree.IsEpmtyBefore = true;
  3608. // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  3609. // }
  3610. // }
  3611. // else
  3612. // {
  3613. // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  3614. // }
  3615. //}
  3616. }
  3617. }
  3618. //if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  3619. //{
  3620. // if (LThreeInputMaterialQuene.Count > 0)
  3621. // {
  3622. // while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
  3623. // {
  3624. // Thread.Sleep(5);
  3625. // if (globalVar.ExitMainTask)
  3626. // return;
  3627. // }
  3628. // g: string id = Guid.NewGuid().ToString();
  3629. // if (id == LThreerobotJobId)
  3630. // goto g;
  3631. // string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
  3632. // // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
  3633. // LThreerobotJobId = id;
  3634. // Thread.Sleep(500);
  3635. // LineCarryTaskErrorCodeAnalysis(info, 3);
  3636. // }
  3637. //}
  3638. //else
  3639. //{
  3640. // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
  3641. // // lineAlarm = -1;
  3642. //}
  3643. }
  3644. /// <summary>
  3645. /// 1号线体数据下发
  3646. /// </summary>
  3647. /// <param name="count"></param>
  3648. /// <param name="materialLoc"></param>
  3649. /// <param name="materialWeight"></param>
  3650. public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight)
  3651. {
  3652. switch (count)
  3653. {
  3654. case 0:
  3655. DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
  3656. DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶2重量
  3657. break;
  3658. case 1:
  3659. DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
  3660. DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
  3661. break;
  3662. case 2:
  3663. DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
  3664. DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
  3665. break;
  3666. case 3:
  3667. DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
  3668. DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
  3669. break;
  3670. case 4:
  3671. DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
  3672. DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
  3673. break;
  3674. case 5:
  3675. DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
  3676. DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
  3677. break;
  3678. case 6:
  3679. DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
  3680. DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
  3681. break;
  3682. case 7:
  3683. DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
  3684. DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
  3685. break;
  3686. }
  3687. }
  3688. /// <summary>
  3689. /// 2号线体数据下发
  3690. /// </summary>
  3691. /// <param name="count"></param>
  3692. /// <param name="materialLoc"></param>
  3693. /// <param name="materialWeight"></param>
  3694. public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight)
  3695. {
  3696. switch (count)
  3697. {
  3698. case 0:
  3699. DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
  3700. DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
  3701. break;
  3702. case 1:
  3703. DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
  3704. DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
  3705. break;
  3706. case 2:
  3707. DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
  3708. DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
  3709. break;
  3710. case 3:
  3711. DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
  3712. DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
  3713. break;
  3714. case 4:
  3715. DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
  3716. DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
  3717. break;
  3718. case 5:
  3719. DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
  3720. DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
  3721. break;
  3722. case 6:
  3723. DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
  3724. DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
  3725. break;
  3726. case 7:
  3727. DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
  3728. DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
  3729. break;
  3730. }
  3731. }
  3732. /// <summary>
  3733. /// 3号线体数据下发
  3734. /// </summary>
  3735. /// <param name="count"></param>
  3736. /// <param name="materialLoc"></param>
  3737. /// <param name="materialWeight"></param>
  3738. public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight)
  3739. {
  3740. switch (count)
  3741. {
  3742. case 0:
  3743. DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
  3744. DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶2重量
  3745. break;
  3746. case 1:
  3747. DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
  3748. DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
  3749. break;
  3750. case 2:
  3751. DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
  3752. DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
  3753. break;
  3754. case 3:
  3755. DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
  3756. DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
  3757. break;
  3758. case 4:
  3759. DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
  3760. DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
  3761. break;
  3762. case 5:
  3763. DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
  3764. DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
  3765. break;
  3766. case 6:
  3767. DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
  3768. DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
  3769. break;
  3770. case 7:
  3771. DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
  3772. DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
  3773. break;
  3774. }
  3775. }
  3776. /// <summary>
  3777. /// AGV线体进料就位信号下发至PLC
  3778. /// </summary>
  3779. public void AgvArriveLineSingelSetDown(ConcurrentQueue<MaterialInfo> queue)
  3780. {
  3781. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3782. {
  3783. case 1:
  3784. case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
  3785. case 2:
  3786. case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
  3787. case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
  3788. }
  3789. }
  3790. /// <summary>
  3791. /// 炒锅滚筒信号检测
  3792. /// </summary>
  3793. //public void FryPotRollerTroubleCheck()
  3794. //{
  3795. // FryPotAlarm = 0;
  3796. // FryPotTwoAlarm = 0;
  3797. // FryPotThreeAlarm = 0;
  3798. // FryPotFourAlarm = 0;
  3799. // FryPotFiveAlarm = 0;
  3800. // switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3801. // {
  3802. // case 1:
  3803. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
  3804. // {
  3805. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3806. // return;
  3807. // }
  3808. // MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  3809. // FryPotAlarm = 1; break;
  3810. // case 2:
  3811. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
  3812. // {
  3813. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3814. // return;
  3815. // }
  3816. // MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
  3817. // FryPotTwoAlarm = 1; break;
  3818. // case 3:
  3819. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
  3820. // {
  3821. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3822. // return;
  3823. // }
  3824. // MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
  3825. // FryPotThreeAlarm = 1; break;
  3826. // case 4:
  3827. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
  3828. // {
  3829. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3830. // return;
  3831. // }
  3832. // MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  3833. // FryPotFourAlarm = 1; break;
  3834. // case 5:
  3835. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
  3836. // {
  3837. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3838. // return;
  3839. // }
  3840. // MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
  3841. // FryPotFiveAlarm = 1; break;
  3842. // }
  3843. //}
  3844. /// <summary>
  3845. /// 炒锅1,4滚筒信号检测
  3846. /// </summary>
  3847. public void FryPotOneRollerTroubleCheck()
  3848. {
  3849. FryPotAlarm = 0;
  3850. FryPotFourAlarm = 0;
  3851. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3852. {
  3853. case 1:
  3854. if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
  3855. {
  3856. Thread.Sleep(5); if (globalVar.ExitLineOneTask)
  3857. return;
  3858. }
  3859. MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  3860. FryPotAlarm = 1; break;
  3861. case 4:
  3862. if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
  3863. {
  3864. Thread.Sleep(5); if (globalVar.ExitLineOneTask)
  3865. return;
  3866. }
  3867. MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  3868. FryPotFourAlarm = 1; break;
  3869. }
  3870. }
  3871. /// <summary>
  3872. /// 炒锅2,5滚筒信号检测
  3873. /// </summary>
  3874. public void FryPotTwoRollerTroubleCheck()
  3875. {
  3876. FryPotTwoAlarm = 0;
  3877. FryPotFiveAlarm = 0;
  3878. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3879. {
  3880. case 2:
  3881. if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
  3882. {
  3883. Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
  3884. return;
  3885. }
  3886. MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  3887. FryPotTwoAlarm = 1; break;
  3888. case 5:
  3889. if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
  3890. {
  3891. Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
  3892. return;
  3893. }
  3894. MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  3895. FryPotFiveAlarm = 1; break;
  3896. }
  3897. }
  3898. /// <summary>
  3899. /// 炒锅3滚筒信号检测
  3900. /// </summary>
  3901. public void FryPotThreeRollerTroubleCheck()
  3902. {
  3903. FryPotThreeAlarm = 0;
  3904. if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
  3905. {
  3906. Thread.Sleep(5); if (globalVar.ExitLineThreeTask)
  3907. return;
  3908. }
  3909. MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
  3910. FryPotThreeAlarm = 1;
  3911. }
  3912. }
  3913. }