FrmTVShows.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Control;
  13. using Infragistics.Win.UltraWinGrid;
  14. using System.Speech.Synthesis;
  15. using Core.StlMes.Client.PipeLeaveFactory.Tool;
  16. namespace Core.StlMes.Client.PipeLeaveFactory
  17. {
  18. public partial class FrmTVShows : FrmBase
  19. {
  20. public FrmTVShows()
  21. {
  22. InitializeComponent();
  23. }
  24. public FrmTVShows(OpeBase _ob)
  25. {
  26. InitializeComponent();
  27. // new CodeFile.FormMove(this, panel1);
  28. ob = _ob;
  29. }
  30. private static object sync = new object();
  31. private static FrmTVShows instance;
  32. public static FrmTVShows GetSingleton(OpeBase _ob)
  33. {
  34. lock (sync)
  35. {
  36. ;
  37. if (instance == null || instance.IsDisposed)
  38. instance = new FrmTVShows(_ob);
  39. }
  40. return instance;
  41. }
  42. private void timer1_Tick(object sender, EventArgs e)
  43. {
  44. Loadrecord();
  45. }
  46. ListViewItem itCall=null;
  47. private void btnCall_Click(object sender, EventArgs e)
  48. {
  49. string tt;
  50. if (itCall == null)
  51. {
  52. tt = lstCarNo.Items[0].SubItems[1].Text;
  53. lstCarNo.Items[0].BackColor = Color.Green;
  54. }
  55. else {
  56. tt = itCall.SubItems[1].Text;
  57. }
  58. itCall = null;
  59. if (tt != null)
  60. {
  61. tt += "请车号" + tt + "进来开票";
  62. BaseHelper.Speak(tt);
  63. }
  64. }
  65. void get()
  66. {
  67. int itemnum = this.lstCarNo.Items.Count;
  68. string[] str = { "D:", "本机磁盘", "10G", "6G" };
  69. ListViewItem itm = new ListViewItem(str);
  70. itm.BackColor = Color.Green;
  71. this.lstCarNo.Items.Insert(itemnum, itm);
  72. }
  73. void del()
  74. {
  75. foreach (ListViewItem it in lstCarNo.Items)
  76. {
  77. if (it.SubItems[0].Text.Contains("A"))
  78. {
  79. lstCarNo.Items.Remove(it);
  80. }
  81. }
  82. }
  83. private void lstCarNo_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  84. {
  85. lstCarNo.FullRowSelect = true;
  86. if (this.lstCarNo.SelectedItems.Count > 0)
  87. {
  88. itCall = lstCarNo.SelectedItems[0];
  89. lstCarNo.SelectedItems[0].BackColor = Color.Green;
  90. lstCarNo.SelectedItems[0].Selected = false;
  91. }
  92. }
  93. void Loadrecord()
  94. {
  95. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
  96. DataTable dtLoad = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryCarNoLoadvehicleBySteel",
  97. new Object[] { }, ob);
  98. if (dtLoad != null)
  99. {
  100. dtLoad.DefaultView.Sort = "CREATE_TIME ASC";
  101. dtLoad = dtLoad.DefaultView.ToTable();
  102. lstLoading.Items.Clear();
  103. this.lstLoaded.Items.Clear();
  104. // ArrayList ArrList = new ArrayList();
  105. int i = 1;
  106. int t = 1;
  107. foreach (DataRow Dtr in dtLoad.Rows)
  108. {
  109. if (Dtr["AFFIRM_FLAG"].ToString() == "0")
  110. {
  111. int itemnum = this.lstLoading.Items.Count;
  112. string dr = Dtr["CREATE_TIME"].ToString().Trim();
  113. string[] str = { i.ToString(), Dtr["VEHICLE_NO"].ToString(), dr.Substring(5, dr.Length - 8) };
  114. ListViewItem itm = new ListViewItem(str);
  115. //if (i % 2 == 1)//不需要颜色
  116. //{
  117. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));;
  118. //}
  119. this.lstLoading.Items.Insert(itemnum, itm);
  120. i++;
  121. }
  122. if (Dtr["AFFIRM_FLAG"].ToString() == "1" && Dtr["VEHICLE_NO"].ToString().Length > 3)
  123. {
  124. int itemnum = this.lstLoaded.Items.Count;
  125. string dr = Dtr["CREATE_TIME"].ToString().Trim();
  126. string[] str = { t.ToString(), Dtr["VEHICLE_NO"].ToString(), dr.Substring(5, dr.Length - 8) };
  127. ListViewItem itm = new ListViewItem(str);
  128. //if (t % 2 == 1)//不需要颜色
  129. //{
  130. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));;
  131. //}
  132. this.lstLoaded.Items.Insert(itemnum, itm);
  133. t++;
  134. }
  135. }
  136. }
  137. DataTable dtCarNo = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryCarNoWeightInfoNewBySteel",
  138. new Object[] { }, ob);
  139. if (dtCarNo != null)
  140. {
  141. this.lstCarNo.Items.Clear();
  142. // int i = 1;
  143. foreach (DataRow Dtr in dtCarNo.Rows)
  144. {
  145. int continues = 0;
  146. int finishs = 0; //todo判断是否完成
  147. bool state = true;
  148. if (Dtr["VALIDFLAG"].ToString().Trim() != "1")
  149. {
  150. continue;
  151. }
  152. if (dtLoad != null)//判断车辆是否在提货中
  153. {
  154. foreach (DataRow Dd in dtLoad.Rows)
  155. {
  156. if ((Dtr["CAR_NO"].ToString() == Dd["VEHICLE_NO"].ToString()) && Dd["AFFIRM_FLAG"].ToString() == "0")
  157. {
  158. // state = false;
  159. // break;
  160. finishs++;
  161. }
  162. }
  163. }
  164. foreach (DataRow Dd in dtCarNo.Rows)
  165. {
  166. if (Dtr["CAR_NO"].ToString() == Dd["CAR_NO"].ToString())
  167. {
  168. // state = false;
  169. // break;
  170. continues++;
  171. }
  172. }
  173. if (state == true && continues > finishs)
  174. {
  175. int itemnum = this.lstCarNo.Items.Count;
  176. string dr = Dtr["RECORD_DATE"].ToString().Trim();
  177. string[] str = { Dtr["NUM"].ToString(), Dtr["CAR_NO"].ToString(), dr.Substring(5, dr.Length - 8) };
  178. ListViewItem itm = new ListViewItem(str);
  179. //if (i % 2 == 1)
  180. //{
  181. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));;
  182. //}
  183. this.lstCarNo.Items.Insert(itemnum, itm);
  184. // i++;
  185. }
  186. }
  187. }
  188. // labCarNo.Text = "共计 " + lstCarNo.Items.Count + " 车";
  189. // labLoad.Text = "共计 " + lstLoading.Items.Count + " 车";
  190. // labLoaded.Text = "共计 " + lstLoaded.Items.Count + " 车";
  191. }
  192. public void Recivied(string carno, string time)
  193. {
  194. Loadrecord();
  195. foreach (ListViewItem item in lstCarNo.Items)
  196. {
  197. if (carno == item.SubItems[1].Text && time == item.SubItems[2].Text)
  198. {
  199. item.BackColor = Color.Green;
  200. }
  201. }
  202. }
  203. private void FrmTVShow_Load(object sender, EventArgs e)
  204. {
  205. Loadrecord();
  206. this.WindowState = FormWindowState.Normal;
  207. }
  208. private void btnClose_Click(object sender, EventArgs e)
  209. {
  210. this.Close();
  211. }
  212. private void pictureBox1_Click(object sender, EventArgs e)
  213. {
  214. this.WindowState = FormWindowState.Maximized;
  215. }
  216. private void timer2_Tick(object sender, EventArgs e)
  217. {
  218. if (label1.Width + label1.Location.X < 0)
  219. {
  220. label1.Location = new Point(panel2.Width, 10);
  221. }
  222. else
  223. {
  224. label1.Location = new Point(label1.Location.X - 5,8);
  225. }
  226. labDate.Text = DateTime.Now.ToString();
  227. }
  228. }
  229. }