Пример #1
0
        void postjson()
        {
            HttpWebConnect http  = new HttpWebConnect();
            string         s     = "1381410529249";
            string         s2    = GlobleV.Secret.ToString();
            GPSPoint       gps1  = new GPSPoint(0.1, 0.2, "11", "22", "33", s2);
            GPSPoint       gps2  = new GPSPoint(4827636.71875, 12983703.125, "11");
            string         json1 = Newtonsoft.Json.JsonConvert.SerializeObject(gps1);
            string         json2 = Newtonsoft.Json.JsonConvert.SerializeObject(gps2);

            http.TryPostData("http://localhost:3000/postgps", json1);
            http.TryPostData("http://localhost:3000/postgps", json2);
        }
        void SpeakAboutSomething(List <epcInfo> epcList)
        {
            if (epcList == null || epcList.Count <= 0)
            {
                return;
            }
            string         jsonString  = string.Empty;
            string         tempToSpeak = string.Empty;
            CommandInfo    c           = null;
            HttpWebConnect helper      = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addLedInfo);
            string url = staticClass.getRestAddress();

            //string url = staticClass.RestAddress;
            switch (staticClass.mode)
            {
            case MonitorMode.防盗模式:
                tempToSpeak = "编号为 ";
                foreach (epcInfo s in epcList)
                {
                    tempToSpeak = tempToSpeak + s.epc + ",";
                }
                tempToSpeak += "的产品 已不在货架,请检查";
                Debug.WriteLine(
                    string.Format("Form1.SpeakAboutSomething  -> 防盗模式 = {0}"
                                  , tempToSpeak));
                c          = new CommandInfo("tts", tempToSpeak, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.0.98");
                jsonString = JSON.Instance.ToJSON(c);
                helper.TryPostData(url, jsonString);
                break;

            case MonitorMode.讲解模式:
                epcInfo   epc  = epcList[0];
                DataRow[] rows = null;
                string    type = epc.type;
                rows = MemoryTable.typeMapTable.Select("type = '" + type + "'");
                if (rows.Length > 0)
                {
                    tempToSpeak += (string)rows[0]["description"];
                    Debug.WriteLine(
                        string.Format("Form1.SpeakAboutSomething  -> 讲解模式 = {0}"
                                      , tempToSpeak));
                    c          = new CommandInfo("tts", tempToSpeak, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.0.98");
                    jsonString = JSON.Instance.ToJSON(c);
                    helper.TryPostData(url, jsonString);
                }
                break;
            }
        }
        private void btnAsyn_Click(object sender, EventArgs e)
        {
            DataRow[] rowsMap = this.mapConfigsTable.Select("NOT(studenID = '')");
            int       count   = rowsMap.Length;
            //int count = 45;
            //计算总共多少座位数
            DataTable dt          = MemoryTable.dtRoomConfig;
            int       total_count = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int iRows   = int.Parse(dt.Rows[i]["IROW"].ToString());
                int iColumn = int.Parse(dt.Rows[i]["ICOLUMN"].ToString());
                total_count = total_count + iRows * iColumn;
            }

            //将当前使用的座位数和总座位数上传到服务器

            string         strToUpload = "{" + string.Format("\"name\":\"教室一\",\"total_count\":\"{0}\",\"used_count\":\"{1}\",\"update_date\":\"\"", total_count, count) + "}";
            HttpWebConnect helper      = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_state_info);
            string url = string.Format("http://{0}:{1}/index.php/Index/add_classroom_state", staticClass.restIP, staticClass.restPort);

            helper.TryPostData(url, strToUpload);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.cmbName.SelectedIndex == -1)
            {
                MessageBox.Show("请选择产品名称!");
                return;
            }
            Product newPro = new Product(this.txtPID.Text, this.cmbName.Text,
                                         this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.cmbFactory.Text,
                                         this.txtComment.Text);
            string jsonString = fastJSON.JSON.Instance.ToJSON(newPro);

            Debug.WriteLine(
                string.Format("frmProductManageAdd.btnSave_Click  -> json string = {0}"
                              , jsonString));
            HttpWebConnect helper = new HttpWebConnect();
            string         url    = RestUrl.updateProduct;

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_update);
            helper.TryPostData(url, jsonString);
            return;

            //if (ctl.UpdateProductItem(this.txtPID.Text, this.cmbName.Text,
            //                        this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.cmbFactory.Text,
            //                        this.txtComment.Text))
            //{
            //    MessageBox.Show("更新产品信息成功!");
            //    this.refreshDGV();
            //}
            //else
            //{
            //    MessageBox.Show("更新产品信息出错!");
            //}
        }
