Ejemplo n.º 1
0
        private void BindStation(int stationno, byte[] byt)
        {
            CRLStationInfo si = StationInfo.Find(
                delegate(CRLStationInfo ss)
            {
                return(ss.stationno == stationno);
            }
                );

            if (stationno == 1276)
            {
            }
            if (si != null)//leo 绑定站台信息
            {
                si.taskno      = byt[0] * 256 + byt[1];
                si.barcode1    = (byt[2] * 256 + byt[3]) * 65536 + byt[4] * 256 + byt[5]; //托盘条码
                si.goodstype   = byt[6] * 256 + byt[7];                                   //货物类型(1. 空托盘组 2. 实托盘3.空托盘4. 单烟包)
                si.fromstation = byt[8] * 256 + byt[9];
                si.tostation   = byt[10] * 256 + byt[11];
                si.weight1     = byt[12] * 256 + byt[13];
                si.field1      = byt[18] * 256 + byt[19];//备用
                //si.barcode2 = (byt[20] * 256 + byt[21]) * 256 + byt[22] * 256 + byt[23];//下层烟箱号
                si.weight2 = byt[14] * 256 + byt[15];
                //si.field3 = byt[16] * 256 + byt[17];
                si.checkinfo = byt[16] * 256 + byt[17];
            }
        }
Ejemplo n.º 2
0
        public string[] ReadStationInfo(int stationno)
        {
            string[]       info = new string[11];
            CRLStationInfo si   = StationInfo.Find(
                delegate(CRLStationInfo ss)
            {
                return(ss.stationno == stationno);
            }
                );

            if (si != null)
            {
                info[0] = si.stationno.ToString();
                info[1] = si.taskno.ToString();
                info[2] = si.field1.ToString();
                info[3] = si.goodstype.ToString();
                info[4] = si.fromstation.ToString();
                info[5] = si.tostation.ToString();
                info[6] = si.barcode1 == 0 ? "0" : si.barcode1.ToString().PadLeft(8, '0');
                //info[7] = si.barcode2 == 0 ? "0" : si.barcode2.ToString().PadLeft(4, '0');
                info[7]  = si.weight2.ToString();
                info[8]  = si.checkinfo.ToString();
                info[9]  = si.weight1.ToString();
                info[10] = si.config.ToString();
            }
            return(info);
        }
Ejemplo n.º 3
0
        public bool WriteStationInfo(int station, string value, int index)
        {
            CRLStationInfo si = StationInfo.Find(
                delegate(CRLStationInfo ss)
            {
                return(ss.stationno == station);
            }
                );

            PLCList["192.168.56.11"].Write(50, si.value + index * 2, 2, GetHexBytes(value));
            return(true);
        }
Ejemplo n.º 4
0
        private void ConveryInit(DataRow dt)
        {
            CRLStationInfo si = new CRLStationInfo();

            si.stationno   = int.Parse(dt["stationno"].ToString());
            si.stationtype = int.Parse(dt["stationtype"].ToString());
            si.LocationX   = int.Parse(dt["field1"].ToString());
            si.LocationY   = int.Parse(dt["field2"].ToString());
            si.Width       = SplitWidth(dt["remark"].ToString())[0];
            si.Height      = SplitWidth(dt["remark"].ToString())[1];
            si.value       = int.Parse(dt["value"].ToString());
            si.length      = int.Parse(dt["signaltype"].ToString());
            si.config      = dt["field3"].ToString();
            si.key_ip      = dt["userid"].ToString();
            si.DBAddress   = int.Parse(dt["objects"].ToString());
            StationInfo.Add(si);
        }
Ejemplo n.º 5
0
        public bool WriteStationInfo(string[] str)
        {
            CRLStationInfo si = StationInfo.Find(
                delegate(CRLStationInfo ss)
            {
                return(ss.stationno == int.Parse(str[0]));
            }
                );

            if (si != null)
            {
                byte[] byt = new byte[20];//leo 30 to 20
                for (int i = 1; i < str.Length; i++)
                {
                    Array.Copy(GetHexBytes(str[i]), 0, byt, (i - 1) * 2, 2);
                }
                ////mPLC.Connect();
                //if (!mPLC.Write(50, si.value, 20, byt))//leo 30 to 20  PLCList[csi.key_ip]
                //if (PLCList[si.key_ip].Write(50, si.value, 20, byt))
                //{
                //    mPLC.Connect();
                //    return false;
                //}
                if (si.cFlag)
                {
                    PLCList[si.key_ip].Write(50, si.value, 20, byt);
                }
                ////PLC连不上时临时使用
                //si.taskno = int.Parse(str[1]);
                //si.barcode1 = int.Parse(str[2]) * 65536 + int.Parse(str[3]);
                //si.barcode2 = int.Parse(str[3]);
                //si.goodstype = int.Parse(str[4]);
                //si.fromstation = int.Parse(str[5]);
                //si.tostation = int.Parse(str[6]);
                //si.weight1 = int.Parse(str[7]);
                //si.weight2 = int.Parse(str[8]);
                //si.checkinfo = int.Parse(str[9]);
            }
            return(true);
        }