示例#1
0
文件: LocomInfo.cs 项目: subinhu/RIIS
        /// <summary>
        /// 序列化
        /// </summary>
        /// <returns></returns>
        public byte[] Serialize()
        {
            ClSet   cs = new ClSet();
            ClTable ct = new ClTable("System");

            ct.AddColumn("INFO", typeof(int));
            cs.Tables.Add(ct);
            ClRow _cr = ct.NewRow();

            _cr[0] = sysstate;
            ct.Rows.Add(_cr);
            int idna = 0, idsna = 1, idsp = 2, idlo = 3, idst = 4;

            ct = new ClTable("Locoms");
            ct.AddColumn("NAME", typeof(string));
            ct.AddColumn("SECTIONNA", typeof(string));
            ct.AddColumn("SPEED", typeof(short));
            ct.AddColumn("LOCATION", typeof(byte));
            ct.AddColumn("STATE", typeof(byte));
            cs.Tables.Add(ct);
            foreach (Locom l in this)
            {
                ClRow cr = ct.NewRow();
                cr[idna]  = l.name;
                cr[idsna] = l.sectionname;
                cr[idsp]  = l.speed;
                cr[idlo]  = l.location;
                cr[idst]  = l.state;
                ct.Rows.Add(cr);
            }
            return(cs.Serialize(2));
        }
示例#2
0
文件: LocomInfo.cs 项目: subinhu/RIIS
        private void Init(ClSet cs)
        {
            ClTable ct = cs.Tables["Locoms"];

            if (ct == null)
            {
                return;
            }
            int idna = 0, idsna = 1, idsp = 2, idlo = 3, idst = 4;

            foreach (ClRow cr in ct.Rows)
            {
                Locom l = new Locom();
                l.LocomName   = cr[idna].ToString();
                l.sectionname = cr[idsna].ToString();
                l.speed       = Convert.ToInt16(cr[idsp]);
                l.location    = Convert.ToByte(cr[idlo]);
                l.state       = Convert.ToByte(cr[idst]);
                Add(l);
            }
            ct = cs.Tables["System"];
            ClRow _cr = ct.Rows[0];

            sysstate = (byte)Convert.ToInt32(_cr["INFO"]);
        }
示例#3
0
文件: TrainWnd.cs 项目: subinhu/RIIS
        /// <summary>
        /// 序列化
        /// </summary>
        /// <param name="wnds">车次窗</param>
        /// <param name="color">颜色</param>
        /// <returns>字节流</returns>
        public static byte[] Serialize(TrainWnd[] wnds, byte color)
        {
            ClSet   cs  = new ClSet();
            ClTable ct1 = new ClTable("Infomations");

            ct1.AddColumn("I_LINE_ID", typeof(short));
            ct1.AddColumn("C_TRA_NUM", typeof(string));
            ct1.AddColumn("F_WEGH", typeof(float));
            ct1.AddColumn("F_LEN", typeof(short));
            ct1.AddColumn("I_CAR_CNT", typeof(short));
            ct1.AddColumn("B_FLAG", typeof(byte));
            ct1.AddColumn("C_NOTE", typeof(string));
            ct1.AddColumn("B_LOCOM_TYPE", typeof(byte));
            ClTable ct2 = new ClTable("CarStream");

            ct2.AddColumn("I_LINE_ID", typeof(short));
            ct2.AddColumn("I_GRO_ID", typeof(short));
            ct2.AddColumn("I_CAR_CNT", typeof(short));
            foreach (TrainWnd w in wnds)
            {
                ClRow cr = ct1.NewRow();
                cr["I_LINE_ID"]    = w.lineID;
                cr["F_WEGH"]       = w.weight;
                cr["F_LEN"]        = (short)(w.length * 10 + .5);
                cr["I_CAR_CNT"]    = w.cnt;
                cr["C_TRA_NUM"]    = w.trainnum;
                cr["B_FLAG"]       = w.flag;
                cr["C_NOTE"]       = w.infomation;
                cr["B_LOCOM_TYPE"] = w.LocomType;
                ct1.Rows.Add(cr);
                foreach (CarInfomation inf in w.infomations)
                {
                    if (inf.cnt > 0)
                    {
                        cr = ct2.NewRow();
                        cr["I_LINE_ID"] = w.lineID;
                        cr["I_GRO_ID"]  = inf.dir;
                        cr["I_CAR_CNT"] = inf.cnt;
                        ct2.Rows.Add(cr);
                    }
                }
            }
            cs.Tables.Add(ct1);
            cs.Tables.Add(ct2);
            if (color != 0)
            {
                ct2 = new ClTable("SYSCOLOR");
                ct2.AddColumn("COLOR", typeof(byte));
                ClRow _cr = ct2.NewRow();
                _cr[0] = color;
                ct2.Rows.Add(_cr);
                cs.Tables.Add(ct2);
            }
            byte[] b = cs.Serialize(2);
            b[0] = 0x33;
            return(b);
        }
