1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069 |
- using Sunny.UI;
- using System;
- using System.Collections;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace HRT_Measure
- {
- public class ReadPLCHelp
- {
- public static WindowDisplay EnumWindowDisplay = WindowDisplay.主界面;
- public static Dictionary<string ,string> dictM01 = new Dictionary<string ,string>();
- public static Dictionary<string, string> dictM02 = new Dictionary<string, string>();
- public static Dictionary<string, string> dictM04 = new Dictionary<string, string>();
- public static Thread thReadPLCM01M02 = new Thread(new ThreadStart(ThReadPLCM01M02));
- public static Thread thReadPLCM03 = new Thread(new ThreadStart(ThReadPLCM03));
- public static Thread thReadPLCM04M05 = new Thread(new ThreadStart(ThReadPLCM04M05));
- public static Thread thPressure = new Thread(new ThreadStart(ThPressure));
- public static int iM01M02IOStation = 0;
- public static int iM03IOStation = 0;
- public static int iM04M05IOStation = 0;
- public static int iM01M02AxisStation = 0;
- public static int iM03AxisStation = 0;
- public static int iM04M05AxisStation = 0;
- //public static bool isM01M02Show = false;
- //public static bool isM03Show = false;
- //public static bool isM04M05Show = false;
- //public static bool isWeightShow = false;
- //压机
- public static List<string> listPressureStr = new List<string>();
- public static Dictionary<string, ClsPressure> dictPressure = new Dictionary<string, ClsPressure>();
- public static string str主缸当前位置 = "";
- public static string str主缸当前压力 = "";
- //public static bool is记录保压数据 = false;
- public static ConcurrentQueue<short> queuePressureSignals = new ConcurrentQueue<short>();
- public static UpTrigger upTrigger = new UpTrigger();
- //称重
- public static string strWeightStartAdd = "DB136.502.4";//称重开始信号
- //public static bool isWeightStart = false;
- public static string[] arrWeightStartSignalsAdd = new string[10] { "DB31.0", "DB31.2", "DB31.4", "DB31.6", "DB31.8", "DB31.10", "DB31.12", "DB31.14", "DB31.16", "DB31.18" };
- public static short[] arrShortWeightStart = new short[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- public static string[] arrWeightDoneAdd = new string[10] { "DB31.20", "DB31.24", "DB31.28", "DB31.32", "DB31.36", "DB31.40", "DB31.44", "DB31.48", "DB31.52", "DB31.56" };
- public static string[] arrWeightDoneStatus = new string[10] { "DB31.60", "DB31.62", "DB31.64", "DB31.66", "DB31.68", "DB31.70", "DB31.72", "DB31.74", "DB31.76", "DB31.78" };
- //public static int[] arrWeightValue = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- public static void GetPressureInfo()
- {
- listPressureStr.Clear();
- #region MyRegion
- listPressureStr.Add("主缸位置,D5,short,0.1");
- listPressureStr.Add("位置修正值,D235,short,0.1");
- listPressureStr.Add("主缸压力,D4,short,0.1");
- //listPressureStr.Add("位置应用值,D5,short");
- listPressureStr.Add("当前动作,D10,short,1");
- listPressureStr.Add("动作提示,D11,short,1");
- listPressureStr.Add("设定1压力,D12,short,0.1");
- listPressureStr.Add("设定1流量,D13,short,1");
- listPressureStr.Add("顶缸位移,D106,short,0.1");
- listPressureStr.Add("主缸速度,D125,short,0.1");
- listPressureStr.Add("顶缸速度,D127,short,0.1");
- listPressureStr.Add("设定1压力模拟量,D130,short,1");
- listPressureStr.Add("设定1流量模拟量,D134,short,1");
- listPressureStr.Add("保压倒计时,D180,short,1");
- listPressureStr.Add("泄压倒计时,D185,short,1");
- listPressureStr.Add("主缸压力设定,D200,short,0.1");
- listPressureStr.Add("泄压延时设置,D202,short,0.1");
- listPressureStr.Add("保压延时设定,D203,short,0.1");
- listPressureStr.Add("顶出停止位置设定,D206,short,0.1");
- listPressureStr.Add("快退减速位置设定,D207,short,0.1");
- listPressureStr.Add("慢速顶出位置设定,D209,short,0.1");
- listPressureStr.Add("快速退回位置设定,D210,short,0.1");
- listPressureStr.Add("退回停止位置设定,D211,short,0.1");
- listPressureStr.Add("快上压力,D220,short,0.1");
- listPressureStr.Add("快上流量,D221,short,1");
- listPressureStr.Add("慢上压力,D222,short,0.1");
- listPressureStr.Add("慢上流量,D223,short,1");
- listPressureStr.Add("减退压力,D224,short,0.1");
- listPressureStr.Add("减退流量,D225,short,1");
- listPressureStr.Add("慢退压力,D226,short,0.1");
- listPressureStr.Add("慢退流量,D227,short,1");
- listPressureStr.Add("快退压力,D228,short,0.1");
- listPressureStr.Add("快退流量,D229,short,1");
- //listPressureStr.Add("位置修正值,D235,short,0.1");
- listPressureStr.Add("位置应用值,D245,short,0.1");
- listPressureStr.Add("工件计数,D400,short,1");
- listPressureStr.Add("设定计数,D401,short,1");
- listPressureStr.Add("第一次压力,D284,short,0.1");
- listPressureStr.Add("第二次压力,D262,short,0.1");
- listPressureStr.Add("第三次压力,D264,short,0.1");
- listPressureStr.Add("第一次保压时间,D266,short,0.1");
- listPressureStr.Add("第二次保压时间,D268,short,0.1");
- listPressureStr.Add("第三次保压时间,D270,short,0.1");
- listPressureStr.Add("第一次顶出停止位置,D272,short,0.1");
- listPressureStr.Add("第二次顶出停止位置,D274,short,0.1");
- listPressureStr.Add("第三次顶出停止位置,D276,short,0.1");
- listPressureStr.Add("第一次顶出减速位置,D278,short,0.1");
- listPressureStr.Add("第二次顶出减速位置,D280,short,0.1");
- listPressureStr.Add("第三次顶出减速位置,D282,short,0.1");
- #endregion
- dictPressure.Clear();
- for (int i = 0; i < listPressureStr.Count; i++)
- {
- ClsPressure clsPressure = new ClsPressure(listPressureStr[i]);
- dictPressure.Add(clsPressure.Name, clsPressure);
- }
- queuePressureSignals.Clear();
- }
- public static void LoadPLCAdd()
- {
- dictM01.Clear();
- dictM02.Clear();
- dictM04.Clear();
- dictPressure.Clear();
- #region M01M02M04M05
- //M01
- dictM01.Add("药A暂存当前盒数", "DB20.476");
- dictM01.Add("药B暂存当前盒数", "DB20.478");
- dictM01.Add("抛盖暂存槽当前数量", "DB20.492");
- dictM01.Add("空桶暂存槽当前数量", "DB20.490");
- //M02
- dictM02.Add("药A称重配比重量", "DB14.20");
- dictM02.Add("A料仓1当前重量", "DB20.76");
- dictM02.Add("A料仓2当前重量", "DB20.80");
- dictM02.Add("A料仓3当前重量", "DB20.84");
- dictM02.Add("A料仓4当前重量", "DB20.88");
- dictM02.Add("A料仓5当前重量", "DB20.92");
- dictM02.Add("药B称重配比重量", "DB14.24");
- dictM02.Add("B料仓1当前重量", "DB20.96");
- dictM02.Add("B料仓2当前重量", "DB20.100");
- dictM02.Add("B料仓3当前重量", "DB20.104");
- dictM02.Add("B料仓4当前重量", "DB20.108");
- dictM02.Add("B料仓5当前重量", "DB20.112");
- //M04
- dictM04.Add("允许下料", "DB186.26.0");
- dictM04.Add("当前检测高度", "DB31.50");
- dictM04.Add("当前重量", "DB31.8");
- dictM04.Add("产品高度", "DB80.0");
- dictM04.Add("产品重量", "DB80.4");
- dictM04.Add("相机结果", "DB80.8");
- dictM04.Add("废料数量", "DB80.12");
- dictM04.Add("合格数量", "DB80.16");
- dictM04.Add("盘数", "DB80.20");
- dictM04.Add("NG数量", "DB80.22");
- dictM04.Add("本次完成箱子数量", "DB80.26");
- dictM04.Add("产品信息打包上传", "DB80.40.0");
- #endregion
- GetPressureInfo();
- thReadPLCM01M02.IsBackground = true;
- thReadPLCM01M02.Start();
- thReadPLCM03.IsBackground = true;
- thReadPLCM03.Start();
- thReadPLCM04M05.IsBackground = true;
- thReadPLCM04M05.Start();
- thPressure.IsBackground = true;
- thPressure.Start();
- }
- #region GetValue
- #region M01M02
- public static void GetM01M02InitValue(PLCInitIO plcInitIO, CommPLC commPLC)
- {
- try
- {
- plcInitIO.isHandOrAuto = plcInitIO.HandOrAutoAdd != "" ? GetM01M02BoolValue(plcInitIO.HandOrAutoAdd, commPLC) : false;
- plcInitIO.isInitDone = plcInitIO.InitDoneAdd != "" ? GetM01M02BoolValue(plcInitIO.InitDoneAdd, commPLC) : false;
- plcInitIO.isAutoRunning = plcInitIO.AutoRunningAdd != "" ? GetM01M02BoolValue(plcInitIO.AutoRunningAdd, commPLC) : false;
- plcInitIO.isAlm = plcInitIO.AlmAdd != "" ? GetM01M02BoolValue(plcInitIO.AlmAdd, commPLC) : false;
- plcInitIO.isWait = plcInitIO.WaitAdd != "" ? GetM01M02BoolValue(plcInitIO.WaitAdd, commPLC) : false;
- plcInitIO.isBtnInit = plcInitIO.btnInitAdd != "" ? GetM01M02BoolValue(plcInitIO.btnInitAdd, commPLC) : false;
- plcInitIO.isBtnExceptionQuit = plcInitIO.btnExcetionQuitAdd != "" ? GetM01M02BoolValue(plcInitIO.btnExcetionQuitAdd, commPLC) : false;
- plcInitIO.isBtnStop = plcInitIO.btnStopAdd != "" ? GetM01M02BoolValue(plcInitIO.btnStopAdd, commPLC) : false;
- plcInitIO.isBtnStart = plcInitIO.btnStartAdd != "" ? GetM01M02BoolValue(plcInitIO.btnStartAdd, commPLC) : false;
- plcInitIO.isBtnHandOrAuto = plcInitIO.btnHandOrAutoAdd != "" ? GetM01M02BoolValue(plcInitIO.btnHandOrAutoAdd, commPLC) : false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- public static void GetM01M02AlmValue(Dictionary <string,ClsAlm> dictAlm, CommPLC commPLC)
- {
- foreach (var item in dictAlm)
- {
- try
- {
- item.Value.isAlm = item.Value.AlmAdd != "" ? GetM01M02BoolValue(item.Value.AlmAdd, commPLC) : false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- }
- public static void GetM01M02CylinderValue(Dictionary<string,ClsPLCIO> dictIO, CommPLC commPLC)
- {
- foreach (var item in dictIO)
- {
- try
- {
- item.Value.isLedResetOn = item.Value.LedResetAdd != "" ? GetM01M02BoolValue(item.Value.LedResetAdd, commPLC) : false ;
- item.Value.isLedSetOn = item.Value.LedSetAdd != "" ? GetM01M02BoolValue(item.Value.LedSetAdd, commPLC): false;
- item.Value.isSensorResetOn = item.Value.SensorResetAdd != "" ? GetM01M02BoolValue(item.Value.SensorResetAdd, commPLC): false;
- item.Value.isSensorSetOn = item.Value.SensorSetAdd != "" ? GetM01M02BoolValue(item.Value.SensorSetAdd, commPLC): false;
- item.Value.isResetEnableOn = item.Value.ResetEnableAdd != "" ? GetM01M02BoolValue(item.Value.ResetEnableAdd, commPLC): false;
- item.Value.isSetEnableOn = item.Value.SetEnableAdd != "" ? GetM01M02BoolValue(item.Value.SetEnableAdd, commPLC): false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- //Thread.Sleep(1);
- }
- }
- public static void GetM01M02AxisPos(Dictionary<string,ClsAxisPos> dictAxisPos,CommPLC commPLC)
- {
- try
- {
- foreach (var item in dictAxisPos)
- {
- item.Value.isLightOn = item.Value.LightAdd != "" ? GetM01M02BoolValue(item.Value.LightAdd, commPLC) : false;
- commPLC.ReadUshort(item.Value.GoAdd, out item.Value.GoCurrValue,out string str );
- //Thread.Sleep(1);
- }
- }
- catch (Exception )
- {
- // MessageBox.Show(ex.ToString());
- }
- }
- public static void GetM01M02Axis(ClsAxis dictAxis, CommPLC commPLC)
- {
- try
- {
- dictAxis.is使能完成 = dictAxis.使能完成 != "" ? GetM01M02BoolValue(dictAxis.使能完成, commPLC) : false;
- dictAxis.is运行允许 = dictAxis.运行允许 != "" ? GetM01M02BoolValue(dictAxis.运行允许, commPLC) : false;
- dictAxis.is异常 = dictAxis.异常 != "" ? GetM01M02BoolValue(dictAxis.异常, commPLC) : false;
- dictAxis.isPositiveLimitOn = dictAxis.正极限 != "" ? GetM01M02BoolValue(dictAxis.正极限, commPLC) : false;
- dictAxis.isOriginalLimitOn = dictAxis.原点 != "" ? GetM01M02BoolValue(dictAxis.原点, commPLC) : false;
- dictAxis.isNegativeLimitOn = dictAxis.负极限 != "" ? GetM01M02BoolValue(dictAxis.负极限, commPLC) : false;
- dictAxis.is轴使能 = dictAxis.轴使能 != "" ? GetM01M02BoolValue(dictAxis.轴使能, commPLC) : false;
- dictAxis.i当前位置 = GetM01M02IntValue(dictAxis.当前位置, commPLC);
- dictAxis.s异常代码 = GetM01M02Int16Value(dictAxis.异常代码, commPLC);
- dictAxis.i点动速度 = GetM01M02IntValue(dictAxis.点动速度, commPLC);
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- #endregion
- #region M03
- public static void GetM03InitValue(PLCInitIO plcInitIO, CommPLC commPLC)
- {
- try
- {
- plcInitIO.isHandOrAuto = plcInitIO.HandOrAutoAdd != "" ? GetM03BoolValue(plcInitIO.HandOrAutoAdd, commPLC) : false;
- plcInitIO.isInitDone = plcInitIO.InitDoneAdd != "" ? GetM03BoolValue(plcInitIO.InitDoneAdd, commPLC) : false;
- plcInitIO.isAutoRunning = plcInitIO.AutoRunningAdd != "" ? GetM03BoolValue(plcInitIO.AutoRunningAdd, commPLC) : false;
- plcInitIO.isAlm = plcInitIO.AlmAdd != "" ? GetM03BoolValue(plcInitIO.AlmAdd, commPLC) : false;
- plcInitIO.isWait = plcInitIO.WaitAdd != "" ? GetM03BoolValue(plcInitIO.WaitAdd, commPLC) : false;
- plcInitIO.isBtnInit = plcInitIO.btnInitAdd != "" ? GetM03BoolValue(plcInitIO.btnInitAdd, commPLC) : false;
- plcInitIO.isBtnExceptionQuit = plcInitIO.btnExcetionQuitAdd != "" ? GetM03BoolValue(plcInitIO.btnExcetionQuitAdd, commPLC) : false;
- plcInitIO.isBtnStop = plcInitIO.btnStopAdd != "" ? GetM03BoolValue(plcInitIO.btnStopAdd, commPLC) : false;
- plcInitIO.isBtnStart = plcInitIO.btnStartAdd != "" ? GetM03BoolValue(plcInitIO.btnStartAdd, commPLC) : false;
- plcInitIO.isBtnHandOrAuto = plcInitIO.btnHandOrAutoAdd != "" ? GetM03BoolValue(plcInitIO.btnHandOrAutoAdd, commPLC) : false;
- }
- catch (Exception)
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- public static void GetM03AlmValue(Dictionary<string, ClsAlm> dictAlm, CommPLC commPLC)
- {
- foreach (var item in dictAlm)
- {
- try
- {
- item.Value.isAlm = item.Value.AlmAdd != "" ? GetM03BoolValue(item.Value.AlmAdd, commPLC) : false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- }
- public static void GetM03CylinderValue(Dictionary<string, ClsPLCIO> dictIO, CommPLC commPLC)
- {
- foreach (var item in dictIO)
- {
- try
- {
- item.Value.isLedResetOn = item.Value.LedResetAdd != "" ? GetM03BoolValue(item.Value.LedResetAdd, commPLC) : false;
- item.Value.isLedSetOn = item.Value.LedSetAdd != "" ? GetM03BoolValue(item.Value.LedSetAdd, commPLC) : false;
- item.Value.isSensorResetOn = item.Value.SensorResetAdd != "" ? GetM03BoolValue(item.Value.SensorResetAdd, commPLC) : false;
- item.Value.isSensorSetOn = item.Value.SensorSetAdd != "" ? GetM03BoolValue(item.Value.SensorSetAdd, commPLC) : false;
- item.Value.isResetEnableOn = item.Value.ResetEnableAdd != "" ? GetM03BoolValue(item.Value.ResetEnableAdd, commPLC) : false;
- item.Value.isSetEnableOn = item.Value.SetEnableAdd != "" ? GetM03BoolValue(item.Value.SetEnableAdd, commPLC) : false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- //Thread.Sleep(1);
- }
- }
- public static void GetM03AxisPos(Dictionary<string, ClsAxisPos> dictAxisPos, CommPLC commPLC)
- {
- try
- {
- foreach (var item in dictAxisPos)
- {
- item.Value.isLightOn = item.Value.LightAdd != "" ? GetM03BoolValue(item.Value.LightAdd, commPLC) : false;
- commPLC.ReadUshort(item.Value.GoAdd, out item.Value.GoCurrValue, out string str);
- Thread.Sleep(1);
- }
-
- }
- catch (Exception )
- {
- // MessageBox.Show(ex.ToString());
- }
- }
- public static void GetM03Axis(ClsAxis dictAxis, CommPLC commPLC)
- {
- try
- {
- dictAxis.is使能完成 = dictAxis.使能完成 != "" ? GetM03BoolValue(dictAxis.使能完成, commPLC) : false;
- dictAxis.is运行允许 = dictAxis.运行允许 != "" ? GetM03BoolValue(dictAxis.运行允许, commPLC) : false;
- dictAxis.is异常 = dictAxis.异常 != "" ? GetM03BoolValue(dictAxis.异常, commPLC) : false;
- dictAxis.isPositiveLimitOn = dictAxis.正极限 != "" ? GetM03BoolValue(dictAxis.正极限, commPLC) : false;
- dictAxis.isOriginalLimitOn = dictAxis.原点 != "" ? GetM03BoolValue(dictAxis.原点, commPLC) : false;
- dictAxis.isNegativeLimitOn = dictAxis.负极限 != "" ? GetM03BoolValue(dictAxis.负极限, commPLC) : false;
- dictAxis.i当前位置 = GetM03IntValue(dictAxis.当前位置, commPLC);
- dictAxis.s异常代码 = GetM03Int16Value(dictAxis.异常代码, commPLC);
- dictAxis.i点动速度 = GetM03IntValue(dictAxis.点动速度, commPLC);
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- #endregion
- #region M04M05
- public static void GetM04M05InitValue(PLCInitIO plcInitIO, CommPLC commPLC)
- {
- try
- {
- plcInitIO.isHandOrAuto = plcInitIO.HandOrAutoAdd != "" ? GetM04M05BoolValue(plcInitIO.HandOrAutoAdd, commPLC) : false;
- plcInitIO.isInitDone = plcInitIO.InitDoneAdd != "" ? GetM04M05BoolValue(plcInitIO.InitDoneAdd, commPLC) : false;
- plcInitIO.isAutoRunning = plcInitIO.AutoRunningAdd != "" ? GetM04M05BoolValue(plcInitIO.AutoRunningAdd, commPLC) : false;
- plcInitIO.isAlm = plcInitIO.AlmAdd != "" ? GetM04M05BoolValue(plcInitIO.AlmAdd, commPLC) : false;
- plcInitIO.isWait = plcInitIO.WaitAdd != "" ? GetM04M05BoolValue(plcInitIO.WaitAdd, commPLC) : false;
- plcInitIO.isBtnInit = plcInitIO.btnInitAdd != "" ? GetM04M05BoolValue(plcInitIO.btnInitAdd, commPLC) : false;
- plcInitIO.isBtnExceptionQuit = plcInitIO.btnExcetionQuitAdd != "" ? GetM04M05BoolValue(plcInitIO.btnExcetionQuitAdd, commPLC) : false;
- plcInitIO.isBtnStop = plcInitIO.btnStopAdd != "" ? GetM04M05BoolValue(plcInitIO.btnStopAdd, commPLC) : false;
- plcInitIO.isBtnStart = plcInitIO.btnStartAdd != "" ? GetM04M05BoolValue(plcInitIO.btnStartAdd, commPLC) : false;
- plcInitIO.isBtnHandOrAuto = plcInitIO.btnHandOrAutoAdd != "" ? GetM04M05BoolValue(plcInitIO.btnHandOrAutoAdd, commPLC) : false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- public static void GetM04M05AlmValue(Dictionary<string, ClsAlm> dictAlm, CommPLC commPLC)
- {
- foreach (var item in dictAlm)
- {
- try
- {
- item.Value.isAlm = item.Value.AlmAdd != "" ? GetM04M05BoolValue(item.Value.AlmAdd, commPLC) : false;
- }
- catch (Exception )
- {
- // MessageBox.Show(ex.ToString());
- }
- }
- }
- public static void GetM04M05CylinderValue(Dictionary<string, ClsPLCIO> dictIO, CommPLC commPLC)
- {
- foreach (var item in dictIO)
- {
- try
- {
- item.Value.isLedResetOn = item.Value.LedResetAdd != "" ? GetM04M05BoolValue(item.Value.LedResetAdd, commPLC) : false;
- item.Value.isLedSetOn = item.Value.LedSetAdd != "" ? GetM04M05BoolValue(item.Value.LedSetAdd, commPLC) : false;
- item.Value.isSensorResetOn = item.Value.SensorResetAdd != "" ? GetM04M05BoolValue(item.Value.SensorResetAdd, commPLC) : false;
- item.Value.isSensorSetOn = item.Value.SensorSetAdd != "" ? GetM04M05BoolValue(item.Value.SensorSetAdd, commPLC) : false;
- item.Value.isResetEnableOn = item.Value.ResetEnableAdd != "" ? GetM04M05BoolValue(item.Value.ResetEnableAdd, commPLC) : false;
- item.Value.isSetEnableOn = item.Value.SetEnableAdd != "" ? GetM04M05BoolValue(item.Value.SetEnableAdd, commPLC) : false;
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- //Thread.Sleep(1);
- }
- }
- public static void GetM04M05AxisPos(Dictionary<string, ClsAxisPos> dictAxisPos, CommPLC commPLC)
- {
- try
- {
- foreach (var item in dictAxisPos)
- {
- item.Value.isLightOn = item.Value.LightAdd != "" ? GetM04M05BoolValue(item.Value.LightAdd, commPLC) : false;
- commPLC.ReadUshort(item.Value.GoAdd, out item.Value.GoCurrValue, out string str);
- //Thread.Sleep(1);
- }
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- public static void GetM04M05Axis(ClsAxis dictAxis, CommPLC commPLC)
- {
- try
- {
- dictAxis.is使能完成 = dictAxis.使能完成 != "" ? GetM04M05BoolValue(dictAxis.使能完成, commPLC) : false;
- dictAxis.is运行允许 = dictAxis.运行允许 != "" ? GetM04M05BoolValue(dictAxis.运行允许, commPLC) : false;
- dictAxis.is异常 = dictAxis.异常 != "" ? GetM04M05BoolValue(dictAxis.异常, commPLC) : false;
- dictAxis.isPositiveLimitOn = dictAxis.正极限 != "" ? GetM04M05BoolValue(dictAxis.正极限, commPLC) : false;
- dictAxis.isOriginalLimitOn = dictAxis.原点 != "" ? GetM04M05BoolValue(dictAxis.原点, commPLC) : false;
- dictAxis.isNegativeLimitOn = dictAxis.负极限 != "" ? GetM04M05BoolValue(dictAxis.负极限, commPLC) : false;
- dictAxis.i当前位置 = GetM04M05IntValue(dictAxis.当前位置, commPLC);
- dictAxis.s异常代码 = GetM04M05Int16Value(dictAxis.异常代码, commPLC);
- dictAxis.i点动速度 = GetM04M05IntValue(dictAxis.点动速度, commPLC);
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- }
- #endregion
- #endregion
- private static void ThReadPLCM01M02()
- {
- while(true)
- {
- if(!ProgramHelp.Instance.commPLC_M01M02.isPLCConnected)
- {
- Thread.Sleep(5);
- continue;
- }
- GetM01M02InitValue(PLCCylinder.dictPLC_InitIO["M01M02"], ProgramHelp.Instance.commPLC_M01M02);
- foreach (var itemM01 in dictM01)
- {
- short sResult = GetM01M02Int16Value(itemM01.Value, ProgramHelp.Instance.commPLC_M01M02);
- SetM01Result(sResult, itemM01.Key);
- }
- //foreach (var itemM02 in dictM02)
- //{
- // short sResult = GetM01M02Int16Value(itemM02.Value, ProgramHelp.Instance.commPLC_M01M02);
- // SetM02Result(sResult, itemM02.Key);
- //}
- PLCResultHelp.isM01_清料 = GetM01M02BoolValue("DB20.496.0", ProgramHelp.Instance.commPLC_M01M02);
- for (int i = 0; i < 10; i++)
- {
- arrShortWeightStart[i] = GetM01M02Int16Value(arrWeightStartSignalsAdd[i], ProgramHelp.Instance.commPLC_M01M02);
- }
- PLCResultHelp.isM01_称重开始 = GetM01M02BoolValue(strWeightStartAdd, ProgramHelp.Instance.commPLC_M01M02);
- //if (PLCResultHelp.isM01_称重开始)
- //{
-
- //}
- foreach (var itemM02 in dictM02)
- {
- int iResult = GetM01M02IntValue(itemM02.Value, ProgramHelp.Instance.commPLC_M01M02);
- SetM02Result(iResult, itemM02.Key);
- }
- GetM01M02AlmValue(PLCCylinder.dictM01M02_Alm, ProgramHelp.Instance.commPLC_M01M02);//
- if (EnumWindowDisplay != WindowDisplay.上料称重房)
- {
- Thread.Sleep(2);
- continue;
- }
- try
- {
- //ClsWeightHelp.GetWeightValue();//称重房
- if (EnumWindowDisplay == WindowDisplay.上料称重房)
- {
- switch (iM01M02IOStation)
- {
- case 0:
- GetM01M02CylinderValue(PLCCylinder.dictM01M02_上料工位, ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 1:
- GetM01M02CylinderValue(PLCCylinder.dictM01M02_取出工位, ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 2:
- GetM01M02CylinderValue(PLCCylinder.dictM01M02_提升机工位, ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 3:
- GetM01M02CylinderValue(PLCCylinder.dictM01M02_称重工位, ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 4:
- GetM01M02CylinderValue(PLCCylinder.dictM01M02_出口工位, ProgramHelp.Instance.commPLC_M01M02);
- break;
- }
- switch(iM01M02AxisStation)
- {
- case 0:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_取料X轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["取料X轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 1:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_取料Y轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["取料Y轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 2:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_取料Z轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["取料Z轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 3:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_取料R轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["取料R轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 4:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_上料站X轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["上料站X轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 5:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_上料站Y轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["上料站Y轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- case 6:
- GetM01M02AxisPos(PLCAxisPos.dictM01M02_上料站Z轴, ProgramHelp.Instance.commPLC_M01M02);
- GetM01M02Axis(PLCAxis.dictM01M02_轴["上料站Z轴"], ProgramHelp.Instance.commPLC_M01M02);
- break;
- }
- //GetM01M02Axis(PLCAxis.dictM01M02_轴, ProgramHelp.Instance.commPLC_M01M02);
- }
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- Thread.Sleep(1);
- }
- }
- private static void ThReadPLCM03()
- {
- while (true)
- {
- if (!ProgramHelp.Instance.commPLC_M03.isPLCConnected)
- {
- Thread.Sleep(5);
- continue;
- }
- GetM03InitValue(PLCCylinder.dictPLC_InitIO["M03"], ProgramHelp.Instance.commPLC_M03);
- GetM03AlmValue(PLCCylinder.dictM03_Alm, ProgramHelp.Instance.commPLC_M03);//
- if (EnumWindowDisplay != WindowDisplay.压机房)
- {
- Thread.Sleep(2);
- continue;
- }
- try
- {
- if (EnumWindowDisplay == WindowDisplay.压机房)
- {
- switch (iM03IOStation)
- {
- case 0:
- GetM03CylinderValue(PLCCylinder.dictM03_整平工位, ProgramHelp.Instance.commPLC_M03);
- break;
- case 1:
- GetM03CylinderValue(PLCCylinder.dictM03_装冲工位, ProgramHelp.Instance.commPLC_M03);
- break;
- case 2:
- GetM03CylinderValue(PLCCylinder.dictM03_压合工位, ProgramHelp.Instance.commPLC_M03);
- break;
- case 3:
- GetM03CylinderValue(PLCCylinder.dictM03_清洗工位, ProgramHelp.Instance.commPLC_M03);
- break;
- case 4:
- GetM03CylinderValue(PLCCylinder.dictM03_下流线工位, ProgramHelp.Instance.commPLC_M03);
- break;
- case 5:
- GetM03CylinderValue(PLCCylinder.dictM03_出料口工位, ProgramHelp.Instance.commPLC_M03);
- break;
- }
- switch (iM03AxisStation)
- {
- case 0:
- //GetM03AxisPos(PLCAxisPos.dictM03_取料X轴, ProgramHelp.Instance.commPLC_M03);
- GetM03Axis(PLCAxis.dictM03_轴["压机流线伺服"], ProgramHelp.Instance.commPLC_M03);
- break;
- case 1:
- //GetM03AxisPos(PLCAxisPos.dictM03_取料Y轴, ProgramHelp.Instance.commPLC_M03);
- GetM03Axis(PLCAxis.dictM03_轴["压机前流线伺服"], ProgramHelp.Instance.commPLC_M03);
- break;
- }
- //GetM03Axis(PLCAxis.dictM03_轴, ProgramHelp.Instance.commPLC_M03);
- }
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- Thread.Sleep(1);
- }
- }
- private static void ThReadPLCM04M05()
- {
- while(true)
- {
- if (!ProgramHelp.Instance.commPLC_M04M05.isPLCConnected)
- {
- Thread.Sleep(5);
- continue;
- }
- GetM04M05InitValue(PLCCylinder.dictPLC_InitIO["M04M05"], ProgramHelp.Instance.commPLC_M04M05);
- foreach (var itemM04 in dictM04)
- {
- switch (itemM04.Key)
- {
- case "允许下料":
- PLCResultHelp.isM04_允许下料 = GetM04M05BoolValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case "当前检测高度":
- PLCResultHelp.fM04_当前检测高度 = GetM04M05RealValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case "当前重量":
- PLCResultHelp.fM04_当前重量 = Convert.ToSingle(GetM04M05IntValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05)) / 100;
- break;
- //case "产品高度":
- // PLCResultHelp.fM04_产品高度 = GetM04M05RealValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- // break;
- //case "产品重量":
- // PLCResultHelp.fM04_产品重量 = GetM04M05IntValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- // break;
- //case "废料数量":
- // PLCResultHelp.fM04_废料数量 = GetM04M05IntValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- // break;
- //case "合格数量":
- // PLCResultHelp.fM04_合格数量 = GetM04M05IntValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- // break;
- //case "相机结果":
- // ProgramHelp.Instance.commPLC_M04M05.ReadString(itemM04.Value, out PLCResultHelp.fM04_相机结果, out string str);
- // break;
- //case "盘数":
- // PLCResultHelp.fM04_盘数 = GetM04M05Int16Value(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- // break;
- case "产品信息打包上传":
- PLCResultHelp.isM04_产品信息打包上传 = GetM04M05BoolValue(itemM04.Value, ProgramHelp.Instance.commPLC_M04M05);
- break;
- }
- }
- int iM05Result = GetM04M05IntValue("DB186.12", ProgramHelp.Instance.commPLC_M04M05);
- PLCResultHelp.iM05_箱数 = iM05Result;
- GetM04M05AlmValue(PLCCylinder.dictM04M05_Alm, ProgramHelp.Instance.commPLC_M04M05);//
- if (EnumWindowDisplay != WindowDisplay.检测装箱房)
- {
- Thread.Sleep(5);
- continue;
- }
- try
- {
- if (EnumWindowDisplay == WindowDisplay.检测装箱房)
- {
- switch (iM04M05IOStation)
- {
- case 0:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_ST0进口门工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 1:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_取出工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 2:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_清洗工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 3:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_提升机工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 4:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_测量工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 5:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_装盘工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 6:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_出盘工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 7:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_下流线工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 8:
- GetM04M05CylinderValue(PLCCylinder.dictM04M05_下料站工位, ProgramHelp.Instance.commPLC_M04M05);
- break;
- }
- switch (iM04M05AxisStation)
- {
- case 0:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_取料X轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["取料X轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 1:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_取料Y轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["取料Y轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 2:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_装盘X轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["装盘X轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 3:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_装盘Y轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["装盘Y轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 4:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_装盘Z轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["装盘Z轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 5:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_下料站X轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["下料站X轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 6:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_下料站Y轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["下料站Y轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- case 7:
- GetM04M05AxisPos(PLCAxisPos.dictM04M05_下料站Z轴, ProgramHelp.Instance.commPLC_M04M05);
- GetM04M05Axis(PLCAxis.dictM04M05_轴["下料站Z轴"], ProgramHelp.Instance.commPLC_M04M05);
- break;
- }
- //GetM04M05Axis(PLCAxis.dictM04M05_轴, ProgramHelp.Instance.commPLC_M04M05);
- }
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- Thread.Sleep(1);
- }
- }
- private static void ThPressure()
- {
- short svalue = 0;
- float fvalue = 0;
- int ivalue = 0;
- string str;
- while (true)
- {
- if (!ProgramHelp.Instance.comm压机.isPLCConnected)
- {
- Thread.Sleep(5);
- continue;
- }
- //if(EnumWindowDisplay != WindowDisplay.压力机)
- //{
- // Thread.Sleep(5);
- // continue;
- //}
- try
- {
- foreach (var item in dictPressure)
- {
- if(item.Value.type == "short")
- {
- ProgramHelp.Instance.comm压机.ReadShort(item.Value.Address, out svalue, out str);
- item.Value.value = (svalue * item.Value.Scale).ToString();
- if(item.Value.Name == "主缸位置")
- {
- str主缸当前位置 = item.Value.value;
- }
- if (item.Value.Name == "主缸压力")
- {
- str主缸当前压力 = item.Value.value;
- }
- if(item.Value.Name == "当前动作")
- {
- upTrigger.Now = item.Value.value == "1" ? true : false;
- if(upTrigger.OutPut)
- {
- queuePressureSignals.Enqueue(1);
- }
- }
- }
- else if(item.Value.type == "float")
- {
- ProgramHelp.Instance.comm压机.ReadFloat(item.Value.Address, out fvalue, out str);
- item.Value.value =(fvalue * item.Value.Scale).ToString("0.0");
- }
- else if(item.Value.type == "int")
- {
- ProgramHelp.Instance.comm压机.ReadInt(item.Value.Address, out ivalue, out str);
- item.Value.value = (ivalue * item.Value.Scale).ToString();
- }
- Thread.Sleep(1);
- }
- }
- catch (Exception )
- {
- //MessageBox.Show(ex.ToString());
- }
- Thread.Sleep(2);
- }
- }
- #region read function
- #region M01M02
- public static bool GetM01M02BoolValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return false;
- commPLC.ReadCoin(add, out bool result, out string str);
- return result;
- }
- public static int GetM01M02IntValue(string add,CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadInt(add,out int result,out string str);
- return result;
- }
- public static Int16 GetM01M02Int16Value(string add,CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadShort(add, out Int16 result, out string str);
- return result;
- }
- public static float GetM01M02RealValue(string add,CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadFloat(add, out float result, out string str);
- return result;
- }
- #endregion
- #region M03
- public static bool GetM03BoolValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return false;
- commPLC.ReadCoin(add, out bool result, out string str);
- return result;
- }
- public static int GetM03IntValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadInt(add, out int result, out string str);
- return result;
- }
- public static Int16 GetM03Int16Value(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadShort(add, out Int16 result, out string str);
- return result;
- }
- public static float GetM03RealValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadFloat(add, out float result, out string str);
- return result;
- }
- #endregion
- #region M04M05
- public static bool GetM04M05BoolValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return false;
- commPLC.ReadCoin(add, out bool result, out string str);
- return result;
- }
- public static int GetM04M05IntValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadInt(add, out int result, out string str);
- return result;
- }
- public static Int16 GetM04M05Int16Value(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadShort(add, out Int16 result, out string str);
- return result;
- }
- public static float GetM04M05RealValue(string add, CommPLC commPLC)
- {
- if (!commPLC.isPLCConnected) return 0;
- commPLC.ReadFloat(add, out float result, out string str);
- return result;
- }
- #endregion
- #endregion
- #region write function
- public static void SetBoolValue(string add, CommPLC commPLC,bool value)
- {
- if (!commPLC.isPLCConnected) return ;
- commPLC.WriteCoin(add, value, out string str);
- }
- public static void SetIntValue(string add, CommPLC commPLC,int value)
- {
- if (!commPLC.isPLCConnected) return;
- commPLC.WriteInt(add, value, out string str);
- }
- public static void SetInt16Value(string add, CommPLC commPLC,short value)
- {
- if (!commPLC.isPLCConnected) return;
- commPLC.WriteShort(add, value, out string str);
- }
- public static void SetRealValue(string add, CommPLC commPLC,float value)
- {
- if (!commPLC.isPLCConnected) return;
- commPLC.WriteFloat(add, value, out string str);
- }
- #endregion
- #region SetValue
- public static void SetM01Result(short value,string keyName)
- {
- switch(keyName)
- {
- case "药A暂存当前盒数":
- PLCResultHelp.iM01_药A暂存当前盒数 = value;
- break;
- case "药B暂存当前盒数":
- PLCResultHelp.iM01_药B暂存当前盒数 = value;
- break;
- case "抛盖暂存槽当前数量":
- PLCResultHelp.iM01_抛盖暂存槽当前数量 = value;
- break;
- case "空桶暂存槽当前数量":
- PLCResultHelp.iM01_空桶暂存槽当前数量 = value;
- break;
- }
- }
- public static void SetM02Result(int value, string keyName)
- {
- switch (keyName)
- {
- case "药A称重配比重量":
- PLCResultHelp.iM02_药A称重配比重量 = value;
- break;
- case "A料仓1当前重量":
- PLCResultHelp.iM02_A料仓1当前重量 = value;// 1000
- break;
- case "A料仓2当前重量":
- PLCResultHelp.iM02_A料仓2当前重量 = value;// 1000
- break;
- case "A料仓3当前重量":
- PLCResultHelp.iM02_A料仓3当前重量 = value ;// 1000
- break;
- case "A料仓4当前重量":
- PLCResultHelp.iM02_A料仓4当前重量 = value;// 1000
- break;
- case "A料仓5当前重量":
- PLCResultHelp.iM02_A料仓5当前重量 = value;// 1000
- break;
- case "药B称重配比重量":
- PLCResultHelp.iM02_药B称重配比重量 = value;
- break;
- case "B料仓1当前重量":
- PLCResultHelp.iM02_B料仓1当前重量 = value;// 1000
- break;
- case "B料仓2当前重量":
- PLCResultHelp.iM02_B料仓2当前重量 = value;// 1000
- break;
- case "B料仓3当前重量":
- PLCResultHelp.iM02_B料仓3当前重量 = value;// 1000
- break;
- case "B料仓4当前重量":
- PLCResultHelp.iM02_B料仓4当前重量 = value;// 1000
- break;
- case "B料仓5当前重量":
- PLCResultHelp.iM02_B料仓5当前重量 = value;// 1000
- break;
- }
- }
- public static void SetM04ResultInt(int value,string keyName)
- {
- //switch(keyName)
- //{
- // case "产品重量":
- // PLCResultHelp.iM04_产品重量 = value;
- // break;
- // case "废料数量":
- // PLCResultHelp.iM04_废料数量 = value;
- // break;
- // case "合格数量":
- // PLCResultHelp.iM04_合格数量 = value;
- // break;
- //}
- }
- public static void SetM04ResultShort(short value, string keyName)
- {
- //switch (keyName)
- //{
- // case "产品重量":
- // PLCResultHelp.iM04_相机结果 = value;
- // break;
- // case "废料数量":
- // PLCResultHelp.iM04_盘数 = value;
- // break;
- //}
- }
- #endregion
- }
- }
|