예제 #1
0
        //pos 上传
        public void posUpload()
        {
            ObjectList datalist = new ObjectList();

            GetEvent("pcPort").pcPort = PcPort;
            if (GetEvent("OpenComm").OpenComm() != 0)
            {
                MessageBox.Show("打开串口" + PcPort + "失败!");
                return;
            }
            GetEvent("ack").ack = "C";
            GetEvent("RespAckPos").RespAckPos();
            var ret = 0;

            while ((ret = GetEvent("Readdata").Readdata()) == 0)
            {
                var data = GetEvent("strdata").strdata;
                //如果数据内容是ok,传完了,发送ok过去后pos机控件开始清除数据
                if (data == "OK")
                {
                    datalist.Completed += (o, a) =>
                    {
                        if (a.Error == null)
                        {
                            GetEvent("ack").ack = "C";
                            GetEvent("RespAckPos").RespAckPos();
                        }
                    };
                    datalist.Save();
                    break;
                }
                else
                {
                    MessageBox.Show(data);
                    //解析,保存数据
                    GeneralObject go = parsePos(data);
                    datalist.Add(go);
                    //校验数据 ,正确 ,数据存储,否则,发送N
                    GetEvent("ack").ack = "C";
                    GetEvent("RespAckPos").RespAckPos();
                }
            }
            if (ret != 0)
            {
                MessageBox.Show("错误类型" + ret);
            }
            //关串口
            GetEvent("CloseComm").CloseComm();
        }
예제 #2
0
파일: PosObj.cs 프로젝트: DuBin1988/restv2
 //pos 上传
 public void posUpload()
 {
     ObjectList datalist = new ObjectList();
     GetEvent("pcPort").pcPort = PcPort;
     if (GetEvent("OpenComm").OpenComm() != 0)
     {
         MessageBox.Show("打开串口" + PcPort + "失败!");
         return;
     }
     GetEvent("ack").ack = "C";
     GetEvent("RespAckPos").RespAckPos();
     var ret = 0;
     while ((ret = GetEvent("Readdata").Readdata()) == 0)
     {
         var data = GetEvent("strdata").strdata;
         //如果数据内容是ok,传完了,发送ok过去后pos机控件开始清除数据
         if (data == "OK")
         {
             datalist.Completed += (o, a) =>
             {
                 if (a.Error == null)
                 {
                     GetEvent("ack").ack = "C";
                     GetEvent("RespAckPos").RespAckPos();
                 }
             };
             datalist.Save();
             break;
         }
         else
         {
             MessageBox.Show(data);
             //解析,保存数据
             GeneralObject go = parsePos(data);
             datalist.Add(go);
             //校验数据 ,正确 ,数据存储,否则,发送N
             GetEvent("ack").ack = "C";
             GetEvent("RespAckPos").RespAckPos();
         }
     }
     if (ret != 0)
     {
         MessageBox.Show("错误类型" + ret);
     }
     //关串口
     GetEvent("CloseComm").CloseComm();
 }
