frmSetAddit.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Collections;
  8. using System.Windows.Forms;
  9. using Core.LgMes.Client.lgClassModel;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Common;
  12. namespace Core.LgMes.Client.LgResMgt
  13. {
  14. public partial class frmSetAddit : Core.Mes.Client.Common.frmStyleBase
  15. {
  16. public frmSetAddit(OpeBase oba)
  17. {
  18. InitializeComponent();
  19. ob = oba;
  20. }
  21. #region " Member Variable"
  22. private DataTable m_dtMain = null;
  23. private string devicePos = ""; //CVT01
  24. private string _curMaterType = ""; //FL
  25. private PictureBox _curPicBx = null;
  26. private Label _curLbl = null;
  27. public string strMaterCode = ""; //物料编号
  28. public string strMaterName = ""; //物料名称
  29. public bool blClean = false; //清除标致
  30. #endregion
  31. //选择料斗
  32. private void PicClickHandler(object sender, System.EventArgs e)
  33. {
  34. _curPicBx = (PictureBox)sender;
  35. _curPicBx.BorderStyle = BorderStyle.Fixed3D;
  36. }
  37. private void frmSetHopper_Load(object sender, EventArgs e)
  38. {
  39. GetDataSource();
  40. BindingGrid();
  41. }
  42. #region " InitDataSoutce"
  43. private void GetDataSource()
  44. {
  45. string strErr = "", szWhere = " where MATERIELTYPE ='BH' order by MATERIELTYPE";
  46. try
  47. {
  48. //hengxing
  49. //CallingMessage par = new CallingMessage();
  50. //par.ServerName = "lgJobMgt";
  51. //par.AssemblyName = "Core.LgMes.Server.lgJobMgt";
  52. //par.ClassName = "Core.LgMes.Server.lgJobMgt.classCommonModule";
  53. //par.MethodName = "GetMaterialData";
  54. //par.args = new object[] { szWhere };
  55. ArrayList arry = new ArrayList();
  56. arry.Add("GetMaterialData.select");
  57. CommonClientToServer cctos = new CommonClientToServer();
  58. cctos.ob = this.ob;
  59. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  60. "doSimpleQuery", arry, out strErr);
  61. if (strErr == "" && ds != null)
  62. {
  63. this.m_dtMain = ds.Tables[0];
  64. }
  65. }
  66. catch (Exception ex)
  67. {
  68. string Msg = ex.Message;
  69. }
  70. }
  71. private void BindingGrid()
  72. {
  73. this.ulgridMtrInfo.DataSource = this.m_dtMain;
  74. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[0].Width = 60;
  75. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[0].Header.Caption = "物料编码";
  76. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[0].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  77. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[0].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Ascending;
  78. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[1].Width = 110;
  79. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[1].Header.Caption = "物料全称";
  80. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[1].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  81. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[2].Width = 100;
  82. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[2].Header.Caption = "物料简称";
  83. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[2].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  84. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[3].Width = 65;
  85. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[3].Header.Caption = "物料类型";
  86. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[3].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  87. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[4].Width = 0;
  88. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[4].Header.Caption = "";
  89. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[4].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  90. this.ulgridMtrInfo.DisplayLayout.Bands[0].Columns[4].Hidden = true;
  91. }
  92. #endregion
  93. private void btClose_Click(object sender, EventArgs e)
  94. {
  95. this.Close();
  96. }
  97. //显示料斗配置信息
  98. private void radioButton_Click(object sender, System.EventArgs e)
  99. {
  100. if (_curMaterType != ((RadioButton)sender).Tag.ToString())
  101. _curMaterType = ((RadioButton)sender).Tag.ToString();
  102. else
  103. return;
  104. this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + _curMaterType + "'";
  105. this.ulgridMtrInfo.UpdateData();
  106. }
  107. private void btOK_Click(object sender, EventArgs e)
  108. {
  109. if (ulgridMtrInfo.ActiveRow != null)
  110. {
  111. strMaterCode = ulgridMtrInfo.ActiveRow.Cells["MATERIELCODE"].Value.ToString();
  112. strMaterName = ulgridMtrInfo.ActiveRow.Cells["MATERIELNAME"].Value.ToString();
  113. blClean = false;
  114. this.Close();
  115. }
  116. else
  117. MessageBox.Show("请选择物料!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  118. }
  119. private void button1_Click(object sender, EventArgs e)
  120. {
  121. blClean = true;
  122. this.Close();
  123. }
  124. }
  125. }