260ee93af28b8c2e5822c6f87cb6521af5bdd752.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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 UIM070041 : FrmBase
  14. {
  15. public UIM070041()
  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. switch(this.tabControl1.SelectedIndex)
  42. {
  43. case 0:
  44. this.dataSet1.Tables[0].Clear();
  45. string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  46. startTime = startTime.Substring(0, 6) + "01";
  47. startTime = "20220401";
  48. string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  49. ArrayList al = new ArrayList();
  50. al.Add("UIM070021_01.SELECT");
  51. al.Add(startTime);
  52. al.Add(endTime);
  53. al.Add(startTime);
  54. al.Add(startTime);
  55. al.Add(endTime);
  56. //if (this.ultraComboEditor1.Value.ToString() == "2")
  57. //{
  58. // startTime = "20220401";
  59. // al.Add("UIM070021_06.SELECT");
  60. // al.Add(startTime);
  61. // al.Add(endTime);
  62. // al.Add(startTime);
  63. // al.Add(startTime);
  64. // al.Add(endTime);
  65. //}
  66. this.dataSet1.Tables[0].Clear();
  67. CoreClientParam ccp = new CoreClientParam();
  68. ccp.ServerName = "UIB.COM.ComDBQuery";
  69. ccp.MethodName = "doSimpleQuery";
  70. ccp.ServerParams = new object[] { al };
  71. ccp.SourceDataTable = this.dataSet1.Tables[0];
  72. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  73. break;
  74. case 1:
  75. this.dataSet2.Tables[0].Clear();
  76. startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  77. startTime = startTime.Substring(0, 6) + "01";
  78. startTime = "20220401";
  79. endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  80. al = new ArrayList();
  81. //al.Add("UIM070021_03.SELECT");
  82. //al.Add(startTime);
  83. //al.Add(endTime);
  84. //al.Add(startTime);
  85. //al.Add(startTime);
  86. //al.Add(endTime);
  87. al.Add("UIM070021_31.SELECT");
  88. al.Add(startTime);
  89. al.Add(endTime);
  90. al.Add(startTime);
  91. al.Add(startTime);
  92. al.Add(endTime);
  93. al.Add(startTime);
  94. al.Add(endTime);
  95. al.Add(startTime);
  96. al.Add(startTime);
  97. al.Add(endTime);
  98. this.dataSet2.Tables[0].Clear();
  99. ccp = new CoreClientParam();
  100. ccp.ServerName = "UIB.COM.ComDBQuery";
  101. ccp.MethodName = "doSimpleQuery";
  102. ccp.ServerParams = new object[] { al };
  103. ccp.SourceDataTable = this.dataSet2.Tables[0];
  104. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  105. break;
  106. default:
  107. return;
  108. }
  109. }
  110. catch (Exception EX)
  111. {
  112. MessageBox.Show(EX.ToString());
  113. }
  114. }
  115. /// <summary>
  116. /// 导出EXCEL
  117. /// </summary>
  118. private void Export()
  119. {
  120. try
  121. {
  122. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  123. {
  124. string fileName = this.saveFileDialog1.FileName;
  125. this.ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  126. System.Diagnostics.Process.Start(fileName);
  127. }
  128. }
  129. catch (Exception ex)
  130. {
  131. MessageBox.Show(ex.ToString());
  132. }
  133. }
  134. //switch (this.ul)
  135. // {
  136. // case 0:
  137. // dlivTp = "T";
  138. // this.dataSet1.Tables[0].Clear();
  139. // ccp.SourceDataTable = this.dataSet1.Tables[0];
  140. // ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  141. // this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  142. // drs = dataSet1.Tables[0].Rows;
  143. // for (int i = 0; i < drs.Count; i++)
  144. // {
  145. // ultraGrid1.Rows[i].Cells[0].Value = false;
  146. // ultraGrid1.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  147. // }
  148. // dataSet5.Tables[0].Clear();
  149. // dataSet3.Tables[0].Clear();
  150. // break;
  151. // case 1:
  152. // dlivTp = "C";
  153. // this.dataSet2.Tables[0].Clear();
  154. // ccp.SourceDataTable = this.dataSet2.Tables[0];
  155. // ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  156. // this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  157. // drs = dataSet2.Tables[0].Rows;
  158. // for (int i = 0; i < drs.Count; i++)
  159. // {
  160. // ultraGrid4.Rows[i].Cells[0].Value = false;
  161. // ultraGrid4.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  162. // }
  163. // dataSet4.Tables[0].Clear();
  164. // dataSet6.Tables[0].Clear();
  165. // break;
  166. // default:
  167. // return;
  168. // }
  169. private void UIM070041_Load(object sender, EventArgs e)
  170. {
  171. this.ultraComboEditor1.Text= "期初库存查询";
  172. }
  173. private void DoSave()
  174. {
  175. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  176. ArrayList list = new ArrayList();
  177. string[] param = null;
  178. CoreClientParam ccp = new CoreClientParam();
  179. rs = this.ultraGrid1.Rows;
  180. for (int i = 0; i < rs.Count; i++)
  181. {
  182. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  183. {
  184. param = new string[2];
  185. param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim();
  186. param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim();
  187. list.Add(param);
  188. }
  189. }
  190. ccp.ServerName = "UIM.UIM070041";
  191. ccp.MethodName = "addLzbz";
  192. ccp.ServerParams = new Object[] { list };
  193. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  194. }
  195. private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  196. {
  197. try
  198. {
  199. if (this.ultraGrid1.ActiveRow != null)
  200. {
  201. Core.LZMes.Client.UIM.UIM070042 frm = new Core.LZMes.Client.UIM.UIM070042();
  202. frm.ob = this.ob;
  203. frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ultraGrid1.ActiveRow.Cells["INVID"].Value); ;
  204. frm.ShowDialog();
  205. }
  206. }
  207. catch (System.Exception ex)
  208. {
  209. System.Diagnostics.Debug.WriteLine(ex.ToString());
  210. }
  211. }
  212. private void button1_Click(object sender, EventArgs e)
  213. {
  214. try
  215. {
  216. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  217. {
  218. string fileName = this.saveFileDialog1.FileName;
  219. ultraGridExcelExporter1.Export(ultraGrid2, fileName);
  220. System.Diagnostics.Process.Start(fileName);
  221. }
  222. }
  223. catch (Exception ex)
  224. {
  225. MessageBox.Show(ex.ToString());
  226. }
  227. }
  228. }
  229. }