예제 #3
0
        // private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#";

        //生成用气地址列表
        public void Invoke()
        {
            State       = State.StartLoad;
            this.isBusy = true;
            //楼号
            string startbuild = this.GetPropertyValue("f_startbuild") + "";
            string endbuild   = startbuild;

            //结束楼号不为空
            if (this.GetPropertyValue("f_endbuild") + "" != "")
            {
                endbuild = this.GetPropertyValue("f_endbuild") + "";
            }
            //单元
            string startunit = this.GetPropertyValue("f_startunit") + "";
            string endunit   = startunit;

            if (this.GetPropertyValue("f_endunit") + "" != "")
            {
                endunit = this.GetPropertyValue("f_endunit") + "";
            }
            //楼层
            string startlayer = this.GetPropertyValue("f_startlayer") + "";
            string endlayer   = startlayer;

            if (this.GetPropertyValue("f_endlayer") + "" != "")
            {
                endlayer = this.GetPropertyValue("f_endlayer") + "";
            }
            //房间号
            string startroom = this.GetPropertyValue("f_startroom") + "";
            string endroom   = startroom;

            if (this.GetPropertyValue("f_endroom") + "" != "")
            {
                endroom = this.GetPropertyValue("f_endroom") + "";
            }
            //楼号列表
            List <string> builds = GetList(startbuild, endbuild);
            List <string> units  = GetList(startunit, endunit);
            List <string> layers = GetList(startlayer, endlayer);
            List <string> rooms  = GetList(startroom, endroom);
            ObjectList    plans  = new ObjectList();

            plans.WebClientInfo = this.WebClientInfo;
            plans.Name          = Guid.NewGuid().ToString();
            try
            {
                foreach (string build in builds)
                {
                    foreach (string unit in units)
                    {
                        foreach (string layer in layers)
                        {
                            //每层多少室
                            foreach (string room in rooms)
                            {
                                GeneralObject go = new GeneralObject();
                                go.EntityType    = this.EntityType;
                                go.WebClientInfo = this.WebClientInfo;
                                go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                                go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                                //设置楼号,有模式,按模式设置
                                string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                                string str          = MatchPattern(build, buildpattern);
                                go.SetPropertyValue("f_cusDom", str, true);
                                //设置单元
                                string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                                str = MatchPattern(unit, unitpattern);
                                go.SetPropertyValue("f_cusDy", str, true);
                                //设置层
                                string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                                str = MatchPattern(layer, layerpattern);
                                go.SetPropertyValue("f_cusFloor", str, true);
                                //设置每层室
                                string roompattern = this.GetPropertyValue("f_roompattern") + "";
                                str = MatchPattern(room, roompattern);
                                go.SetPropertyValue("f_apartment", str, true);
                                //Change();
                                //string ad = this.GetPropertyValue("f_gasaddress") + "";
                                go.Name = "test";
                                plans.Add(go);
                            }
                        }
                    }
                }
            }catch (NullReferenceException e)
            {
                MessageBox.Show("输入的内容不符合要求");
            }
            finally
            {
                plans.Completed += plans_Completed;
                plans.Save();
            }
        }
예제 #4
0
 //生成用气地址列表
 public void Invoke()
 {
     State = State.StartLoad;
     this.isBusy = true;
     //楼号
     string startbuild = this.GetPropertyValue("f_startbuild") + "";
     string endbuild = startbuild;
     //结束楼号不为空
     if (this.GetPropertyValue("f_endbuild") + "" != "")
     {
         endbuild = this.GetPropertyValue("f_endbuild") + "";
     }
     //单元
     string startunit = this.GetPropertyValue("f_startunit") + "";
     string endunit = startunit;
     if (this.GetPropertyValue("f_endunit") + "" != "")
     {
         endunit = this.GetPropertyValue("f_endunit") + "";
     }
     //楼层
     string startlayer = this.GetPropertyValue("f_startlayer") + "";
     string endlayer = startlayer;
     if (this.GetPropertyValue("f_endlayer") + "" != "")
     {
         endlayer = this.GetPropertyValue("f_endlayer") + "";
     }
     //房间号
     string startroom = this.GetPropertyValue("f_startroom") + "";
     string endroom = startroom;
     if (this.GetPropertyValue("f_endroom") + "" != "")
     {
         endroom = this.GetPropertyValue("f_endroom") + "";
     }
     //楼号列表
     List<string> builds = GetList(startbuild, endbuild);
     List<string> units = GetList(startunit, endunit);
     List<string> layers = GetList(startlayer, endlayer);
     List<string> rooms = GetList(startroom, endroom);
     ObjectList plans = new ObjectList();
     plans.WebClientInfo = this.WebClientInfo;
     plans.Name = Guid.NewGuid().ToString();
     foreach (string build in builds)
     {
         foreach (string unit in units)
         {
             foreach (string layer in layers)
             {
                 //每层多少室
                 foreach (string room in rooms)
                 {
                     //设置楼号
                     //SetPropertyValue("f_startbuild", build, true);
                     //设置单元
                     //SetPropertyValue("f_startunit", unit, true);
                     //设置层
                     //SetPropertyValue("f_startlayer", layer, true);
                     //设置每层室
                     //SetPropertyValue("f_room", room, true);
                     GeneralObject go = new GeneralObject();
                     go.EntityType = this.EntityType;
                     go.WebClientInfo = this.WebClientInfo;
                     go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                     go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                     //设置楼号,有模式,按模式设置
                     string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                     string str = MatchPattern(build, buildpattern);
                     go.SetPropertyValue("f_cusDom", str, true);
                     //设置单元
                     string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                     str = MatchPattern(unit, unitpattern);
                     go.SetPropertyValue("f_cusDy", str, true);
                     //设置层
                     string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                     str = MatchPattern(layer, layerpattern);
                     go.SetPropertyValue("f_cusFloor", str, true);
                     //设置每层室
                     string roompattern = this.GetPropertyValue("f_roompattern") + "";
                     str = MatchPattern(room, roompattern);
                     go.SetPropertyValue("f_apartment", str, true);
                     //Change();
                     //string ad = this.GetPropertyValue("f_gasaddress") + "";
                     go.Name = "test";
                     plans.Add(go);
                 }
             }
         }
     }
     plans.Completed += plans_Completed;
     plans.Save();
 }