示例#4
0
        static ClTable CreateInfoTable(byte tdcsmode)
        {
            ClTable ct = new ClTable("CONSINFO");

            ct.AddColumn("C_NAME", typeof(string));
            ct.AddColumn("C_VALUE", typeof(string));
            ClRow cr = ct.NewRow();

            cr["C_NAME"]  = "TDCSMODE";
            cr["C_VALUE"] = tdcsmode.ToString();
            ct.Rows.Add(cr);
            return(ct);
        }
 public void RemoveClRow(ClRow row) {
     this.Rows.Remove(row);
 }
 public void AddClRow(ClRow row) {
     this.Rows.Add(row);
 }
 public ClRowChangeEvent(ClRow row, global::System.Data.DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }
示例#8
0
        /// <summary>
        /// 到发确报目录表-》CLTABLE
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="tdcsmode"></param>
        /// <param name="dsdict"></param>
        /// <returns></returns>
        public static ClSet ConsTable2ClSet(DataSet ds, byte tdcsmode, DataSet dsdict)
        {
            string[] tn = { "C_TRA_NUM_ARR", "C_TRA_NUM_DEP" };
            string[] id = { "I_CONS_ID", "I_CONS_ID" };
            string[] st = { "E_ST_CONS", "E_ST_DEPCONS" };
            string[] tm = { "D_TRA_DEP", "D_TRA_DEP" };
            string[] lid = { "I_LINE_ID", "I_LINE_ID" };
            string[] ccnt = { "I_CAR_NUM", "I_CAR_NUM" };
            string[] len = { "F_LEN_TRA", "F_LEN_TRA" };
            string[] weig = { "F_WEGH_TRA", "F_WEGH_TRA" };
            string[] sta = { "C_STA_CO_ARR", "C_STA_CO_DEP" };
            string[] bstat = { "B_SYM_CHECK", "B_SYM_CHECK" };
            string[] locom1 = { "C_LOCOM_CO1", "C_LOCOM_CO1" };
            string[] locom2 = { "C_LOCOM_CO2", "C_LOCOM_CO2" };
            ClTable  ctarr, ctdep;

            ctarr = CreateTable("ARRCONS");
            ctdep = CreateTable("DEPCONS");
            ClTable ct;

            DataRow[] drs;
            ct  = ctarr;
            drs = ds.Tables["DM_TD_ARRCONSLIST"].Select("E_ST_CONS < " + CIPS.DB.E_ST_CONS.SHIFT, "E_ST_CONS DESC, D_TRA_DEP, I_LINE_ID", DataViewRowState.CurrentRows);
            for (int i = 0; i < 2; i++)
            {
                short n = 1;
                foreach (DataRow dr in drs)
                {
                    if ((Convert.ToInt32(dr["B_SYM_CHECK"]) & CIPS.DB.B_SYM_CHECK.STOP) != 0)
                    {
                        continue;
                    }
                    ClRow cr = ct.NewRow();
                    cr["I_CONS_ID"]        = dr[id[i]];
                    cr["E_ST_CONS"]        = dr[st[i]];
                    cr["C_TRA_NUM"]        = dr[tn[i]];
                    cr["D_TRA"]            = dr[tm[i]];
                    cr["I_LINE_ID_ARRDEP"] = dr[lid[i]];
                    cr["I_CAR_NUM"]        = dr[ccnt[i]];
                    cr["F_LEN_TRA"]        = dr[len[i]];
                    cr["F_WEGH_TRA"]       = dr[weig[i]];
                    cr["B_SYM_CHECK"]      = dr[bstat[i]];
                    cr["I_CONS_ORDER"]     = n;
                    cr["C_LOCOM_CO1"]      = dr[locom1[i]];
                    cr["C_LOCOM_CO2"]      = dr[locom2[i]];
                    cr["C_STA_CO"]         = "";
                    cr["I_STATION_ID"]     = 0;
                    DataRow[] _drs = dsdict.Tables["DC_TD_STA"].Select("C_STA_CO = '" + dr[sta[i]].ToString().Trim() + "'");
                    if (_drs.Length > 0)
                    {
                        _drs = dsdict.Tables["DC_TD_GRO"].Select("I_GRO_ID =" + _drs[0]["I_GRO_ID"].ToString().Trim());
                        if (_drs.Length > 0)
                        {
                            cr["C_STA_CO"] = _drs[0]["C_GRO_FORSH"].ToString().Trim();
                        }
                    }
                    _drs = dsdict.Tables["DC_RA_YARD"].Select("C_RANGE_FORSH = '" + dr[sta[i]].ToString().Trim() + "' and E_RANGE_LEVEL = " + CIPS.DB.E_RANGE_LEVEL.STATION.ToString());
                    if (_drs.Length > 0)
                    {
                        cr["I_STATION_ID"] = Convert.ToInt16(_drs[0]["I_RANGE_ID"]);
                    }
                    n++;
                    ct.Rows.Add(cr);
                }
                ct  = ctdep;
                drs = ds.Tables["DM_TD_DEPCONSLIST"].Select("E_ST_DEPCONS < " + CIPS.DB.E_ST_DEPCONS.SHIFT, "E_ST_DEPCONS DESC, D_TRA_DEP, I_LINE_ID", DataViewRowState.CurrentRows);
            }
            ClSet cs = new ClSet();

            cs.Tables.Add(ctarr);
            cs.Tables.Add(ctdep);
            cs.Tables.Add(CreateInfoTable(tdcsmode));
            return(cs);
        }
