|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150 |
- 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;
-
- namespace FryPot_DosingSystem.Control
- {
- internal class DosingLogicControl
- {
- public static DosingLogicControl _instance;
- public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
- /// <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路径
- string LSevenrobotJobId = string.Empty; //从线体1到清洗台路径
- string LEightrobotJobId = string.Empty; //从线体2到清洗台路径
- string LNinerobotJobId = string.Empty; //从线体3到清洗台路径
- string LTenrobotJobId = string.Empty; //从清洗台到线体4路径
-
- 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.agvArriveCleanUnLoad = true;//清洗台空桶下料就位
-
- }), "AgvArriveCleanPlateLoc");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位
-
- }), "AgvArriveCleanPlateLocLoad");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- globalVar.agvArriveLineFour = true;
-
- }), "AgvArriveLineFourLoc");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- EmptyRollerCleanTaskRestart();
-
- }), "EmptyRollerCleanTaskRestart");
-
- #endregion
- //接口调试
- ActionManage.GetInstance.Register(new Action(() =>
- {
- string id = Guid.NewGuid().ToString();
- string errorCode = AGVHelper._Instance.AgvToLineOneLoadRoller(id);
- if (errorCode == "SUCCESS")
- {
- MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功");
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
- }
- }), "AgvDebug");
- 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()
- {
- 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);
- }
- }
- }
- 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);
- }
- }
- }
- 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);
- }
- }
- }
- 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);
- }
- }
- }
- 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);
- }
- }
- }
- }
- /// <summary>
- /// 时间差计算
- /// </summary>
- /// <param name="t">当前时间</param>
- /// <param name="t2">创建时间</param>
- /// <returns></returns>
- private int TimeDiff(DateTime t, DateTime t2)
- {
- long lReturn = -1;
- System.TimeSpan NowValue = new TimeSpan(t.Ticks);
- System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
- System.TimeSpan DateDiff = TimeSpan.Zero;
- try
- {
- //计算时间差
- //DateDiff = TimeValue.Subtract(NowValue).Duration();
- DateDiff = NowValue.Subtract(TimeValue);
- int h = DateDiff.Hours;
- int m = DateDiff.Minutes;
- return DateDiff.Days;
- }
- catch
- {
- return -1;
- }
- }
- /// <summary>
- /// 炒锅数据实时保存
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void SaveFryPotData()
- {
- Task.Run(new Action(() =>
- {
- while (true)
- {
- FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
- }
- }));
- }
-
- /// <summary>
- /// 时间判断,数据处理
- /// </summary>
- private void DateTimeJudge()
- {
- #region sqlite数据库保存
- //if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
- // if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
- // if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
- // if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- //if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
- // if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
-
- //if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
- //{
- // string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
- // if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
- // {
- // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
- // FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
- // }
- //}
- #endregion
- string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
- string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
- string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
- string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
- string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
- if (!Directory.Exists("AccessFile//" + "Statistic"))
- Directory.CreateDirectory("AccessFile//" + "Statistic");
- if (File.Exists(p1))
- {
- using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p2))
- {
- using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p3))
- {
- using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p4))
- {
- using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- if (File.Exists(p5))
- {
- using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
- {
- string time = sReader.ReadLine();
- string statistic = sReader.ReadLine();
- if (DateTime.Now.ToShortDateString() == time)
- {
- FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
- FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
-
- }
- }
- }
- }
-
- /// <summary>
- /// AGV上下料上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvFeedBackUpReportDataAnalysis(object obj)
- {
- //if (obj != null && obj is byte[] datas)
- //{
- //string strData = Encoding.UTF8.GetString(datas);
- Upstreamrequest objData = JsonConvert.DeserializeObject<Upstreamrequest>(obj.ToString());
- if (objData != null)
- {
-
- #region 线体到炒锅
- //线体1请求上下料
- if (objData.robotJobId == LOnerobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LOnerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveUnLoad = true;//AGV到达下料位置
-
- }
- //线体2请求上下料
- if (objData.robotJobId == LTworobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LTworobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.LTwoagvArriveUnLoad = true;//AGV到达下料位置
-
- }
- //线体3请求上下料
- if (objData.robotJobId == LThreerobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LThreerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.LThreeagvArriveUnLoad = true;//AGV到达下料位置
- }
- #endregion
-
- #region 炒锅到线体4请求上下料
- if (objData.robotJobId == LFourrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LFourrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveLineFour = true;//AGV到达下料位置
-
- }
-
- if (objData.robotJobId == LFiverobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LFiverobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveLineFour = true;//AGV到达下料位置
-
- }
-
- if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveLineFour = true;//AGV到达下料位置
- }
- #endregion
- #region 线体到清洗台
- if (objData.robotJobId == LSevenrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
- {
- globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LSevenrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置
-
- }
-
- if (objData.robotJobId == LEightrobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LEightrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置
-
- }
-
- if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置
-
- }
- if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
- {
- globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置
- }
- #endregion
-
- if (objData.robotJobId == LTenrobotJobId && objData.command == "LOAD")
- {
- globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置
- }
- if (objData.robotJobId == LTenrobotJobId && objData.command == "UNLOAD")
- {
- globalVar.agvArriveLineFour = true;//agv到达线体4下料位置
- }
- }
-
- }
-
- /// <summary>
- /// AGV搬运任务上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvTaskUpReportDataAnalysis(object obj)
- {
- //if (obj != null && obj is byte[] datas)
- //{
- // string strData = Encoding.UTF8.GetString(datas);
- AGVToUpSystem objData = JsonConvert.DeserializeObject<AGVToUpSystem>(obj.ToString());
- if (objData != null)
- {
- #region 线体上下料任务信息回报
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
- {
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
- {
- //日志
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
- {
- //日志
- }
- //---------------------空桶从线体去清洗-------------------------------//
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料
- {
- // globalVar.rollerLineOne.IsEpmtyBefore = false;
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料
- {
- // globalVar.rollerLineTwo.IsEpmtyBefore = false;
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料
- {
- // globalVar.rollerLineThree.IsEpmtyBefore = false;
- }
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
- {
-
- AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.Yes);
- 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);
- }
- }
-
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
- {
-
- AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.Yes);
- 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);
- }
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
- {
-
- AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.Yes);
- AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
-
- }
-
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料
- {
- globalVar.agvArriveLineOneLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_1);
- //到清洗处
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料
- {
- globalVar.agvArriveLineTwoLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_2);
- //到清洗处
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料
- {
- globalVar.agvArriveLineThreeLoadCom = true;
- AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_3);
- //到清洗处
-
- }
- //线体1任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
- {
-
- }
- //线体2任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
- {
-
- }
- //线体3任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
- {
-
- }
- //线体1任务上报
- if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料
- {
-
- }
- //线体2任务上报
- if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料
- {
-
- }
- //线体3任务上报
- if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料
- {
-
- }
- #endregion
-
- #region 空桶上下料任务信息回报
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
- {
- //日志
- }
-
- //线体1任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
- {
- globalVar.agvFryPotEmptyRollerArrive = true;
- 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);
- }
- }
- //线体2任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
- {
- globalVar.LTwoagvFryPotEmptyRollerArrive = true;
- 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);
- }
- }
- //线体3任务上报
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
- {
- globalVar.LThreeagvFryPotEmptyRollerArrive = true;
- AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
- }
-
-
- //线体1任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
- }
- }
- //线体2任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
- }
- }
- //线体3任务上报
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
- }
- }
- //线体1任务上报
- if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
- {
- // globalVar.EmptyRollerUnLoadcCom = true;
- AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(1);
- AgvViewModel.GetInstance().Set停车桩(1, IsBool.Yes);
-
- }
- //线体2任务上报
- if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
- {
- // globalVar.EmptyRollerUnLoadcCom = true;
- AgvViewModel.GetInstance().Set小车运动(2, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(2);
- AgvViewModel.GetInstance().Set停车桩(2, IsBool.Yes);
- }
- //线体3任务上报
- if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
- {
- // globalVar.EmptyRollerUnLoadcCom = true;
- AgvViewModel.GetInstance().Set小车运动(3, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(3);
- AgvViewModel.GetInstance().Set停车桩(3, IsBool.Yes);
- }
-
- if (objData.state == "DONE" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体1到清戏台空桶下料
- {
- AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(4);
- AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
- }
- if (objData.state == "DONE" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体2到清戏台空桶下料
- {
- AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(4);
- AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
- }
- if (objData.state == "DONE" && objData.robotJobId == LNinerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体3到清戏台空桶下料
- {
- AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(4);
- AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
- }
- if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料位置上料完成,指清戏台空桶到上料
- {
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.hs_4);//去四号空桶线
-
- }
- if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTenrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指清洗台空桶到线体4下料
- {
- AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No);
- if (globalVar.LFourRollerNum >= 8)
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
- }
- else
- {
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
- }
- }
-
- if (objData.state == "DONE" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指清戏台空桶到线体4下料
- {
- AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj"));
- AgvViewModel.GetInstance().Set小车停止(4);
- AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
-
- }
-
- #endregion
-
-
- }
-
- }
-
- /// <summary>
- /// 主任务重启
- /// </summary>
- private void ResetProgram()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
- {
- MessageLog.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();
- MessageLog.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任务线程");
- MessageLog.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任务线程");
- MessageLog.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任务线程");
- MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
- }));
- }
-
- public void EmptyRollerCleanTaskRestart()
- {
- ThreadManage.GetInstance().StopTask("空桶清洗任务线程", new Action(() =>
- {
- globalVar.rollerLineOne.StationEight = 0;
- globalVar.rollerLineOne.EmptyRollerNums.Clear();
- globalVar.rollerLineOne.EmptyRollerNums.Add(108);
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- // globalVar.rollerLineOne.CanRun = true;
-
- globalVar.rollerLineTwo.StationEight = 0;
- globalVar.rollerLineTwo.EmptyRollerNums.Clear();
- globalVar.rollerLineTwo.EmptyRollerNums.Add(208);
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- //globalVar.rollerLineTwo.CanRun = true;
-
- 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.agvArriveCleanUnLoad = false;
- globalVar.agvArriveLineOneLoadEmptyRoller = false;
- globalVar.agvArriveLineTwoLoadEmptyRoller = false;
- globalVar.agvArriveLineThreeLoadEmptyRoller = false;
- globalVar.agvArriveLineOneLoadCom = false;
- globalVar.agvArriveLineTwoLoadCom = false;
- globalVar.agvArriveLineThreeLoadCom = false;
- ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程");
- MessageLog.GetInstance.ShowUserLog("空桶清洗任务重启成功");
- }));
- }
- /// <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];
- //globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
- //globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
- //globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
- AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
- AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
- AlarmHelper<AlarmInfo>.Alarm.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];
- }));
- 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];
- }));
- 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>.Alarm.FryPotOneRollerTrouble = data[0];
- AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
- AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
- AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble = data[3];
- AlarmHelper<AlarmInfo>.Alarm.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 =>
- {
-
- globalVar.CleadBarrelEnterSingle = data[0];
- }));
- GetAddressData("D2077", new Action<ushort[]>(data =>
- {
-
- globalVar.CleadBarrelExitSingle = data[0];
- }));
- //炒锅1状态数据
- GetFryOneData("D2001", new Action<ushort[]>(data =>
- {
-
- }));
- //炒锅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.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0)
- {
- globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
- }
- if (globalVar.rollerLineTwo.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineTwo.EmptyRollerNum != 0)
- {
- globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum);
- }
- if (globalVar.rollerLineThree.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineThree.EmptyRollerNum != 0)
- {
- globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
- }
- //炒锅状态数据
- 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");
-
- }
-
- 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.ToShortDateString() };
- 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.ToShortDateString() };
- 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))
- {
-
- PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
- 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))
- {
-
- PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
- 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))
- {
-
- PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
- 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))
- {
-
- PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
- 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.ToShortDateString() };
- 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.ToShortDateString() };
- 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.ToShortDateString() };
- 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.ToShortDateString() };
- 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>.Alarm.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>.Alarm.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>.Alarm.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;
- MessageLog.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(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程");
-
- }
-
-
-
- /// <summary>
- /// 线体1的执行流程
- /// </summary>
- public void LineOneProcessExecute()
- {
- //if (!globalVar.LOneTaskLock)
- //{
- // globalVar.LOneTaskLock = true;
- LOneRecipeDataToPlc();
- LOneLoadRoller();
- LOneFryPotInputMaterial();
- LOneFallMaterial();
- LOneFryPotOutputMaterial();
- LOneEmptyOperate();
- // globalVar.LOneTaskLock = false;
- //}
-
- }
- /// <summary>
- /// 线体2的执行流程
- /// </summary>
- public void LineTwoProcessExecute()
- {
- //if (!globalVar.LTwoTaskLock)
- //{
- // globalVar.LTwoTaskLock = true;
- LTwoRecipeDataToPlc();
- LTwoAgvLoadRoller();
- LTwoFryPotInputMaterial();
- LTwoFallMaterial();
- LTwoFryPotOutputMaterial();
- LTwoEmptyOperate();
- // globalVar.LTwoTaskLock = false;
-
- //}
- }
- /// <summary>
- /// 线体3的执行流程
- /// </summary>
- public void LineThreeProcessExecute()
- {
- //if (!globalVar.LThreeTaskLock)
- //{
- // globalVar.LThreeTaskLock = true;
- LThreeRecipeDataToPlc();
- LThreeAgvLoadRoller();
- LThreeFryPotInputMaterial();
- LThreeFallMaterial();
- LThreeFryPotOutputMaterial();
- LThreeEmptyOperate();
- // globalVar.LThreeTaskLock = false;
-
- //}
- }
- private void LineFourProcessExecute()
- {
- //线体123到清洗台
- AgvFromLineToCleanPlate();
- AgvArriveCleanPlate();
- //清洗台到线体4
- CallAgvToLineFour();
- CleanPlateUpLoad();
- EmptyRollerToLinFour();
- }
-
- private void CleanPlateUpLoad()
- {
- if (globalVar.agvArriveCleanLoad)
- {
- globalVar.agvArriveCleanLoad = false;
- MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置");
- MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成");
- AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum);
- AgvViewModel.GetInstance().Set小车是否承载物品(4,IsBool.OnllYes);
- AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_4);
- }
- }
-
- /// <summary>
- /// 线体到清洗台
- /// </summary>
- private void AgvFromLineToCleanPlate()
- {
- if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
- {
- //线体1到清洗台
- if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun)
- {
- var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
- if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
- {
-
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("N");
- 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;
- //globalVar.rollerLineOne.CanRun = false;
- AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- }
- }
- else
- {
- AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- }
- }
- // 线体2到清洗台
- if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
- {
- if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun)
- {
- var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
- if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
- {
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("N");
- 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;
- // globalVar.rollerLineTwo.CanRun = false;
- AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
- }
- }
- else
- {
- AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
- }
- }
- //线体3到清洗台
- if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
- {
- if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun)
- {
- var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
- if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
- {
- //下发AGV去空桶线洗桶任务
- e: string id = Guid.NewGuid().ToString("N");
- 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;
- //globalVar.rollerLineThree.CanRun = false;
- AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- }
- }
- else
- {
- AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
- }
- }
- }
-
- /// <summary>
- /// AGV到达清洗台下料位置
- /// </summary>
- private void AgvArriveCleanPlate()
- {
- if (globalVar.agvArriveCleanUnLoad)
- {
- globalVar.agvArriveCleanUnLoad = false;
- MessageLog.GetInstance.ShowRunLog("空桶到达清洗位置,准备卸桶");
- MessageLog.GetInstance.ShowRunLog("卸桶完成");
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_hj);
- AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
- AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
- //plc交互
- }
- }
-
- /// <summary>
- /// 呼叫Agv从清洗台运洗好的空桶到四号线体
- /// </summary>
- public void CallAgvToLineFour()
- {
- if (globalVar.CleanComplete == 1)
- {
- //是否需要手动给PLC置位??
- globalVar.CleanComplete = 0;
- e: string id = Guid.NewGuid().ToString("N");
- 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.AgvFromCleanToLineFourUnLoadRoller(id);
- LTenrobotJobId = id;
- Thread.Sleep(500);
- MessageLog.GetInstance.ShowRunLog("清洗台呼叫AGV取桶");
- CleanToLineCarryTaskErrorCodeAnalysis(info, 4);
- }
- }
- /// <summary>
- /// 3号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void LThreeRecipeDataToPlc()
- {
- if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe)
- {
- if (globalVar.LThreeCurrentRecipeName != string.Empty)
- {
- MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
- 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)//后续添加其它限制条件
- {
- 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);
- //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());
- MessageLog.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, result.materialCollection[i].MaterialWeight);//3号滚筒线桶号以及重量数据下发
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- LThreeInputMaterialQuene.Clear();
- LThreeErrorRecipe = true;
- return;
- }
- }
- DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
- //AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LThreeFryPotSerial, IsRun.Stop);
- }
- }
-
-
-
- }
- /// <summary>
- /// 2号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- /// <exception cref="NotImplementedException"></exception>
- private void LTwoRecipeDataToPlc()
- {
- if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe)
- {
- if (globalVar.LTwoCurrentRecipeName != string.Empty)
- {
- MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
- 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(2000); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
- }
- }
-
- if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 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}】 配方制作完成");
- 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());
- MessageLog.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 == 1)//炒锅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, result.materialCollection[i].MaterialWeight);//2号滚筒线桶号以及重量数据下发
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- LTwoInputMaterialQuene.Clear();
- LTwoErrorRecipe = true;
- return;
- }
- }
- DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据
-
- }
- }
-
-
-
- }
-
- /// <summary>
- /// 1号滚筒线数据下发 2022/7/4 新增
- /// </summary>
- private void LOneRecipeDataToPlc()
- {
- if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe)
- {
- if (globalVar.LOneCurrentRecipeName != string.Empty)
- {
- MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成");
- 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)//后续添加其它限制条件
- {
- 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);
- }
- 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());
- MessageLog.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, result.materialCollection[i].MaterialWeight);//1号滚筒线桶号以及重量数据下发
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
- InputMaterialQuene.Clear();
- ErrorRecipe = true;
- return;
- }
- }
- DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据
-
- }
- }
-
-
-
- }
-
- /// <summary>
- /// 数据下发PLC
- /// </summary>
- //public void RecipeDataToPlc()
- //{
- // if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
- // {
- // //NewRecipeModel newRecipe = new NewRecipeModel();
- // //MaterialType material = new MaterialType();
- // if (RecipeQuene.TryDequeue(out NewRecipeModel result))
- // {
- // //newRecipe = result;
- // MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方");
- // //for (int k = 0; k < newRecipe.materialCollection.Count - 1; k++)
- // //{
- // // for (int j = 0; j < newRecipe.materialCollection.Count - 1 - k; j++)
- // // {
- // // if (newRecipe.materialCollection[j].MaterialLoc > newRecipe.materialCollection[j + 1].MaterialLoc)
- // // {
- // // material = newRecipe.materialCollection[j];
- // // // newRecipe.materialCollection[j] = null;
- // // newRecipe.materialCollection[j] = newRecipe.materialCollection[j + 1];
- // // // newRecipe.materialCollection[j + 1] = null;
- // // newRecipe.materialCollection[j + 1] = material;
- // // }
- // // }
- // //}
- // for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- // {
- // //将配方中原料加入新的队列
- // InputMaterialQuene.Enqueue(new MaterialInfo()
- // {
- // materialType = result.materialCollection[i],
- // materialId = result.RecipeId
- // });
- // ushort n = result.materialCollection[i].MaterialLoc;
- // switch (n / 100)
- // {
- // case 1:
- // case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发
- // case 2:
- // case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发
- // case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发
- // }
- // }
- // switch (result.materialCollection[0].MaterialLoc / 100)
- // {
- // case 1:
- // DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据
- // case 2:
- // DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据
- // case 3:
- // DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据
- // }
- // }
- // }
-
- //}
- /// <summary>
- /// AGV到配方线体1装桶以及出料到炒锅
- /// </summary>
- //public void AgvLoadRoller()
- //{
- // //lineAlarm = 0;
- // if (InputMaterialQuene.Count > 0)
- // {
- // switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶
- // case 2:
- // case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶
- // case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶
- // }
- // }
-
- //}
- /// <summary>
- /// AGV到配方线体1装桶以及出料到炒锅
- /// </summary>
- public void LOneLoadRoller()
- {
- if (InputMaterialQuene.Count > 0)
- {
- 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;
- MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
- }
- }
-
- /// <summary>
- /// AGV到配方线体2装桶以及出料到炒锅
- /// </summary>
- public void LTwoAgvLoadRoller()
- {
- if (LTwoInputMaterialQuene.Count > 0)
- {
- AgvToLineTwoLoadRoller();
- AgvFromLineTwoToFryPot();//AGV到2号线体装桶
- AgvLineTwoLoadRollerCom();
-
- }
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- private void AgvLineTwoLoadRollerCom()
- {
- if (globalVar.agvLineTwoLoadCom)
- {
- globalVar.rollerLineTwo.CanRun = true;
- globalVar.agvLineTwoLoadCom = false;
- MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
- }
- }
-
- /// <summary>
- /// AGV到配方线体3装桶以及出料到炒锅
- /// </summary>
- public void LThreeAgvLoadRoller()
- {
- if (LThreeInputMaterialQuene.Count > 0)
- {
-
- AgvToLineThreeLoadRoller();
- AgvFromLineThreeToFryPot();//AGV到2号线体装桶
- AgvLineThreeLoadRollerCom();
- }
- }
- /// <summary>
- /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
- /// </summary>
- private void AgvLineThreeLoadRollerCom()
- {
- if (globalVar.agvLineThreeLoadCom)
- {
- globalVar.rollerLineThree.CanRun = true;
- globalVar.agvLineThreeLoadCom = false;
- MessageLog.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);
- //}
-
- MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
- AgvArriveFryPotOneOrFourSingleSetDown();
- globalVar.agvArriveUnLoad = false;
- globalVar.PotOneInputMaterialArrive = true;
- }
- }
-
- 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 || FryPotFourAlarm == 1)//炒锅滚筒无故障
- {
- 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 }); }));
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
- //炒锅滚筒进料运行到位处理
- FryPotOneOrFourInputMaterialRollerOperate();
- AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start);
- 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);
- //}
- MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅下料位置");
- AgvArriveFryPotTwoOrFiveSingleSetDown();
- globalVar.LTwoagvArriveUnLoad = false;
- globalVar.LTwoPotInputMaterialArrive = true;
- }
- }
- 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();//保存数据
- //}
- FryPotTwoRollerTroubleCheck();
- if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障
- {
- 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 }); }));
- }
- AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
- //炒锅滚筒进料运行到位处理
- FryPotTwoOrFiveInputMaterialRollerOperate();
- AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV
- AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start);
- 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);
- MessageLog.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置");
- AgvArriveFryPotThreeSingleSetDown();
- globalVar.LThreeagvArriveUnLoad = false;
- globalVar.LThreePotInputMaterialArrive = true;
- }
- }
-
- 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();//保存数据
- FryPotThreeRollerTroubleCheck();
- 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 }); }));
- AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
- //炒锅滚筒进料运行到位处理
- FryPotThreeInputMaterialRollerOperate();
- AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV
- AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start);
- 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 (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.agvArriveUpLoad && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
- {
-
- MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
- globalVar.agvArriveUpLoad = false;
- globalVar.AgvArrivePot = true;
- }
- }
- public void LOneEmptyOperate()
- {
- if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot)
- {
-
- FryPotOneRollerTroubleCheck();
- if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障
- {
- 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.agvFryPotEmptyRollerArrive = false;
- globalVar.InOrOutputLock = false;
- globalVar.LOneMaterialNum--;
- MessageLog.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.agvArriveLTwoUpLoad && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
- {
-
- MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoAgvArrivePot = true;
- }
- }
-
- public void LTwoEmptyOperate()
- {
- if ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
- {
- FryPotTwoRollerTroubleCheck();
- 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.LTwoagvFryPotEmptyRollerArrive = false;
- globalVar.LTwoInOrOutputLock = false;
- globalVar.LTwoMaterialNum--;
- MessageLog.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.agvArriveLThreeUpLoad && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
- {
- MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置");
- AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeAgvArrivePot = true;
- }
- }
-
- public void LThreeEmptyOperate()
- {
- if (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
- {
- FryPotThreeRollerTroubleCheck();
- if (FryPotThreeAlarm == 1)//无故障
- {
- if (globalVar.LThreeagvFryPotEmptyRollerArrive)
- {
- FryPotThreeOutEmpetyRollerOperate();
- if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
- //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
- globalVar.LThreeagvFryPotEmptyRollerArrive = false;
- globalVar.LThreeInOrOutputLock = false;
- globalVar.LThreeMaterialNum--;
- MessageLog.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 EmptyRollerToLinFour()
- {
- if (globalVar.agvArriveLineFour)//agv到达线体4下料位置
- {
- globalVar.agvArriveLineFour = false;
- //线体四信号交互
- MessageLog.GetInstance.ShowRunLog("AGV到达【4】号回收线体,准备卸桶");
- MessageLog.GetInstance.ShowRunLog("卸桶完成");
- AgvViewModel.GetInstance().Set滚筒线状态(4,IsRun.Start);
- AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
- AgvViewModel.GetInstance().Set小车是否承载物品(4,IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(4,CartMotionTrajectory.hj);
- AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes);
- }
- }
- ///// <summary>
- ///// 2号线体对应空桶清洗
- ///// </summary>
- //public void LTwoEmptyRollerToLineFour()
- //{
- // if (globalVar.LTwoEmptyRollerUnLoadcCom)//agv在4号线体下料完成
- // {
- // globalVar.AllowAgvToLineTwoLoadRoller = true;
- // globalVar.LTwoLoadRoller = false;
- // globalVar.LTwoAgvToFryPot = false;
- // globalVar.LTwoPotInputMaterialArrive = false;
- // globalVar.LTwoPotOutputRollerArrive = false;
- // globalVar.LTwoAgvArrivePot = false;
- // }
- //}
- ///// <summary>
- ///// 3号线体对应空桶清洗
- ///// </summary>
- //public void LThreeEmptyRollerToLinFour()
- //{
- // if (globalVar.LThreeEmptyRollerUnLoadcCom)//agv在4号线体下料完成
- // {
- // globalVar.AllowAgvToLineThreeLoadRoller = true;
- // globalVar.LThreeLoadRoller = false;
- // globalVar.LThreeAgvToFryPot = false;
- // globalVar.LThreePotInputMaterialArrive = false;
- // globalVar.LThreePotOutputRollerArrive = false;
- // globalVar.LThreeAgvArrivePot = false;
- // }
- //}
-
- /// <summary>
- /// 炒锅滚筒进料运行到位处理
- /// </summary>
- //public void FryPotInputMaterialRollerOperate(ConcurrentQueue<MaterialInfo> queue)
- //{
- // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
- // {
- // case 1:
- // while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- // case 2:
- // while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- // case 3:
- // while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- // case 4:
- // while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- // case 5:
- // while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
- // {
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- // }
- // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- // }
-
- //}
- /// <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;
- //}
- MessageLog.GetInstance.ShowRunLog($"炒锅【1】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- case 4:
- //while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageLog.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;
- //}
- MessageLog.GetInstance.ShowRunLog($"炒锅【2】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- case 5:
- //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageLog.GetInstance.ShowRunLog($"炒锅【5】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
- }
- }
- public void FryPotThreeInputMaterialRollerOperate()
- {
- //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageLog.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;
- //}
- MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
- case 4:
- //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageLog.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;
- //}
- MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
- case 5:
- //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
- //{
- // Thread.Sleep(5); if (globalVar.ExitMainTask)
- // return;
- //}
- MessageLog.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;
- //}
- MessageLog.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("N");//上游唯一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("N");//上游唯一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("N");//上游唯一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("N");//上游唯一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("N");//上游唯一ID
- // if (id4 == LTworobotJobId)
- // {
- // goto erp4;
- // }
- // string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- // LTworobotJobId = id4;
- // FryCarryTaskErrorCodeAnalysis(info4, 5); break;
- // }
- //}
- /// <summary>
- /// AGV离开炒锅1,4运送空桶任务
- /// </summary>
- public void AgvFromFryPotOneOrFourToClean()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
- {
- goto erp;
- }
- MessageLog.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务");
- string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
- LFourrobotJobId = id;
- FryCarryTaskErrorCodeAnalysis(info, 1); break;
- case 4:
- erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || id3 == LSevenrobotJobId || id3 == LEightrobotJobId || id3 == LNinerobotJobId || id3 == LTenrobotJobId)
- {
- goto erp3;
- }
- MessageLog.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务");
- string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
- LFourrobotJobId = id3;
- FryCarryTaskErrorCodeAnalysis(info3, 4); break;
- }
- }
- /// <summary>
- /// AGV离开炒锅2,5运送空桶任务
- /// </summary>
- public void AgvFromFryPotTwoOrFiveToClean()
- {
- switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 2:
- erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || id1 == LSevenrobotJobId || id1 == LEightrobotJobId || id1 == LNinerobotJobId || id1 == LTenrobotJobId)
- {
- goto erp1;
- }
- MessageLog.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务");
- string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
- LFiverobotJobId = id1;
- FryCarryTaskErrorCodeAnalysis(info1, 2); break;
- case 5:
- erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || id4 == LSevenrobotJobId || id4 == LEightrobotJobId || id4 == LNinerobotJobId || id4 == LTenrobotJobId)
- {
- goto erp4;
- }
- MessageLog.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务");
- string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- LFiverobotJobId = id4;
- FryCarryTaskErrorCodeAnalysis(info4, 5); break;
- }
- }
- /// <summary>
- /// AGV离开炒锅3运送空桶任务
- /// </summary>
- public void AgvFromFryPotThreeToClean()
- {
- erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || id2 == LSevenrobotJobId || id2 == LEightrobotJobId || id2 == LNinerobotJobId || id2 == LTenrobotJobId)
- {
- goto erp2;
- }
- MessageLog.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务");
- string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
- LSixrobotJobId = id2;
- FryCarryTaskErrorCodeAnalysis(info2, 3);
- }
- /// <summary>
- /// 处理agv从线体1到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineOneToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
- {
- if (globalVar.agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
- {
-
- MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(InputMaterialQuene);
- if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
- AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
- globalVar.LOneCurrentCookingStep++;
- OutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveUpLoad = false;
- globalVar.AgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
- }
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
- {
- Thread.Sleep(5);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从1号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineOneToClean(ushort emptyRollerNum)
- {
- erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
- {
- MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
- MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
- AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
- globalVar.LOneMaterialNum--;
- globalVar.agvArriveLineOneLoadEmptyRoller = false;
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineOneLoadCom)//上料完成
- {
- globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0);
- globalVar.agvArriveLineOneLoadCom = false;
- globalVar.rollerLineOne.IsEpmtyBefore = false;
- MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成{emptyRollerNum}号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
- {
- Thread.Sleep(5);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 处理agv从线体2到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineTwoToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
- {
- MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
- if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
- AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
- globalVar.LTwoCurrentCookingStep++;
- LTwoOutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveLTwoUpLoad = false;
- globalVar.LTwoAgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
-
- }
-
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
- {
- Thread.Sleep(5);
- if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从2号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineTwoToClean(ushort emptyRollerNum)
- {
- erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
- {
- MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
- MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
- AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
- globalVar.LTwoMaterialNum--;
- globalVar.agvArriveLineTwoLoadEmptyRoller = false;
-
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineTwoLoadCom)//上料完成
- {
- globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0);
- globalVar.agvArriveLineTwoLoadCom = false;
- globalVar.rollerLineTwo.IsEpmtyBefore = false;
- MessageLog.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
- {
- Thread.Sleep(5);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 处理agv从线体3到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineThreeToFryPot()
- {
- erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
- {
- MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
- AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
- if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
- AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
- globalVar.LThreeCurrentCookingStep++;
- LThreeOutputMaterialQuene.Enqueue(materialInfo);
- globalVar.agvArriveLThreeUpLoad = false;
- globalVar.LThreeAgvToFryPot = true;
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
-
- }
-
- }
- else //有故障
- {
- while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
- {
- Thread.Sleep(5);
- if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// Agv从3号线体运空桶到清洗处
- /// </summary>
- public void AgvFromLineThreeToClean(ushort emptyRollerNum)
- {
- erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
- {
- if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
- {
- MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
- DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
- MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
- AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
- globalVar.LThreeMaterialNum--;
- globalVar.agvArriveLineThreeLoadEmptyRoller = false;
- // globalVar.rollerLineThree.IsEpmtyBefore = false;
-
- //原料到位,agv到位,agv自行运料到清洗处
- }
- if (globalVar.agvArriveLineThreeLoadCom)//上料完成
- {
- globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0);
- globalVar.agvArriveLineThreeLoadCom = false;
- globalVar.rollerLineThree.IsEpmtyBefore = false;
- MessageLog.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
- }
- }
- else//有故障
- {
- while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
- {
- Thread.Sleep(5);
- if (globalVar.ExitLineOneTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
-
- }
- /// <summary>
- /// 线体到炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
- AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(num, AgvViewModel.GetInstance().GetCommandValue($"qc_{num}"));
- MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
- globalVar.AllowAgvToLineLoadRoller = false;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- }
- }
- /// <summary>
- /// 线体到清洗台搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public void LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
- AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue($"tqx_{num}"));
- MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- }
- }
- /// <summary>
- /// 清洗台到线体搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public void CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
- AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No);
- AgvViewModel.GetInstance().Set小车运动(num, CartMotionTrajectory.jtqx);
- MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线卸桶");
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
- }
- }
- /// <summary>
- /// 炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
- }
- }
-
- public void AgvToLineOneLoadRoller()
- {
- if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
- {
- if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && globalVar.rollerLineOne.OutMaterialingSingle == 1 && !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("N");
- 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.AgvToLineOneLoadRoller(id);
- LOnerobotJobId = id;
- Thread.Sleep(500);
- LineCarryTaskErrorCodeAnalysis(info, 1);
- globalVar.LoadRoller = true;
- }
- //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("N");
- // 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>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
- {
- if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && globalVar.rollerLineTwo.OutMaterialingSingle == 1 && !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("N");
- 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.AgvToLineTwoLoadRoller(id);
- LTworobotJobId = id;
- Thread.Sleep(500);
- LineCarryTaskErrorCodeAnalysis(info, 2);
- globalVar.LTwoLoadRoller = true;
- }
- //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("N");
- // 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>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
- {
- if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && globalVar.rollerLineThree.OutMaterialingSingle == 1 && !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("N");
- 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.AgvToLineThreeLoadRoller(id);
- LThreerobotJobId = id;
- Thread.Sleep(500);
- LineCarryTaskErrorCodeAnalysis(info, 3);
- globalVar.LThreeLoadRoller = true;
- }
- //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("N");
- // 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)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶2重量
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶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)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶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)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶2重量
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶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>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
- {
- Thread.Sleep(5); if (globalVar.ExitLineOneTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 4:
- if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
- {
- Thread.Sleep(5); if (globalVar.ExitLineOneTask)
- return;
- }
- MessageLog.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>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
- {
- Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotTwoAlarm = 1; break;
- case 5:
- if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
- {
- Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- FryPotFiveAlarm = 1; break;
- }
- }
- /// <summary>
- /// 炒锅3滚筒信号检测
- /// </summary>
- public void FryPotThreeRollerTroubleCheck()
- {
- FryPotThreeAlarm = 0;
- if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
- {
- Thread.Sleep(5); if (globalVar.ExitLineThreeTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
- FryPotThreeAlarm = 1;
- }
-
- }
- }
|