예제 #5
0
        // private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#";

        //生成用气地址列表
        public void Invoke()
        {
            State       = State.StartLoad;
            this.isBusy = true;
            //楼号
            string startbuild = this.GetPropertyValue("f_startbuild") + "";
            string endbuild   = startbuild;

            //结束楼号不为空
            if (this.GetPropertyValue("f_endbuild") + "" != "")
            {
                endbuild = this.GetPropertyValue("f_endbuild") + "";
            }
            //单元
            string startunit = this.GetPropertyValue("f_startunit") + "";
            string endunit   = startunit;

            if (this.GetPropertyValue("f_endunit") + "" != "")
            {
                endunit = this.GetPropertyValue("f_endunit") + "";
            }
            //楼层
            string startlayer = this.GetPropertyValue("f_startlayer") + "";
            string endlayer   = startlayer;

            if (this.GetPropertyValue("f_endlayer") + "" != "")
            {
                endlayer = this.GetPropertyValue("f_endlayer") + "";
            }
            //房间号
            string startroom = this.GetPropertyValue("f_startroom") + "";
            string endroom   = startroom;

            if (this.GetPropertyValue("f_endroom") + "" != "")
            {
                endroom = this.GetPropertyValue("f_endroom") + "";
            }
            //楼号列表
            List <string> builds = GetList(startbuild, endbuild);
            List <string> units  = GetList(startunit, endunit);
            List <string> layers = GetList(startlayer, endlayer);
            List <string> rooms  = GetList(startroom, endroom);
            ObjectList    plans  = new ObjectList();

            plans.WebClientInfo = this.WebClientInfo;
            plans.Name          = Guid.NewGuid().ToString();
            try
            {
                for (int a = 0; a < builds.Count; a++)
                {
                    for (int b = 0; b < units.Count; b++)
                    {
                        for (int c = 0; c < layers.Count; c++)
                        {
                            for (int d = 0; d < rooms.Count; d++)
                            {
                                GeneralObject go = new GeneralObject();
                                go.EntityType    = this.EntityType;
                                go.WebClientInfo = this.WebClientInfo;
                                go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                                go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                                //设置楼号,有模式,按模式设置
                                string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                                string str          = MatchPattern(builds[a], buildpattern);
                                go.SetPropertyValue("f_cusDom", str, true);
                                //设置单元
                                string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                                str = MatchPattern(units[b], unitpattern);
                                go.SetPropertyValue("f_cusDy", str, true);
                                //设置层
                                string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                                str = MatchPattern(layers[c], layerpattern);
                                go.SetPropertyValue("f_cusFloor", str, true);
                                //设置每层室
                                string roompattern = this.GetPropertyValue("f_roompattern") + "";

                                int roomInt, endroomInt;
                                int.TryParse(rooms[d], out roomInt);
                                int.TryParse(endroom, out endroomInt);
                                str = MatchPattern((roomInt + endroomInt * b).ToString(), roompattern);
                                go.SetPropertyValue("f_apartment", str, true);
                                go.Name = "test";
                                plans.Add(go);
                            }
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("输入有误");
            }
            finally
            {
                plans.Completed += plans_Completed;
                plans.Save();
            }
        }
예제 #6
0
        // private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#";
        //生成用气地址列表
        public void Invoke()
        {
            State = State.StartLoad;
            this.isBusy = true;
            //楼号
            string startbuild = this.GetPropertyValue("f_startbuild") + "";
            string endbuild = startbuild;
            //结束楼号不为空
            if (this.GetPropertyValue("f_endbuild") + "" != "")
            {
                endbuild = this.GetPropertyValue("f_endbuild") + "";
            }
            //单元
            string startunit = this.GetPropertyValue("f_startunit") + "";
            string endunit = startunit;
            if (this.GetPropertyValue("f_endunit") + "" != "")
            {
                endunit = this.GetPropertyValue("f_endunit") + "";
            }
            //楼层
            string startlayer = this.GetPropertyValue("f_startlayer") + "";
            string endlayer = startlayer;
            if (this.GetPropertyValue("f_endlayer") + "" != "")
            {
                endlayer = this.GetPropertyValue("f_endlayer") + "";
            }
            //房间号
            string startroom = this.GetPropertyValue("f_startroom") + "";
            string endroom = startroom;
            if (this.GetPropertyValue("f_endroom") + "" != "")
            {
                endroom = this.GetPropertyValue("f_endroom") + "";
            }
            //楼号列表
            List<string> builds = GetList(startbuild, endbuild);
            List<string> units = GetList(startunit, endunit);
            List<string> layers = GetList(startlayer, endlayer);
            List<string> rooms = GetList(startroom, endroom);
            ObjectList plans = new ObjectList();
            plans.WebClientInfo = this.WebClientInfo;
            plans.Name = Guid.NewGuid().ToString();

            try
            {
                for (int a = 0; a < builds.Count; a++)
                {
                    for (int b = 0; b < units.Count; b++)
                    {
                        for (int c = 0; c < layers.Count; c++)
                        {

                            for (int d = 0; d < rooms.Count; d++)
                            {
                                    GeneralObject go = new GeneralObject();
                                    go.EntityType = this.EntityType;
                                    go.WebClientInfo = this.WebClientInfo;
                                    go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true);
                                    go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true);
                                    //设置楼号,有模式,按模式设置
                                    string buildpattern = this.GetPropertyValue("f_buildpattern") + "";
                                    string str = MatchPattern(builds[a], buildpattern);
                                    go.SetPropertyValue("f_cusDom", str, true);
                                    //设置单元
                                    string unitpattern = this.GetPropertyValue("f_unitpattern") + "";
                                    str = MatchPattern(units[b], unitpattern);
                                    go.SetPropertyValue("f_cusDy", str, true);
                                    //设置层
                                    string layerpattern = this.GetPropertyValue("f_layerpattern") + "";
                                    str = MatchPattern(layers[c], layerpattern);
                                    go.SetPropertyValue("f_cusFloor", str, true);
                                    //设置每层室
                                    string roompattern = this.GetPropertyValue("f_roompattern") + "";
                                    int  roomInt,endroomInt;
                                    int.TryParse(rooms[d], out roomInt);
                                    int.TryParse(endroom, out endroomInt);
                                    str = MatchPattern((roomInt + endroomInt * c).ToString(), roompattern);
                                    go.SetPropertyValue("f_apartment", str, true);
                                    go.Name = "test";
                                    plans.Add(go);
                            }

                        }

                    }
                }
            }catch(NullReferenceException)
            {
                MessageBox.Show("error");
            }
            finally
            {
                plans.Completed += plans_Completed;
                plans.Save();
            }
        }