示例#9
0
        public static ClSet TrainTable2ClSet(DataTable dt, DataTable dtTrainText, bool bExpressMode, DataRow[] arrconsrows, DataRow[] depconsrows)
        {
            ClTable ctarr, ctdep;
            string  selcmd;

            ctarr = CreateTable("ARRCONS");
            ctdep = CreateTable("DEPCONS");
            int stationid = 0;

            selcmd = "E_SYM_ARRDEP <> " + CIPS.DB.E_PL_TYPE.ARR_LIGHTLOCOM.ToString() + " and E_PL_TYPE <> " + CIPS.DB.E_PL_TYPE.DEP_LIGHTLOCOM.ToString() +
                     " and E_PL_STATE < " + CIPS.DB.E_PL_STATE.SHIFT.ToString() + " and E_TRA_CHARA <> " + CIPS.DB.E_TRA_CHARA.TRA_CAR.ToString() +
                     " and E_RECORD_U<>" + CIPS.DB.E_RECORD_U.STOP.ToString() + " and E_RECORD_U<>" + CIPS.DB.E_RECORD_U.STA_ADD.ToString();
            DataRow[] drs = dt.Select(selcmd, "E_PL_STATE DESC,B_SYM_CHECK DESC, E_CONS_STATE DESC, I_LINE_ID_ARRDEP", System.Data.DataViewRowState.CurrentRows);
            short     n1 = 1, n2 = 1;

            foreach (DataRow dr in drs)
            {
                int   arrdep = Convert.ToInt16(dr["E_SYM_ARRDEP"]);
                ClRow cr     = ctarr.NewRow();
                if (arrdep == CIPS.DB.E_SYM_ARRDEP.END_ARR)
                {
                    cr["E_ST_CONS"]    = GetArrConsST(dr, dtTrainText, out stationid);
                    cr["I_CONS_ORDER"] = n1;
                    n1++;
                    ctarr.Rows.Add(cr);
                }
                else if (arrdep == CIPS.DB.E_SYM_ARRDEP.START_DEP)
                {
                    cr["E_ST_CONS"] = GetDepConsST(dr, dtTrainText, out stationid);

                    cr["I_CONS_ORDER"] = n2;
                    n2++;
                    ctdep.Rows.Add(cr);
                }
                else
                {
                    continue;
                }
                if (bExpressMode)
                {
                    cr["I_CONS_ID"] = dr["I_CONS_ID"];
                }
                else
                {
                    cr["I_CONS_ID"] = dr["I_TRA_ID"];
                }
                cr["C_TRA_NUM"]        = dr["C_TRA_NUM"];
                cr["D_TRA"]            = dr["D_TRA_TIME"];
                cr["I_LINE_ID_ARRDEP"] = dr["I_LINE_ID_ARRDEP"];
                cr["I_CAR_NUM"]        = dr["I_CAR_NUM"];
                cr["F_LEN_TRA"]        = dr["F_LEN"];
                cr["F_WEGH_TRA"]       = dr["F_WEGH"];
                cr["B_SYM_CHECK"]      = dr["B_SYM_CHECK"];
                cr["C_STA_CO"]         = "";
                cr["I_STATION_ID"]     = stationid;
            }

            foreach (DataRow dr in arrconsrows)
            {
                if ((Convert.ToInt32(dr["B_SYM_CHECK"]) & CIPS.DB.B_SYM_CHECK.STOP) != 0)
                {
                    continue;
                }
                ClRow cr = ctarr.NewRow();
                cr["E_ST_CONS"]    = dr["E_ST_CONS"];
                cr["I_CONS_ORDER"] = n1;
                n1++;
                ctarr.Rows.Add(cr);
                cr["I_CONS_ID"]        = dr["I_CONS_ID"];
                cr["C_TRA_NUM"]        = dr["C_TRA_NUM_ARR"];
                cr["D_TRA"]            = dr["D_TRA_DEP"];
                cr["I_LINE_ID_ARRDEP"] = dr["I_LINE_ID"];
                cr["I_CAR_NUM"]        = dr["I_CAR_NUM"];
                cr["F_LEN_TRA"]        = dr["F_LEN_TRA"];
                cr["F_WEGH_TRA"]       = dr["F_WEGH_TRA"];
                cr["B_SYM_CHECK"]      = dr["B_SYM_CHECK"];
                cr["C_STA_CO"]         = dr["C_STA_CO_ARR"];
            }
            foreach (DataRow dr in depconsrows)
            {
                if ((Convert.ToInt32(dr["B_SYM_CHECK"]) & CIPS.DB.B_SYM_CHECK.STOP) != 0)
                {
                    continue;
                }
                ClRow cr = ctdep.NewRow();
                cr["E_ST_CONS"]    = dr["E_ST_DEPCONS"];
                cr["I_CONS_ORDER"] = n2;
                n2++;
                ctdep.Rows.Add(cr);
                cr["I_CONS_ID"]        = dr["I_CONS_ID"];
                cr["C_TRA_NUM"]        = dr["C_TRA_NUM_DEP"];
                cr["D_TRA"]            = dr["D_TRA_DEP"];
                cr["I_LINE_ID_ARRDEP"] = dr["I_LINE_ID"];
                cr["I_CAR_NUM"]        = dr["I_CAR_NUM"];
                cr["F_LEN_TRA"]        = dr["F_LEN_TRA"];
                cr["F_WEGH_TRA"]       = dr["F_WEGH_TRA"];
                cr["B_SYM_CHECK"]      = dr["B_SYM_CHECK"];
                cr["C_STA_CO"]         = dr["C_STA_CO_DEP"];
            }
            ClSet cs = new ClSet();

            cs.Tables.Add(ctarr);
            cs.Tables.Add(ctdep);
            cs.Tables.Add(CreateInfoTable(0));
            return(cs);
        }