Пример #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DataGridViewRowCollection rows = this.dgvOrderInfo.Rows;

            foreach (DataGridViewRow vr in rows)
            {
                DataGridViewCheckBoxCell cbc = (DataGridViewCheckBoxCell)vr.Cells[0];
                if ((cbc.Value != null) && cbc.Value.ToString() == Boolean.TrueString)
                {
                    DataGridViewCell cepc = (DataGridViewCell)vr.Cells[1];
                    string           epc  = (string)cepc.Value;

                    Order  o          = new Order(epc, -1);
                    string jsonString = string.Empty;
                    jsonString = JSON.Instance.ToJSON(o);
                    HttpWebConnect helper = new HttpWebConnect();
                    helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_deleteOrder);
                    string url = RestUrl.deleteOrder;
                    helper.TryPostData(url, jsonString);

                    //this.ctlOrder.DeleteOrderItem(epc);
                }
            }
            //this.RefreshOrderInfo();
        }
Пример #6
0
        static void _timer_Tick(object sender, EventArgs e)
        {
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_get_syc_list);
            helper.TryPostData(key_check_url, strCrypto);
        }
Пример #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.txtNodeID.Text.Length <= 0)
            {
                MessageBox.Show("请填写有效的节点ID!", "信息提示");
                return;
            }
            if (this.txtMaxTemp.Value < this.txtMinTemp.Value)
            {
                MessageBox.Show("最高温度小于最低温度!", "信息提示");
                return;
            }
            if (this.txtMaxHumunity.Value < this.txtMinHumunity.Value)
            {
                MessageBox.Show("最大湿度小于最小温度!", "信息提示");
                return;
            }

            ZigbeeNode zn = new ZigbeeNode(this.txtNodeID.Text,
                                           this.txtLocation.Text,
                                           this.txtMaxTemp.Value.ToString(), this.txtMinTemp.Value.ToString(),
                                           this.txtMaxHumunity.Value.ToString(), this.txtMinHumunity.Value.ToString());
            string jsonString = string.Empty;

            jsonString = JSON.Instance.ToJSON(zn);
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addZigbeeNodeInfo);

            string url = RestUrl.addZigbeeNode;

            helper.TryPostData(url, jsonString);
        }
Пример #8
0
        public void start_sync()
        {
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_get_syc_list);
            helper.TryPostData(get_syc_list_url(), lastTagTimeStamp);
        }
Пример #9
0
        void addTieBiao()
        {
            string  Pid = "产品A";
            string  EPC = this.txtEpc.Text;
            Product p   = new Product();

            p.Pro_code   = EPC;
            p.Pro_Name   = Pid;
            p.Pro_Leibie = this.cmbProductCategory.SelectedText;
            p.Pro_Gui    = "100*200";
            p.Pro_state  = "未入库";
            p.Pro_Pici   = "12001234";
            p.Pro_Chej   = "车间1";
            p.Pro_Person = "大伟";
            p.Contact    = "18812394402";
            p.Remark     = "机械零件";
            p.Pro_Tempre = "";
            p.Pro_Wet    = "";
            p.finishTime = "";
            p.falg       = "1";

            string url     = RestUrl.add_New_Code;
            string jsonstr = string.Empty;

            jsonstr = fastJSON.JSON.Instance.ToJSON(p);
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getaddresult);
            helper.TryPostData(url, jsonstr);
        }
Пример #10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.txtID.Text.Length <= 0)
            {
                return;
            }
            if (this.txtName.Text.Length <= 0)
            {
                return;
            }
            if (this.txtImage.Text.Length <= 0)
            {
                return;
            }
            ProductCategory pc     = new ProductCategory(this.txtID.Text, this.txtName.Text, this.txtImage.Text);
            string          json   = JSON.Instance.ToJSON(pc);
            HttpWebConnect  helper = new HttpWebConnect();
            string          url    = server_ip + "/index.php/Standarder/ProductCategory/add_category";

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_add_category);
            helper.TryPostData(url, json);

            //上传图片
            string uploadfile = this.file_path;
            string url_upload = server_ip + "/index.php/ResSync/resourceSync/upload_file/group/ProductCategory";

            UploadFile.UploadFileEx(uploadfile, url_upload, null, null,
                                    null, null);
        }
        private void backgroundWorker1_DoWork(object sender,
                                              DoWorkEventArgs e)
        {
            // Get the BackgroundWorker that raised this event.
            BackgroundWorker worker = sender as BackgroundWorker;

            // Assign the result of the computation
            // to the Result property of the DoWorkEventArgs
            // object. This is will be available to the
            // RunWorkerCompleted eventhandler.
            string strToSpeakOut = (string)e.Argument;

            if (strToSpeakOut == null || strToSpeakOut.Length <= 0)
            {
                return;
            }
            CommandInfo ctts = new CommandInfo("tts", strToSpeakOut, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.0.98");
            string      jsonStringToSpeak = string.Empty;

            jsonStringToSpeak = JSON.Instance.ToJSON(ctts);
            HttpWebConnect helper1 = new HttpWebConnect();

            helper1.RequestCompleted += new deleGetRequestObject(helper1_RequestCompleted);
            string url = staticClass.addCommandInfo;

#if LOG_OUTPUT
            txtLog.LogError("frmRemind -> backgroundWorker1_DoWork  发送tts命令"
                            , null);
#endif
            helper1.TryPostData(url, jsonStringToSpeak);

            //strToSend = strToSpeakOut + " " + strToSend;
        }
Пример #12
0
        //发送盘点结果
        private void menuItem4_Click(object sender, EventArgs e)
        {
            //发送前先将读取标签的操作停止
            if (this.menuItem5.Checked == true)//正在循环读取标签
            {
                __timer.Enabled        = false;
                this.menuItem5.Checked = false;
            }

            string       strTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            List <tagID> list    = new List <tagID>();

            foreach (System.Windows.Forms.ListViewItem lvi in this.listView1.Items)
            {
                if (lvi.Checked == true)
                {
                    tagID tag1 = new tagID(lvi.Text, strTime, InventoryCommand.盘点);
                    list.Add(tag1);
                }
            }

            string         jsonString = tagID.toJSONFromList(list);
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted);
            string url = RestUrl.addScanedTags;

            helper.TryPostData(url, jsonString);
        }
Пример #13
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.txtPID.Text == null || this.txtPID.Text == string.Empty)
            {
                MessageBox.Show("产品编号必须填写!");
                return;
            }
            if (this.cmbName.SelectedIndex == -1)
            {
                MessageBox.Show("请选择产品名称!");
                return;
            }
            Product newPro = new Product(this.txtPID.Text, this.cmbName.Text,
                                         this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.cmbFactory.Text,
                                         this.txtComment.Text);
            string jsonString = fastJSON.JSON.Instance.ToJSON(newPro);

            Debug.WriteLine(
                string.Format("frmProductManageAdd.btnAdd_Click  -> json string = {0}"
                              , jsonString));
            HttpWebConnect helper = new HttpWebConnect();
            string         url    = RestUrl.addProduct;

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted);
            helper.TryPostData(url, jsonString);
            return;
        }
Пример #14
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.txtPID.Text == null || this.txtPID.Text.Length <= 0)
            {
                return;
            }
            Product newPro = new Product(this.txtPID.Text, this.cmbName.Text,
                                         this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.cmbFactory.Text,
                                         this.txtComment.Text);
            string jsonString = fastJSON.JSON.Instance.ToJSON(newPro);

            Debug.WriteLine(
                string.Format("frmProductManageAdd.btnDelete_Click -> json string = {0}"
                              , jsonString));
            HttpWebConnect helper = new HttpWebConnect();
            string         url    = RestUrl.deleteProduct;

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_delete);
            helper.TryPostData(url, jsonString);
            return;

            if (ctl.DeleteProductItem(this.txtPID.Text))
            {
                MessageBox.Show("删除产品信息成功!");
                this.refreshDGV();
            }
            else
            {
                MessageBox.Show("删除产品信息出错!");
            }
        }
Пример #15
0
        private void btnStorageP_Click(object sender, EventArgs e)
        {
            List <Product>            list = new List <Product>();
            DataGridViewRowCollection rows = this.dgvNotStoragedPInfo.Rows;

            foreach (DataGridViewRow vr in rows)
            {
                DataGridViewCheckBoxCell cbc = (DataGridViewCheckBoxCell)vr.Cells[0];
                if ((string)cbc.Value == Boolean.TrueString)
                {
                    DataGridViewCell cepc = (DataGridViewCell)vr.Cells[1];
                    string           epc  = (string)cepc.Value;
                    Product          p    = new Product(epc, string.Empty, string.Empty, string.Empty, string.Empty);
                    list.Add(p);
                    //ctl.SetProductInStorage(epc);
                }
            }
            string jsonString = fastJSON.JSON.Instance.ToJSON(list);

            Debug.WriteLine(
                string.Format("frmStorageManage.btnStorageP_Click  ->  = {0}"
                              , jsonString));
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addProductToStorage);
            string url = RestUrl.addProductToStorage;

            helper.TryPostData(url, jsonString);

            return;
        }
Пример #16
0
        void addTagsToServer(string tag)
        {
            //Debug.WriteLine("addTagsToServer -> " + tag);
            //读到一个新标签后,检查缓存池,会有三种情况:
            //1 该epc尚未加入到缓存池中
            //2 该epc已经加入到缓存池中,但是在缓冲时间之内
            //3 epc在缓冲池中,且储存时间已经超过缓冲时间
            DataRow[] rows  = null;
            TimeSpan  tsGap = DateTime.Now - staticClass.timeBase;
            long      gap   = (long)tsGap.TotalMilliseconds - this.__reader_info.interval; //距离现在差距缓冲时间间隔的时间点

            rows = __dtTagTemp.Select("time > " + gap + " and tag = '" + tag + "'");       //只要大于这个时间点说明离现在近
            if (rows.Length > 0)                                                           //说明tag等于epc的那个标签已经尚在缓冲时间之内,不能重新上传
            {
                return;
            }
            else
            {
                //如果上不存在epc,则要添加到缓冲池中
                rows = null;
                rows = this.__dtTagTemp.Select("tag = '" + tag + "'");
                if (rows.Length <= 0)
                {
                    this.__dtTagTemp.Rows.Add(new object[] { tag, tsGap.TotalMilliseconds });
                }
                else
                {
                    //这里还剩下的只有 已经加入了缓冲池,但是已经超过缓冲时间的标签,因此只需更新读取时间即可
                    rows[0]["time"] = tsGap.TotalMilliseconds;//记录从应用启动到现在的毫秒数
                }
            }
            tagID  tagIDTag = new tagID(tag, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), this.__reader_info.flag);
            string log      = "发送标签 " + tagIDTag.tag + " " + tagIDTag.startTime;

            this.appendLog(log);

            string         jsonString = fastJSON.JSON.Instance.ToJSON(tagIDTag);
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted);
            string url = RestUrl.addScanedTag;

            helper.TryPostData(url, jsonString);
            //foreach (string flag in this.flagList)
            //{
            //    //Debug.WriteLine(
            //    //    string.Format("frmMain.addTagstoServer  -> web add  = flag = {0}  epc = {1}"
            //    //    , flag, tag));
            //    tagID tagIDTag = new tagID(tag, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), flag);
            //    string log = "发送标签 " + tagIDTag.tag + " " + tagIDTag.startTime;
            //    this.appendLog(log);

            //    string jsonString = fastJSON.JSON.Instance.ToJSON(tagIDTag);
            //    HttpWebConnect helper = new HttpWebConnect();
            //    helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted);
            //    string url = RestUrl.addScanedTag;
            //    helper.TryPostData(url, jsonString);
            //}
        }
Пример #17
0
        void postjson(double _lng, double _lat, string type = "sogou")
        {
            HttpWebConnect http = new HttpWebConnect();
            GPSPoint       gps  = new GPSPoint(_lat, _lng, GlobleV.CarID, currentRoadName, type, GlobleV.Secret);
            string         json = Newtonsoft.Json.JsonConvert.SerializeObject(gps);

            http.TryPostData("http://localhost:3000/postgps", json);
        }
Пример #18
0
        void __timer_Tick_getCommand(object sender, EventArgs e)
        {
            string          url        = RestUrl.getCommand;
            CommandProtocol cmd        = new CommandProtocol(string.Empty, this.lastUpdateTimeStamp, string.Empty);
            string          jsonString = fastJSON.JSON.Instance.ToJSON(cmd);

            __httpHelper.TryPostData(url, jsonString);
        }
Пример #19
0
        private void button4_Click(object sender, EventArgs e)
        {
            string         url    = ResSyncer.server_ip + "/index.php/ResSync/resourceSync/get_syc_list";
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_get_syc_list);
            helper.TryPostData(url, __lastTagTimeStamp);
        }
        void refresh()
        {
            HttpWebConnect helper = new HttpWebConnect();
            string         url    = server_ip + "/index.php/Standarder/ProductCategory/get_category_list";

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_get_category_list);
            helper.TryPostData(url, string.Empty);
        }
Пример #21
0
        private void btnStartCheck_Click(object sender, EventArgs e)
        {
            this.__timer.Enabled       = false;
            this.bGettingTag           = false;
            this.btnGetP.Text          = "扫描";
            this.btnStartCheck.Enabled = false;
            //this.closeSerialPort();
            List <Product> list = new List <Product>();

            DataTable dt = (DataTable)this.dgvDetailProductsInfo.DataSource;

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string  productID = dr[0].ToString();
                    Product p1        = new Product(productID, string.Empty, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), string.Empty, string.Empty);
                    list.Add(p1);
                    //this.ctlTakeOutInventory.InsertProductInfoIntoOutInventory(productID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    //this.ctlTakeOutInventory.ChangeProductStatusforOutInventory(productID);
                }
            }
            string         jsonString = fastJSON.JSON.Instance.ToJSON(list);
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_deleteProductToStorage);
            string url = RestUrl.deleteProductFromStorage;

            helper.TryPostData(url, jsonString);


            DataTable    dtOrder   = (DataTable)this.dgvTakenOutP.DataSource;
            List <Order> listOrder = new List <Order>();

            if (dtOrder != null)
            {
                foreach (DataRow dr in dtOrder.Rows)
                {
                    string Name = dr[0].ToString();
                    Order  o    = new Order(Name, 1);
                    listOrder.Add(o);
                }

                jsonString = fastJSON.JSON.Instance.ToJSON(listOrder);
                Debug.WriteLine(
                    string.Format("frmTakeOutInventory.btnStartCheck_Click  -> orders = {0}"
                                  , jsonString));
                helper = new HttpWebConnect();
                helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_deleteOrders);
                url = RestUrl.deleteOrders;
                helper.TryPostData(url, jsonString);
            }


            //this.ctlTakeOutInventory.DeleteOrderInfo();
            //this.frmTakeOutInventory_Shown(null, null);
        }
Пример #22
0
        private void button1_Click(object sender, EventArgs e)
        {
            string url        = "http://localhost:9002/index.php/Inventory/Demo/demo1";
            string jsonString = string.Empty;

            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getAllOrders);
            helper.TryPostData(url, jsonString);
        }
Пример #23
0
        void __timer_Tick_getCommand(object sender, EventArgs e)
        {
            string      url  = sysConfig.getRestUrl();
            scanTagPara para = new scanTagPara("inventory", this.lastUpdateTimeStamp);
            //LedInfo li = new LedInfo(string.Empty, this.lastUpdateTimeStamp, string.Empty);
            string         jsonString = fastJSON.JSON.Instance.ToJSON(para);
            HttpWebConnect httpHelper = new HttpWebConnect();

            httpHelper.RequestCompleted += new deleGetRequestObject(__httpHelper_RequestCompleted_getCommand);
            httpHelper.TryPostData(url, jsonString);
        }
