frmScaleQuery.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using Common;
  2. using MeterPlugInLibrary;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. using com.hnshituo.core.webapp.vo;
  14. namespace MeterModuleLibrary
  15. {
  16. public partial class frmScaleQuery : Form
  17. {
  18. public frmScaleQuery()
  19. {
  20. InitializeComponent();
  21. }
  22. //语音播报
  23. //private VoicePlay vicPlayClass = new VoicePlay();//语音播放
  24. public List<PbModelDb> ht = new List<PbModelDb>();
  25. private void txtMETER_TYPE_NO_Enter(object sender, EventArgs e)
  26. {
  27. lbMsgInfo.Text = "";
  28. this.Visible = false;
  29. frmNumberKey2 fnk = new frmNumberKey2();
  30. if (fnk.ShowDialog() == DialogResult.OK)
  31. {
  32. this.Visible = true;
  33. txtMETER_TYPE_NO.Text = fnk.sValue;
  34. txtFORWARDING_UNIT_NAME.Text = "";
  35. txtMATTER_NAME.Text = "";
  36. txtRECEIVING_UINT_NAME.Text = "";
  37. ht.Clear();
  38. if (txtMETER_TYPE_NO.Text.Trim() != "" && txtMETER_TYPE_NO.Text.Trim().Length == 9)
  39. {
  40. string strM = txtMETER_TYPE_NO.Text.Trim();
  41. string sql = @"select t1.load_point_no as id, t1.load_point_name text, t1.meter_code text2
  42. from meter_base_load_point t1
  43. where t1.meter_code = '" + strM.Substring(3, 3) + @"'
  44. and t1.valid_Flag = '1'
  45. union all
  46. select t1.load_point_no as id, t1.load_point_name text, t1.meter_code text2
  47. from meter_base_load_point t1
  48. where t1.meter_code = '" + strM.Substring(6, 3) + @"'
  49. and t1.valid_Flag = '1'
  50. union all
  51. select t2.matter_no as id, t2.matter_name text, t2.meter_code text2
  52. from meter_base_matter_info t2
  53. where t2.meter_code = '" + strM.Substring(0, 3) + @"'
  54. and t2.valid_Flag = '1'";
  55. PbModelDbService<List<PbModelDb>> pb = new PbModelDbService<List<PbModelDb>>();
  56. RESTfulResult<List<PbModelDb>> rm = pb.executeSqlDataWf(sql);
  57. if (rm.Succeed && rm.Data != null && rm.Data.Count == 3)
  58. {
  59. txtMATTER_NAME.Text = rm.Data[2].text;
  60. txtFORWARDING_UNIT_NAME.Text = rm.Data[0].text;
  61. txtRECEIVING_UINT_NAME.Text = rm.Data[1].text;
  62. //根据规则,将数据按3位数截取,然后作为条件查询基础表数据,然后绑定到界面上
  63. ht = rm.Data;
  64. }
  65. else
  66. {
  67. //vicPlayClass.GetVoicePlay("信息输入有误", PbCache.collect.carno);
  68. lbMsgInfo.Text = "*不存在该业务编码!";
  69. }
  70. }
  71. else
  72. {
  73. //vicPlayClass.GetVoicePlay("信息输入有误", PbCache.collect.carno);
  74. lbMsgInfo.Text = "*不存在该业务编码!";
  75. }
  76. btnSubmit.Focus();
  77. }
  78. else
  79. {
  80. btnSubmit.Focus();
  81. this.Visible = true;
  82. }
  83. }
  84. public string strValue = "";
  85. private void btnSubmit_Click(object sender, EventArgs e)
  86. {
  87. strValue = txtMETER_TYPE_NO.Text.Trim();
  88. this.DialogResult = DialogResult.OK;
  89. this.Close();
  90. }
  91. private void btnCancel_Click(object sender, EventArgs e)
  92. {
  93. this.Close();
  94. }
  95. }
  96. }