|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091 |
- using BPASmartClient.AGV;
- using BPASmartClient.AGV.Enums;
- using BPASmartClient.AGV.Feedback;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.Helper;
- using BPASmartClient.HubHelper;
- using FryPot_DosingSystem.Model;
- using FryPot_DosingSystem.ViewModel;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Media;
- using System.Windows;
- using FryPot_DosingSystem.AGV;
- using FryPot_DosingSystem.FryPotStatus;
- using System.IO;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Diagnostics;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.CustomResource.UserControls;
-
- namespace FryPot_DosingSystem.Control
- {
- internal class DosingLogicControl
- {
- public static DosingLogicControl _instance;
- public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
-
- public ushort[] RollerNum = new ushort[] { 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 207, 208, 301, 302, 303, 304, 305, 306, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 501, 502, 503, 504, 505, 506, 507, 508 };
- /// <summary>
- /// 桶净重
- /// </summary>r
- public ushort RollerNetweight = 19;//19公斤
-
- /// <summary>
- /// 滚筒线PLC数据
- /// </summary>
- public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
-
- public ConcurrentDictionary<string, object> FryOneData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryTwoData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryThreeData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryFourData = new ConcurrentDictionary<string, object>();
- public ConcurrentDictionary<string, object> FryFiveData = new ConcurrentDictionary<string, object>();
- /// <summary>
- /// 线体1配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 线体2配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> LTwoRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 线体3配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> LThreeRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 线体1进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体2进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LTwoInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体3进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LThreeInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体1出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体2出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LTwoOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 线体3出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> LThreeOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 全局变量对象声明
- /// </summary>
- GlobalVariable globalVar;
- /// <summary>
- /// 线体状态对象声明
- /// </summary>
- HardWareStatusViewModel hardWareStatusModel;
- ///// <summary>
- ///// 炒锅1状态
- ///// </summary>
- //PotOneStatus fryOne;
- ///// <summary>
- ///// 炒锅2状态
- ///// </summary>
- //PotTwoStatus fryTwo;
- ///// <summary>
- ///// 炒锅3状态
- ///// </summary>
- //PotThreeStatus fryThree;
- ///// <summary>
- ///// 炒锅4状态
- ///// </summary>
- //PotFourStatus fryFour;
- ///// <summary>
- ///// 炒锅5状态
- ///// </summary>
- //PotFiveStatus fryFive;
- /// <summary>
- /// 报警信息对象声明
- /// </summary>
- #region 上位机内部变量
- int FryPotAlarm = 0;//炒锅1滚筒故障信号 1:无故障 -1:故障
- int FryPotTwoAlarm = 0;//炒锅2滚筒故障信号 1:无故障 -1:故障
- int FryPotThreeAlarm = 0;//炒锅3滚筒故障信号 1:无故障 -1:故障
- int FryPotFourAlarm = 0;//炒锅4滚筒故障信号 1:无故障 -1:故障
- int FryPotFiveAlarm = 0;//炒锅5滚筒故障信号 1:无故障 -1:故障
- int ReicpeNum = 0;//记录接收到的配方数
- bool ErrorRecipe;//线体1错误配方标识
- bool LTwoErrorRecipe;//线体2错误配方标识
- bool LThreeErrorRecipe;//线体3错误配方标识
- string fryOneRecipe = string.Empty;
- string fryTwoRecipe = string.Empty;
- string fryThreeRecipe = string.Empty;
- string fryFourRecipe = string.Empty;
- string fryFiveRecipe = string.Empty;
- #endregion
- #region agv临时变量
- //bool agvArriveUpLoad = false;//agv是否到达线体1上料位置
- //bool agvArriveLTwoUpLoad = false;//agv是否到达线体2上料位置
- //bool agvArriveLThreeUpLoad = false;//agv是否到达线体3上料位置
-
- //bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置
- //bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置
- //bool LThreeagvArriveUnLoad = false;//线体3 agv是否到达炒锅送料位置
-
- //bool agvFryPotEmptyRollerArrive = false;// 线体1的agv是否拿到炒锅空桶
- //bool LTwoagvFryPotEmptyRollerArrive = false; //线体2的agv是否拿到炒锅空桶
- //bool LThreeagvFryPotEmptyRollerArrive = false;//线体3的agv是否拿到炒锅空桶
-
- string LOnerobotJobId = string.Empty;//线体1当前上游系统任务号,全局唯一 从线体1到炒锅路径
- string LTworobotJobId = string.Empty;//线体2当前上游系统任务号,全局唯一 从线体2到炒锅路径
- string LThreerobotJobId = string.Empty;//线体3当前上游系统任务号,全局唯一 从线体3到炒锅路径
- string LFourrobotJobId = string.Empty;//线体4当前上游系统任务号,全局唯一 从炒锅1、4到线体4路径
- string LFiverobotJobId = string.Empty; //从炒锅2、5到线体4路径
- string LSixrobotJobId = string.Empty; //从炒锅3到线体4路径
- List<string> LSevenrobotJobId = new List<string>(); //从线体1到清洗台路径
- List<string> LEightrobotJobId = new List<string>();//从线体2到清洗台路径
- List<string> LNinerobotJobId = new List<string>(); //从线体3到清洗台路径
- List<string> LTenrobotJobId = new List<string>(); //从清洗台到线体4路径
-
- Dictionary<string, int> agvCode = new Dictionary<string, int>() { { "ZT11-21", 1 }, { "ZT11-22", 2 }, { "ZT11-23", 3 }, { "ZT11-24", 4 } };//agv小车的编号对AGV动画小车编号
-
- private static readonly object Obj_Lock = new object();//3条滚筒线洗桶线程互斥锁
- public int CleanNum = 0;//当前清洗台桶数
-
- #endregion
- /// <summary>
- /// 调试命令注册
- /// </summary>
- public void CommandRegist()
- {
-
- #region 线体空桶清洗及回收调试
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineOneLoadEmptyRoller = true;
-
- }), "AgvArriveLineOneEmptyRollerLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineTwoLoadEmptyRoller = true;
-
- }), "AgvArriveLineTwoEmptyRollerLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineThreeLoadEmptyRoller = true;
-
- }), "AgvArriveLineThreeEmptyRollerLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.CleanComplete = 1;
-
- }), "CleanPlateCallAgv");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;
- globalVar.rollerLineThree.agvArriveCleanUnLoad = true;
-
- }), "AgvArriveCleanPlateLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位
-
- }), "AgvArriveCleanPlateLocLoad");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineFour = true;
- globalVar.rollerLineOne.agvArriveLineFour = true;
- globalVar.rollerLineTwo.agvArriveLineFour = true;
- globalVar.rollerLineThree.agvArriveLineFour = true;
- }), "AgvArriveLineFourLoc");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- LineOneEmptyRollerCleanTaskRestart();
-
- }), "EmptyRollerCleanTaskRestart");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- LineTwoEmptyRollerCleanTaskRestart();
-
- }), "LineTwoEmptyRollerCleanTaskRestart");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- LineThreeEmptyRollerCleanTaskRestart();
-
- }), "LineThreeEmptyRollerCleanTaskRestart");
- #endregion
- //接口调试
- ActionManage.GetInstance.Register(new Action(() =>
- {
- string id = Guid.NewGuid().ToString("D");
- string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV任务下发成功");
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文");
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
- }
- }), "AgvDebug");
-
- ActionManage.GetInstance.Register(() =>
- {
- MessageNotify.GetInstance.ShowRunLog("清洗台卸桶完成");
-
- }, "AgvArriveCleanPlateLocCom");
-
- ActionManage.GetInstance.Register(() =>
- {
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成");
- MessageNotify.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成");
- MessageNotify.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成");
- MessageNotify.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成");
-
- }, "AgvArriveLineFourLocCom");
- ActionManage.GetInstance.Register(() =>
- {
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成");
-
- }, "AgvArriveCleanPlateLocLoadCom");
-
- ActionManage.GetInstance.Register(() =>
- {
- // globalVar.rollerLineOne.RecipeCompleteSingle = 1;
-
- }, "LineOneRecipeComSignal");
- ActionManage.GetInstance.Register(() =>
- {
- // globalVar.rollerLineTwo.RecipeCompleteSingle = 1;
-
- }, "LineTwoRecipeComSignal");
- ActionManage.GetInstance.Register(() =>
- {
- // globalVar.rollerLineThree.RecipeCompleteSingle = 1;
-
- }, "LineThreeRecipeComSignal");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineOneLoadCom = true;
- }), "AgvLineOneLoadEmptyCom");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineTwoLoadCom = true;
- }), "AgvLineTwoLoadEmptyCom");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineThreeLoadCom = true;
- }), "AgvLineThreeLoadEmptyCom");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineOne.CanRun = true;
- }), "AGVLineOneLoadCom");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineTwo.CanRun = true;
- }), "AGVLineTwoLoadCom");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineThree.CanRun = true;
- }), "AGVLineThreeLoadCom");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineOne.OutMaterialingSingle = 1;
- }), "RollerLineRunning");
- ActionManage.GetInstance.Register(new Action<object>((obj) =>
- {
- globalVar.rollerLineOne.StationEight = (ushort)obj;
- }), "EightWorkLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.fryPotOne.InputMaterialArrivedSingle = 1;
- globalVar.fryPotFour.InputMaterialArrivedSingle = 1;
- }), "FryPotInputArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1;
- globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1;
- }), "FryPotEmptyRollerArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveUpLoad = true;
- }), "AGVLOneArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveUnLoad = true;
- }), "AGVFryPotDownArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveUpLoad = true;
- }), "AGVFryPotUpArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvFryPotEmptyRollerArrive = true;
-
- }), "AGVFryPotGetEmptyRoller");
- //滚筒线2
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineTwo.OutMaterialingSingle = 1;
- }), "RollerLineTwoRunning");
- ActionManage.GetInstance.Register(new Action<object>((obj) =>
- {
- globalVar.rollerLineTwo.StationEight = (ushort)obj;
- }), "TwoEightWorkLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.fryPotTwo.InputMaterialArrivedSingle = 1;
- globalVar.fryPotFive.InputMaterialArrivedSingle = 1;
- }), "FryPotTwoInputArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1;
- globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1;
- }), "FryPotTwoEmptyRollerArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLTwoUpLoad = true;
- }), "AGVLTwoArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.LTwoagvArriveUnLoad = true;
- }), "AGVFryPotTwoDownArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLTwoUpLoad = true;
- }), "AGVFryPotTwoUpArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.LTwoagvFryPotEmptyRollerArrive = true;
-
- }), "AGVFryPotTwoGetEmptyRoller");
- //滚筒线3
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.rollerLineThree.OutMaterialingSingle = 1;
- }), "RollerLineThreeRunning");
- ActionManage.GetInstance.Register(new Action<object>((obj) =>
- {
- globalVar.rollerLineThree.StationEight = (ushort)obj;
- }), "ThreeEightWorkLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.fryPotThree.InputMaterialArrivedSingle = 1;
- }), "FryPotThreeInputArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1;
- }), "FryPotThreeEmptyRollerArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLThreeUpLoad = true;
- }), "AGVLThreeArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.LThreeagvArriveUnLoad = true;
- }), "AGVFryPotThreeDownArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLThreeUpLoad = true;
- }), "AGVFryPotThreeUpArrive");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.LThreeagvFryPotEmptyRollerArrive = true;
-
- }), "AGVFryPotThreeGetEmptyRoller");
- }
- public DosingLogicControl()
- {
- globalVar = new GlobalVariable();
- //fryOne = new PotOneStatus();
- //fryTwo = new PotTwoStatus();
- //fryThree = new PotThreeStatus();
- //fryFour = new PotFourStatus();
- //fryFive = new PotFiveStatus();
- hardWareStatusModel = HardWareStatusViewModel.GetInstance;
- DateTimeJudge();
- FileRegClean();
- ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
- //ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
- ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
- ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes");
- ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes");
- //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
- //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit");
- HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
- HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
- //ResetProgram();
- ReadPlcData();
- SaveFryPotData();
- MainTask();
- CommandRegist();
- }
- /// <summary>
- /// 文件数据定期清理
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void FileRegClean()
- {
- try
- {
- int days = 5; //清除期限
- string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
- if (filesOne.Count() > 0)
- {
- foreach (var item in filesOne)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
- if (filesTwo.Count() > 0)
- {
- foreach (var item in filesTwo)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
- if (filesThree.Count() > 0)
- {
- foreach (var item in filesThree)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
- if (filesFour.Count() > 0)
- {
- foreach (var item in filesFour)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
- if (filesFive.Count() > 0)
- {
- foreach (var item in filesFive)
- {
- FileInfo info = new FileInfo(item);
- DateTime createTime = info.CreationTime;
- DateTime timeNow = DateTime.Now;
- if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
- {
- Directory.Delete(item, true);
- }
- }
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- /// <summary>
- /// 时间差计算
- /// </summary>
- /// <param name="t">当前时间</param>
- /// <param name="t2">创建时间</param>
- /// <returns></returns>
- private int TimeDiff(DateTime t, DateTime t2)
- {
- long lReturn = -1;
- System.TimeSpan NowValue = new TimeSpan(t.Ticks);
- System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
- System.TimeSpan DateDiff = TimeSpan.Zero;
- try
- {
- //计算时间差
- //DateDiff = TimeValue.Subtract(NowValue).Duration();
- DateDiff = NowValue.Subtract(TimeValue);
- int h = DateDiff.Hours;
- int m = DateDiff.Minutes;
- return DateDiff.Days;
- }
- catch
- {
- return -1;
- }
- }
- /// <summary>
- /// 炒锅数据实时保存
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void SaveFryPotData()
- {
- Task.Run(new Action(() =>
- {
- while (true)
- {
- FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
- }
- }));
- }
-
- /// <summary>
- /// 时间判断,数据处理
- /// </summary>
- private void DateTimeJudge()
- {
- #region sqlite数据库保存
- //if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
- // if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
- // if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
- // if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
- // if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
-
- //if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
- // if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- #endregion
- string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
- string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
- string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
- string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
- string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
- if (!Directory.Exists("AccessFile//" + "Statistic"))
- Directory.CreateDirectory("AccessFile//" + "Statistic");
- if (File.Exists(p1))
- {
- using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p2))
- {
- using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p3))
- {
- using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p4))
- {
- using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p5))
- {
- using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- }
- int cout = 0;
- int cout1 = 0;
- /// <summary>
- /// AGV上下料上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvFeedBackUpReportDataAnalysis(object obj)
- {
- //if (obj != null && obj is byte[] datas)
- //{
- //string strData = Encoding.UTF8.GetString(datas);
- EventData objData = JsonConvert.DeserializeObject<EventData>(obj.ToString());
- if (objData != null)
- {
- AGVHelper.GetInstance.UpDownFeedBack(objData.agvCode, objData.jobId, objData.msgId);
- #region 线体到炒锅请求上下料
- //线体1请求上下料
- if (objData.equipmentId == 1 && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveUpLoad = true;//AGV到达上料位置
-
- }
- if ((objData.equipmentId == 5 || objData.equipmentId == 8) && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveUnLoad = true;//AGV到达下料位置
- }
- //线体2请求上下料
- if (objData.equipmentId == 2 && objData.command == "LOAD")
- {
- globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
-
- }
- if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.LTwoagvArriveUnLoad = true;//AGV到达下料位置
-
- }
- //线体3请求上下料
- if (objData.equipmentId == 3 && objData.command == "LOAD")
- {
- globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.equipmentId == 7 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.LThreeagvArriveUnLoad = true;//AGV到达下料位置
- }
- #endregion
- #region 炒锅到线体4请求上下料
- //炒锅1,4到线体4
- if ((objData.equipmentId == 5 || objData.equipmentId == 8) && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//发送AGV到位信号
- }
- if (objData.equipmentId == 4 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置
- //AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
-
- }
- //炒锅2,5到线体4
- if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "LOAD")
- {
- globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//发送AGV到位信号
-
- }
- if (objData.equipmentId == 4 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置
-
-
- }
- //炒锅3到线体4
- if (objData.equipmentId == 7 && objData.command == "LOAD")
- {
- globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//发送AGV到位信号
- }
- if (objData.equipmentId == 4 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置
- }
- #endregion
- #region 线体123到清洗台请求上下料
- //线体1到清洗台
- if (objData.equipmentId == 11 && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置
-
- }
- if (objData.equipmentId == 10 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//AGV到达下料位置
- }
- //线体2到清洗台
- if (objData.equipmentId == 22 && objData.command == "LOAD")
- {
- globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置
-
- }
- if (objData.equipmentId == 20 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
-
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;//AGV到达下料位置
- }
-
- if (objData.equipmentId == 33 && objData.command == "LOAD")
- {
- globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置
-
- }
- if (objData.equipmentId == 30 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
-
- globalVar.rollerLineThree.agvArriveCleanUnLoad = true;//AGV到达下料位置
-
- }
- #endregion
- #region 清洗台到线体4请求上下料
- if (objData.equipmentId == 10 && objData.command == "LOAD")
- {
- globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置
- }
- if (objData.equipmentId == 44 && objData.command == "UNLOAD")
- {
- globalVar.agvArriveLineFour = true;//agv到达线体4下料位置
- }
- #endregion
- }
-
- }
-
- /// <summary>
- /// AGV搬运任务上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvTaskUpReportDataAnalysis(object obj)
- {
- TaskEventData objData;
- try
- {
- objData = JsonConvert.DeserializeObject<TaskEventData>(obj.ToString());
- }
- catch (Exception)
- {
-
- MessageNotify.GetInstance.ShowRunLog("Agv任务回报数据异常");
- objData = null;
- }
- if (objData != null)
- {
- if (objData.state == "ABNORMAL_COMPLETED")
- {
- MessageBox.Show("任务异常完成");
- }
- #region 线体上下料任务信息回报
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "sTEwzw")// AGV正在上料,指线体上料
- {
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "PChS6R")// AGV正在上料,指线体上料
- {
- //日志
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "HHif8Z")// AGV正在上料,指线体上料
- {
- //日志
- }
-
- //线体1任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "sTEwzw")//指定上料点上料完成,这里指线体上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1052", 0);
- globalVar.agvLineOneLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
- if (globalVar.LOneFryPotSerial == 1)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_1);
- }
- else if (globalVar.LOneFryPotSerial == 4)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_4);
- }
- }
-
- //线体2任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "PChS6R")//指定上料点上料完成,这里指线体上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1053", 0);
- globalVar.agvLineTwoLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
- if (globalVar.LTwoFryPotSerial == 2)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_2);
- }
- else if (globalVar.LTwoFryPotSerial == 5)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_5);
- }
-
- }
- //线体3任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "HHif8Z")//指定上料点上料完成,这里指线体上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1054", 0);
- globalVar.agvLineThreeLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_3_3);
-
- }
- //线体1任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && (objData.jobData.targetPointCode == "DXDnMJ" || objData.jobData.targetPointCode == "naFssQ"))//指定下料点正在下料,指线体到炒锅下料
- {
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && (objData.jobData.targetPointCode == "PChS6R" || objData.jobData.targetPointCode == "sxSX88"))//指定下料点正在下料,指线体到炒锅下料
- {
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "biZG87")//指定下料点正在下料,指线体到炒锅下料
- {
-
- }
- //线体1任务上报
- if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && (objData.jobData.targetPointCode == "DXDnMJ" || objData.jobData.targetPointCode == "naFssQ"))//指定下料位置下料完成,指线体到炒锅下料
- {
- if (objData.jobData.targetPointCode == "DXDnMJ")
- {
- DeviceOperate.GetInstance.WritePlcData("D1055", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1058", 0);
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- }
- //线体2任务上报
- if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && (objData.jobData.targetPointCode == "CDPGde" || objData.jobData.targetPointCode == "sxSX88"))//指定下料位置下料完成,指线体到炒锅下料
- {
- if (objData.jobData.targetPointCode == "CDPGde")
- {
- DeviceOperate.GetInstance.WritePlcData("D1056", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1059", 0);
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- }
- //线体3任务上报
- if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "biZG87")//指定下料位置下料完成,指线体到炒锅下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1057", 0);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- }
- #endregion
- #region 炒锅空桶上下料任务信息回报
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFourrobotJobId && (objData.jobData.startPointCode == "DXDnMJ" || objData.jobData.startPointCode == "naFssQ"))// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFiverobotJobId && (objData.jobData.startPointCode == "CDPGde" || objData.jobData.startPointCode == "sxSX88"))// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "biZG87")// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
-
- //线体1任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LFourrobotJobId && (objData.jobData.startPointCode == "DXDnMJ" || objData.jobData.startPointCode == "naFssQ"))//指定上料点上料完成,这里指炒锅空桶上料
- {
- if (objData.jobData.startPointCode == "DXDnMJ")
- {
- DeviceOperate.GetInstance.WritePlcData("D1060", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1063", 0);
- }
-
- globalVar.agvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- if (globalVar.LOneFryPotSerial == 1)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_1);
- }
- else if (globalVar.LOneFryPotSerial == 4)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);
- }
- }
- //线体2任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LFiverobotJobId && (objData.jobData.startPointCode == "CDPGde" || objData.jobData.startPointCode == "sxSX88"))//指定上料点上料完成,这里指炒锅空桶上料
- {
-
- if (objData.jobData.startPointCode == "CDPGde")
- {
- DeviceOperate.GetInstance.WritePlcData("D1061", 0);
- }
- else
- {
- DeviceOperate.GetInstance.WritePlcData("D1064", 0);
- }
-
- globalVar.LTwoagvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- if (globalVar.LTwoFryPotSerial == 2)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_2);
- }
- else if (globalVar.LTwoFryPotSerial == 5)
- {
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_5);
- }
- }
- //线体3任务上报
- if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "biZG87")//指定上料点上料完成,这里指炒锅空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1062", 0);
- globalVar.LThreeagvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_3);
- }
-
-
- //线体1任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
-
- }
- //线体1任务上报
- if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
- {
- MessageNotify.GetInstance.ShowRunLog("1号线炒锅空桶在4号线卸桶完成");
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
-
- }
- //线体2任务上报
- if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
- {
- MessageNotify.GetInstance.ShowRunLog("2号线炒锅空桶在4号线卸桶完成");
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- }
- //线体3任务上报
- if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
- {
- MessageNotify.GetInstance.ShowRunLog("3号线炒锅空桶在4号线卸桶完成");
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- }
- #endregion
- #region 线体123空桶到清戏台
- //线体1任务上报
- if (objData.state == "LOAD_COMPLETED" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "sTEwzw")//指定上料点上料完成,这里指线体1空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1052", 0);
- globalVar.agvArriveLineOneLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_1);
- //到清洗处
- }
- //线体2任务上报
- if (objData.state == "LOAD_COMPLETED" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "PChS6R")//指定上料点上料完成,这里指线体2空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1053", 0);
- globalVar.agvArriveLineTwoLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_2);
- //到清洗处
-
- }
- //线体3任务上报
- if (objData.state == "LOAD_COMPLETED" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "HHif8Z")//指定上料点上料完成,这里指线体3空桶上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1054", 0);
- globalVar.agvArriveLineThreeLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_3);
- //到清洗处
-
- }
-
-
- if (objData.state == "DONE" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体1到清戏台空桶下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1065", 0);
- LSevenrobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("线体【1】空桶在清洗台卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- }
- if (objData.state == "DONE" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体2到清戏台空桶下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1065", 0);
- LEightrobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("线体【2】空桶在清洗台卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- }
- if (objData.state == "DONE" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体3到清戏台空桶下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1065", 0);
- LNinerobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("线体【3】空桶在清洗台卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- }
- #endregion
- #region 清洗台到线体4
- if (objData.state == "LOAD_COMPLETED" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "TitRYC")//指定上料位置上料完成,指清戏台空桶到上料
- {
- DeviceOperate.GetInstance.WritePlcData("D1066", 0);
- globalVar.AllowNextEmptyRollerToClean = true;
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);//去四号空桶线
- AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum);
-
- }
- if (objData.state == "ROLLER_UNLOAD_DOING" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料点正在下料,指清洗台空桶到线体4下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
-
- }
-
- if (objData.state == "DONE" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指清戏台空桶到线体4下料
- {
- DeviceOperate.GetInstance.WritePlcData("D1067", 0);
- LTenrobotJobId.Remove(objData.robotJobId);
- MessageNotify.GetInstance.ShowRunLog("【4】号线空桶回桶完成");
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
- AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
-
- }
- #endregion
-
-
-
- }
-
- }
-
- /// <summary>
- /// 主任务重启
- /// </summary>
- private void ResetProgram()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
- {
- MessageNotify.GetInstance.ShowUserLog("主任务正在重启");
-
- ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
- {
- //ActionManage.GetInstance.CancelRegister("RecipeSetDown");
- //ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
- // ActionManage.GetInstance.Send("ClearRecipes");
- ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
- {
- ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
- {
- ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
- {
- globalVar = null;
- globalVar = new GlobalVariable();
- ReicpeNum = 0;
- ReadPlcData();
- MainTask();
- MessageNotify.GetInstance.ShowUserLog("主任务重启完成");
- }));
- }));
-
- }));
- }));
- }
-
- Thread.Sleep(10);
- }), "ResetProgram");
- }
-
- public void LineOneTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
- {
- ActionManage.GetInstance.Send("ClearOneRecipes");
- globalVar.rollerLineOne = null;
- globalVar.rollerLineOne = new RollerLineOne();
- globalVar.fryPotOne = null;
- globalVar.fryPotOne = new FryPotOne();
- globalVar.fryPotFour = null;
- globalVar.fryPotFour = new FryPotFour();
- globalVar.ExitLineOneTask = false;
- globalVar.AllowAgvToLineLoadRoller = true;
- globalVar.InOrOutputLock = false;
- globalVar.LOneCurrentRecipeName = string.Empty;
- globalVar.LoadRoller = false;
- globalVar.AgvToFryPot = false;
- globalVar.PotOneInputMaterialArrive = false;
- globalVar.PotOneOutputRollerArrive = false;
- globalVar.AgvArrivePot = false;
- globalVar.LOneMaterialNum = 0;
- globalVar.LOneFryPotSerial = 1;
- globalVar.LOneCurrentCookingStep = 0;
- globalVar.agvArriveUpLoad = false;
- globalVar.agvArriveUnLoad = false;
- globalVar.agvFryPotEmptyRollerArrive = false;
- globalVar.agvLineOneLoadCom = false;
-
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
- }));
- }
- public void LineTwoTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
- {
- ActionManage.GetInstance.Send("ClearTwoRecipes");
- globalVar.rollerLineTwo = null;
- globalVar.rollerLineTwo = new RollerLineTwo();
- globalVar.fryPotTwo = null;
- globalVar.fryPotTwo = new FryPotTwo();
- globalVar.fryPotFive = null;
- globalVar.fryPotFive = new FryPotFive();
- globalVar.ExitLineTwoTask = false;
- globalVar.AllowAgvToLineTwoLoadRoller = true;
- globalVar.LTwoInOrOutputLock = false;
- globalVar.LTwoCurrentRecipeName = string.Empty;
- globalVar.LTwoLoadRoller = false;
- globalVar.LTwoAgvToFryPot = false;
- globalVar.LTwoPotInputMaterialArrive = false;
- globalVar.LTwoPotOutputRollerArrive = false;
- globalVar.LTwoAgvArrivePot = false;
- globalVar.LTwoMaterialNum = 0;
- globalVar.LTwoFryPotSerial = 2;
- globalVar.LTwoCurrentCookingStep = 0;
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoagvArriveUnLoad = false;
- globalVar.LTwoagvFryPotEmptyRollerArrive = false;
- globalVar.agvLineTwoLoadCom = false;
-
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
- }));
- }
- public void LineThreeTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
- {
- ActionManage.GetInstance.Send("ClearThreeRecipes");
- globalVar.rollerLineThree = null;
- globalVar.rollerLineThree = new RollerLineThree();
- globalVar.fryPotThree = null;
- globalVar.fryPotThree = new FryPotThree();
- globalVar.ExitLineThreeTask = false;
- globalVar.AllowAgvToLineThreeLoadRoller = true;
- globalVar.LThreeInOrOutputLock = false;
- globalVar.LThreeCurrentRecipeName = string.Empty;
- globalVar.LThreeLoadRoller = false;
- globalVar.LThreeAgvToFryPot = false;
- globalVar.LThreePotInputMaterialArrive = false;
- globalVar.LThreePotOutputRollerArrive = false;
- globalVar.LThreeAgvArrivePot = false;
- globalVar.LThreeMaterialNum = 0;
- globalVar.LThreeFryPotSerial = 3;
- globalVar.LThreeCurrentCookingStep = 0;
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeagvArriveUnLoad = false;
- globalVar.LThreeagvFryPotEmptyRollerArrive = false;
- globalVar.agvLineThreeLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
- }));
- }
-
- public void LineOneEmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线1空桶清洗任务线程", new Action(() =>
- {
- globalVar.rollerLineOne.StationEight = 0;
- globalVar.rollerLineOne.EmptyRollerNums.Clear();
- globalVar.rollerLineOne.EmptyRollerNums.Add(108);
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- // globalVar.rollerLineOne.CanRun = true;
-
- globalVar.agvArriveLineFour = false;
- globalVar.agvArriveCleanLoad = false;
- globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineOneLoadEmptyRoller = false;
- globalVar.agvArriveLineOneLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【1】空桶清洗任务重启成功");
- }));
- }
-
-
- public void LineTwoEmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线2空桶清洗任务线程", new Action(() =>
- {
-
- globalVar.rollerLineTwo.StationEight = 0;
- globalVar.rollerLineTwo.EmptyRollerNums.Clear();
- globalVar.rollerLineTwo.EmptyRollerNums.Add(208);
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- //globalVar.rollerLineTwo.CanRun = true;
-
-
- globalVar.agvArriveLineFour = false;
- globalVar.agvArriveCleanLoad = false;
-
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineTwoLoadEmptyRoller = false;
- globalVar.agvArriveLineTwoLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【2】空桶清洗任务重启成功");
- }));
- }
-
- public void LineThreeEmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("滚筒线3空桶清洗任务线程", new Action(() =>
- {
- globalVar.rollerLineThree.StationEight = 0;
- globalVar.rollerLineThree.EmptyRollerNums.Clear();
- globalVar.rollerLineThree.EmptyRollerNums.Add(308);
- globalVar.rollerLineThree.IsEpmtyBefore = false;
- //globalVar.rollerLineThree.CanRun = true;
-
- globalVar.agvArriveLineFour = false;
- globalVar.agvArriveCleanLoad = false;
- globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineThreeLoadEmptyRoller = false;
- globalVar.agvArriveLineThreeLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
- MessageNotify.GetInstance.ShowUserLog("滚筒线【3】空桶清洗任务重启成功");
- }));
- }
- /// <summary>
- /// 实时获取plc数据
- /// </summary>
- public void ReadPlcData()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- GetAddressData("D2001", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineOne.StationOne = data[0];
- globalVar.rollerLineOne.StationTwo = data[1];
- globalVar.rollerLineOne.StationThree = data[2];
- globalVar.rollerLineOne.StationFour = data[3];
- globalVar.rollerLineOne.StationFive = data[4];
- globalVar.rollerLineOne.StationSix = data[5];
- globalVar.rollerLineOne.StationSeven = data[6];
- globalVar.rollerLineOne.StationEight = data[7];
- }));
- GetAddressData("D2011", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineTwo.StationOne = data[0];
- globalVar.rollerLineTwo.StationTwo = data[1];
- globalVar.rollerLineTwo.StationThree = data[2];
- globalVar.rollerLineTwo.StationFour = data[3];
- globalVar.rollerLineTwo.StationFive = data[4];
- globalVar.rollerLineTwo.StationSix = data[5];
- globalVar.rollerLineTwo.StationSeven = data[6];
- globalVar.rollerLineTwo.StationEight = data[7];
- }));
- GetAddressData("D2021", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineThree.StationOne = data[0];
- globalVar.rollerLineThree.StationTwo = data[1];
- globalVar.rollerLineThree.StationThree = data[2];
- globalVar.rollerLineThree.StationFour = data[3];
- globalVar.rollerLineThree.StationFive = data[4];
- globalVar.rollerLineThree.StationSix = data[5];
- globalVar.rollerLineThree.StationSeven = data[6];
- globalVar.rollerLineThree.StationEight = data[7];
- }));
- GetAddressData("D2031", new Action<ushort[]>((data) =>
- {
- //globalVar.rollerLineOne.OutMaterialingSingle = data[3];
- //globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
- //globalVar.rollerLineThree.OutMaterialingSingle = data[5];
-
- //AlarmHelper<AlarmInfo>.GetInstance().LineOneRollerRunning = data[3];
- //AlarmHelper<AlarmInfo>.GetInstance().LineTwoRollerRunning = data[4];
- //AlarmHelper<AlarmInfo>.GetInstance().LineThreeRollerRunning = data[5];
-
- AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble = data[6];
- AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble = data[7];
- AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble = data[8];
-
- }));
- //GetAddressData("D2040", new Action<ushort[]>((data) =>
- //{
- // globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
- // globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
- // globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
- // globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
- // globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
-
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotOneRollerRunning = data[0];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoRollerRunning = data[1];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerRunning = data[2];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFourRollerRunning = data[3];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveRollerRunning = data[4];
-
- //}));
- GetAddressData("D2045", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
- globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
- globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
- globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
- globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
- }));
- GetAddressData("D2050", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
- globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
- globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
- globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
- globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
- }));
- //GetAddressData("D2065", new Action<ushort[]>((data) =>
- //{
- // globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
- // globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
- // globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
- // globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
- // globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
-
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotOneEmptyRollerRunning = data[0];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoEmptyRollerRunning = data[1];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeEmptyRollerRunning = data[2];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFourEmptyRollerRunning = data[3];
- // AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveEmptyRollerRunning = data[4];
- //}));
- GetAddressData("D2070", new Action<ushort[]>((data) =>
- {
- //globalVar.fryPotOne.RollerTroubleSingle = data[0];
- //globalVar.fryPotTwo.RollerTroubleSingle = data[1];
- //globalVar.fryPotThree.RollerTroubleSingle = data[2];
- //globalVar.fryPotFour.RollerTroubleSingle = data[3];
- //globalVar.fryPotFive.RollerTroubleSingle = data[4];
- AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble = data[0];
- AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble = data[1];
- AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble = data[2];
- AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble = data[3];
- AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble = data[4];
- }));
- //GetAddressData("D2078", new Action<ushort[]>(data =>
- //{
- // //globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
- // //globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
- // //globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
- //}));
- GetAddressData("D2075", new Action<ushort[]>(data =>
- {
- AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning = data[0];
- globalVar.CleadBarrelEnterSingle = data[0];
- }));
- GetAddressData("D2076", new Action<ushort[]>(data =>
- {
- globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号
-
- }));
- GetAddressData("D2077", new Action<ushort[]>(data =>
- {
- AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning = data[0];
- globalVar.CleadBarrelExitSingle = data[0];
- }));
-
- //滚筒线123开始信号
- GetAddressData("D2101", new Action<ushort[]>(data =>
- {
- globalVar.rollerLineOne.ExcuteIsConfirm = data[0];
- globalVar.rollerLineTwo.ExcuteIsConfirm = data[1];
- globalVar.rollerLineThree.ExcuteIsConfirm = data[2];
- }));
- GetAddressData("D4400", new Action<ushort[]>(data =>
- {
- globalVar.rollerLineOne.EmptyRollerNum = data[0];
- }));
- GetAddressData("D4410", new Action<ushort[]>(data =>
- {
- globalVar.rollerLineTwo.EmptyRollerNum = data[0];
- }));
- GetAddressData("D4420", new Action<ushort[]>(data =>
- {
- globalVar.rollerLineThree.EmptyRollerNum = data[0];
- }));
-
- GetAddressData("D2111", new Action<ushort[]>(data =>
- {
- globalVar.rollerLineOne.WashEmptyRollerModel = data[0];
- globalVar.rollerLineTwo.WashEmptyRollerModel = data[1];
- globalVar.rollerLineThree.WashEmptyRollerModel = data[2];
-
- globalVar.rollerLineOne.WashRollerArriveSignal = data[3];
- globalVar.rollerLineTwo.WashRollerArriveSignal = data[4];
- globalVar.rollerLineThree.WashRollerArriveSignal = data[5];
- }));
-
- //炒锅1状态数据
- //GetFryOneData("D2001", new Action<ushort[]>(data =>
- //{
- // //FryPotMonitorManage.GetInstance.fryOne.Temperature =?;
- //}));
-
- ////炒锅2状态数据
- //GetFryTwoData("D2001", new Action<ushort[]>(data =>
- //{
-
- //}));
- ////炒锅3状态数据
- //GetFryThreeData("D2001", new Action<ushort[]>(data =>
- //{
-
- //}));
- ////炒锅4状态数据
- //GetFryFourData("D2001", new Action<ushort[]>(data =>
- //{
-
- //}));
- ////炒锅5状态数据
- //GetFryFiveData("D2001", new Action<ushort[]>(data =>
- //{
-
- //}));
- //线体上放空桶
- if (globalVar.rollerLineOne.EmptyRollerNum != 0)
- {
- if (RollerNum.Contains(globalVar.rollerLineOne.EmptyRollerNum))
- {
- if (!globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.EmptyRollerNum))
- {
- globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
- ++globalVar.LOneMaterialNum;
- }
- }
-
- //是否手动复位PLC
- }
- if (globalVar.rollerLineTwo.EmptyRollerNum != 0)
- {
-
- if (RollerNum.Contains(globalVar.rollerLineTwo.EmptyRollerNum))
- {
- if (!globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.EmptyRollerNum))
- {
- globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum);
- ++globalVar.LTwoMaterialNum;
- }
- }
- //是否手动复位PLC
- }
- if (globalVar.rollerLineThree.EmptyRollerNum != 0)
- {
-
- if (RollerNum.Contains(globalVar.rollerLineThree.EmptyRollerNum))
- {
- if (!globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.EmptyRollerNum))
- {
- globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
- ++globalVar.LThreeMaterialNum;
- }
- }
- //是否手动复位PLC
- }
- //炒锅状态数据
- if (globalVar.fryPotOne.OilConfirm == 1)
- {
- FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
- FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity;
- }
- if (globalVar.fryPotTwo.OilConfirm == 1)
- {
- FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity;
- FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity;
- }
- if (globalVar.fryPotThree.OilConfirm == 1)
- {
- FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity;
- FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity;
- }
- if (globalVar.fryPotFour.OilConfirm == 1)
- {
- FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity;
- FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity;
- }
- if (globalVar.fryPotFive.OilConfirm == 1)
- {
- FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
- FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
- }
- //炒锅状态实时显示
- FryPotStatusDisplay();
- RollerLineStatusDisplay();
- Thread.Sleep(10);
- }), "MainViewReadPlcData");
-
- }
- /// <summary>
- /// 炒锅状态实时显示
- /// </summary>
- private void FryPotStatusDisplay()
- {
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOnePower").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.HotPower.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoPower").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.HotPower.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreePower").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.HotPower.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourPower").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.HotPower.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString();
-
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFivePower").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.HotPower.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
- FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();
-
- //FryPotMonitorManage.GetInstance.fryFive.Temperature = 10;
- //FryPotMonitorManage.GetInstance.fryFive.HotPower = "9";
- //FryPotMonitorManage.GetInstance.fryFive.Speed = 8;
- //FryPotMonitorManage.GetInstance.fryFive.FryPotWeight=7;
- //FryPotMonitorManage.GetInstance.fryFive.OilCapacity = 6;
- //FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = 5;
- //FryPotMonitorManage.GetInstance.fryFive.TotalProduct = 4;
- }
- /// <summary>
- /// 炒锅状态数据保存到二进制文件
- /// </summary>
- public void FryPotDataSaveToBinaryFile()
- {
-
- #region 炒锅1状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅2状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅3状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅4状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- #region 炒锅5状态数据保存
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据"))
- {
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据");
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
-
- if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- else
- {
- if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
- Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
- if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
- {
- using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
- {
- writeStream.Position = writeStream.Length;
- PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, 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.ToString("yyyy-MM-dd-HH-mm") };
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(writeStream, p1);
-
- }
- }
- }
- #endregion
- }
- /// <summary>
- /// 滚筒线运行状态显示
- /// </summary>
- private void RollerLineStatusDisplay()
- {
- hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
- hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
- hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
- hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
- hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
- hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
- hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
- hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
- if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)
- {
-
- hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
-
- hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
- {
-
- hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
- }
- else
- {
-
- hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
- hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
- hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
- hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
- hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
- hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
- hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
- hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
- if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)
- {
- hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
- hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
- {
-
- hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
-
- }
- else
- {
- hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
- hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
- hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
- hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
- hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
- hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
- hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
- hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
- if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)
- {
- hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
- hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
- {
- hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
- }
- else
- {
- hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- //滚筒线4
-
- }
- /// <summary>
- /// 返回滚筒线PLC指定地址指定长度的数据
- /// </summary>
- /// <param name="address"></param>
- /// <returns></returns>
- public void GetAddressData(string address, Action<ushort[]> action)
- {
- PlcReadData = DeviceOperate.GetInstance.GetAllData();
- if (PlcReadData.ContainsKey(address))
- {
- action((ushort[])(PlcReadData[address]));
- }
- }
- public void GetFryOneData(string address, Action<ushort[]> action)
- {
- FryOneData = DeviceOperate.GetInstance.GetFryOneData();
- if (FryOneData.ContainsKey(address))
- {
- action((ushort[])(FryOneData[address]));
- }
- }
- public void GetFryTwoData(string address, Action<ushort[]> action)
- {
- FryTwoData = DeviceOperate.GetInstance.GetFryTwoData();
- if (FryTwoData.ContainsKey(address))
- {
- action((ushort[])(FryTwoData[address]));
- }
- }
- public void GetFryThreeData(string address, Action<ushort[]> action)
- {
- FryThreeData = DeviceOperate.GetInstance.GetFryThreeData();
- if (FryThreeData.ContainsKey(address))
- {
- action((ushort[])(FryThreeData[address]));
- }
- }
- public void GetFryFourData(string address, Action<ushort[]> action)
- {
- FryFourData = DeviceOperate.GetInstance.GetFryFourData();
- if (FryFourData.ContainsKey(address))
- {
- action((ushort[])(FryFourData[address]));
- }
- }
- public void GetFryFiveData(string address, Action<ushort[]> action)
- {
- FryFiveData = DeviceOperate.GetInstance.GetFryFiveData();
- if (FryFiveData.ContainsKey(address))
- {
- action((ushort[])(FryFiveData[address]));
- }
- }
- /// <summary>
- /// 写Plc数据
- /// </summary>
- /// <param name="address"></param>
- /// <param name="Value"></param>
- public void WritePlcData(string address, ushort Value)
- {
- DeviceOperate.GetInstance.WritePlcData(address, Value);
- }
- /// <summary>
- /// 初始化任务
- /// </summary>
- //public void IniteTask()
- //{
- // ThreadManage.GetInstance().StartLong(new Action(() =>
- // {
- // MainTask();
- // }), "MainTask");
- //}
- /// <summary>
- /// 配方数据接收
- /// </summary>
- public void RecipeDataParse(object obj)
- {
- Task.Run(new Action(() =>
- {
- if (obj != null && obj is NewRecipeModel[] recipes)
- {
- ReicpeNum = ReicpeNum + recipes.Length;
- MessageNotify.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方");
- for (int i = 0; i < recipes.Length; i++)
- {
- int? res = recipes[i].materialCollection.ElementAt(0).MaterialLoc / 100;
- if (res != null)
- {
- switch (res)
- {
- case 1:
- case 4: RecipeQuene.Enqueue(recipes[i]); break;
- case 3: LThreeRecipeQuene.Enqueue(recipes[i]); break;
- case 2:
- case 5: LTwoRecipeQuene.Enqueue(recipes[i]); break;
- }
- }
- }
- }
-
- }));
-
- }
- /// <summary>
- /// 开启主任务
- /// </summary>
- public void MainTask()
- {
- ////RecipeDataToPlc();
- //LOneRecipeDataToPlc();
- //LTwoRecipeDataToPlc();
- //LThreeRecipeDataToPlc();
- ////AgvLoadRoller();
- //LOneLoadRoller();
- //LTwoAgvLoadRoller();
- //LThreeAgvLoadRoller();
- //// FryPotInputMaterial();
- //LOneFryPotInputMaterial();
- //LTwoFryPotInputMaterial();
- //LThreeFryPotInputMaterial();
- ////FryPotOutputMaterial();
- //LOneFryPotOutputMaterial();
- //LTwoFryPotOutputMaterial();
- //LThreeFryPotOutputMaterial();
-
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { ToLineFourFromCleanPlate(); Thread.Sleep(10); }), "清洗台空桶回桶任务线程");
- ThreadManage.GetInstance().StartLong(new Action(() => { EmptyRollerToLinFourFromPot(); Thread.Sleep(10); }), "炒锅空桶回桶任务线程");
-
- }
-
- ///// <summary>
- ///// 1号线统一洗桶
- ///// </summary>
- //public void LineOneUnifyWashRollerModel()
- //{
-
- //}
- ///// <summary>
- ///// 2号线统一洗桶
- ///// </summary>
- //public void LineTwoUnifyWashRollerModel()
- //{
-
- //}
- ///// <summary>
- ///// 3号线统一洗桶
- ///// </summary>
- //public void LineThreeUnifyWashRollerModel()
- //{
-
- //}
- /// <summary>
- /// 线体1的执行流程
- /// </summary>
- public void LineOneProcessExecute()
- {
-
- LOneRecipeDataToPlc();
- LineOneRecipeExecuteConfirm();
- LOneLoadRoller();
- LOneFryPotInputMaterial();
- LOneFallMaterial();
- LOneFryPotOutputMaterial();
- LOneEmptyOperate();
- // globalVar.LOneTaskLock = false;
- //}
-
- }
- /// <summary>
- /// 线体2的执行流程
- /// </summary>
- public void LineTwoProcessExecute()
- {
-
- LTwoRecipeDataToPlc();
- LineTwoRecipeExecuteConfirm();
- LTwoAgvLoadRoller();
- LTwoFryPotInputMaterial();
- LTwoFallMaterial();
- LTwoFryPotOutputMaterial();
- LTwoEmptyOperate();
- // globalVar.LTwoTaskLock = false;
-
- //}
- }
- /// <summary>
- /// 线体3的执行流程
- /// </summary>
- public void LineThreeProcessExecute()
- {
-
- LThreeRecipeDataToPlc();
- LineThreeRecipeExecuteConfirm();
- LThreeAgvLoadRoller();
- LThreeFryPotInputMaterial();
- LThreeFallMaterial();
- LThreeFryPotOutputMaterial();
- LThreeEmptyOperate();
- // globalVar.LThreeTaskLock = false;
-
- //}
- }
- private void LineOneToCleanProcessExecute()
- {
- //线体1到清洗台
- AgvFromLineOneToCleanPlate();
- AgvArriveCleanPlateFromLineOne();
- }
- public void LineTwoToCleanProcessExecute()
- {
- //线体2到清洗台
- AgvFromLineTwoToCleanPlate();
- AgvArriveCleanPlateFromLineTwo();
-
- }
- public void LineThreeToCleanProcessExecute()
- {
- //线体3到清洗台
- AgvFromLineThreeToCleanPlate();
- AgvArriveCleanPlateFromLineThree();
-
- }
- private void ToLineFourFromCleanPlate()
- {
- //空桶到线体4
- CallAgvToLineFour();
- CleanPlateUpLoad();
- EmptyRollerToLinFourFromClean();
- }
- private void CleanPlateUpLoad()
- {
- if (globalVar.agvArriveCleanLoad)
- {
- globalVar.agvArriveCleanLoad = false;
- MessageNotify.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置");
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 0)
- {
- //plc交互
- WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶出桶滚筒重新运行!!");
- goto erp;
- }
- }
- }
-
- /// <summary>
- /// 线体1到清洗台
- /// </summary>
- private void AgvFromLineOneToCleanPlate()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障
- {
-
- if (globalVar.rollerLineOne.WashEmptyRollerModel == 0)
- {
-
- try
- {
- lock (Obj_Lock)
- {
- //线体1到清洗台
- if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineOne.EmptyRollerNums.Count > 0)
- {
-
- var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
- if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.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.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0)))//一种情况工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶,另一种在没有下单的情况下,线体上的桶都认为是空桶
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
- LSevenrobotJobId.Add(id);
- // Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功
- {
-
- globalVar.rollerLineOne.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LSevenrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
- }
- // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
-
- }
- else
- {
- AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- }
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else //统一洗桶模式
- {
- if (RTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel)))
- MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为统一洗桶模式");
- lock (Obj_Lock)
- {
- if (globalVar.rollerLineOne.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
- LSevenrobotJobId.Add(id);
- // Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功
- {
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LSevenrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
- }
-
- else
- {
- AgvFromLineOneToClean();//AGV从线体1到清洗处
- }
- }
-
- }
-
- }
-
- }
-
- /// <summary>
- /// 线体2到清洗台
- /// </summary>
- private void AgvFromLineTwoToCleanPlate()
- {
-
- // 线体2到清洗台
- if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障
- {
- if (globalVar.rollerLineTwo.WashEmptyRollerModel == 0)
- {
- try
- {
- lock (Obj_Lock)
- {
- if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0)
- {
-
- var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
- if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.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.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
- {
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
- LEightrobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2))
- {
-
- globalVar.rollerLineTwo.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LEightrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
-
- //AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
- }
- }
-
- else
- {
- AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- }
- }
-
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else
- {
- if (RTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel)))
- MessageNotify.GetInstance.ShowRunLog($"2号滚筒线切换为统一洗桶模式");
- lock (Obj_Lock)
- {
- if (globalVar.rollerLineTwo.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
- LEightrobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2))
- {
-
-
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else
- {
- LEightrobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
- }
-
-
- else
- {
-
- AgvFromLineTwoToClean();//AGV从线体1到清洗处
- }
- }
- }
- }
-
-
- }
- /// <summary>
- /// 线体3到清洗台
- /// </summary>
- private void AgvFromLineThreeToCleanPlate()
- {
- //线体3到清洗台
- if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障
- {
- if (globalVar.rollerLineThree.WashEmptyRollerModel == 0)
- {
- try
- {
- lock (Obj_Lock)
- {
- if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineThree.EmptyRollerNums.Count > 0)
- {
-
- var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
- if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.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.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
- {
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
- LNinerobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功
- {
-
- globalVar.rollerLineThree.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else//呼叫失败
- {
- LNinerobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
-
- //AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- }
-
- }
- else
- {
- AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- }
- }
- }
- catch (Exception)
- {
-
- // throw;
- }
- }
- else
- {
- if (RTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel)))
- MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为统一洗桶模式");
- lock (Obj_Lock)
- {
- if (globalVar.rollerLineThree.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
- LNinerobotJobId.Add(id);
- //Thread.Sleep(500);
- if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功
- {
-
- globalVar.rollerLineThree.IsEpmtyBefore = true;
- globalVar.AllowNextEmptyRollerToClean = false;
- }
- else//呼叫失败
- {
- LNinerobotJobId.Remove(id);
- Thread.Sleep(5000);
- }
-
- }
- else
- {
- AgvFromLineThreeToClean();//AGV从线体3到清洗处
- }
- }
- }
- }
- }
-
- /// <summary>
- /// AGV从线体1到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlateFromLineOne()
- {
- if (globalVar.rollerLineOne.agvArriveCleanUnLoad)
- {
- globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
- MessageNotify.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶");
-
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
- {
- //plc交互
- WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
- goto erp;
- }
- }
-
- }
-
- /// <summary>
- /// AGV从线体2到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlateFromLineTwo()
- {
-
- if (globalVar.rollerLineTwo.agvArriveCleanUnLoad)
- {
- globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
- MessageNotify.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶");
-
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
- {
- //plc交互
- WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
- goto erp;
- }
- }
-
-
- }
- /// <summary>
- /// AGV从线体3到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlateFromLineThree()
- {
-
- if (globalVar.rollerLineThree.agvArriveCleanUnLoad)
- {
- globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
- MessageNotify.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶");
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
- {
- //plc交互
- WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
- goto erp;
- }
- ////plc交互
- //WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
- //if (globalVar.CleadBarrelEnterSingle == 0)
- //{
- // MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!");
- //}
-
- }
-
- }
- /// <summary>
- /// 呼叫Agv从清洗台运洗好的空桶到四号线体
- /// </summary>
- public void CallAgvToLineFour()
- {
- if (RTrig.GetInstance("呼叫AGV").Start(Convert.ToBoolean(globalVar.CleanComplete)))
- {
- //DeviceOperate.GetInstance.WritePlcData("D2076",0);
- //Thread.Sleep(800);
- //是否需要手动给PLC置位??
- // globalVar.CleanComplete = 0;
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id);
- LTenrobotJobId.Add(id);
- //Thread.Sleep(500);
- MessageNotify.GetInstance.ShowRunLog("清洗台呼叫AGV取桶");
- if (!CleanToLineCarryTaskErrorCodeAnalysis(info, 4))
- {
- LTenrobotJobId.Remove(id);
- MessageNotify.GetInstance.ShowRunLog("清洗台呼叫AGV取桶失败");
- }
- }
- }
- /// <summary>
- /// 3号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void LThreeRecipeDataToPlc()
- {
- if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe)
- {
- globalVar.rollerLineThree.RecipeComMidSingle = 1;
- if (globalVar.LThreeCurrentRecipeName != string.Empty)
- {
- MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
- WritePlcData("D2103", 0);
- WritePlcData("D1103", 0);//复位开始执行指令
- PlcLineThreeRecipeDataReset();
- if (globalVar.LThreeFryPotSerial == 3)
- {
- FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryThree.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryThree.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
- }
- globalVar.LThreeCurrentRecipeName = string.Empty;
- Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
- }
- }
- if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.WashEmptyRollerModel == 0)//后续添加其它限制条件
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
- WritePlcData("D2103", 0);
- WritePlcData("D1103", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineThreeRecipeDataReset();//PLC复位
- Thread.Sleep(800);
- //if (globalVar.LThreeCurrentRecipeName != string.Empty)
- // MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
- if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- LThreeErrorRecipe = false;
- int headNum = result.materialCollection[0].MaterialLoc / 100;
- globalVar.LThreeMaterialNum = result.materialCollection.Count;
- globalVar.LThreeFryPotSerial = headNum;
- globalVar.LThreeCurrentRecipeName = result.RecipeName;
-
- AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
- MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- //if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3)
- //{
- fryThreeRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; }));
- //将配方中原料加入新的队列
- LThreeInputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//3号滚筒线桶号以及重量数据、偏差量下发
- //}
- //else
- //{
- // MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- // MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- // LThreeInputMaterialQuene.Clear();
- // LThreeErrorRecipe = true;
- // return;
- //}
- }
- DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
- // globalVar.rollerLineThree.RecipeComMidSingle = 0;
- WritePlcData("D1103", 1);//配方开始执行命令
- globalVar.rollerLineThree.LowSignalJude = true;
- }
- }
- //else if (RTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel)))
- //{
- // MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线处于集中洗桶模式,无法下发配方");
- // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线处于集中洗桶模式,无法下发配方"); }));
- // LThreeRecipeQuene.Clear();
-
- //}
-
-
- }
- /// <summary>
- /// 2号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void LTwoRecipeDataToPlc()
- {
- if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe)
- {
- globalVar.rollerLineTwo.RecipeComMidSingle = 1;
- if (globalVar.LTwoCurrentRecipeName != string.Empty)
- {
- MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
- WritePlcData("D2102", 0);
- WritePlcData("D1102", 0);//复位开始执行指令
- PlcLineTwoRecipeDataReset();
- if (globalVar.LTwoFryPotSerial == 2)
- {
- FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryTwo.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryTwo.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
- }
- if (globalVar.LTwoFryPotSerial == 5)
- {
- FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFive.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFive.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
- }
- globalVar.LTwoCurrentRecipeName = string.Empty;
- Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
- }
- }
-
- if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.WashEmptyRollerModel == 0)//后续添加其它限制条件
- {
- if (globalVar.LTwoFryPotSerial == 2)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
- }
- if (globalVar.LTwoFryPotSerial == 5)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
- }
- //if (globalVar.LTwoCurrentRecipeName != string.Empty)
- // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
- WritePlcData("D2102", 0);
- WritePlcData("D1102", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineTwoRecipeDataReset();//PLC复位
- Thread.Sleep(800);
- if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- LTwoErrorRecipe = false;
- int headNum = result.materialCollection[0].MaterialLoc / 100;
- globalVar.LTwoMaterialNum = result.materialCollection.Count;
- globalVar.LTwoFryPotSerial = headNum;
- globalVar.LTwoCurrentRecipeName = result.RecipeName;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString());
- MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- //if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5))
- //{
- if (headNum == 2)//炒锅2
- {
- fryTwoRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; }));
- }
- else//炒锅5
- {
- fryFiveRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; }));
- }
- //将配方中原料加入新的队列
- LTwoInputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发
- //}
- //else
- //{
- // MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- // MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- // LTwoInputMaterialQuene.Clear();
- // LTwoErrorRecipe = true;
- // return;
- //}
- }
- DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据
- //globalVar.rollerLineTwo.RecipeComMidSingle = 0;
- WritePlcData("D1102", 1);//配方开始执行命令
- globalVar.rollerLineTwo.LowSignalJude = true;
- }
- //else if (RTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel)))
- //{
- // MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线处于集中洗桶模式,无法下发配方");
- // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); }));
- // LTwoRecipeQuene.Clear();
- //}
- }
- }
-
- /// <summary>
- /// 1号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- private void LOneRecipeDataToPlc()
- {
- if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe)
- {
- globalVar.rollerLineOne.RecipeComMidSingle = 1;
- if (globalVar.LOneCurrentRecipeName != string.Empty)
- {
- MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成");
- WritePlcData("D2101", 0);
- WritePlcData("D1101", 0);//复位开始执行指令
- PlcLineOneRecipeDataReset();
-
- if (globalVar.LOneFryPotSerial == 1)
- {
- FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryOne.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryOne.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
- }
- if (globalVar.LOneFryPotSerial == 4)
- {
- FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
- using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFour.txt", false, Encoding.UTF8))
- {
- txtWriter.WriteLine(DateTime.Now.ToShortDateString());
- txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFour.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy);//炒锅1产量以及总油量记录
- }
- //Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
- }
- globalVar.LOneCurrentRecipeName = string.Empty;
- Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; });
- }
- }
- if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.WashEmptyRollerModel == 0)//后续添加其它限制条件
- {
- if (globalVar.LOneFryPotSerial == 1)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
- }
- if (globalVar.LOneFryPotSerial == 4)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; }));
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection<WorkflowModel>(); }));
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
- }
- WritePlcData("D2101", 0);
- WritePlcData("D1101", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineOneRecipeDataReset();//PLC复位
- Thread.Sleep(800);
- if (RecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- ErrorRecipe = false;
- int headNum = result.materialCollection[0].MaterialLoc / 100;
- globalVar.LOneMaterialNum = result.materialCollection.Count;
- globalVar.LOneFryPotSerial = headNum;
- globalVar.LOneCurrentRecipeName = result.RecipeName;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString());
- MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- //if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
- //{
- if (headNum == 1)//炒锅1
- {
- fryOneRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; }));
- }
- else//炒锅4
- {
- fryFourRecipe = result.RecipeName;//炒锅状态开始记录
- Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; }));
- }
- //将配方中原料加入新的队列
- InputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//1号滚筒线桶号以及重量、偏差量数据下发
-
- //}
- //else
- //{
- // MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- // MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- // InputMaterialQuene.Clear();
- // ErrorRecipe = true;
- // return;
- //}
- }
- DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据
- // globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0
- WritePlcData("D1101", 1);//线体1配方开始执行命令
- globalVar.rollerLineOne.LowSignalJude = true;
- }
- }
- //else if (RTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel)))
- //{
- // MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线处于集中洗桶模式,无法下发配方");
- // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线处于集中洗桶模式,无法下发配方"); }));
- // RecipeQuene.Clear();
- //}
-
-
- }
-
-
-
- /// <summary>
- /// 线体1配方执行等待下位确认
- /// </summary>
- public void LineOneRecipeExecuteConfirm()
- {
- if (globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.LowSignalJude)
- {
- if (globalVar.rollerLineOne.ExcuteIsConfirm == 1) //收到下位执行信号
- {
- WritePlcData("D2101", 0);
- globalVar.rollerLineOne.NextStart = true;
- globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0
- globalVar.rollerLineOne.LowSignalJude = false;
- }
- else if (globalVar.rollerLineOne.ExcuteIsConfirm == 2) //收到下位取消执行命令
- {
- RecipeQuene.Clear();
- OutputMaterialQuene.Clear();
- globalVar.rollerLineOne.NextStart = false;
- WritePlcData("D2101", 0);
- WritePlcData("D1101", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineOneRecipeDataReset();//PLC复位
- InputMaterialQuene.Clear();
- MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【1】号线体【{globalVar.LOneCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowRunLog($"1号滚筒线所有配方已清除");
- MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【1】号线体【{globalVar.LOneCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowUserLog($"1号滚筒线所有配方已清除");
- globalVar.LOneCurrentRecipeName = string.Empty;
- globalVar.rollerLineOne.LowSignalJude = false;
- }
- else //未收到下位执行信号
- {
- globalVar.rollerLineOne.NextStart = false;
- }
- }
- }
-
- /// <summary>
- /// 线体2配方执行等待下位确认
- /// </summary>
- public void LineTwoRecipeExecuteConfirm()
- {
- if (globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.LowSignalJude)
- {
- if (globalVar.rollerLineTwo.ExcuteIsConfirm == 1) //收到下位执行信号
- {
- WritePlcData("D2102", 0);
- globalVar.rollerLineTwo.NextStart = true;
- globalVar.rollerLineTwo.RecipeComMidSingle = 0;//配方完成的中转信号置0
- globalVar.rollerLineTwo.LowSignalJude = false;
- }
- else if (globalVar.rollerLineTwo.ExcuteIsConfirm == 2) //收到下位取消执行命令
- {
- LTwoRecipeQuene.Clear();
- LTwoOutputMaterialQuene.Clear();
- globalVar.rollerLineTwo.NextStart = false;
- WritePlcData("D2102", 0);
- WritePlcData("D1102", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineTwoRecipeDataReset();//PLC复位
- LTwoInputMaterialQuene.Clear();
- MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【2】号线体【{globalVar.LTwoCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowRunLog($"2号滚筒线所有配方已清除");
- MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【2】号线体【{globalVar.LTwoCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowUserLog($"2号滚筒线所有配方已清除");
- globalVar.LTwoCurrentRecipeName = string.Empty;
- globalVar.rollerLineTwo.LowSignalJude = false;
- }
- else //未收到下位执行信号
- {
- globalVar.rollerLineTwo.NextStart = false;
- }
- }
- }
- /// <summary>
- /// 线体3配方执行等待下位确认
- /// </summary>
- public void LineThreeRecipeExecuteConfirm()
- {
- if (globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.LowSignalJude)
- {
-
- if (globalVar.rollerLineThree.ExcuteIsConfirm == 1) //收到下位执行信号
- {
- WritePlcData("D2103", 0);
- globalVar.rollerLineThree.NextStart = true;
- globalVar.rollerLineThree.RecipeComMidSingle = 0;//配方完成的中转信号置0
- globalVar.rollerLineThree.LowSignalJude = false;
- }
- else if (globalVar.rollerLineThree.ExcuteIsConfirm == 2) //收到下位取消执行命令
- {
- LThreeRecipeQuene.Clear();
- LThreeOutputMaterialQuene.Clear();
- globalVar.rollerLineThree.NextStart = false;
- WritePlcData("D2103", 0);
- WritePlcData("D1103", 0);//复位开始执行指令
- //清空配方数据队列
- PlcLineThreeRecipeDataReset();//PLC复位
- LThreeInputMaterialQuene.Clear();
- MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【3】号线体【{globalVar.LThreeCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowRunLog($"3号滚筒线所有配方已清除");
- MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【3】号线体【{globalVar.LThreeCurrentRecipeName}】配方的制作");
- MessageNotify.GetInstance.ShowUserLog($"3号滚筒线所有配方已清除");
-
- globalVar.LThreeCurrentRecipeName = string.Empty;
- globalVar.rollerLineThree.LowSignalJude = false;
- }
- else //未收到下位执行信号
- {
- globalVar.rollerLineThree.NextStart = false;
- }
- }
- }
-
- /// <summary>
- /// AGV到配方线体1装桶以及出料到炒锅
- /// </summary>
- public void LOneLoadRoller()
- {
- if (InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.NextStart)
- {
- AgvToLineOneLoadRoller();
- AgvFromLineOneToFryPot();//AGV到1号线体装桶
- AgvLineOneLoadRollerCom();
- }
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void AgvLineOneLoadRollerCom()
- {
- if (globalVar.agvLineOneLoadCom)
- {
- globalVar.rollerLineOne.CanRun = true;
- globalVar.agvLineOneLoadCom = false;
- MessageNotify.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
- }
- }
-
- /// <summary>
- /// AGV到配方线体2装桶以及出料到炒锅
- /// </summary>
- public void LTwoAgvLoadRoller()
- {
- if (LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.NextStart)
- {
- AgvToLineTwoLoadRoller();
- AgvFromLineTwoToFryPot();//AGV到2号线体装桶
- AgvLineTwoLoadRollerCom();
-
- }
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- private void AgvLineTwoLoadRollerCom()
- {
- if (globalVar.agvLineTwoLoadCom)
- {
- globalVar.rollerLineTwo.CanRun = true;
- globalVar.agvLineTwoLoadCom = false;
- MessageNotify.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
- }
- }
-
- /// <summary>
- /// AGV到配方线体3装桶以及出料到炒锅
- /// </summary>
- public void LThreeAgvLoadRoller()
- {
- if (LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.NextStart)
- {
-
- AgvToLineThreeLoadRoller();
- AgvFromLineThreeToFryPot();//AGV到2号线体装桶
- AgvLineThreeLoadRollerCom();
- }
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- private void AgvLineThreeLoadRollerCom()
- {
- if (globalVar.agvLineThreeLoadCom)
- {
- globalVar.rollerLineThree.CanRun = true;
- globalVar.agvLineThreeLoadCom = false;
- MessageNotify.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成");
- }
- }
- /// <summary>
- /// AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- //public void FryPotInputMaterial()
- //{
- // if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
- // {
- // while (!agvArriveUnLoad)//等待agv到达炒锅位置
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // AgvArriveFryPotSingleSetDown();
- // FryPotRollerTroubleCheck();
- // if (FryPotAlarm == 1)//炒锅滚筒无故障
- // {
- // //炒锅滚筒进料运行到位处理
- // FryPotInputMaterialRollerOperate();
- // globalVar.InOrOutputLock = true;
- // }
-
- // }
-
- //}
- /// <summary>
- /// 线体1的AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void LOneFryPotInputMaterial()
- {
- if (OutputMaterialQuene.Count > 0 && globalVar.agvArriveUnLoad && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive)
- {
- //if (globalVar.LOneFryPotSerial == 1)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1);
- //}
- //else if (globalVar.LOneFryPotSerial == 4)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4);
- //}
-
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
- AgvArriveFryPotOneOrFourSingleSetDown();
- globalVar.agvArriveUnLoad = false;
- globalVar.PotOneInputMaterialArrive = true;
- FryPotOneRollerTroubleCheck();
- }
- }
-
- public void LOneFallMaterial()
- {
-
- if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
- {
- //if (globalVar.LOneFryPotSerial == 1)
- //{
- // Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- // Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
- //}
- //else
- //{
- // Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- // Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
- //}
- //FryPotOneRollerTroubleCheck();
- if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1) || (FryPotFourAlarm == 1 && globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障
- {
- if (globalVar.LOneFryPotSerial == 1)
- {
-
- 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 }); }));
- }
- else
- {
- 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 }); }));
- }
-
- //炒锅滚筒进料运行到位处理
- FryPotOneOrFourInputMaterialRollerOperate();
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start);
- FryPotOneRollerTroubleCheck();
- globalVar.InOrOutputLock = true;
- globalVar.PotOneOutputRollerArrive = true;
-
-
- }
- }
-
- }
- /// <summary>
- /// 线体2的AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void LTwoFryPotInputMaterial()
- {
- if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
- {
- //if (globalVar.LTwoFryPotSerial == 2)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
- //}
- //else if (globalVar.LTwoFryPotSerial == 5)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
- //}
- MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅下料位置");
- AgvArriveFryPotTwoOrFiveSingleSetDown();
- globalVar.LTwoagvArriveUnLoad = false;
- globalVar.LTwoPotInputMaterialArrive = true;
- FryPotTwoRollerTroubleCheck();
- }
- }
- public void LTwoFallMaterial()
- {
- if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)
- {
- //if (globalVar.LTwoFryPotSerial == 2)
- //{
- // Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- // Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
- //}
- //else
- //{
- // Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- // Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
- //}
-
- if ((FryPotTwoAlarm == 1 && globalVar.LTwoFryPotSerial == 2) || (FryPotFiveAlarm == 1 && globalVar.LTwoFryPotSerial == 5))//炒锅滚筒无故障
- {
- if (globalVar.LTwoFryPotSerial == 2)
- {
-
- 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 }); }));
-
- }
- else
- {
-
- 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 }); }));
- }
-
- //炒锅滚筒进料运行到位处理
- FryPotTwoOrFiveInputMaterialRollerOperate();
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start);
- FryPotTwoRollerTroubleCheck();
- globalVar.LTwoInOrOutputLock = true;
- globalVar.LTwoPotOutputRollerArrive = true;
-
-
- }
- }
- }
- /// <summary>
- /// 线体3的AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void LThreeFryPotInputMaterial()
- {
- if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
- {
- // AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
- MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置");
- AgvArriveFryPotThreeSingleSetDown();
- globalVar.LThreeagvArriveUnLoad = false;
- globalVar.LThreePotInputMaterialArrive = true;
- FryPotThreeRollerTroubleCheck();
- }
- }
-
- public void LThreeFallMaterial()
- {
- if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
- {
- //Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
- //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
-
- if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
- {
- 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 }); }));
-
- //炒锅滚筒进料运行到位处理
- FryPotThreeInputMaterialRollerOperate();
-
- AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start);
- FryPotThreeRollerTroubleCheck();
- globalVar.LThreeInOrOutputLock = true;
- globalVar.LThreePotOutputRollerArrive = true;
-
-
- }
- }
- }
- /// <summary>
- /// 炒锅出桶
- /// </summary>
- //public void FryPotOutputMaterial()
- //{
- // if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
- // {
- // AgvFromFryPotToClean();//上游下发搬运任务给AGV
- // while (!agvArriveUpLoad)//等待agv到达炒锅位置
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // agvArriveUpLoad = false;
- // AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
- // FryPotRollerTroubleCheck();
- // if (FryPotAlarm == 1)//无故障
- // {
- // FryPotOutEmpetyRollerOperate();
- // if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- // {
- // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- // globalVar.AllowAgvToLineLoadRoller = true;
- // globalVar.InOrOutputLock = false;
- // }
- // }
-
- // }
- //}
- /// <summary>
- /// 线体1对应炒锅出桶
- /// </summary>
- public void LOneFryPotOutputMaterial()
- {
- if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1) && OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
- {
- //上游下发搬运任务给AGV
- if (AgvFromFryPotOneOrFourToClean())
- {
- globalVar.AgvArrivePot = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
-
- }
- }
- public void LOneEmptyOperate()
- {
-
- if (globalVar.agvArriveUpLoad && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot)
- {
- if (globalVar.agvFryPotEmptyRollerArrive)
- {
- FryPotOneOrFourOutEmpetyRollerOperate();
- if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
- //if (globalVar.LOneFryPotSerial == 1)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1);
- //}
- //else if (globalVar.LOneFryPotSerial == 4)
- //{
- // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4);
- //}
- globalVar.agvArriveUpLoad = false;
- globalVar.agvFryPotEmptyRollerArrive = false;
- globalVar.InOrOutputLock = false;
- MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineLoadRoller = true;
- globalVar.LoadRoller = false;
- globalVar.AgvToFryPot = false;
- globalVar.PotOneInputMaterialArrive = false;
- globalVar.PotOneOutputRollerArrive = false;
- globalVar.AgvArrivePot = false;
-
- }
- }
- //}
- }
-
-
- }
-
- /// <summary>
- /// 线体2对应炒锅出桶
- /// </summary>
- public void LTwoFryPotOutputMaterial()
- {
- if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
- {
- //上游下发搬运任务给AGV
- if (AgvFromFryPotTwoOrFiveToClean())
- {
- globalVar.LTwoAgvArrivePot = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
-
-
- }
- }
-
- public void LTwoEmptyOperate()
- {
- if (globalVar.agvArriveLTwoUpLoad && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
- {
-
-
- //if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障
- //{
- if (globalVar.LTwoagvFryPotEmptyRollerArrive)
- {
-
- FryPotTwoOrFiveOutEmpetyRollerOperate();
- if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
- //if (globalVar.LTwoFryPotSerial == 2)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
- //}
- //else if (globalVar.LTwoFryPotSerial == 5)
- //{
- // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
- //}
-
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoagvFryPotEmptyRollerArrive = false;
- globalVar.LTwoInOrOutputLock = false;
-
- MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineTwoLoadRoller = true;
- globalVar.LTwoLoadRoller = false;
- globalVar.LTwoAgvToFryPot = false;
- globalVar.LTwoPotInputMaterialArrive = false;
- globalVar.LTwoPotOutputRollerArrive = false;
- globalVar.LTwoAgvArrivePot = false;
-
- }
- }
- //}
- }
-
- }
- /// <summary>
- /// 线体3对应炒锅出桶
- /// </summary>
- public void LThreeFryPotOutputMaterial()
- {
- if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
- {
- //上游下发搬运任务给AGV
- if (AgvFromFryPotThreeToClean())
- {
- globalVar.LThreeAgvArrivePot = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
- }
- }
-
- public void LThreeEmptyOperate()
- {
- if (globalVar.agvArriveLThreeUpLoad && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
- {
- //if (FryPotThreeAlarm == 1)//无故障
- //{
- if (globalVar.LThreeagvFryPotEmptyRollerArrive)
- {
- //FryPotThreeOutEmpetyRollerOperate();
- MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成");
- if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
- //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
-
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeagvFryPotEmptyRollerArrive = false;
- globalVar.LThreeInOrOutputLock = false;
-
- MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineThreeLoadRoller = true;
- globalVar.LThreeLoadRoller = false;
- globalVar.LThreeAgvToFryPot = false;
- globalVar.LThreePotInputMaterialArrive = false;
- globalVar.LThreePotOutputRollerArrive = false;
- globalVar.LThreeAgvArrivePot = false;
-
- }
- }
- // }
- }
-
- }
-
- /// <summary>
- /// 清洗台到4号线体下料
- /// </summary>
- public void EmptyRollerToLinFourFromClean()
- {
-
- if (globalVar.agvArriveLineFour)//agv到达线体4下料位置
- {
- globalVar.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- MessageNotify.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
-
- }
-
- public void EmptyRollerToLinFourFromPot()
- {
- if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置
- {
- globalVar.rollerLineOne.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- MessageNotify.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
- if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置
- {
- globalVar.rollerLineTwo.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- MessageNotify.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
- if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置
- {
- globalVar.rollerLineThree.agvArriveLineFour = false;
- //线体四信号交互
- WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- MessageNotify.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
- // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- }
- }
- ///// <summary>
- ///// 线体1对应炒锅到4号线体下料
- ///// </summary>
- //public void EmptyRollerToLinFourFromLineOne()
- //{
-
-
- // if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置
- // {
- // globalVar.rollerLineOne.agvArriveLineFour = false;
- // //线体四信号交互
- // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- // MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶");
- // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- // }
-
-
- //}
-
- ///// <summary>
- /////线体2对应炒锅到4号线体下料
- ///// </summary>
- //public void EmptyRollerToLinFourFromLineTwo()
- //{
- // if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置
- // {
- // globalVar.rollerLineTwo.agvArriveLineFour = false;
- // //线体四信号交互
- // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- // MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶");
- // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- // }
-
- //}
- ///// <summary>
- ///// 线体3对应炒锅到4号线体下料
- ///// </summary>
- //public void EmptyRollerToLinFourFromLineThree()
- //{
- // if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置
- // {
- // globalVar.rollerLineThree.agvArriveLineFour = false;
- // //线体四信号交互
- // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
- // MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
- // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
- // }
-
- //}
- /// <summary>
- /// 炒锅1,4滚筒进料运行到位处理
- /// </summary>
- public void FryPotOneOrFourInputMaterialRollerOperate()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- //while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【1】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- case 4:
- //while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【4】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- }
- }
- /// <summary>
- /// 炒锅2,5滚筒进料运行到位处理
- /// </summary>
- public void FryPotTwoOrFiveInputMaterialRollerOperate()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- //while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【2】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- case 5:
- //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【5】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- }
- }
- public void FryPotThreeInputMaterialRollerOperate()
- {
- //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【3】:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料");
- }
- /// <summary>
- /// 炒锅滚筒空桶出桶处理
- /// </summary>
- //public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
- //{
- // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 2:
- // while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 3:
- // while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 4:
- // while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
- // case 5:
- // while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
-
- // }
- //}
- /// <summary>
- /// 炒锅1,4滚筒空桶出桶处理
- /// </summary>
- public void FryPotOneOrFourOutEmpetyRollerOperate()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- //while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
- case 4:
- //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
- }
- }
- /// <summary>
- /// 炒锅2,5滚筒空桶出桶处理
- /// </summary>
- public void FryPotTwoOrFiveOutEmpetyRollerOperate()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- //while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
- case 5:
- //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
- }
- }
- /// <summary>
- /// 炒锅3滚筒空桶出桶处理
- /// </summary>
- public void FryPotThreeOutEmpetyRollerOperate()
- {
- //while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成");
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体到炒锅)
- /// </summary>
- public void AgvArriveFryPotSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
- {
- switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
- case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
- case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体1到炒锅)
- /// </summary>
- public void AgvArriveFryPotOneOrFourSingleSetDown()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体2到炒锅)
- /// </summary>
- public void AgvArriveFryPotTwoOrFiveSingleSetDown()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体3到炒锅)
- /// </summary>
- public void AgvArriveFryPotThreeSingleSetDown()
- {
- DeviceOperate.GetInstance.WritePlcData("D1057", 1); //agv到炒锅3送料就位信号
- }
- /// <summary>
- /// 发送agv回桶就位信号至PLC
- /// </summary>
- public void AgvArriveFryPotOutEmptyRollerSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
- {
- switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
- case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
- case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
- }
- }
-
- public void AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
- }
- }
- public void AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
- }
- }
- public void AgvArriveFryPotThreeOutEmptyRollerSingleSetDown()
- {
- DeviceOperate.GetInstance.WritePlcData("D1062", 1);//agv到炒锅3送料就位信号
- }
- ///// <summary>
- ///// AGV离开炒锅运送空桶任务
- ///// </summary>
- //public void AgvFromFryPotToClean(ConcurrentQueue<MaterialInfo> queue)
- //{
- // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // erp: string id = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId)
- // {
- // goto erp;
- // }
- // string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
- // LOnerobotJobId = id;
- // FryCarryTaskErrorCodeAnalysis(info, 1); break;
- // case 2:
- // erp1: string id1 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id1 == LTworobotJobId)
- // {
- // goto erp1;
- // }
- // string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
- // LTworobotJobId = id1;
- // FryCarryTaskErrorCodeAnalysis(info1, 2); break;
- // case 3:
- // erp2: string id2 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id2 == LThreerobotJobId)
- // {
- // goto erp2;
- // }
- // string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
- // LThreerobotJobId = id2;
- // FryCarryTaskErrorCodeAnalysis(info2, 3); break;
- // case 4:
- // erp3: string id3 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id3 == LOnerobotJobId)
- // {
- // goto erp3;
- // }
- // string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
- // LOnerobotJobId = id3;
- // FryCarryTaskErrorCodeAnalysis(info3, 4); break;
- // case 5:
- // erp4: string id4 = Guid.NewGuid().ToString("D");//上游唯一ID
- // if (id4 == LTworobotJobId)
- // {
- // goto erp4;
- // }
- // string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- // LTworobotJobId = id4;
- // FryCarryTaskErrorCodeAnalysis(info4, 5); break;
- // }
- //}
- /// <summary>
- /// AGV离开炒锅1,4运送空桶任务
- /// </summary>
- public bool AgvFromFryPotOneOrFourToClean()
- {
- bool result = true;
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- erp: string id = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- {
- goto erp;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务");
- string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
- LFourrobotJobId = id;
-
- if (!FryCarryTaskErrorCodeAnalysis(info, 1))
- {
- id = String.Empty;
- result = false;
- }
- break;
- case 4:
- erp3: string id3 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id3) != null || LEightrobotJobId.FirstOrDefault(p => p == id3) != null || LNinerobotJobId.FirstOrDefault(p => p == id3) != null || LTenrobotJobId.FirstOrDefault(p => p == id3) != null)
- {
- goto erp3;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务");
- string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
- LFourrobotJobId = id3;
- if (!FryCarryTaskErrorCodeAnalysis(info3, 4))
- {
- id3 = String.Empty;
- result = false;
- }
-
- break;
- }
- return result;
- }
- /// <summary>
- /// AGV离开炒锅2,5运送空桶任务
- /// </summary>
- public bool AgvFromFryPotTwoOrFiveToClean()
- {
- bool result = true;
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- erp1: string id1 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id1) != null || LEightrobotJobId.FirstOrDefault(p => p == id1) != null || LNinerobotJobId.FirstOrDefault(p => p == id1) != null || LTenrobotJobId.FirstOrDefault(p => p == id1) != null)
- {
- goto erp1;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务");
- string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
- LFiverobotJobId = id1;
-
- if (!FryCarryTaskErrorCodeAnalysis(info1, 2))
- {
- id1 = String.Empty;
- result = false;
- }
- break;
- case 5:
- erp4: string id4 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id4) != null || LEightrobotJobId.FirstOrDefault(p => p == id4) != null || LNinerobotJobId.FirstOrDefault(p => p == id4) != null || LTenrobotJobId.FirstOrDefault(p => p == id4) != null)
- {
- goto erp4;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务");
- string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- LFiverobotJobId = id4;
-
- if (!FryCarryTaskErrorCodeAnalysis(info4, 5))
- {
- id4 = String.Empty;
- result = false;
- }
- break;
- }
- return result;
- }
- /// <summary>
- /// AGV离开炒锅3运送空桶任务
- /// </summary>
- public bool AgvFromFryPotThreeToClean()
- {
- bool result = true;
- erp2: string id2 = Guid.NewGuid().ToString("D");//上游唯一ID
- if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id2) != null || LEightrobotJobId.FirstOrDefault(p => p == id2) != null || LNinerobotJobId.FirstOrDefault(p => p == id2) != null || LTenrobotJobId.FirstOrDefault(p => p == id2) != null)
- {
- goto erp2;
- }
- MessageNotify.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务");
- string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
- LSixrobotJobId = id2;
-
- if (!FryCarryTaskErrorCodeAnalysis(info2, 3))
- {
- id2 = string.Empty;
- result = false;
- }
- return result;
- }
- /// <summary>
- /// 处理agv从线体1到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineOneToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)
- {
- if (globalVar.agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
- {
-
- MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(InputMaterialQuene);
- if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
-
- globalVar.LOneCurrentCookingStep++;
- OutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveUpLoad = false;
- globalVar.AgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
- }
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从1号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineOneToClean(ushort emptyRollerNum = 0)
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
-
-
- globalVar.agvArriveLineOneLoadEmptyRoller = false;
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineOneLoadCom)//上料完成
- {
- if (emptyRollerNum != 0)
- globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0);
- globalVar.agvArriveLineOneLoadCom = false;
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV在【1】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 处理agv从线体2到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineTwoToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
- if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
-
- globalVar.LTwoCurrentCookingStep++;
- LTwoOutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoAgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
-
- }
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从2号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineTwoToClean(ushort emptyRollerNum = 0)
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
-
-
- globalVar.agvArriveLineTwoLoadEmptyRoller = false;
-
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineTwoLoadCom)//上料完成
- {
- if (emptyRollerNum != 0)
- globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0);
- globalVar.agvArriveLineTwoLoadCom = false;
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 处理agv从线体3到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineThreeToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
- if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
-
- globalVar.LThreeCurrentCookingStep++;
- LThreeOutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeAgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
-
- }
-
- }
- else //有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从3号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineThreeToClean(ushort emptyRollerNum = 0)
- {
- erp: if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
- {
- MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
-
-
- globalVar.agvArriveLineThreeLoadEmptyRoller = false;
- // globalVar.rollerLineThree.IsEpmtyBefore = false;
-
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineThreeLoadCom)//上料完成
- {
- if (emptyRollerNum != 0)
- globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0);
- globalVar.agvArriveLineThreeLoadCom = false;
- globalVar.rollerLineThree.IsEpmtyBefore = false;
- if (emptyRollerNum != 0)
- MessageNotify.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1)
- {
- Thread.Sleep(1000);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 线体到炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- return false;
- }
- }
- /// <summary>
- /// 线体到清洗台搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装空桶");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- return false;
- }
- }
- /// <summary>
- /// 清洗台到线体搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV从清洗台到{num}号滚筒线卸桶");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- return false;
- }
- }
- /// <summary>
- /// 炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public bool FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageNotify.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
- return true;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
- return false;
- }
- else
- {
- MessageNotify.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
- return false;
- }
- }
-
- public void AgvToLineOneLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障
- {
- if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && !globalVar.LoadRoller)
- {
- if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
- {
- globalVar.rollerLineOne.CanRun = false;
- e: string id = Guid.NewGuid().ToString("D");//32位
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
- string info;
- if (globalVar.LOneFryPotSerial == 1)
- {
- info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
- }
- else
- {
- info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id);
- }
- LOnerobotJobId = id;
- if (LineCarryTaskErrorCodeAnalysis(info, 1))
- {
- globalVar.AllowAgvToLineLoadRoller = false;
- globalVar.LoadRoller = true;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
- }
- //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
- //{
- // globalVar.rollerLineOne.CanRun = true;
- //}
- //else // 工位8上面不是配方料桶或没有桶时
- //{
- // if (!globalVar.rollerLineOne.IsEpmtyBefore)
- // {
- // var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
- // if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
- // {
- // //下发AGV去空桶线洗桶任务
- // e: string id = Guid.NewGuid().ToString("D");
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- // goto e;
-
- // string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
- // LFourrobotJobId = id;
- // Thread.Sleep(500);
- // LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
- // globalVar.rollerLineOne.IsEpmtyBefore = true;
- // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- // }
- // }
- // else
- // {
- // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- // }
- //}
-
- }
- }
- //else
- //{
- // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
- // // lineAlarm = -1;
- //}
- //// lineAlarm = 1;
- }
- public void AgvToLineTwoLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障
- {
- if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && !globalVar.LTwoLoadRoller)
- {
- if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
- {
- globalVar.rollerLineTwo.CanRun = false;
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
- string info;
- if (globalVar.LTwoFryPotSerial == 2)
- {
- info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
- }
- else
- {
- info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id);
- }
- LTworobotJobId = id;
- //Thread.Sleep(500);
- if (LineCarryTaskErrorCodeAnalysis(info, 2))
- {
- globalVar.LTwoLoadRoller = true;
- globalVar.AllowAgvToLineTwoLoadRoller = false;
- }
- else
- {
- Thread.Sleep(5000);
- }
- }
- //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
- //{
- // globalVar.rollerLineTwo.CanRun = true;
- //}
- }
- //else// 工位8上面不是配方料桶或没有桶时
- //{
- // if (!globalVar.rollerLineTwo.IsEpmtyBefore)
- // {
- // var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
- // if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
- // {
- // //下发AGV去空桶线洗桶任务
- // e: string id = Guid.NewGuid().ToString("D");
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- // goto e;
-
- // string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
- // LFiverobotJobId = id;
- // Thread.Sleep(500);
- // LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
- // globalVar.rollerLineTwo.IsEpmtyBefore = true;
- // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
- // }
- // }
- // else
- // {
- // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- // }
- //}
- }
- }
- public void AgvToLineThreeLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障
- {
- if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && !globalVar.LThreeLoadRoller)
- {
- if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
- {
- globalVar.rollerLineThree.CanRun = false;
- e: string id = Guid.NewGuid().ToString("D");
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
- goto e;
-
- string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
- LThreerobotJobId = id;
- //Thread.Sleep(500);
- if (LineCarryTaskErrorCodeAnalysis(info, 3))
- {
- globalVar.LThreeLoadRoller = true;
- globalVar.AllowAgvToLineThreeLoadRoller = false;
- }
- else
- {
- Thread.Sleep(5000);
- }
-
- }
- //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
- //{
- // globalVar.rollerLineThree.CanRun = true;
- //}
- //else // 工位8上面不是配方料桶或没有桶时
- //{
- // if (!globalVar.rollerLineThree.IsEpmtyBefore)
- // {
- // var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
- // if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
- // {
- // //下发AGV去空桶线洗桶任务
- // e: string id = Guid.NewGuid().ToString("D");
- // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- // goto e;
-
- // string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
- // LSixrobotJobId = id;
- // Thread.Sleep(500);
- // LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
- // globalVar.rollerLineThree.IsEpmtyBefore = true;
- // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- // }
- // }
- // else
- // {
- // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- // }
- //}
- }
- }
-
- //if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
- //{
- // if (LThreeInputMaterialQuene.Count > 0)
- // {
- // while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
- // {
- // Thread.Sleep(5);
- // if (globalVar.ExitMainTask)
- // return;
- // }
- // g: string id = Guid.NewGuid().ToString();
- // if (id == LThreerobotJobId)
- // goto g;
- // string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
- // // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
- // LThreerobotJobId = id;
- // Thread.Sleep(500);
- // LineCarryTaskErrorCodeAnalysis(info, 3);
- // }
-
- //}
- //else
- //{
- // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
- // // lineAlarm = -1;
- //}
-
- }
- /// <summary>
- /// 1号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶1重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1200", materialOffset);//桶重1量偏差
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1202", materialOffset);//桶2重量偏差
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1204", materialOffset);//桶3重量偏差
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1206", materialOffset);//桶4重量偏差
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1208", materialOffset);//桶5重量偏差
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1210", materialOffset);//桶6重量偏差
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1212", materialOffset);//桶7重量偏差
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1214", materialOffset);//桶8重量偏差
- break;
-
- }
- }
- /// <summary>
- /// 2号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1216", materialOffset);//桶重1量偏差
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1218", materialOffset);//桶重2量偏差
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1220", materialOffset);//桶重3量偏差
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1222", materialOffset);//桶重4量偏差
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1224", materialOffset);//桶重5量偏差
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1226", materialOffset);//桶重6量偏差
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1228", materialOffset);//桶重7量偏差
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1230", materialOffset);//桶重8量偏差
- break;
-
- }
- }
- /// <summary>
- /// 3号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶1重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1232", materialOffset);//桶重1量偏差
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1234", materialOffset);//桶重2量偏差
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1236", materialOffset);//桶重3量偏差
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1238", materialOffset);//桶重4量偏差
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1240", materialOffset);//桶重5量偏差
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1242", materialOffset);//桶重6量偏差
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1244", materialOffset);//桶重7量偏差
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
- DeviceOperate.GetInstance.WriteRealPlcData("D1246", materialOffset);//桶重8量偏差
- break;
-
- }
-
- }
- /// <summary>
- /// AGV线体进料就位信号下发至PLC
- /// </summary>
- public void AgvArriveLineSingelSetDown(ConcurrentQueue<MaterialInfo> queue)
- {
- switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
- case 2:
- case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
- case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
- }
-
- }
-
- /// <summary>
- /// 炒锅滚筒信号检测
- /// </summary>
- //public void FryPotRollerTroubleCheck()
- //{
- // FryPotAlarm = 0;
- // FryPotTwoAlarm = 0;
- // FryPotThreeAlarm = 0;
- // FryPotFourAlarm = 0;
- // FryPotFiveAlarm = 0;
- // switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- // FryPotAlarm = 1; break;
- // case 2:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
- // FryPotTwoAlarm = 1; break;
- // case 3:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
- // FryPotThreeAlarm = 1; break;
- // case 4:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- // FryPotFourAlarm = 1; break;
- // case 5:
- // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
- // FryPotFiveAlarm = 1; break;
-
- // }
- //}
- /// <summary>
- /// 炒锅1,4滚筒信号检测
- /// </summary>
- public void FryPotOneRollerTroubleCheck()
- {
- FryPotAlarm = 0;
- FryPotFourAlarm = 0;
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- if (AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble == 1)
- {
- FryPotAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障");
- }
- else
- {
- FryPotAlarm = 1; return;
-
- }
- while (AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 4:
- if (AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineOneTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- FryPotFourAlarm = 1; break;
- }
-
- }
- /// <summary>
- /// 炒锅2,5滚筒信号检测
- /// </summary>
- public void FryPotTwoRollerTroubleCheck()
- {
- FryPotTwoAlarm = 0;
- FryPotFiveAlarm = 0;
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- if (AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotTwoAlarm = 1; break;
- case 5:
- if (AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- FryPotFiveAlarm = 1; break;
- }
- }
- /// <summary>
- /// 炒锅3滚筒信号检测
- /// </summary>
- public void FryPotThreeRollerTroubleCheck()
- {
- FryPotThreeAlarm = 0;
- if (AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble == 1)
- {
- Thread.Sleep(1000); if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageNotify.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
- FryPotThreeAlarm = 1;
- }
-
- /// <summary>
- /// PLC线体1配方数据复位功能
- /// </summary>
- public void PlcLineOneRecipeDataReset()
- {
-
- //复位桶号,桶重,,工序
- WritePlcData("D1001", 0);
- WritePlcData("D1002", 0);
- WritePlcData("D1003", 0);
- WritePlcData("D1004", 0);
- WritePlcData("D1005", 0);
- WritePlcData("D1006", 0);
- WritePlcData("D1007", 0);
- WritePlcData("D1008", 0);
- WritePlcData("D1009", 0);
- WritePlcData("D1010", 0);
- WritePlcData("D1011", 0);
- WritePlcData("D1012", 0);
- WritePlcData("D1013", 0);
- WritePlcData("D1014", 0);
- WritePlcData("D1015", 0);
- WritePlcData("D1016", 0);
- WritePlcData("D1017", 0);
- //桶偏差
- DeviceOperate.GetInstance.WriteRealPlcData("D1200", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1202", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1204", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1206", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1208", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1210", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1212", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1214", 0.0F);
- }
- /// <summary>
- /// PLC线体2配方数据复位功能
- /// </summary>
- public void PlcLineTwoRecipeDataReset()
- {
- WritePlcData("D1018", 0);
- WritePlcData("D1019", 0);
- WritePlcData("D1020", 0);
- WritePlcData("D1021", 0);
- WritePlcData("D1022", 0);
- WritePlcData("D1023", 0);
- WritePlcData("D1024", 0);
- WritePlcData("D1025", 0);
- WritePlcData("D1026", 0);
- WritePlcData("D1027", 0);
- WritePlcData("D1028", 0);
- WritePlcData("D1029", 0);
- WritePlcData("D1030", 0);
- WritePlcData("D1031", 0);
- WritePlcData("D1032", 0);
- WritePlcData("D1033", 0);
- WritePlcData("D1034", 0);
-
- DeviceOperate.GetInstance.WriteRealPlcData("D1216", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1218", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1220", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1222", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1224", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1226", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1228", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1230", 0.0F);
- }
- /// <summary>
- /// PLC线体3配方数据复位功能
- /// </summary>
- public void PlcLineThreeRecipeDataReset()
- {
- WritePlcData("D1035", 0);
- WritePlcData("D1036", 0);
- WritePlcData("D1037", 0);
- WritePlcData("D1038", 0);
- WritePlcData("D1039", 0);
- WritePlcData("D1040", 0);
- WritePlcData("D1041", 0);
- WritePlcData("D1042", 0);
- WritePlcData("D1043", 0);
- WritePlcData("D1044", 0);
- WritePlcData("D1045", 0);
- WritePlcData("D1046", 0);
- WritePlcData("D1047", 0);
- WritePlcData("D1048", 0);
- WritePlcData("D1049", 0);
- WritePlcData("D1050", 0);
- WritePlcData("D1051", 0);
-
- DeviceOperate.GetInstance.WriteRealPlcData("D1232", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1234", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1236", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1238", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1240", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1242", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F);
- DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F);
- }
- }
- }
|