Пример #24
0
        //定时获取扫描到的标签
        void __timer_Tick(object sender, EventArgs e)
        {
            scanTagPara    para       = new scanTagPara(InventoryCommand.扫描入库, this.__lastTagTimeStamp);
            string         jsonString = fastJSON.JSON.Instance.ToJSON(para);
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getScanTags);
            string url = RestUrl.getScanedTags;

            helper.TryPostData(url, jsonString);
        }
Пример #25
0
        private void 关闭读写器CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CommandProtocol cp = new CommandProtocol("close_reader2300", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "inventory");
            //CommandProtocol cp = new CommandProtocol("close_rmu900", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "inventory");
            string         jsonString = fastJSON.JSON.Instance.ToJSON(cp);
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addCommand);
            string url = RestUrl.addCommand;

            helper.TryPostData(url, jsonString);
        }
Пример #26
0
        private void button2_Click(object sender, EventArgs e)
        {
            string    url        = "http://localhost:9002/index.php/Inventory/Demo/demo2";
            jsonClass jc         = new jsonClass("wei", "24");
            string    jsonString = string.Empty;

            jsonString = fastJSON.JSON.Instance.ToJSON(jc);
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getAllOrders);
            helper.TryPostData(url, jsonString);
        }
        void LinkEPCToProduct(string epc)
        {
            //根据编码获取产品具体信息
            Product        p1         = new Product(epc, string.Empty, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), string.Empty, string.Empty);
            string         jsonString = fastJSON.JSON.Instance.ToJSON(p1);
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getProduct);
            string url = RestUrl.getProduct;

            helper.TryPostData(url, jsonString);
            return;
        }
Пример #28
0
        private void timer4_Tick(object sender, EventArgs e)
        {
            string     url = RestUrl.getZigbeeInfo;
            zigbeeInfo zn  = new zigbeeInfo();

            zn.node_id = staticClass.zigbee_id;
            string jsonstring = fastJSON.JSON.Instance.ToJSON(zn);
            //string url = newurl.getEnviromentInfos;
            HttpWebConnect helper = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getZigbeeInfo);
            helper.TryPostData(url, jsonstring);
        }
Пример #29
0
        void refreshDGVOrder()
        {
            DataTable dt = null;

            if (this.dgvTakenOutP.DataSource == null)
            {
                dt = new DataTable();
                dt.Columns.Add("产品名称", typeof(string));
                dt.Columns.Add("订购数量", typeof(string));
                dt.Columns.Add("已扫描数量", typeof(string));
                dgvTakenOutP.DataSource = dt;
            }
            else
            {
                dt = (DataTable)dgvTakenOutP.DataSource;
            }
            dt.Rows.Clear();
            //DataTable dt = ctlTakeOutInventory.GetOrderTable();
            //this.dgvTakenOutP.DataSource = dt;

            this.dgvTakenOutP.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            int headerW  = this.dgvTakenOutP.RowHeadersWidth;
            int columnsW = 0;
            DataGridViewColumnCollection columns = this.dgvTakenOutP.Columns;

            if (columns.Count > 0)
            {
                for (int i = 0; i < columns.Count; i++)
                {
                    columnsW += columns[i].Width;
                }
                if (columnsW + headerW < this.dgvTakenOutP.Width)
                {
                    int leftTotalWidht       = this.dgvTakenOutP.Width - columnsW - headerW;
                    int eachColumnAddedWidth = leftTotalWidht / (columns.Count);
                    for (int i = 0; i < columns.Count; i++)
                    {
                        columns[i].Width += eachColumnAddedWidth;
                    }
                }
            }

            string         jsonString = string.Empty;
            HttpWebConnect helper     = new HttpWebConnect();

            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getProductList4deleteProductFromStorage);
            string url = RestUrl.getProductList4deleteProductFromStorage;

            helper.TryPostData(url, jsonString);
        }
Пример #30
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.textBox1.Text.Length > 0)
     {
         string      strToSpeakOut = this.textBox1.Text;
         CommandInfo c             = new CommandInfo("led", strToSpeakOut, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "172.16.13.99");
         string      jsonString    = string.Empty;
         jsonString = JSON.Instance.ToJSON(c);
         HttpWebConnect helper = new HttpWebConnect();
         helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addLedInfo);
         string url = staticClass.get_set_led_url();
         helper.TryPostData(url, jsonString);
     }
 }