LFFLInfo.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using Infragistics.Win.UltraWinGrid;
  7. using Infragistics.Win;
  8. using Infragistics.Win.UltraWinEditors;
  9. using CoreFS.CA06;
  10. using System.Data;
  11. namespace Core.LgMes.Client.LgResMgt
  12. {
  13. /// <summary>
  14. /// LFFLInfo 的摘要说明。
  15. /// </summary>
  16. public class LFFLInfo : CoreFS.CA06.FrmBase
  17. {
  18. private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
  19. private System.Data.DataSet dataSet1;
  20. private System.Data.DataTable dataTable1;
  21. private System.Data.DataColumn dataColumn1;
  22. private System.Data.DataColumn dataColumn2;
  23. private System.Data.DataColumn dataColumn3;
  24. private System.Data.DataColumn dataColumn4;
  25. private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
  26. private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox2;
  27. private Infragistics.Win.Misc.UltraButton ClearBtn;
  28. private Infragistics.Win.Misc.UltraButton ExitBtn;
  29. private Infragistics.Win.Misc.UltraButton OkBtn;
  30. /// <summary>
  31. /// 必需的设计器变量。
  32. /// </summary>
  33. private System.ComponentModel.Container components = null;
  34. public LFFLInfo()
  35. {
  36. //
  37. // Windows 窗体设计器支持所必需的
  38. //
  39. InitializeComponent();
  40. //
  41. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  42. //
  43. }
  44. /// <summary>
  45. /// 清理所有正在使用的资源。
  46. /// </summary>
  47. protected override void Dispose( bool disposing )
  48. {
  49. if( disposing )
  50. {
  51. if(components != null)
  52. {
  53. components.Dispose();
  54. }
  55. }
  56. base.Dispose( disposing );
  57. }
  58. #region Windows 窗体设计器生成的代码
  59. /// <summary>
  60. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  61. /// 此方法的内容。
  62. /// </summary>
  63. private void InitializeComponent()
  64. {
  65. Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
  66. Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand1 = new Infragistics.Win.UltraWinGrid.UltraGridBand("Table1", -1);
  67. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLBM");
  68. Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
  69. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLLX");
  70. Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
  71. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLMJC");
  72. Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
  73. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLMQC");
  74. Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
  75. Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
  76. Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
  77. Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
  78. Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
  79. this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
  80. this.dataSet1 = new System.Data.DataSet();
  81. this.dataTable1 = new System.Data.DataTable();
  82. this.dataColumn1 = new System.Data.DataColumn();
  83. this.dataColumn2 = new System.Data.DataColumn();
  84. this.dataColumn3 = new System.Data.DataColumn();
  85. this.dataColumn4 = new System.Data.DataColumn();
  86. this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
  87. this.ultraGroupBox2 = new Infragistics.Win.Misc.UltraGroupBox();
  88. this.ClearBtn = new Infragistics.Win.Misc.UltraButton();
  89. this.ExitBtn = new Infragistics.Win.Misc.UltraButton();
  90. this.OkBtn = new Infragistics.Win.Misc.UltraButton();
  91. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
  92. ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
  93. ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit();
  94. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
  95. this.ultraGroupBox1.SuspendLayout();
  96. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox2)).BeginInit();
  97. this.ultraGroupBox2.SuspendLayout();
  98. this.SuspendLayout();
  99. //
  100. // ultraGrid1
  101. //
  102. this.ultraGrid1.DataMember = "Table1";
  103. this.ultraGrid1.DataSource = this.dataSet1;
  104. appearance1.BackColor = System.Drawing.Color.LightSteelBlue;
  105. appearance1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(233)))), ((int)(((byte)(233)))));
  106. appearance1.BackGradientStyle = Infragistics.Win.GradientStyle.BackwardDiagonal;
  107. this.ultraGrid1.DisplayLayout.Appearance = appearance1;
  108. ultraGridColumn1.AutoEdit = false;
  109. ultraGridColumn1.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  110. appearance2.TextHAlign = Infragistics.Win.HAlign.Center;
  111. ultraGridColumn1.CellAppearance = appearance2;
  112. ultraGridColumn1.Header.VisiblePosition = 0;
  113. ultraGridColumn1.Hidden = true;
  114. ultraGridColumn1.Width = 80;
  115. ultraGridColumn2.AutoEdit = false;
  116. ultraGridColumn2.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  117. appearance3.TextHAlign = Infragistics.Win.HAlign.Center;
  118. ultraGridColumn2.CellAppearance = appearance3;
  119. ultraGridColumn2.Header.VisiblePosition = 1;
  120. ultraGridColumn2.Width = 60;
  121. ultraGridColumn3.AutoEdit = false;
  122. ultraGridColumn3.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  123. appearance4.TextHAlign = Infragistics.Win.HAlign.Center;
  124. ultraGridColumn3.CellAppearance = appearance4;
  125. ultraGridColumn3.Header.VisiblePosition = 2;
  126. ultraGridColumn3.Width = 120;
  127. ultraGridColumn4.AutoEdit = false;
  128. ultraGridColumn4.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  129. ultraGridColumn4.Header.VisiblePosition = 3;
  130. ultraGridColumn4.Width = 180;
  131. ultraGridBand1.Columns.AddRange(new object[] {
  132. ultraGridColumn1,
  133. ultraGridColumn2,
  134. ultraGridColumn3,
  135. ultraGridColumn4});
  136. this.ultraGrid1.DisplayLayout.BandsSerializer.Add(ultraGridBand1);
  137. appearance5.BackColor = System.Drawing.Color.Navy;
  138. appearance5.ForeColor = System.Drawing.Color.White;
  139. this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance5;
  140. this.ultraGrid1.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
  141. this.ultraGrid1.DisplayLayout.Override.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.NotAllowed;
  142. this.ultraGrid1.DisplayLayout.Override.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.None;
  143. this.ultraGrid1.DisplayLayout.Override.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.NotAllowed;
  144. this.ultraGrid1.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
  145. this.ultraGrid1.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
  146. appearance6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
  147. this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance6;
  148. this.ultraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
  149. this.ultraGrid1.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.None;
  150. this.ultraGrid1.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
  151. this.ultraGrid1.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.None;
  152. this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
  153. this.ultraGrid1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  154. this.ultraGrid1.Location = new System.Drawing.Point(3, 0);
  155. this.ultraGrid1.Name = "ultraGrid1";
  156. this.ultraGrid1.Size = new System.Drawing.Size(370, 314);
  157. this.ultraGrid1.TabIndex = 27;
  158. this.ultraGrid1.DoubleClick += new System.EventHandler(this.ultraGrid1_DoubleClick);
  159. //
  160. // dataSet1
  161. //
  162. this.dataSet1.DataSetName = "NewDataSet";
  163. this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
  164. this.dataSet1.Tables.AddRange(new System.Data.DataTable[] {
  165. this.dataTable1});
  166. //
  167. // dataTable1
  168. //
  169. this.dataTable1.Columns.AddRange(new System.Data.DataColumn[] {
  170. this.dataColumn1,
  171. this.dataColumn2,
  172. this.dataColumn3,
  173. this.dataColumn4});
  174. this.dataTable1.TableName = "Table1";
  175. //
  176. // dataColumn1
  177. //
  178. this.dataColumn1.Caption = "物料编码";
  179. this.dataColumn1.ColumnName = "WLBM";
  180. //
  181. // dataColumn2
  182. //
  183. this.dataColumn2.Caption = "物料类型";
  184. this.dataColumn2.ColumnName = "WLLX";
  185. //
  186. // dataColumn3
  187. //
  188. this.dataColumn3.Caption = "物料简称";
  189. this.dataColumn3.ColumnName = "WLMJC";
  190. //
  191. // dataColumn4
  192. //
  193. this.dataColumn4.Caption = "物料全称";
  194. this.dataColumn4.ColumnName = "WLMQC";
  195. //
  196. // ultraGroupBox1
  197. //
  198. this.ultraGroupBox1.Controls.Add(this.ultraGrid1);
  199. this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0);
  200. this.ultraGroupBox1.Name = "ultraGroupBox1";
  201. this.ultraGroupBox1.Size = new System.Drawing.Size(376, 317);
  202. this.ultraGroupBox1.TabIndex = 28;
  203. //
  204. // ultraGroupBox2
  205. //
  206. this.ultraGroupBox2.Appearance.BackColor = System.Drawing.Color.LightSteelBlue;
  207. this.ultraGroupBox2.Controls.Add(this.ClearBtn);
  208. this.ultraGroupBox2.Controls.Add(this.ExitBtn);
  209. this.ultraGroupBox2.Controls.Add(this.OkBtn);
  210. this.ultraGroupBox2.Dock = System.Windows.Forms.DockStyle.Bottom;
  211. this.ultraGroupBox2.Location = new System.Drawing.Point(0, 317);
  212. this.ultraGroupBox2.Name = "ultraGroupBox2";
  213. this.ultraGroupBox2.Size = new System.Drawing.Size(376, 48);
  214. this.ultraGroupBox2.TabIndex = 29;
  215. //
  216. // ClearBtn
  217. //
  218. appearance7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
  219. this.ClearBtn.Appearance = appearance7;
  220. this.ClearBtn.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  221. this.ClearBtn.Location = new System.Drawing.Point(176, 10);
  222. this.ClearBtn.Name = "ClearBtn";
  223. this.ClearBtn.Size = new System.Drawing.Size(56, 24);
  224. this.ClearBtn.TabIndex = 27;
  225. this.ClearBtn.Text = "置空";
  226. this.ClearBtn.Click += new System.EventHandler(this.ClearBtn_Click);
  227. //
  228. // ExitBtn
  229. //
  230. appearance8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
  231. this.ExitBtn.Appearance = appearance8;
  232. this.ExitBtn.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  233. this.ExitBtn.Location = new System.Drawing.Point(304, 10);
  234. this.ExitBtn.Name = "ExitBtn";
  235. this.ExitBtn.Size = new System.Drawing.Size(56, 24);
  236. this.ExitBtn.TabIndex = 26;
  237. this.ExitBtn.Text = "退出";
  238. this.ExitBtn.Click += new System.EventHandler(this.ExitBtn_Click);
  239. //
  240. // OkBtn
  241. //
  242. appearance9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
  243. this.OkBtn.Appearance = appearance9;
  244. this.OkBtn.BackColor = System.Drawing.SystemColors.Control;
  245. this.OkBtn.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  246. this.OkBtn.Location = new System.Drawing.Point(240, 10);
  247. this.OkBtn.Name = "OkBtn";
  248. this.OkBtn.Size = new System.Drawing.Size(56, 24);
  249. this.OkBtn.TabIndex = 25;
  250. this.OkBtn.Text = "确认";
  251. this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click);
  252. //
  253. // LFFLInfo
  254. //
  255. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  256. this.ClientSize = new System.Drawing.Size(376, 365);
  257. this.Controls.Add(this.ultraGroupBox2);
  258. this.Controls.Add(this.ultraGroupBox1);
  259. this.MaximizeBox = false;
  260. this.MinimizeBox = false;
  261. this.Name = "LFFLInfo";
  262. this.Text = "选择添加料类型";
  263. this.WindowState = System.Windows.Forms.FormWindowState.Normal;
  264. this.Load += new System.EventHandler(this.LFFLInfo_Load);
  265. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
  266. ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
  267. ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit();
  268. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
  269. this.ultraGroupBox1.ResumeLayout(false);
  270. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox2)).EndInit();
  271. this.ultraGroupBox2.ResumeLayout(false);
  272. this.ResumeLayout(false);
  273. }
  274. #endregion
  275. private int x0 = 0;
  276. public int x1
  277. {
  278. set{x0 = value;}
  279. }
  280. private int y0 = 0;
  281. public int y1
  282. {
  283. set{y0 = value;}
  284. }
  285. private string ClearFlag = "";
  286. public string strClearFlag
  287. {
  288. set{ClearFlag = value;}
  289. }
  290. private string curWLLX = "";
  291. public string strWLLX
  292. {
  293. set{curWLLX = value;}
  294. }
  295. private string curWLBM = "";
  296. public string strWLBM
  297. {
  298. get{return curWLBM;}
  299. }
  300. private string curWLMJC = "";
  301. public string strWLMJC
  302. {
  303. get{return curWLMJC;}
  304. }
  305. private string curWLMQC = "";
  306. public string strWLMQC
  307. {
  308. get{return curWLMQC;}
  309. }
  310. private void LFFLInfo_Load(object sender, System.EventArgs e)
  311. {
  312. this.DesktopLocation = new Point(x0,y0);
  313. if(ClearFlag.Trim() == "0")
  314. {
  315. this.ClearBtn.Enabled = false;
  316. }
  317. GetFLPZInfo();
  318. }
  319. private void OkBtn_Click(object sender, System.EventArgs e)
  320. {
  321. if(this.ultraGrid1.Rows.Count == 0 || this.ultraGrid1.ActiveRow == null)
  322. {
  323. return;
  324. }
  325. HandleDoubleClick();
  326. this.DialogResult = DialogResult.OK;
  327. }
  328. private void ExitBtn_Click(object sender, System.EventArgs e)
  329. {
  330. this.DialogResult = DialogResult.Cancel;
  331. }
  332. private void ClearBtn_Click(object sender, System.EventArgs e)
  333. {
  334. this.DialogResult = DialogResult.No;
  335. }
  336. private void GetFLPZInfo()
  337. {
  338. string strError = "";
  339. try
  340. {
  341. DataSet ds = null;//hengxing (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("lgResMgt", "Core.LgMes.Server.LgResMgt.LfsCollect", "GetFLPZInfo", new object[] { this.curWLLX }, out strError);
  342. if (strError != "")
  343. {
  344. MessageBox.Show(strError, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
  345. }
  346. else
  347. {
  348. this.dataTable1.Clear();
  349. if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  350. {
  351. foreach (DataRow drow in ds.Tables[0].Rows)
  352. {
  353. DataRow NewRow = this.dataTable1.NewRow();
  354. foreach (DataColumn dataColumn in this.dataTable1.Columns)
  355. {
  356. if(dataColumn.ColumnName.ToString().Trim() == "WLLX")
  357. {
  358. switch(drow[dataColumn.ColumnName].ToString().Trim())
  359. {
  360. case "HJ":
  361. NewRow[dataColumn.ColumnName] = "合金";
  362. break;
  363. case "FL":
  364. NewRow[dataColumn.ColumnName] = "辅料";
  365. break;
  366. case "WS":
  367. NewRow[dataColumn.ColumnName] = "喂线";
  368. break;
  369. default:
  370. break;
  371. }
  372. }
  373. else
  374. {
  375. NewRow[dataColumn.ColumnName] = drow[dataColumn.ColumnName].ToString();
  376. }
  377. }
  378. this.dataTable1.Rows.Add(NewRow);
  379. }
  380. dataTable1.AcceptChanges();
  381. }
  382. this.ultraGrid1.DataBind();
  383. this.ultraGrid1.ActiveRow = null;
  384. }
  385. }
  386. catch (System.Exception exp)
  387. {
  388. MessageBox.Show(exp.Message, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
  389. return;
  390. }
  391. }
  392. /// <summary>
  393. /// 双击Grid设置辅料信息
  394. /// </summary>
  395. /// <param name="sender"></param>
  396. /// <param name="e"></param>
  397. private void ultraGrid1_DoubleClick(object sender, System.EventArgs e)
  398. {
  399. UIElement mainElement;
  400. UIElement element;
  401. Point screenPoint;
  402. Point clientPoint;
  403. UltraGridRow row;
  404. mainElement = this.ultraGrid1.DisplayLayout.UIElement;
  405. screenPoint = Control.MousePosition;
  406. clientPoint = this.ultraGrid1.PointToClient(screenPoint);
  407. element = mainElement.ElementFromPoint(clientPoint);
  408. if (element == null)
  409. return;
  410. row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow;
  411. if (row == null)
  412. {
  413. return;
  414. }
  415. if (this.ultraGrid1.ActiveRow == null || this.ultraGrid1.ActiveRow.Index < 0)
  416. {
  417. return;
  418. }
  419. HandleDoubleClick();
  420. }
  421. /// <summary>
  422. /// 取到物料编码,物料名简称,物料名全称
  423. /// </summary>
  424. private void HandleDoubleClick()
  425. {
  426. this.curWLBM = this.ultraGrid1.ActiveRow.Cells["WLBM"].Value.ToString().Trim();
  427. this.curWLMJC = this.ultraGrid1.ActiveRow.Cells["WLMJC"].Value.ToString().Trim();
  428. this.curWLMQC = this.ultraGrid1.ActiveRow.Cells["WLMQC"].Value.ToString().Trim();
  429. this.DialogResult = DialogResult.OK;
  430. }
  431. }
  432. }