UIM010080.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. namespace Core.LZMes.Client.UIM
  12. {
  13. public partial class UIM010080 : FrmBase
  14. {
  15. public UIM010080()
  16. {
  17. InitializeComponent();
  18. }
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query":
  24. this.DoQuery();
  25. break;
  26. case "Export":
  27. this.Export();
  28. break;
  29. case "Save":
  30. this.DoSave();
  31. break;
  32. }
  33. }
  34. /// <summary>
  35. /// 查询原料库库存数据
  36. /// </summary>
  37. private void DoQuery()
  38. {
  39. try
  40. {
  41. this.dataSet1.Tables[0].Clear();
  42. string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  43. string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  44. string specStlGrd = this.textBox3.Text.Trim();//牌号
  45. string coilWthMin = this.textBox4.Text.Trim();//宽度最小值
  46. string coilWthMax = this.textBox5.Text.Trim();//宽度最大值
  47. string coilThkMin = this.textBox6.Text.Trim();//厚度最小值
  48. string coilThkMax = this.textBox7.Text.Trim();//厚度最大值
  49. string curLoadLoc = this.textBox8.Text.Trim();//垛位
  50. string coilNo = this.textBox9.Text.Trim();//钢卷号
  51. string ordNo = this.textBox11.Text.Trim();//订单号
  52. string ordSeq = "";// this.textBox12.Text;//合同
  53. string ordFl ="8"; //订单区分,默认为8
  54. if (this.ultraComboEditor5.Text != "")
  55. {
  56. ordFl =this.ultraComboEditor5.Value.ToString();
  57. }
  58. string devlmtDate = this.ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";//交货期
  59. string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
  60. string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilWthMin, coilWthMax,
  61. coilThkMin, coilThkMax, curLoadLoc, coilNo, ordNo, ordSeq, ordFl, devlmtDate, progCd};
  62. List<string[]> list = new List<String[]>();
  63. list.Add(queryParams);
  64. CoreClientParam ccp = new CoreClientParam();
  65. ccp.ServerName = "UIM.UIM010080";
  66. ccp.MethodName = "queryYardList";
  67. ccp.ServerParams = new object[] { list };
  68. ccp.SourceDataTable = this.dataSet1.Tables[0];
  69. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  70. Color color = Color.FromArgb(255, 255, 255);
  71. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  72. {
  73. string status = ugr.Cells["TOT_DEC_GRD"].Value.ToString().Trim();
  74. string befstl = ugr.Cells["BEF_SPEC_STL_GRD"].Value.ToString().Trim();
  75. string stl = ugr.Cells["SPEC_STL_GRD"].Value.ToString().Trim();
  76. if ("合格".Equals(status))
  77. {
  78. color = Color.White;
  79. }
  80. else if ("不合格".Equals(status))
  81. {
  82. color = Color.FromArgb(255, 128, 128);
  83. }
  84. else
  85. {
  86. color = Color.SandyBrown;
  87. }
  88. if (befstl!=stl)
  89. {
  90. color = Color.Gold;
  91. }
  92. ugr.Appearance.BackColor = color;
  93. }
  94. //统计钢卷数量,钢卷总重量
  95. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  96. double coilWgtSum = 0;
  97. foreach (DataRow dr in dataSet1.Tables[0].Rows)
  98. {
  99. double tmpWgt = 0;
  100. try
  101. {
  102. tmpWgt = double.Parse(dr["ACT_WGT"].ToString());
  103. }
  104. catch (Exception e)
  105. {
  106. }
  107. coilWgtSum += tmpWgt;
  108. }
  109. this.textBox1.Text = coilCount.ToString();
  110. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  111. }
  112. catch (Exception EX)
  113. {
  114. MessageBox.Show(EX.ToString());
  115. }
  116. }
  117. /// <summary>
  118. /// 导出EXCEL
  119. /// </summary>
  120. private void Export()
  121. {
  122. try
  123. {
  124. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  125. {
  126. string fileName = this.saveFileDialog1.FileName;
  127. this.ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  128. System.Diagnostics.Process.Start(fileName);
  129. }
  130. }
  131. catch (Exception ex)
  132. {
  133. MessageBox.Show(ex.ToString());
  134. }
  135. }
  136. private void UIM010080_Load(object sender, EventArgs e)
  137. {
  138. this.ultraDateTimeEditor1.Value = "" ;
  139. this.ultraDateTimeEditor2.Value = "";
  140. this.ultraDateTimeEditor3.Value = "";
  141. }
  142. private void DoSave()
  143. {
  144. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  145. ArrayList list = new ArrayList();
  146. string[] param = null;
  147. CoreClientParam ccp = new CoreClientParam();
  148. rs = this.ultraGrid1.Rows;
  149. for (int i = 0; i < rs.Count; i++)
  150. {
  151. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  152. {
  153. param = new string[2];
  154. param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim();
  155. param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim();
  156. list.Add(param);
  157. }
  158. }
  159. ccp.ServerName = "UIM.UIM010080";
  160. ccp.MethodName = "addLzbz";
  161. ccp.ServerParams = new Object[] { list };
  162. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  163. }
  164. private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  165. {
  166. try
  167. {
  168. if (this.ultraGrid1.ActiveRow != null)
  169. {
  170. string COIL_NO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.ActiveRow.Cells["H_COIL_NO"].Value));
  171. UIM010081C frm = new UIM010081C();
  172. frm.ob = this.ob;
  173. frm.Condition = COIL_NO;
  174. frm.ShowDialog();
  175. //Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  176. //frm.ob = this.ob;
  177. //frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value);
  178. //frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ;
  179. //frm.ShowDialog();
  180. }
  181. }
  182. catch (System.Exception ex)
  183. {
  184. System.Diagnostics.Debug.WriteLine(ex.ToString());
  185. }
  186. }
  187. }
  188. }