CtrlMSCDetection.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using CoreFS.CA06;
  2. using Infragistics.Win.UltraWinEditors;
  3. using Infragistics.Win.UltraWinGrid;
  4. using System;
  5. using System.Data;
  6. using System.Windows.Forms;
  7. namespace Core.StlMes.Client.Qcm
  8. {
  9. public partial class CtrlMSCDetection : UserControl
  10. {
  11. public FrmComMSCStdDetection _frmDetectionStd;
  12. private bool isLoaded = false;
  13. private string _customInfo;
  14. public event BeforeRowInsertEventHandler BeforeRowInsert;
  15. public OpeBase Ob
  16. {
  17. get { return _frmDetectionStd.ob; }
  18. set { _frmDetectionStd.ob = value; }
  19. }
  20. public UltraGrid Grid
  21. {
  22. get { return _frmDetectionStd.UltraGrid1; }
  23. }
  24. public DataTable DetectionDataTable1
  25. {
  26. get { return _frmDetectionStd.DataTable1; }
  27. }
  28. public DataTable DetectionDataTable2
  29. {
  30. get { return _frmDetectionStd.DataTable2; }
  31. }
  32. public bool IsQueryValidData
  33. {
  34. get { return _frmDetectionStd.UltraCheckValid.Checked; }
  35. set { _frmDetectionStd.UltraCheckValid.Checked = value; }
  36. }
  37. public CtrlMSCDetection(System.Windows.Forms.Control container)
  38. {
  39. InitializeComponent();
  40. this.Dock = DockStyle.Fill;
  41. _frmDetectionStd = new FrmComMSCStdDetection();
  42. _frmDetectionStd.UltraGrid1.BeforeRowInsert += new BeforeRowInsertEventHandler(UltraGrid1_BeforeRowInsert);
  43. _frmDetectionStd.UltraGrid1.AfterRowInsert += new Infragistics.Win.UltraWinGrid.RowEventHandler(UltraGrid1_AfterRowInsert);
  44. this.Controls.Add(_frmDetectionStd.UltraGrid1);
  45. container.Controls.Add(this);
  46. this.BringToFront();
  47. }
  48. public void ShowGrid(string msc, OpeBase ob)
  49. {
  50. if (isLoaded == false)
  51. {
  52. _frmDetectionStd.Msc = msc;
  53. _frmDetectionStd.PopupLoad("1", ob);
  54. _customInfo = "1";
  55. isLoaded = true;
  56. }
  57. else
  58. {
  59. if (_frmDetectionStd.Msc != "" && _frmDetectionStd.Msc != msc)
  60. {
  61. _frmDetectionStd.Msc = msc;
  62. this.RefreshData();
  63. }
  64. }
  65. }
  66. /// <summary>
  67. /// 显示以标准为查询条件的内控标准
  68. /// </summary>
  69. public void ShowStdGrid(string stdCode, string stdCodeSNk, string stdStyleSNk, string isNkEdite,
  70. string produccodeNk, string steelcodeNk, string processCode, OpeBase ob)
  71. {
  72. if (isLoaded == false)
  73. {
  74. //_frmChemStd = new FrmChemStandard();
  75. //_frmChemStd.Msc = msc;
  76. _frmDetectionStd.StdCode = stdCode;
  77. _frmDetectionStd.ProduccodeNk = produccodeNk;
  78. _frmDetectionStd.SteelcodeNk = steelcodeNk;
  79. _frmDetectionStd.StdCodesNk = stdCodeSNk;
  80. _frmDetectionStd.StdStylesNk = stdStyleSNk;
  81. _frmDetectionStd.IsNkEdite = isNkEdite;
  82. _frmDetectionStd.ProcessCode = processCode;
  83. _frmDetectionStd.PopupLoad("2", ob);
  84. _customInfo = "2";
  85. isLoaded = true;
  86. }
  87. else
  88. {
  89. if (_frmDetectionStd.StdCode != "" && _frmDetectionStd.StdCode != stdCode)
  90. {
  91. _frmDetectionStd.StdCode = stdCode;
  92. _frmDetectionStd.ProduccodeNk = produccodeNk;
  93. _frmDetectionStd.SteelcodeNk = steelcodeNk;
  94. _frmDetectionStd.StdCodesNk = stdCodeSNk;
  95. _frmDetectionStd.StdStylesNk = stdStyleSNk;
  96. _frmDetectionStd.IsNkEdite = isNkEdite;
  97. _frmDetectionStd.ProcessCode = processCode;
  98. //this.RefreshData();
  99. _frmDetectionStd.PopupRefresh();
  100. }
  101. }
  102. }
  103. public void ShowPurchaseGrid(OpeBase ob)
  104. {
  105. if (isLoaded)
  106. {
  107. _frmDetectionStd.PopupRefresh();
  108. }
  109. else
  110. {
  111. _frmDetectionStd.PopupLoad("2", ob);
  112. isLoaded = true;
  113. }
  114. }
  115. public void Query(string msc, string codeJg)
  116. {
  117. _frmDetectionStd.Msc = msc;
  118. _frmDetectionStd.CodeJg = codeJg;
  119. _frmDetectionStd.ToolBar_Click(null, "Query");
  120. }
  121. public void QueryStd(string stdCode, string modelCode)
  122. {
  123. _frmDetectionStd.StdCode = stdCode;
  124. _frmDetectionStd.ModelCode = modelCode;
  125. _frmDetectionStd.ToolBar_Click(null, "Query");
  126. }
  127. public void QueryPurchaseAgreement(string stdCodeNk)
  128. {
  129. _frmDetectionStd.QueryPurchaseAgreement(stdCodeNk);
  130. }
  131. public void Save()
  132. {
  133. _frmDetectionStd.ToolBar_Click(null, "Save");
  134. }
  135. public void Delete()
  136. {
  137. _frmDetectionStd.ToolBar_Click(null, "Delete");
  138. }
  139. public void Resume()
  140. {
  141. _frmDetectionStd.ToolBar_Click(null, "Resume");
  142. }
  143. public void Copy()
  144. {
  145. _frmDetectionStd.ToolBar_Click(null, "Copy");
  146. }
  147. public void Paste()
  148. {
  149. _frmDetectionStd.ToolBar_Click(null, "Paste");
  150. }
  151. public void RefreshData()
  152. {
  153. _frmDetectionStd.ToolBar_Click(null, "Refresh");
  154. }
  155. public void Group()
  156. {
  157. _frmDetectionStd.ToolBar_Click(null, "Group");
  158. }
  159. public void CancelGroup()
  160. {
  161. _frmDetectionStd.ToolBar_Click(null, "Cancel");
  162. }
  163. public void Clear()
  164. {
  165. _frmDetectionStd.DataTable2.Clear();
  166. _frmDetectionStd.DataTable1.Clear();
  167. }
  168. public void ExpandFirstRow()
  169. {
  170. if (_frmDetectionStd.UltraGrid1.Rows.Count > 0)
  171. {
  172. _frmDetectionStd.UltraGrid1.Rows[0].ExpandAll();
  173. }
  174. }
  175. private void UltraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
  176. {
  177. if (e.Row.HasParent()) return;
  178. if (_customInfo == "1")
  179. {
  180. e.Row.SetValue("MSC", _frmDetectionStd.Msc);
  181. DataTable dt = (DataTable)((UltraComboEditor)e.Row.Band.Columns["MSC"].EditorComponent).DataSource;
  182. DataRow[] drs = dt.Select("MSC = '" + _frmDetectionStd.Msc + "'");
  183. if (drs.Length > 0)
  184. {
  185. e.Row.Cells["PSC"].Value = drs[0][2];
  186. e.Row.Cells["PSC_DESC"].Value = drs[0][3];
  187. e.Row.Cells["PRODUCNAME"].Value = drs[0][4];
  188. if (e.Row.Cells.Exists("STD_NAME_B"))
  189. {
  190. e.Row.Cells["STD_NAME_B"].Value = drs[0][5];
  191. }
  192. else
  193. {
  194. e.Row.Cells["STD_NAME"].Value = drs[0][5];
  195. }
  196. e.Row.Cells["STEELNAME"].Value = drs[0][6];
  197. e.Row.Cells["STD_STYLE_DESC"].Value = drs[0][7];
  198. e.Row.Cells["STDSTYLE"].Value = drs[0][8];
  199. }
  200. }
  201. else if (_customInfo == "2")
  202. {
  203. e.Row.Cells["STD_CODE_NK"].Value = _frmDetectionStd.StdCode;
  204. DataTable dt = (DataTable)((UltraComboEditor)e.Row.Band.Columns["STD_CODE_NK"].EditorComponent).DataSource;
  205. DataRow[] drs = dt.Select("STD_CODE = '" + _frmDetectionStd.StdCode + "'");
  206. if (drs.Length > 0)
  207. {
  208. e.Row.Cells["STD_NAME_NK"].Value = drs[0][1];
  209. e.Row.Cells["STDSTYLE"].Value = drs[0][2];
  210. }
  211. }
  212. }
  213. private void UltraGrid1_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
  214. {
  215. if (BeforeRowInsert != null)
  216. {
  217. BeforeRowInsert(sender, e);
  218. }
  219. }
  220. }
  221. }