示例#10
0
文件: YH5_New.cs 项目: subinhu/RIIS
            void Init(ClRow cr)
            {
                ClTable ct = new ClTable("");

                ct.AddColumn("I_CAR_CO", typeof(uint));
                ct.AddColumn("F_LEN", typeof(byte));
                ct.AddColumn("I_GRO_ID", typeof(short));
                ct.AddColumn("B_CAR_CHARA", typeof(long));
                ct.AddColumn("E_CAR_CHARA", typeof(byte));
                ct.AddColumn("C_GOODS_NA", typeof(string));
                ct.AddColumn("C_STA_NA_ARR", typeof(string));
                ct.AddColumn("C_STA_NA_DEP", typeof(string));
                ct.AddColumn("I_CAR_ID", typeof(int));
                ct.AddColumn("E_OIL_TYPE", typeof(byte));
                ct.AddColumn("C_CONSIGNOR", typeof(string));
                ct.AddColumn("C_CONSIGNEE", typeof(string));
                ct.AddColumn("C_CAR_TYPE", typeof(string));
                ct.AddColumn("C_REMARK", typeof(string));
                ct.AddColumn("C_CANVAS_ID", typeof(string));
                ct.AddColumn("C_CANVAS_ID1", typeof(string));
                ct.AddColumn("C_CANVAS_ID2", typeof(string));
                ct.AddColumn("F_WEGH_OWN", typeof(short));
                ct.AddColumn("F_WEGH_LOAD", typeof(short));
                ct.AddColumn("D_TRA_ARR", typeof(DateTime));
                ct.AddColumn("C_TRA_NUM_ARR", typeof(string));
                ct.AddColumn("I_LINE_ID", typeof(short));
                ct.AddColumn("B_CAR_STATE", typeof(short));
                ct.AddColumn("B_CAR_CUSTOM", typeof(byte));
                ct.AddColumn("C_PL_CO_RATIFY", typeof(string));
                ct.AddColumn("I_CAR_NUM_RATIFY", typeof(short));
                ct.AddColumn("I_CAR_NUM_CLOAD", typeof(short));
                ct.AddColumn("E_PL_TYPE_FRT", typeof(byte));
                ct.AddColumn("I_BATCH_NUM", typeof(byte));
                ct.AddColumn("I_WORK_NUM", typeof(byte));
                ct.AddColumn("C_OP_LOAD_CHECK", typeof(string));
                ct.AddColumn("E_WORK_RANGE", typeof(short));
                ct.AddColumn("I_GOODS_NUM", typeof(short));
                ct.AddColumn("C_BOOTH_ID", typeof(string));
                ct.AddColumn("C_INV_CO", typeof(string));
                Row = ct.NewRow();

                foreach (string s in ct.Columns)
                {
                    if (cr[s] != null)
                    {
                        Row[s] = cr[s];
                    }
                }
                int i;

                for (i = 0; i < bData.Length; i++)
                {
                    bData[i] = 0;
                }
                for (i = 0; i < sData.Length; i++)
                {
                    sData[i] = "";
                }
                for (i = 0; i < tData.Length; i++)
                {
                    tData[i] = new DateTime(1999, 1, 1);
                }
            }
示例#11
0
文件: YH5_New.cs 项目: subinhu/RIIS
 public TICKET(ClRow cr)
 {
     Init(cr);
 }
 public ClRowChangeEvent(ClRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }