private void fillCategary() { HttpWebConnect helper = new HttpWebConnect(); string url = RestUrl.allProductName; helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_disposeProductNameList); helper.TryRequest(url); }
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 refrashdata() { string url = RestUrl.FindProduceddata; HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getproducingProduct); helper.TryRequest(url); return; }
private void menuItem2_Click(object sender, EventArgs e) { HttpWebConnect helper = new HttpWebConnect(); string url = RestUrl.getProductInfoForInventoryList; helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getProductInfoForInventoryList); helper.TryRequest(url); return; }
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); }
void refreshDGVProductDetail() { //DataTable dt = ctlInventory.GetProductInfoTop0Table(); //this.dgvProductInfo.DataSource = dt; DataTable dt = null; if (this.dgvProductInfo.DataSource == null) { dt = new DataTable(); dt.Columns.Add("产品编号", typeof(string)); dt.Columns.Add("产品名称", typeof(string)); dt.Columns.Add("生产日期", typeof(string)); dt.Columns.Add("产品类别", typeof(string)); dt.Columns.Add("产品备注信息", typeof(string)); } else { dt = (DataTable)dgvProductInfo.DataSource; } dgvProductInfo.DataSource = dt; if (!this.dgvProductInfo.Columns.Contains("checkColumn")) { DataGridViewCheckBoxColumn cc = CreateCheckBoxColumn(); dgvProductInfo.Columns.Insert(0, cc); } this.dgvProductInfo.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); int headerW = this.dgvProductInfo.RowHeadersWidth; int columnsW = 0; DataGridViewColumnCollection columns = this.dgvProductInfo.Columns; if (columns.Count > 0) { for (int i = 0; i < columns.Count; i++) { columnsW += columns[i].Width; } if (columnsW + headerW < this.dgvProductInfo.Width) { int leftTotalWidht = this.dgvProductInfo.Width - columnsW - headerW; int eachColumnAddedWidth = leftTotalWidht / (columns.Count); for (int i = 0; i < columns.Count; i++) { columns[i].Width += eachColumnAddedWidth; } } } HttpWebConnect helper = new HttpWebConnect(); string url = RestUrl.getProductInfoForInventoryList; helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getProductInfoForInventoryList); helper.TryRequest(url); return; }
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); }
//定时获取扫描到的标签 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); }
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); }
private void button5_Click(object sender, EventArgs e) { string url = RestUrl.Put_toProduce; HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_Put_toProduce); helper.TryRequest(url); return; //PList plist = new PList(); //plist.StartPosition = FormStartPosition.CenterScreen; //plist.ShowDialog(); }
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); }
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); }
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; }
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); }
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; } }
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); }
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); } }
void Isexist(string id) { if (id.Length <= 0) { return; } string url = RestUrl.test_isexist; string jsonstr = string.Empty; jsonstr = id; HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getresult); helper.TryPostData(url, jsonstr); }
void refresh() { deleControlInvoke dele = delegate(object ol) { this.categoryList.Clear(); this.listBox1.Items.Clear(); 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); }; this.Invoke(dele, new object()); }
private void btnDelete_Click(object sender, EventArgs e) { if (this.selected_category_id != string.Empty) { HttpWebConnect helper = new HttpWebConnect(); string url = server_ip + "/index.php/Standarder/ProductCategory/delete_category_by_id/id/" + selected_category_id; helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_delete_category_by_id); helper.TryPostData(url, string.Empty); HttpWebConnect helper2 = new HttpWebConnect(); string url_delete = server_ip + "/index.php/ResSync/resourceSync/delete_file/group/ProductCategory/name/" + selected_image_path; //helper2.RequestCompleted += new deleGetRequestObject(helper2_RequestCompleted); helper2.TryPostData(url_delete, string.Empty); } }
void gettts(string text) { CommandInfo c = new CommandInfo("tts", text, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.1.98"); //LedInfo c = new LedInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.0.98"); string jsonString = string.Empty; jsonString = JSON.Instance.ToJSON(c); HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addLedInfo); //string url = RestUrl.addCommandInfo; string url = "http://192.168.1.120:9002/index.php/" + "LED/CommandInfo/addCommandInfo"; helper.TryPostData(url, jsonString); }
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; //if (ctl.AddProductItem(this.txtPID.Text, this.cmbName.Text, // this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), this.cmbFactory.Text, // this.txtComment.Text)) //{ // MessageBox.Show("添加产品信息成功!"); // if (this.refreshForm != null) // { // this.refreshForm.refreshDGV(); // } // if (this.checkBox1.Checked) // { // this.closeSerialPort(); // this.Close(); // } //} //else //{ // MessageBox.Show("添加产品信息失败!"); //} }
private void button4_Click(object sender, EventArgs e) { string url = "http://192.168.57.105:3003/getcmds"; command cmd = new command("cmd2", ""); string jsonString = string.Empty; jsonString = fastJSON.JSON.Instance.ToJSON(cmd); HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += (obj) => { string str = (string)obj; Debug.WriteLine(str); }; helper.TryPostData(url, jsonString); }
void __timer_Tick(object sender, EventArgs e) { //this.__IP = "localhost"; //string restUrl = "http://182.18.26.127:80/index.php/LogisTechBase/CarMonitorGet/getLatestCarPoints"; string restUrl = "http://" + this.__IP + ":" + this.__port + "/index.php/LogisTechBase/CarMonitorGet/getLatestCarPoints"; //Location l = new Location(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), this.__MobileName); CarPoint c = new CarPoint(); c.strTime = this.__timerStamp; c.strCarID = this.__MobileName; string jsonString = fastJSON.JSON.Instance.ToJSON(c); HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_return); helper.TryPostData(restUrl, jsonString); }
void __timer_Tick(object sender, EventArgs e) { //this.__IP = "localhost"; //string restUrl = "http://182.18.26.127:80/index.php/LogisTechBase/CarMonitorGet/getLatestCarPoints"; string restUrl = "http://" + this.__IP + ":" + this.__port + "/index.php/GPSAPIGet/getLatestCarPoint/id/" + this.__MobileName; //Location l = new Location(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), this.__MobileName); //CarPoint c = new CarPoint(); //c.Time = this.__timerStamp; //c.CarID = this.__MobileName; //string jsonString = fastJSON.JSON.Instance.ToJSON(c); HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_return); // {"state":null,"strCarID":"J001","strTime":"2012-02-12 11:42:45","strLatitude":"0","strLongitude":"0"} helper.TryPostData(restUrl, ""); }
void lbNodes_SelectedIndexChanged(object sender, EventArgs e) { if (lbNodes.SelectedItem != null) { string selectedNodeID = lbNodes.SelectedItem.ToString(); ZigbeeNode zn = new ZigbeeNode(); zn.node_id = selectedNodeID; string jsonString = string.Empty; jsonString = JSON.Instance.ToJSON(zn); HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_getZigbeeNode); string url = RestUrl.getZigbeeNode; helper.TryPostData(url, jsonString); } }
void setLED(string text) { CommandInfo c = new CommandInfo("led", text, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.1.30"); //LedInfo c = new LedInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "192.168.0.98"); string jsonString = string.Empty; jsonString = JSON.Instance.ToJSON(c); HttpWebConnect helper = new HttpWebConnect(); helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted_addLedInfo); //string url = RestUrl.addCommandInfo; string url = RestUrl.addZigbeeNode; helper.TryPostData(url, jsonString); }
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.__tagUploadInterval; //距离现在差距缓冲时间间隔的时间点 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;//记录从应用启动到现在的毫秒数 } } 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); this.lblStatus.Text = "发送标签 " + tagIDTag.tag + " " + tagIDTag.startTime; this.appendLog(this.lblStatus.Text); 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); } }
void __timer_Tick_getCommand(object sender, EventArgs e) { //string url = sysConfig.getRestUrl(); //string url = sysConfig.getCommandRestUrl(); string url = sysConfig.getCommandRestUrlComet(); //CommandInfo li = new CommandInfo(string.Empty, string.Empty, this.lastUpdateTimeStamp, string.Empty); LedInfo li = new LedInfo(string.Empty, this.lastUpdateTimeStamp, string.Empty); Debug.WriteLine("__timer_Tick_getCommand -> 时间标识:" + this.lastUpdateTimeStamp); string jsonString = fastJSON.JSON.Instance.ToJSON(li); //this.appendLog(jsonString); HttpWebConnect httpHelper = new HttpWebConnect(); httpHelper.RequestCompleted += new deleGetRequestObject(__httpHelper_RequestCompleted_getCommand); httpHelper.TryPostData(url, jsonString); }