FrmTVShow.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 delegate void delSetColor(string carNo, string time);
  19. public partial class FrmTVShow : FrmBase
  20. {
  21. // public delSetColor setLstColor;
  22. public FrmTVShow()
  23. {
  24. InitializeComponent();
  25. }
  26. private void timer1_Tick(object sender, EventArgs e)
  27. {
  28. Loadrecord();
  29. }
  30. delSetColor delsend;
  31. ListViewItem itCall = null;
  32. Color old;
  33. private void btnCall_Click(object sender, EventArgs e)
  34. {
  35. string tt;
  36. if (itCall == null)
  37. {
  38. tt = lstCarNo.Items[0].SubItems[1].Text;
  39. lstCarNo.Items[0].BackColor = Color.Green;
  40. delsend(lstCarNo.Items[0].SubItems[1].Text, lstCarNo.Items[0].SubItems[2].Text);
  41. }
  42. else
  43. {
  44. tt = itCall.SubItems[1].Text;
  45. delsend(itCall.SubItems[1].Text, itCall.SubItems[2].Text);
  46. }
  47. itCall = null;
  48. if (tt != null)
  49. {
  50. // setLstColor(tt);
  51. tt = "请车号" + tt + "进来开票";
  52. BaseHelper.Speak(tt);
  53. }
  54. Loadrecord();
  55. }
  56. void get()
  57. {
  58. int itemnum = this.lstCarNo.Items.Count;
  59. string[] str = { "D:", "本机磁盘", "10G", "6G" };
  60. ListViewItem itm = new ListViewItem(str);
  61. itm.BackColor = Color.Green;
  62. this.lstCarNo.Items.Insert(itemnum, itm);
  63. }
  64. void del()
  65. {
  66. foreach (ListViewItem it in lstCarNo.Items)
  67. {
  68. if (it.SubItems[0].Text.Contains("A"))
  69. {
  70. lstCarNo.Items.Remove(it);
  71. }
  72. }
  73. }
  74. private void lstCarNo_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  75. {
  76. if (itCall != null)
  77. {
  78. itCall.BackColor = old;
  79. itCall = null;
  80. }
  81. lstCarNo.FullRowSelect = true;
  82. if (this.lstCarNo.SelectedItems.Count > 0)
  83. {
  84. // if (itCall != null)
  85. // {
  86. // if (itCall != lstCarNo.SelectedItems[0])
  87. // {
  88. // itCall.BackColor = old;
  89. // itCall = null;
  90. // }
  91. // }
  92. itCall = lstCarNo.SelectedItems[0];
  93. old = lstCarNo.SelectedItems[0].BackColor;
  94. lstCarNo.SelectedItems[0].BackColor = Color.Green;
  95. // lstCarNo.SelectedItems[0].Selected = false;
  96. }
  97. }
  98. void Loadrecord()
  99. {
  100. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
  101. DataTable dtLoad = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryCarNoLoadvehicleBySteel",
  102. new Object[] { }, ob);
  103. if (dtLoad != null)
  104. {
  105. dtLoad.DefaultView.Sort = "CREATE_TIME ASC";
  106. dtLoad = dtLoad.DefaultView.ToTable();
  107. lstLoading.Items.Clear();
  108. this.lstLoaded.Items.Clear();
  109. // ArrayList ArrList = new ArrayList();
  110. int i = 1;
  111. int t = 1;
  112. foreach (DataRow Dtr in dtLoad.Rows)
  113. {
  114. if (Dtr["AFFIRM_FLAG"].ToString() == "0")
  115. {
  116. int itemnum = this.lstLoading.Items.Count;
  117. string dr = Dtr["CREATE_TIME"].ToString().Trim();
  118. string[] str = { i.ToString(), Dtr["VEHICLE_NO"].ToString(), dr.Substring(5, dr.Length - 8) };
  119. ListViewItem itm = new ListViewItem(str);
  120. //if (i % 2 == 1)//不需要颜色
  121. //{
  122. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));;
  123. //}
  124. this.lstLoading.Items.Insert(itemnum, itm);
  125. i++;
  126. }
  127. if (Dtr["AFFIRM_FLAG"].ToString() == "1" && Dtr["VEHICLE_NO"].ToString().Length > 3)
  128. {
  129. int itemnum = this.lstLoaded.Items.Count;
  130. string dr = Dtr["CREATE_TIME"].ToString().Trim();
  131. string[] str = { t.ToString(), Dtr["VEHICLE_NO"].ToString(), dr.Substring(5, dr.Length - 8) };
  132. ListViewItem itm = new ListViewItem(str);
  133. //if (t % 2 == 1)//不需要颜色
  134. //{
  135. // itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));;
  136. //}
  137. this.lstLoaded.Items.Insert(itemnum, itm);
  138. t++;
  139. }
  140. }
  141. }
  142. DataTable dtCarNo = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryCarNoWeightInfoNewBySteel",
  143. new Object[] { }, ob);
  144. if (dtCarNo != null)
  145. {
  146. this.lstCarNo.Items.Clear();
  147. // int i = 1;
  148. foreach (DataRow Dtr in dtCarNo.Rows)
  149. {
  150. int continues = 0;
  151. int finishs = 0; //todo判断是否完成
  152. bool state = true;
  153. if(Dtr["VALIDFLAG"].ToString().Trim()!="1")
  154. {
  155. continue;
  156. }
  157. if (dtLoad != null)//判断车辆是否在提货中
  158. {
  159. foreach (DataRow Dd in dtLoad.Rows)
  160. {
  161. if ((Dtr["CAR_NO"].ToString() == Dd["VEHICLE_NO"].ToString()) && Dd["AFFIRM_FLAG"].ToString() == "0")
  162. {
  163. // state = false;
  164. // break;
  165. finishs++;
  166. }
  167. }
  168. }
  169. foreach (DataRow Dd in dtCarNo.Rows)
  170. {
  171. if (Dtr["CAR_NO"].ToString() == Dd["CAR_NO"].ToString())
  172. {
  173. // state = false;
  174. // break;
  175. continues++;
  176. }
  177. }
  178. if (state == true && continues > finishs)
  179. {
  180. int itemnum = this.lstCarNo.Items.Count;
  181. string dr = Dtr["RECORD_DATE"].ToString().Trim();
  182. string[] str = { Dtr["NUM"].ToString(), Dtr["CAR_NO"].ToString(), dr.Substring(5, dr.Length - 8) };
  183. ListViewItem itm = new ListViewItem(str);
  184. if (finishs != 0)
  185. {
  186. itm.BackColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));;
  187. }
  188. this.lstCarNo.Items.Insert(itemnum, itm);
  189. // i++;
  190. }
  191. }
  192. }
  193. labCarNo.Text = "共计 " + lstCarNo.Items.Count + " 车";
  194. labLoad.Text = "共计 " + lstLoading.Items.Count + " 车";
  195. labLoaded.Text = "共计 " + lstLoaded.Items.Count + " 车";
  196. }
  197. private void FrmTVShow_Load(object sender, EventArgs e)
  198. {
  199. Loadrecord();
  200. }
  201. private void btnFrm_Click(object sender, EventArgs e)
  202. {
  203. FrmTVShows form = FrmTVShows.GetSingleton(ob); // 有参数
  204. form.Show();
  205. form.Activate();
  206. delsend = form.Recivied;
  207. }
  208. }
  209. }