AddPhyItems.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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 Core.Mes.Client.Comm.Tool;
  11. using Infragistics.Win.UltraWinEditors;
  12. using Core.Mes.Client.Comm.Server;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Infragistics.Win;
  15. using Core.Mes.Client.Comm.Control;
  16. namespace Core.StlMes.Client.Lims.Port
  17. {
  18. public partial class AddPhyItems : FrmBase
  19. {
  20. private OpeBase _ob;
  21. public OpeBase Ob
  22. {
  23. get { return _ob; }
  24. set { _ob = value; }
  25. }
  26. private DataTable dtSampleReq;//人工选的取样要求
  27. public DataTable DtSampleReq
  28. {
  29. get { return dtSampleReq; }
  30. set { dtSampleReq = value; }
  31. }
  32. private DataTable dtPhyDetail;//人工选的检验项目明细
  33. public DataTable DtPhyDetail
  34. {
  35. get { return dtPhyDetail; }
  36. set { dtPhyDetail = value; }
  37. }
  38. private DataTable m_dtSelectPhySampleCode;//工艺里面的取样码
  39. public DataTable DtSelectPhySampleCode
  40. {
  41. get { return m_dtSelectPhySampleCode; }
  42. set { m_dtSelectPhySampleCode = value; }
  43. }
  44. private DataTable m_dtSelectPhyDetail;//工艺里面的检验明细
  45. public DataTable DtSelectPhyDetail
  46. {
  47. get { return m_dtSelectPhyDetail; }
  48. set { m_dtSelectPhyDetail = value; }
  49. }
  50. public AddPhyItems()
  51. {
  52. InitializeComponent();
  53. }
  54. public AddPhyItems(OpeBase ob)
  55. {
  56. InitializeComponent();
  57. this._ob = ob;
  58. }
  59. private DataTable m_dtPhyMax;//大项
  60. private DataTable m_dtPhySampleCode;//下拉框取样码
  61. private DataTable m_dtPhyMin;//下拉框小项
  62. private DataTable m_dtPhyR;//下拉框方向温度尺寸
  63. //private DataTable m_dtSampleStyle;//样片类型
  64. //private DataTable m_dtLength;//长度
  65. //private DataTable m_dtRate;//频率
  66. //private DataTable m_dtPosition;//取样位置
  67. private void AddPhyItems_Load(object sender, EventArgs e)
  68. {
  69. InitColumnsDataTable();
  70. InitCombo();
  71. QueryPhyRItems();
  72. QuerySelectPhyItems();//已经选择的项目赋值
  73. //GridHelper.RefreshAndAutoSize(ultraGrid1);
  74. //GridHelper.RefreshAndAutoSize(ultraGrid2);
  75. }
  76. protected override void OnLoad(EventArgs e)
  77. {
  78. base.OnLoad(e);
  79. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;//不默认加载筛选条件框
  80. //ultraGrid2.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
  81. ultraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  82. }
  83. private void InitColumnsDataTable()
  84. {
  85. //检验项目明细"DEPT_ID","所属部门",
  86. //string[] arrColumnsDetail = new string[] { "CHK", "PHY_CODE_MAX", "PHY_NAME_MAX", "PHY_CODE_MIN", "PHY_NAME_MIN", "PHY_CODE", "PHY_NAME", "ITEM_CODE_F", "ITEM_NAME_F", "ITEM_CODE_W", "ITEM_NAME_W", "ITEM_CODE_S", "ITEM_NAME_S" };
  87. //string[] arrCaptionDetail = new string[] { "选择", "检验项", "检验项", "取样码", "取样码描述", "检验基础项", "检验基础项", "试验方向代码", "试验方向", "试验温度代码", "试验温度", "试样尺寸代码", "试样尺寸" };
  88. //PublicPort.InitColumns(arrColumnsDetail, arrCaptionDetail, dataTable1);
  89. //PublicPort.setColumnShowOrHidden(ultraGrid1, new string[] { "PHY_NAME_MAX", "DEPT_ID", "PHY_NAME_MIN", "PHY_NAME", "ITEM_CODE_F", "ITEM_CODE_W", "ITEM_CODE_S" }, false);//不需要显示的行
  90. //PublicPort.setOtherColumnReadOnly(ultraGrid1, new string[] { "CHK", "PHY_CODE_MAX", "PHY_NAME_MAX", "DEPT_ID", "PHY_CODE_MIN", "PHY_NAME_MIN", "PHY_CODE", "PHY_NAME" });
  91. //PublicPort.setOtherColumnReadOnly(ultraGrid1, new string[] { "CHK" });
  92. //取样要求队列
  93. string[] arrColumnsSampleReq = new string[] { "CHK", "DATA_TYPE", "DATA_TYPE_DESC", "PHY_CODE_MAX", "PHY_NAME_MAX", "PHY_CODE_MIN", "PHY_NAME_MIN", "SAMPLE_STYLE", "DESC_SAMPLE_STYLE", "STD_CODE", "STD_NAME", "LENGTH", "DESC_LENGTH", "WIDTH", "RATE", "DESC_RATE", "BATCH_UNIT", "BATCH_CNT", "POSITION", "DESC_POSITION", "DESC_COUNT", "SAMPLE_COUNT" };
  94. string[] arrCaptionSampleReq = new string[] { "选择", "样品类型", "样品类型", "检验项", "检验项", "取样码", "取样码", "样片类型", "样片类型", "标准代码", "标准名称", "取样长度", "取样长度", "取样宽度", "取样频率", "取样频率", "分批单位", "分批数量", "取样位置", "取样位置", "取样数量", "样条数" };
  95. PublicPort.InitColumns(arrColumnsSampleReq, arrCaptionSampleReq, dataTable2);
  96. PublicPort.setColumnShowOrHidden(ultraGrid2, new string[] { "DATA_TYPE_DESC", "PHY_NAME_MAX", "PHY_NAME_MIN", "DESC_SAMPLE_STYLE", "STD_CODE", "STD_NAME", "DESC_LENGTH", "DESC_RATE", "DESC_POSITION" }, false);//不需要显示的行
  97. PublicPort.setOtherColumnReadOnly(ultraGrid2, new string[] { "SAMPLE_STYLE", "DESC_SAMPLE_STYLE", "STD_CODE", "STD_NAME", "LENGTH", "DESC_LENGTH", "WIDTH", "RATE", "DESC_RATE", "BATCH_UNIT", "BATCH_CNT", "POSITION", "DESC_POSITION", "DESC_COUNT", "SAMPLE_COUNT" });
  98. }
  99. private void InitCombo()
  100. {
  101. try
  102. {
  103. ultraGrid1.DisplayLayout.Bands[0].Columns["DATA_TYPE"].EditorComponent = ultDATA_TYPE;//样品类型
  104. ultraGrid1.DisplayLayout.Bands[0].Columns["DATA_TYPE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  105. ultraGrid2.DisplayLayout.Bands[0].Columns["DATA_TYPE"].EditorComponent = ultDATA_TYPE;//样品类型
  106. ultraGrid2.DisplayLayout.Bands[0].Columns["DATA_TYPE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  107. ultraGrid1.DisplayLayout.Bands[0].Columns["JUDGE_BASIS"].EditorComponent = ultraComJudgeBasis;//判定依据
  108. ultraGrid1.DisplayLayout.Bands[0].Columns["JUDGE_BASIS"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  109. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDCONDITION"].EditorComponent = ultraADDCONDITION;//条件项
  110. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDCONDITION"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  111. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMIN_SIGN"].EditorComponent = ultraComSignMin;//下限标准范围默认
  112. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMIN_SIGN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  113. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMIN_SIGN2"].EditorComponent = ultraComSignMin;//下限标准范围二
  114. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMIN_SIGN2"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  115. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MIN_SIGN"].EditorComponent = ultraComSignMin;//下限限制规格一
  116. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MIN_SIGN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  117. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MIN_SIGN2"].EditorComponent = ultraComSignMin;//下限限制规格二
  118. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MIN_SIGN2"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  119. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDSTD_MIN_SIGN"].EditorComponent = ultraComSignMin;//下限附加标准范围
  120. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDSTD_MIN_SIGN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  121. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMAX_SIGN"].EditorComponent = ultraComSignMax;//上限标准范围默认
  122. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMAX_SIGN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  123. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMAX_SIGN2"].EditorComponent = ultraComSignMax;//上限标准范围二
  124. ultraGrid1.DisplayLayout.Bands[0].Columns["STDMAX_SIGN2"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  125. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MAX_SIGN"].EditorComponent = ultraComSignMax;//上限限制规格一
  126. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MAX_SIGN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  127. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MAX_SIGN2"].EditorComponent = ultraComSignMax;//上限限制规格二
  128. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_MAX_SIGN2"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  129. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDSTD_MAX_SIGN"].EditorComponent = ultraComSignMax;//上限附加标准范围
  130. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDSTD_MAX_SIGN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  131. //附加标准项4070
  132. initJGDropDown(ultraADDSTDCON_CODE, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4070", "BASENAME", "BASECODE");
  133. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDSTDCON_CODE"].EditorComponent = ultraADDSTDCON_CODE;
  134. ultraGrid1.DisplayLayout.Bands[0].Columns["ADDSTDCON_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  135. //取大小值4071
  136. initJGDropDown(ultraSTD_CHOOSE, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4071", "BASENAME", "BASECODE");
  137. ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CHOOSE"].EditorComponent = ultraSTD_CHOOSE;
  138. ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CHOOSE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  139. //限制规格描述// 4003
  140. initJGDropDown(ultraSIZE_CODE, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4003", "BASENAME", "BASECODE");
  141. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_CODE"].EditorComponent = ultraSIZE_CODE;
  142. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  143. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_CODE2"].EditorComponent = ultraSIZE_CODE;
  144. ultraGrid1.DisplayLayout.Bands[0].Columns["SIZE_CODE2"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  145. //接箍规格描述
  146. //initJGDropDown(ultraSPEC_JG, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4003", "BASENAME", "BASECODE");
  147. //ultraGrid1.DisplayLayout.Bands[0].Columns["SPEC_JG"].EditorComponent = ultraSPEC_JG;
  148. //ultraGrid1.DisplayLayout.Bands[0].Columns["SPEC_JG"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  149. //检验大项
  150. initJGDropDown(ultPHY_NAME_MAX, "com.steering.mes.port.mil.FrmMilConfirmItems.QueryPhyMaxItems", null, "PHY_NAME_MAX", "PHY_CODE_MAX");
  151. ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_CODE_MAX"].EditorComponent = ultPHY_NAME_MAX;
  152. ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_CODE_MAX"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  153. ultraGrid2.DisplayLayout.Bands[0].Columns["PHY_CODE_MAX"].EditorComponent = ultPHY_NAME_MAX;
  154. ultraGrid2.DisplayLayout.Bands[0].Columns["PHY_CODE_MAX"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  155. //取样码
  156. initJGDropDown(ultPHY_NAME_MIN, "com.steering.mes.port.mil.FrmMilConfirmItems.QueryPhySampleCode", null, "PHY_NAME_MIN", "PHY_CODE_MIN");
  157. ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_CODE_MIN"].EditorComponent = ultPHY_NAME_MIN;
  158. ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_CODE_MIN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  159. //initJGDropDown(ultPHY_NAME_MIN_, "com.steering.mes.port.mil.FrmMilConfirmItems.QueryPhySampleCode", "PHY_NAME_MIN", "PHY_CODE_MIN");
  160. ultraGrid2.DisplayLayout.Bands[0].Columns["PHY_CODE_MIN"].EditorComponent = ultPHY_NAME_MIN;
  161. ultraGrid2.DisplayLayout.Bands[0].Columns["PHY_CODE_MIN"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  162. //检验基础项
  163. initJGDropDown(ultPHY_NAME, "com.steering.mes.port.mil.FrmMilConfirmItems.QueryPhyMinItems", null, "PHY_NAME", "PHY_CODE");
  164. ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_CODE"].EditorComponent = ultPHY_NAME;
  165. ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  166. //长度4010
  167. initJGDropDown(ultDESC_LENGTH, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4010", "BASENAME", "BASECODE");
  168. ultraGrid2.DisplayLayout.Bands[0].Columns["LENGTH"].EditorComponent = ultDESC_LENGTH;
  169. ultraGrid2.DisplayLayout.Bands[0].Columns["LENGTH"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  170. //频率4011
  171. initJGDropDown(ultDESC_RATE, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4086", "BASENAME", "BASECODE");
  172. ultraGrid2.DisplayLayout.Bands[0].Columns["RATE"].EditorComponent = ultDESC_RATE;
  173. ultraGrid2.DisplayLayout.Bands[0].Columns["RATE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  174. //分批单位
  175. ultraGrid2.DisplayLayout.Bands[0].Columns["BATCH_UNIT"].EditorComponent = ultBATCH_UNIT;
  176. ultraGrid2.DisplayLayout.Bands[0].Columns["BATCH_UNIT"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  177. //位置4012
  178. initJGDropDown(ultDESC_POSITION, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4012", "BASENAME", "BASECODE");
  179. ultraGrid2.DisplayLayout.Bands[0].Columns["POSITION"].EditorComponent = ultDESC_POSITION;
  180. ultraGrid2.DisplayLayout.Bands[0].Columns["POSITION"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  181. //样片类型
  182. initJGDropDown(ultDESC_SAMPLE_STYLE, "com.steering.mes.port.mil.FrmMilConfirmItems.GetBaseData", "4081", "BASENAME", "BASECODE");
  183. ultraGrid2.DisplayLayout.Bands[0].Columns["SAMPLE_STYLE"].EditorComponent = ultDESC_SAMPLE_STYLE;
  184. ultraGrid2.DisplayLayout.Bands[0].Columns["SAMPLE_STYLE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  185. }
  186. catch (Exception e)
  187. {
  188. MessageUtil.ShowWarning(e.Message);
  189. }
  190. }
  191. private void initJGDropDown(UltraComboEditor uce, string MethodId, string strId, string memberDis, string memberValue)
  192. {
  193. //初始化编辑区域下拉框
  194. DataTable dt = PublicServer.GetData(MethodId, strId == null ? null : new Object[] { strId }, this._ob);
  195. if (dt != null && dt.Rows.Count > 0)
  196. {
  197. if (uce == ultPHY_NAME_MAX)
  198. {
  199. m_dtPhyMax = dt.Copy();
  200. }
  201. else if (uce == ultPHY_NAME_MIN)
  202. {
  203. m_dtPhySampleCode = dt.Copy();
  204. //ValueList vl = PublicPort.GeneralValuelist(ref dt, "PHY_NAME_MIN", "PHY_NAME_MIN");
  205. //ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_NAME_MIN"].ValueList = ultPHY_NAME_MIN;
  206. }
  207. else if (uce == ultPHY_NAME)
  208. {
  209. m_dtPhyMin = dt.Copy();
  210. }
  211. else if (uce == ultDESC_SAMPLE_STYLE)
  212. {
  213. //m_dtSampleStyle = dt.Copy();
  214. }
  215. else if (uce == ultDESC_LENGTH)
  216. {
  217. //m_dtLength = dt.Copy();
  218. }
  219. else if (uce == ultDESC_RATE)
  220. {
  221. //m_dtRate = dt.Copy();
  222. }
  223. else if (uce == ultDESC_POSITION)
  224. {
  225. //m_dtPosition = dt.Copy();
  226. }
  227. DataRow newDr = dt.NewRow();
  228. newDr[0] = "";
  229. dt.Rows.Add(newDr);
  230. uce.DataSource = dt;
  231. uce.DisplayMember = memberDis;
  232. uce.ValueMember = memberValue;
  233. }
  234. }
  235. //查询理化项目方向、温度、尺寸信息
  236. private void QueryPhyRItems()
  237. {
  238. try
  239. {
  240. DataTable dt = PublicServer.GetData("com.steering.mes.port.mil.FrmMilConfirmItems.QueryPhyRItems_All",
  241. new Object[] { }, this._ob);
  242. if (dt != null && dt.Rows.Count > 0)
  243. {
  244. m_dtPhyR = dt.Copy();
  245. }
  246. }
  247. catch (Exception ex)
  248. {
  249. MessageUtil.ShowWarning(ex.Message);
  250. }
  251. }
  252. //已经选择的项目赋值
  253. private void QuerySelectPhyItems()
  254. {
  255. try
  256. {
  257. if (dtPhyDetail != null && dtPhyDetail.Rows.Count > 0)
  258. {
  259. GridHelper.CopyDataToDatatable(dtPhyDetail, dataTable1, true);//把dt复制给dataTable1
  260. }
  261. if (dtSampleReq != null && dtSampleReq.Rows.Count > 0)
  262. {
  263. GridHelper.CopyDataToDatatable(dtSampleReq, dataTable2, true);//把dt复制给dataTable1
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. MessageUtil.ShowWarning(ex.Message);
  269. }
  270. }
  271. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  272. {
  273. if (e.Tool.Key == "btnOK") //保存
  274. {
  275. //doSave();
  276. this.DialogResult = DialogResult.OK;
  277. ultraGrid1.UpdateData();
  278. ultraGrid2.UpdateData();
  279. foreach (UltraGridRow ur in ultraGrid1.Rows)
  280. {
  281. ur.Cells["DATA_TYPE_DESC"].Value = ur.Cells["DATA_TYPE"].Text;//样品类型
  282. ur.Cells["PHY_NAME_MAX"].Value = ur.Cells["PHY_CODE_MAX"].Text;
  283. ur.Cells["PHY_NAME_MIN"].Value = ur.Cells["PHY_CODE_MIN"].Text;
  284. ur.Cells["PHY_NAME"].Value = ur.Cells["PHY_CODE"].Text;
  285. }
  286. ultraGrid1.UpdateData();
  287. dtPhyDetail = dataTable1.Copy();
  288. foreach (UltraGridRow ur in ultraGrid2.Rows)
  289. {
  290. ur.Cells["DATA_TYPE_DESC"].Value = ur.Cells["DATA_TYPE"].Text;//样品类型
  291. ur.Cells["DESC_SAMPLE_STYLE"].Value = ur.Cells["SAMPLE_STYLE"].Text;//样片类型
  292. ur.Cells["DESC_LENGTH"].Value = ur.Cells["LENGTH"].Text;//长度
  293. ur.Cells["DESC_RATE"].Value = ur.Cells["RATE"].Text;
  294. ur.Cells["BATCH_UNIT"].Value = ur.Cells["BATCH_UNIT"].Text;
  295. ur.Cells["DESC_POSITION"].Value = ur.Cells["POSITION"].Text;
  296. }
  297. ultraGrid2.UpdateData();
  298. dtSampleReq = dataTable2.Copy();
  299. }
  300. else if (e.Tool.Key == "btnClose") //刷新
  301. {
  302. if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  303. this.Close();
  304. }
  305. }
  306. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  307. {
  308. ultraGrid1.UpdateData();
  309. if (e.Cell.Column.Key == "CHK")
  310. {
  311. if (e.Cell.Row.Cells["CHK"].Value.ToString() == "True")
  312. {
  313. for (int i = 0; i < e.Cell.Row.Cells.Count; i++)
  314. {
  315. e.Cell.Row.Cells[i].Activation = Activation.AllowEdit;
  316. }
  317. }
  318. else
  319. {
  320. for (int i = 0; i < e.Cell.Row.Cells.Count; i++)
  321. {
  322. if (e.Cell.Row.Cells[i].Column.Key == "CHK")
  323. {
  324. continue;
  325. }
  326. e.Cell.Row.Cells[i].Activation = Activation.ActivateOnly;
  327. }
  328. }
  329. }
  330. else
  331. {
  332. if (e.Cell.Row.Cells["CHK"].Value.ToString() == "True")
  333. {
  334. if (e.Cell.Column.Key == "PHY_CODE_MAX")
  335. {
  336. if (m_dtSelectPhyDetail != null)
  337. {
  338. foreach (DataRow dr in m_dtSelectPhyDetail.Rows)
  339. {
  340. if (e.Cell.Row.Cells["DATA_TYPE"].Value.ToString() == "0" && dr["PHY_CODE_MAX"].ToString() == e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString())
  341. {
  342. MessageUtil.ShowTips("工艺中已有此检验大项!");
  343. e.Cell.Row.Cells["PHY_CODE_MAX"].Value = "";
  344. return;
  345. }
  346. }
  347. }
  348. e.Cell.Row.Cells["PHY_CODE_MIN"].Value = "";//清空取样码
  349. DataTable dtSampleCode = PublicPort.GetSelectDt(m_dtPhySampleCode, "PHY_CODE_MAX = '" + e.Cell.Value.ToString() + "'");
  350. ValueList vl = PublicPort.GeneralValuelist(ref dtSampleCode, "PHY_CODE_MIN", "PHY_NAME_MIN");
  351. vl.ValueListItems.Add("");
  352. e.Cell.Row.Cells["PHY_CODE_MIN"].ValueList = vl;
  353. e.Cell.Row.Cells["PHY_CODE"].Value = "";//清空小项
  354. DataTable dtPhyMin = PublicPort.GetSelectDt(m_dtPhyMin, "PHY_CODE_MAX = '" + e.Cell.Value.ToString() + "'");
  355. ValueList vlMin = PublicPort.GeneralValuelist(ref dtPhyMin, "PHY_CODE", "PHY_NAME");
  356. e.Cell.Row.Cells["PHY_CODE"].ValueList = vlMin;
  357. //e.Cell.Row.Cells["PHY_CODE_MAX"].Value = e.Cell.Row.Cells["PHY_NAME_MAX"].Value;
  358. //e.Cell.Row.Cells["PHY_NAME_MAX"].Value = e.Cell.Row.Cells["PHY_NAME_MAX"].Text;//大项name赋值
  359. }
  360. else if (e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString() != "" && e.Cell.Column.Key == "PHY_CODE_MIN")
  361. {
  362. //同一种样品类型同一个大项不允许存在两种不同的取样码
  363. foreach (UltraGridRow ur in ultraGrid1.Rows)
  364. {
  365. if (ur != e.Cell.Row)
  366. {
  367. if (ur.Cells["DATA_TYPE"].Value.ToString() == e.Cell.Row.Cells["DATA_TYPE"].Value.ToString() && ur.Cells["PHY_CODE_MAX"].Value.ToString() == e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString() && ur.Cells["PHY_CODE_MIN"].Value.ToString() != e.Cell.Row.Cells["PHY_CODE_MIN"].Value.ToString())
  368. {
  369. MessageUtil.ShowTips("同一样品类型同一大项不允许存在不同的取样码!");
  370. e.Cell.Row.Cells["PHY_CODE_MIN"].Value = "";
  371. return;
  372. }
  373. }
  374. }
  375. foreach (UltraGridRow ur in ultraGrid2.Rows)
  376. {
  377. if (ur.Cells["DATA_TYPE"].Value.ToString() == e.Cell.Row.Cells["DATA_TYPE"].Value.ToString() && ur.Cells["PHY_CODE_MAX"].Value.ToString() == e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString() && ur.Cells["PHY_CODE_MIN"].Value.ToString() == e.Cell.Row.Cells["PHY_CODE_MIN"].Value.ToString())
  378. {
  379. return;
  380. }
  381. }
  382. DataRow newDr = dataTable2.NewRow();
  383. newDr["CHK"] = "True";
  384. newDr["DATA_TYPE"] = e.Cell.Row.Cells["DATA_TYPE"].Value;
  385. newDr["PHY_CODE_MAX"] = e.Cell.Row.Cells["PHY_CODE_MAX"].Value;
  386. newDr["PHY_NAME_MAX"] = e.Cell.Row.Cells["PHY_CODE_MAX"].Text;
  387. newDr["PHY_CODE_MIN"] = e.Cell.Row.Cells["PHY_CODE_MIN"].Value;
  388. newDr["PHY_NAME_MIN"] = e.Cell.Row.Cells["PHY_CODE_MIN"].Text;
  389. dataTable2.Rows.Add(newDr);
  390. //e.Cell.Row.Cells["PHY_CODE_MIN"].Value = e.Cell.Row.Cells["PHY_NAME_MIN"].Value; //取样码
  391. //e.Cell.Row.Cells["PHY_NAME_MIN"].Value = e.Cell.Row.Cells["PHY_NAME_MIN"].Text;
  392. }
  393. else if (e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString() != "" && e.Cell.Column.Key == "PHY_CODE")
  394. {
  395. //查询到有方向温度尺寸才弹出来
  396. DataTable dtPhyR = PublicPort.GetSelectDt(m_dtPhyR, "PHY_CODE_MAX = '" + e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString() + "' AND PHY_CODE = '" + e.Cell.Value.ToString() + "'");
  397. if (dtPhyR != null && dtPhyR.Rows.Count > 0)
  398. {
  399. AddPhyRItems addR = new AddPhyRItems(this._ob, e.Cell.Row.Cells["PHY_CODE_MAX"].Value.ToString(), e.Cell.Value.ToString());
  400. addR.ShowDialog();
  401. if (addR.DialogResult != DialogResult.OK)
  402. {
  403. return;
  404. }
  405. UltraGridRow ur = addR.UgRow;
  406. e.Cell.Row.Cells["ITEM_CODE_F"].Value = ur.Cells["ITEM_CODE_F"].Text.Trim();
  407. e.Cell.Row.Cells["ITEM_NAME_F"].Value = ur.Cells["ITEM_NAME_F"].Text.Trim();
  408. e.Cell.Row.Cells["ITEM_CODE_W"].Value = ur.Cells["ITEM_CODE_W"].Text.Trim();
  409. e.Cell.Row.Cells["ITEM_NAME_W"].Value = ur.Cells["ITEM_NAME_W"].Text.Trim();
  410. e.Cell.Row.Cells["ITEM_CODE_S"].Value = ur.Cells["ITEM_CODE_C"].Text.Trim();
  411. e.Cell.Row.Cells["ITEM_NAME_S"].Value = ur.Cells["ITEM_NAME_C"].Text.Trim();
  412. }
  413. //e.Cell.Row.Cells["PHY_CODE"].Value = e.Cell.Row.Cells["PHY_NAME"].Value;
  414. //e.Cell.Row.Cells["PHY_NAME"].Value = e.Cell.Row.Cells["PHY_NAME"].Text;
  415. }
  416. }
  417. else
  418. {
  419. if (e.Cell.Column.DataType == typeof(bool))
  420. {
  421. e.Cell.Value = false;
  422. }
  423. else
  424. {
  425. e.Cell.Value = "";
  426. }
  427. }
  428. }
  429. }
  430. private void ultraGrid2_CellChange(object sender, CellEventArgs e)
  431. {
  432. //ultraGrid2.UpdateData();
  433. //if (e.Cell.Row.Cells["CHK"].Value.ToString() == "True" && m_dtSelectPhySampleCode != null)
  434. //{
  435. // if (e.Cell.Column.Key == "PHY_NAME_MAX")
  436. // {
  437. // foreach (DataRow dr in m_dtSelectPhySampleCode.Rows)
  438. // {
  439. // if (dr["PHY_CODE_MAX"].ToString() == e.Cell.Row.Cells["PHY_NAME_MAX"].Value.ToString())
  440. // {
  441. // MessageUtil.ShowTips("工艺取样码中已有此大类!");
  442. // e.Cell.Row.Cells["PHY_NAME_MAX"].Value = "";
  443. // return;
  444. // }
  445. // }
  446. // DataTable dtSampleCode = PublicPort.GetSelectDt(m_dtPhySampleCode, "PHY_CODE_MAX = '" + e.Cell.Value.ToString() + "'");
  447. // ValueList vl = PublicPort.GeneralValuelist(ref dtSampleCode, "PHY_CODE_MIN", "PHY_NAME_MIN");
  448. // e.Cell.Row.Cells["PHY_NAME_MIN"].ValueList = vl;
  449. // }
  450. //}
  451. //else
  452. //{
  453. // if (e.Cell.Column.Key != "CHK")
  454. // {
  455. // e.Cell.Value = "";
  456. // }
  457. //}
  458. }
  459. }
  460. }