/// <summary> /// 批量报装 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { //起始表号 long meterNoStart = Convert.ToInt64(this.textBox1.Text); //表数目 int meterNum = Convert.ToInt32(this.textBox2.Text); userIdList = new List <string>(); meterIdList = new List <string>(); for (int i = 0; i < meterNum; i++) { //创建测试用户 IoT_User user = new IoT_User() { Address = "测试用户" + i + "的地址", Community = "1", CompanyID = "zzcy", Door = "测试门牌号", Phone = "xxxxxxxxxxxx", State = '1', Street = "1", UserName = "******" + i }; //创建测试表具 IoT_Meter meter = new IoT_Meter() { CompanyID = "zzcy", MeterNo = (meterNoStart + i).ToString(), MeterType = "01" }; CY.IotM.Common.Message m = userService.getChannel.BatchAddUserMeter(user, meter); if (!m.Result) { MessageBox.Show(m.TxtMessage); return; } userIdList.Add(user.UserID); meterIdList.Add(meter.MeterNo); } MessageBox.Show("批量创建测试用户完成"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { try { //价格Id long priceId = Convert.ToInt64(comboBox1.SelectedValue); CY.IotM.Common.Message m = dianHuoService.getChannel.DianHuo(meterIdList, priceId, "zzcy", DateTime.Now, userIdList, "测试操作员"); if (m.Result) { MessageBox.Show("点火成功"); } else { MessageBox.Show(m.TxtMessage); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }