Beispiel #1
0
        public string PcccLoginResponse(LoginEventArgs e)
        {
            var retArr = new short[34];

            if (e.InTagName == "N227:0")
            {
                e.OutTagName = "N228:0";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            retArr[20] = e.SuccessIndicator;
            retArr[21] = e.FaultCode;

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                return(s.PlcResponse(e.SenderIp, retArr, e.OutTagName));
            }
            else if (e.UsePlcMicrologix)
            {
                return(s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName));
            }
            else
            {
                return(s.SlcResponse(e.SenderIp, retArr, e.OutTagName));
            }
        }
Beispiel #2
0
        public void PcccProductionResponse(ProductionEventArgs e)
        {
            var retArr = new short[50];

            if (e.InTagName == "N197:0")
            {
                e.OutTagName = "N198:0";
            }
            else if (e.InTagName == "N207:0")
            {
                e.OutTagName = "N208:0";
            }
            else if (e.InTagName == "N217:0")
            {
                e.OutTagName = "N218:0";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            var cellArr = Util.StringToAbIntArray(e.CellId);

            Array.Copy(cellArr, 0, retArr, 0, cellArr.Length);

            var itemArr = Util.StringToAbIntArray(e.ItemId);

            Array.Copy(itemArr, 0, retArr, 5, itemArr.Length);

            Array.Copy(e.ResponseArray, 18, retArr, 18, 32);

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
        }
Beispiel #3
0
        public void PcccFinalPrintResponse(LabelPrintEventArgs e)
        {
            var retArr = new short[10];

            e.OutTagName = e.InTagName;
            short.TryParse(e.Response, out retArr[0]);

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            };
        }
Beispiel #4
0
        public void PcccSerialRequestRespone(SerialRequestEventArgs e)
        {
            var retArr = new short[20];

            e.OutTagName = "N247:0";
            Array.Copy(e.ResponseArray, 0, retArr, 0, e.ResponseArray.Length);

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
        }
Beispiel #5
0
        public void PcccLoginResponse(LoginEventArgs e)
        {
            var retArr = new short[34];

            e.OutTagName = e.InTagName;
            retArr[20]   = e.SuccessIndicator;
            retArr[21]   = e.FaultCode;

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
        }
Beispiel #6
0
        public void PcccPlcModelSetupResponse(string ipAddress, SetupEventArgs e)
        {
            var retArr = e.PlcModelSetup;
            //for (var i = 0; i < e.Response.PlcModelSetup.Length; i++)
            //{
            //    short.TryParse(e.Response.PlcModelSetup[i], out retArr[i]);
            //}

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, "N241:0");
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, "N241:0");
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, "N241:0");
            }
        }
Beispiel #7
0
        public void PcccSetupResponse(SetupEventArgs e)
        {
            e.ParseReturnData();

            e.OutTagName = "N238:0";
            var retArr = new short[71];

            if (!string.IsNullOrEmpty(e.Response.Component1.AccessId))
            {
                Int16.TryParse(e.Response.Component1.AccessId, out retArr[0]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component1.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 1, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component2.AccessId))
            {
                Int16.TryParse(e.Response.Component2.AccessId, out retArr[11]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component2.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 12, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component3.AccessId))
            {
                Int16.TryParse(e.Response.Component3.AccessId, out retArr[22]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component3.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 23, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component4.AccessId))
            {
                Int16.TryParse(e.Response.Component4.AccessId, out retArr[33]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component4.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 34, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component5.AccessId))
            {
                Int16.TryParse(e.Response.Component5.AccessId, out retArr[44]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component5.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 45, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component6.AccessId))
            {
                Int16.TryParse(e.Response.Component6.AccessId, out retArr[55]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component6.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 56, componentModelArr.Length);
            }
            // add quantity
            if (!Int32.TryParse(e.Response.Quantity, out int result))
            {
                result = 0;
            }
            if (result > 9999)
            {
                var small = result - 10000;
                var big   = (result - small) * 0.0001;
                retArr[66] = (short)big;
                retArr[65] = (short)small;
            }
            else
            {
                retArr[65] = (byte)result;
            }

            Int16.TryParse(e.Response.Acknowledge, out retArr[67]);

            Int16.TryParse(e.Response.ErrorCode, out retArr[68]);
            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }

            if (e.ProcessIndicator == 4)
            {
                PcccPlcModelSetupResponse(e.SenderIp, e);
            }
        }