FrmBaseSample.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Qcm.model;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinEditors;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.Qcm
  15. {
  16. public partial class FrmBaseSample : FrmBase
  17. {
  18. public FrmBaseSample()
  19. {
  20. InitializeComponent();
  21. this.IsLoadUserView = true;
  22. }
  23. public void PopupLoad(string customInfo, OpeBase ob)
  24. {
  25. this.CustomInfo = customInfo;
  26. this.ob = ob;
  27. this._ob = ob;
  28. this.OnLoad(EventArgs.Empty);
  29. }
  30. private OpeBase _ob;
  31. public OpeBase Ob
  32. {
  33. get { return _ob; }
  34. set { _ob = value; }
  35. }
  36. private string phycode = ""; //取样码
  37. public string Phycode
  38. {
  39. get { return phycode; }
  40. set { phycode = value; }
  41. }
  42. private string phydesc; //取样码描述
  43. public string Phydesc
  44. {
  45. get { return phydesc; }
  46. set { phydesc = value; }
  47. }
  48. private string stdcode; //标准码
  49. public string Stdcode
  50. {
  51. get { return stdcode; }
  52. set { stdcode = value; }
  53. }
  54. private string stddesc; //标准名称
  55. public string Stddesc
  56. {
  57. get { return stddesc; }
  58. set { stddesc = value; }
  59. }
  60. private FrmPhySample fhs;
  61. public FrmPhySample Fhs
  62. {
  63. get { return fhs; }
  64. set { fhs = value; }
  65. }
  66. ArrayList parms = new ArrayList(); //新增参数
  67. private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue)
  68. {
  69. //初始化编辑区域下拉框
  70. DataTable dt = ServerHelper.GetData(MethodId, null, this._ob);
  71. if (dt != null && dt.Rows.Count > 0)
  72. {
  73. uce.DataSource = dt;
  74. uce.ValueMember = memberValue;
  75. }
  76. }
  77. private void FrmBaseSample_Load(object sender, EventArgs e)
  78. {
  79. try
  80. {
  81. this.Cursor = Cursors.WaitCursor;
  82. if (_ob == null)
  83. {
  84. _ob = ob;
  85. }
  86. InitCombo();
  87. doQuery();
  88. }
  89. finally
  90. {
  91. this.Cursor = Cursors.Default;
  92. }
  93. }
  94. public override void ToolBar_Click(object sender, string ToolbarKey)
  95. {
  96. base.ToolBar_Click(sender, ToolbarKey);
  97. switch (ToolbarKey)
  98. {
  99. case "查询":
  100. doQuery();
  101. break;
  102. case "ButtonTool1":
  103. doSave();
  104. break;
  105. case "ButtonTool2":
  106. doRefresh();
  107. break;
  108. case "ButtonTool3":
  109. if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  110. this.Close();
  111. break;
  112. case "ButtonTool4":
  113. DeleteOrResume(true);
  114. break;
  115. case "ButtonTool5":
  116. DeleteOrResume(false);
  117. break;
  118. }
  119. }
  120. private void InitCombo()
  121. {
  122. initJGDropDown(ultraComboEditor1, "com.steering.pss.qcm.CoreBaseSample.GetPhyLength", "BASECODE");
  123. ClsBaseInfo.FillComBaseInfo(ultraComboEditor2, "4086", _ob, false);
  124. initJGDropDown(ultraComboEditor3, "com.steering.pss.qcm.CoreBaseSample.GetPhyPosition", "BASECODE");
  125. ClsBaseInfo.FillComBaseInfo(ultraComboEditor5, "4081", _ob, false);
  126. QcmBaseQuery.NitializeStandardGX(ultraComboEditor4, true, _ob);
  127. ClsBaseInfo.FillComBaseInfo(ultraComboEditor9, "4099", _ob, false);
  128. //ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE"].EditorComponent= ultraComboEditor4;
  129. //ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  130. }
  131. private void AutoColSize()
  132. {
  133. UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"] };
  134. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
  135. }
  136. public void doQuery()
  137. {
  138. try
  139. {
  140. this.Cursor = Cursors.WaitCursor;
  141. string validflag = ultraCheckEditor1.Checked ? "0" : "1";
  142. string phyMinName = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : "";
  143. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseSample.Query",
  144. new Object[] { this.Phycode, phyMinName, validflag }, this._ob);
  145. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  146. foreach (UltraGridRow row in this.ultraGrid1.Rows)
  147. {
  148. ControlEdit(row);
  149. if (row.Cells["RATE"].Value.ToString() != "408602")
  150. {
  151. row.Cells["BATCH_CNT"].Value = "";
  152. row.Cells["BATCH_UNIT"].Value = "";
  153. row.Cells["BATCH_CNT"].Activation = Activation.ActivateOnly;
  154. row.Cells["BATCH_UNIT"].Activation = Activation.ActivateOnly;
  155. }
  156. else
  157. {
  158. row.Cells["BATCH_CNT"].Activation = Activation.AllowEdit;
  159. row.Cells["BATCH_UNIT"].Activation = Activation.AllowEdit;
  160. }
  161. if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效"))
  162. {
  163. row.Appearance.ForeColor = Color.Red;
  164. }
  165. else
  166. {
  167. row.Appearance.ForeColor = Color.Black;
  168. }
  169. }
  170. ultraGrid1.UpdateData();
  171. }
  172. finally
  173. {
  174. this.Cursor = Cursors.Default;
  175. }
  176. }
  177. private void doSave()
  178. {
  179. if (GetGridData() == false) return;
  180. if (parms.Count <= 0)
  181. {
  182. MessageUtil.ShowWarning("请选择记录!");
  183. return;
  184. }
  185. if (MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  186. {
  187. return;
  188. }
  189. this.ob = this.Ob;
  190. CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。
  191. ccp.ServerName = "com.steering.pss.qcm.CoreBaseSample"; //服务名指的是服务端的包名+类名
  192. ccp.MethodName = "doSave"; //方法名指的是服务名指定类里的方法
  193. ccp.ServerParams = new object[] { parms };//服务端方法的参数
  194. //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。
  195. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  196. if (ccp.ReturnCode == -1)
  197. return;
  198. MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  199. doQuery();
  200. // this.Close();
  201. }
  202. private void doRefresh()
  203. {
  204. InitCombo();
  205. AutoColSize();
  206. }
  207. private void DeleteOrResume(bool flag)
  208. {
  209. this.ultraGrid1.UpdateData();
  210. int ischeck = 0;
  211. ArrayList parms = new ArrayList();
  212. foreach (UltraGridRow row in ultraGrid1.Rows)
  213. {
  214. if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  215. {
  216. ischeck += 1;
  217. if (row.Cells["VALIDFLAG"].Value.ToString() == "无效")
  218. {
  219. if (flag)
  220. {
  221. MessageBox.Show("无效数据,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  222. row.Activate();
  223. return;
  224. }
  225. }
  226. if (row.Cells["VALIDFLAG"].Value.ToString() == "有效")
  227. {
  228. if (flag == false)
  229. {
  230. MessageBox.Show("有效数据,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  231. row.Activate();
  232. return;
  233. }
  234. }
  235. parms.Add(row.Cells["SIC"].Value.ToString());
  236. }
  237. }
  238. if (ischeck == 0)
  239. {
  240. MessageBox.Show("请选择你要" + (flag ? "作废" : "恢复") + "的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  241. return;
  242. }
  243. if (MessageBox.Show("确认要" + (flag ? "作废" : "恢复") + "选择的记录", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.No)
  244. return;
  245. this.ob = this.Ob;
  246. CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。
  247. ccp.ServerName = "com.steering.pss.qcm.CoreBaseSample"; //服务名指的是服务端的包名+类名
  248. ccp.MethodName = "DeleteOrResume"; //方法名指的是服务名指定类里的方法
  249. ccp.ServerParams = new object[] { parms, flag, this.UserInfo.GetUserName() };//服务端方法的参数
  250. //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。
  251. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  252. if (ccp.ReturnCode == -1)
  253. return;
  254. MessageBox.Show("数据" + (flag ? "作废" : "恢复") + "成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  255. doQuery();
  256. }
  257. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  258. {
  259. if (e.Tool.Key == "查询")
  260. {
  261. doQuery();
  262. }
  263. if (e.Tool.Key == "ButtonTool1") //保存
  264. {
  265. doSave();
  266. }
  267. if (e.Tool.Key == "ButtonTool2") //刷新
  268. {
  269. doRefresh();
  270. }
  271. if (e.Tool.Key == "ButtonTool3") //关闭
  272. {
  273. if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  274. this.Close();
  275. }
  276. if (e.Tool.Key == "ButtonTool4") //删除
  277. {
  278. DeleteOrResume(true);
  279. }
  280. if (e.Tool.Key == "ButtonTool5") //恢复
  281. {
  282. DeleteOrResume(false);
  283. }
  284. }
  285. private void ultraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
  286. {
  287. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  288. string sic = ""; //sic码
  289. string sicd = ""; //最终的sic码
  290. DataRow[] dr = dataTable1.Select("", "SIC DESC");
  291. if (dr.Length > 0)
  292. {
  293. sic = dr[0]["SIC"].ToString();
  294. }
  295. if (sic == "")
  296. {
  297. sicd = this.Phycode + string.Format("{0:000}", 1);
  298. }
  299. else
  300. {
  301. int index = int.Parse(sic.Substring(5, 3));
  302. index += 1;
  303. sicd = this.Phycode + string.Format("{0:000}", index);
  304. }
  305. ugr.Cells["PHY_CODE_MIN"].Value = this.Phycode;
  306. ugr.Cells["PHY_NAME_MIN"].Value = this.Phydesc;
  307. ugr.Cells["STD_CODE"].Value = "";
  308. ugr.Cells["SIC"].Value = sicd;
  309. ugr.Cells["SAMPLE_COUNT"].Value = LoadPhySmpCnt();
  310. if (!ugr.GetValue("PHY_NAME_MIN").StartsWith("SSC"))
  311. {
  312. ugr.Cells["SSC_CONDITION"].Value = "409901";
  313. }
  314. //e.Row.Cells["STEEL_SELECT"].Value = "选择";
  315. }
  316. private string LoadPhySmpCnt()
  317. {
  318. try
  319. {
  320. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseSample.loadPhySmpCnt",
  321. new object[] { phycode }, Ob);
  322. return dt.Rows[0][0].ToString();
  323. }
  324. catch { }
  325. return "";
  326. }
  327. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  328. {
  329. ultraGrid1.UpdateData();
  330. ControlEdit(e.Cell.Row);
  331. if (e.Cell.Row.Cells["RATE"].Value.ToString() != "408602" && e.Cell.Row.Cells["RATE"].Value.ToString() != "408608")
  332. {
  333. e.Cell.Row.Cells["BATCH_CNT"].Value = "";
  334. e.Cell.Row.Cells["BATCH_UNIT"].Value = "";
  335. e.Cell.Row.Cells["BATCH_CNT"].Activation = Activation.ActivateOnly;
  336. e.Cell.Row.Cells["BATCH_UNIT"].Activation = Activation.ActivateOnly;
  337. }
  338. else
  339. {
  340. e.Cell.Row.Cells["BATCH_CNT"].Activation = Activation.AllowEdit;
  341. e.Cell.Row.Cells["BATCH_UNIT"].Activation = Activation.AllowEdit;
  342. }
  343. if (e.Cell.Row.GetText("RATE").Contains("生产批"))
  344. {
  345. e.Cell.Row.Cells["TOP_STOVE"].Activation = Activation.AllowEdit;
  346. e.Cell.Row.Cells["LOOP_VALUE"].Activation = Activation.AllowEdit;
  347. }
  348. else
  349. {
  350. e.Cell.Row.Cells["TOP_STOVE"].Value = "";
  351. e.Cell.Row.Cells["LOOP_VALUE"].Value = "";
  352. e.Cell.Row.Cells["TOP_STOVE"].Activation = Activation.ActivateOnly;
  353. e.Cell.Row.Cells["LOOP_VALUE"].Activation = Activation.ActivateOnly;
  354. }
  355. if (e.Cell.Column.Key == "ATTACH_PERCENT" || e.Cell.Column.Key == "ATTACH_COUNT")
  356. {
  357. e.Cell.Row.Cells["DESC_COUNT"].Value = "";
  358. }
  359. if (e.Cell.Column.Key == "DESC_COUNT")
  360. {
  361. e.Cell.Row.Cells["ATTACH_PERCENT"].Value = "";
  362. e.Cell.Row.Cells["ATTACH_COUNT"].Value = "";
  363. }
  364. e.Cell.Row.Update();
  365. }
  366. private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
  367. {
  368. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  369. if (e.Cell.Column.Key.Equals("DESC_LENGTH"))
  370. {
  371. if (ugr.Cells["DESC_LENGTH"].Value.ToString() != "")
  372. {
  373. this.ultraComboEditor1.Text = ugr.Cells["DESC_LENGTH"].Text.ToString();
  374. ugr.Cells["LENGTH"].Value = this.ultraComboEditor1.Value.ToString();
  375. }
  376. }
  377. if (e.Cell.Column.Key.Equals("DESC_POSITION"))
  378. {
  379. if (ugr.Cells["DESC_POSITION"].Value.ToString() != "")
  380. {
  381. this.ultraComboEditor3.Text = ugr.Cells["DESC_POSITION"].Text.ToString();
  382. ugr.Cells["POSITION"].Value = this.ultraComboEditor3.Value.ToString();
  383. }
  384. }
  385. }
  386. private bool GetGridData()
  387. {
  388. this.ultraGrid1.UpdateData();
  389. parms.Clear();
  390. foreach (UltraGridRow row in ultraGrid1.Rows)
  391. {
  392. if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") //勾选
  393. {
  394. ArrayList listAdd = new ArrayList();
  395. ArrayList listUpdate = new ArrayList();
  396. if (row.Cells["RATE"].Value.ToString() == "")
  397. {
  398. MessageBox.Show("请选择取样频率", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  399. row.Cells["RATE"].Activate();
  400. return false;
  401. }
  402. if (row.Cells["RATE"].Value.ToString() == "408602" || row.Cells["RATE"].Value.ToString() == "408608")// 检验批和生产批(检验批)
  403. {
  404. if (row.Cells["BATCH_UNIT"].Text == "")
  405. {
  406. MessageUtil.ShowWarning("请选择分批单位!");
  407. row.Cells["BATCH_UNIT"].Activate();
  408. return false;
  409. }
  410. else if (row.Cells["BATCH_CNT"].Text == "")
  411. {
  412. MessageUtil.ShowWarning("请输入分批数量!");
  413. row.Cells["BATCH_CNT"].Activate();
  414. return false;
  415. }
  416. }
  417. if (row.Cells["POSITION"].Value.ToString() == "")
  418. {
  419. MessageBox.Show("请选择取样位置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  420. row.Cells["POSITION"].Activate();
  421. return false;
  422. }
  423. if (row.Cells["DESC_COUNT"].Value.ToString() == "" && row.Cells["ATTACH_PERCENT"].Value.ToString() == "")
  424. {
  425. MessageBox.Show("请输入管头个数或百分比%", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  426. row.Cells["DESC_COUNT"].Activate();
  427. return false;
  428. }
  429. if (row.GetValue("SAMPLE_COUNT") == "")
  430. {
  431. MessageUtil.ShowWarning("请输入样条个数!");
  432. row.SetCellActive("SAMPLE_COUNT");
  433. return false;
  434. }
  435. if (row.GetValue("ATTACH_COUNT") != "" && row.GetValue("ATTACH_PERCENT") == "" )
  436. {
  437. MessageUtil.ShowWarning("min支不为空,请输入百分比%");
  438. row.SetCellActive("ATTACH_PERCENT");
  439. return false;
  440. }
  441. if (row.GetValue("ATTACH_PERCENT") != "" && row.GetValue("ATTACH_COUNT") == "")
  442. {
  443. MessageUtil.ShowWarning("百分比%不为空,请输入min支");
  444. row.SetCellActive("ATTACH_COUNT");
  445. return false;
  446. }
  447. if (row.GetText("RATE").Contains("生产批"))
  448. {
  449. if (row.GetValue("TOP_STOVE") == "")
  450. {
  451. MessageUtil.ShowWarning("请输入头几炉!");
  452. row.SetCellActive("TOP_STOVE");
  453. return false;
  454. }
  455. if (row.GetValue("LOOP_VALUE") == "")
  456. {
  457. MessageUtil.ShowWarning("请输入循环值!");
  458. row.SetCellActive("LOOP_VALUE");
  459. return false;
  460. }
  461. }
  462. if (row.GetValue("EXCLUDE_PHY_MIN").Split(';').Length > 3)
  463. {
  464. MessageUtil.ShowWarning("材料号排它最多只能选择3个试样组!");
  465. row.SetCellActive("EXCLUDE_PHY_MIN_NAME");
  466. return false;
  467. }
  468. if (row.GetValue("PHY_NAME_MIN").StartsWith("SSC") && row.GetValue("SSC_CONDITION") == "")
  469. {
  470. MessageUtil.ShowWarning("请选择SSC+!");
  471. row.SetCellActive("SSC_CONDITION");
  472. return false;
  473. }
  474. //if (row.GetValue("MIN_D") != "" && row.GetValue("MIN_D_SIGN") == "")
  475. //{
  476. // MessageUtil.ShowWarning("请选择适用外径下限符号!");
  477. // row.SetCellActive("MIN_D_SIGN");
  478. // return false;
  479. //}
  480. //if (row.GetValue("MIN_D") == "" && row.GetValue("MIN_D_SIGN") != "")
  481. //{
  482. // MessageUtil.ShowWarning("请输入使用外径下限值!");
  483. // row.SetCellActive("MIN_D");
  484. // return false;
  485. //}
  486. //if (row.GetValue("MAX_D") != "" && row.GetValue("MAX_D_SIGN") == "")
  487. //{
  488. // MessageUtil.ShowWarning("请选择适用外径上限符号!");
  489. // row.SetCellActive("MAX_D_SIGN");
  490. // return false;
  491. //}
  492. //if (row.GetValue("MAX_D") == "" && row.GetValue("MAX_D_SIGN") != "")
  493. //{
  494. // MessageUtil.ShowWarning("请输入适用外径上限值!");
  495. // row.SetCellActive("MAX_D");
  496. // return false;
  497. //}
  498. //if (row.GetValue("MIN_D_SIGN") != "=")
  499. //{
  500. // if (row.GetValue("MIN_H") != "" && row.GetValue("MIN_H_SIGN") == "")
  501. // {
  502. // MessageUtil.ShowWarning("请选择适用壁厚下限符号!");
  503. // row.SetCellActive("MIN_H_SIGN");
  504. // return false;
  505. // }
  506. // if (row.GetValue("MIN_H") == "" && row.GetValue("MIN_H_SIGN") != "")
  507. // {
  508. // MessageUtil.ShowWarning("请输入适用壁厚下限值!");
  509. // row.SetCellActive("MIN_H");
  510. // return false;
  511. // }
  512. // if (row.GetValue("MAX_H") != "" && row.GetValue("MAX_H_SIGN") == "")
  513. // {
  514. // MessageUtil.ShowWarning("请选择适用壁厚上限符号!");
  515. // row.SetCellActive("MAX_H_SIGN");
  516. // return false;
  517. // }
  518. // if (row.GetValue("MAX_H") == "" && row.GetValue("MAX_H_SIGN") != "")
  519. // {
  520. // MessageUtil.ShowWarning("请输入适用壁厚上限值!");
  521. // row.SetCellActive("MAX_H");
  522. // return false;
  523. // }
  524. //}
  525. //else
  526. //{
  527. // if (row.GetValue("MAX_D") != "")
  528. // {
  529. // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用外径上限值!");
  530. // row.SetCellActive("MAX_D");
  531. // return false;
  532. // }
  533. // else if (row.GetValue("MAX_D_SIGN") != "")
  534. // {
  535. // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用外径上限符号!");
  536. // row.SetCellActive("MAX_D_SIGN");
  537. // return false;
  538. // }
  539. // else if (row.GetValue("MIN_H") != "")
  540. // {
  541. // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用壁厚下限值!");
  542. // row.SetCellActive("MIN_H");
  543. // return false;
  544. // }
  545. // else if (row.GetValue("MIN_H_SIGN") != "")
  546. // {
  547. // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用壁厚下限符号!");
  548. // row.SetCellActive("MIN_H_SIGN");
  549. // return false;
  550. // }
  551. // else if (row.GetValue("MAX_H") != "")
  552. // {
  553. // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用壁厚上限值!");
  554. // row.SetCellActive("MAX_H");
  555. // return false;
  556. // }
  557. // else if (row.GetValue("MAX_H_SIGN") != "")
  558. // {
  559. // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用壁厚上限符号!");
  560. // row.SetCellActive("MAX_H_SIGN");
  561. // return false;
  562. // }
  563. //}
  564. //if (row.GetValue("MIN_D") != "" && row.GetValue("MAX_D") != "")
  565. //{
  566. // if (decimal.Parse(row.GetValue("MIN_D")) > decimal.Parse(row.GetValue("MAX_D")))
  567. // {
  568. // MessageUtil.ShowWarning("适用外径下限值不能大于上限值!");
  569. // row.SetCellActive("MIN_D");
  570. // return false;
  571. // }
  572. // else if (decimal.Parse(row.GetValue("MIN_D")) == decimal.Parse(row.GetValue("MAX_D")))
  573. // {
  574. // MessageUtil.ShowWarning("适用外径下限值和上限值相等时,下限符号只能选>=,上限符号只能选<=!");
  575. // row.SetCellActive("MIN_D_SIGN");
  576. // return false;
  577. // }
  578. //}
  579. //if (row.GetValue("MIN_H") != "" && row.GetValue("MAX_H") != "")
  580. //{
  581. // if (decimal.Parse(row.GetValue("MIN_H")) > decimal.Parse(row.GetValue("MAX_H")))
  582. // {
  583. // MessageUtil.ShowWarning("适用壁厚下限值不能大于上限值!");
  584. // row.SetCellActive("MIN_H");
  585. // return false;
  586. // }
  587. // else if (decimal.Parse(row.GetValue("MIN_H")) == decimal.Parse(row.GetValue("MAX_H")))
  588. // {
  589. // MessageUtil.ShowWarning("适用壁厚下限值和上限值相等时,下限符号只能选>=,上限符号只能选<=!");
  590. // row.SetCellActive("MIN_H_SIGN");
  591. // return false;
  592. // }
  593. //}
  594. if (row.GetValue("MIN_D_SIGN") != "" && row.GetValue("MIN_D") == "")
  595. {
  596. MessageUtil.ShowWarning("请输入外径下限值!");
  597. row.SetCellActive("MIN_D");
  598. return false;
  599. }
  600. else if (row.GetValue("MIN_D_SIGN") == "" && row.GetValue("MIN_D") != "")
  601. {
  602. MessageUtil.ShowWarning("请选择外径下限符号!");
  603. row.SetCellActive("MIN_D_SIGN");
  604. return false;
  605. }
  606. else if (row.GetValue("MAX_D_SIGN") != "" && row.GetValue("MAX_D") == "")
  607. {
  608. MessageUtil.ShowWarning("请输入外径上限值!");
  609. row.SetCellActive("MAX_D");
  610. return false;
  611. }
  612. else if (row.GetValue("MAX_D_SIGN") == "" && row.GetValue("MAX_D") != "")
  613. {
  614. MessageUtil.ShowWarning("请选择外径上限符号!");
  615. row.SetCellActive("MAX_D_SIGN");
  616. return false;
  617. }
  618. else if (row.GetValue("MIN_H_SIGN") != "" && row.GetValue("MIN_H") == "")
  619. {
  620. MessageUtil.ShowWarning("请输入壁厚下限值!");
  621. row.SetCellActive("MIN_H");
  622. return false;
  623. }
  624. else if (row.GetValue("MIN_H_SIGN") == "" && row.GetValue("MIN_H") != "")
  625. {
  626. MessageUtil.ShowWarning("请选择壁厚下限符号!");
  627. row.SetCellActive("MIN_H_SIGN");
  628. return false;
  629. }
  630. else if (row.GetValue("MAX_H_SIGN") != "" && row.GetValue("MAX_H") == "")
  631. {
  632. MessageUtil.ShowWarning("请输入壁厚上限值!");
  633. row.SetCellActive("MAX_H");
  634. return false;
  635. }
  636. else if (row.GetValue("MAX_H_SIGN") == "" && row.GetValue("MAX_H") != "")
  637. {
  638. MessageUtil.ShowWarning("请选择壁厚上限符号!");
  639. row.SetCellActive("MAX_H_SIGN");
  640. return false;
  641. }
  642. else if (row.GetValue("MIN_D_SIGN") == "=" && row.GetValue("MAX_D_SIGN") != "")
  643. {
  644. MessageUtil.ShowWarning("外径下限符号为等号时,不能存在外径上限符号和外径上限值!");
  645. row.SetCellActive("MAX_D_SIGN");
  646. return false;
  647. }
  648. else if (row.GetValue("MIN_H_SIGN") == "=" && row.GetValue("MAX_H_SIGN") != "")
  649. {
  650. MessageUtil.ShowWarning("壁厚下限符号为等号时,不能存在壁厚上限符号和壁厚上限值!");
  651. row.SetCellActive("MAX_H_SIGN");
  652. return false;
  653. }
  654. else if (row.GetValue("MIN_D") != "" && row.GetValue("MAX_D") != ""
  655. && decimal.Parse(row.GetValue("MIN_D")) >= decimal.Parse(row.GetValue("MAX_D")))
  656. {
  657. MessageUtil.ShowWarning("外径下限值不能大于等于外径上限值!");
  658. row.SetCellActive("MIN_D");
  659. return false;
  660. }
  661. else if (row.GetValue("MIN_H") != "" && row.GetValue("MAX_H") != ""
  662. && decimal.Parse(row.GetValue("MIN_H")) >= decimal.Parse(row.GetValue("MAX_H")))
  663. {
  664. MessageUtil.ShowWarning("壁厚下限值不能大于等于壁厚上限值!");
  665. row.SetCellActive("MIN_H");
  666. return false;
  667. }
  668. ComBaseSampleEntity baseSampleEntity = new ComBaseSampleEntity();
  669. baseSampleEntity.Sic = row.GetValue("SIC");
  670. baseSampleEntity.PhyCodeMin = row.GetValue("PHY_CODE_MIN");
  671. baseSampleEntity.PhyNameMin = row.GetValue("PHY_NAME_MIN");
  672. baseSampleEntity.StdCode = row.GetValue("STD_CODE");
  673. baseSampleEntity.StdName = row.GetValue("STD_NAME");
  674. baseSampleEntity.Length = row.GetValue("LENGTH");
  675. baseSampleEntity.DescLength = row.GetText("DESC_LENGTH");
  676. baseSampleEntity.Rate = row.GetValue("RATE");
  677. baseSampleEntity.DescRate = row.GetText("RATE");
  678. if (row.GetValue("DESC_COUNT") != "")
  679. {
  680. baseSampleEntity.DescCount = decimal.Parse(row.GetValue("DESC_COUNT"));
  681. }
  682. baseSampleEntity.Position = row.GetValue("POSITION");
  683. baseSampleEntity.DescPosition = row.GetText("POSITION");
  684. baseSampleEntity.CreateName = this.UserInfo.GetUserName();
  685. baseSampleEntity.Memo = row.GetValue("MEMO");
  686. baseSampleEntity.SampleCount = decimal.Parse(row.GetValue("SAMPLE_COUNT"));
  687. baseSampleEntity.SampleStyle = row.GetValue("SAMPLE_STYLE");
  688. if (row.GetValue("WIDTH") == "")
  689. {
  690. baseSampleEntity.Width = null;
  691. }
  692. else
  693. {
  694. baseSampleEntity.Width = decimal.Parse(row.GetValue("WIDTH"));
  695. }
  696. baseSampleEntity.MinD = row.GetValue("MIN_D");
  697. baseSampleEntity.MinDSign = row.GetValue("MIN_D_SIGN");
  698. baseSampleEntity.MaxD = row.GetValue("MAX_D");
  699. baseSampleEntity.MaxDSign = row.GetValue("MAX_D_SIGN");
  700. baseSampleEntity.MinH = row.GetValue("MIN_H");
  701. baseSampleEntity.MinHSign = row.GetValue("MIN_H_SIGN");
  702. baseSampleEntity.MaxH = row.GetValue("MAX_H");
  703. baseSampleEntity.MaxHSign = row.GetValue("MAX_H_SIGN");
  704. baseSampleEntity.SteelCode = row.GetValue("STEELCODE");
  705. baseSampleEntity.SteelName = row.GetValue("STEELNAME");
  706. baseSampleEntity.Produccode = row.GetValue("PRODUCCODE");
  707. baseSampleEntity.Producname = row.GetValue("PRODUCNAME");
  708. baseSampleEntity.Validflag = row.GetValue("VALIDFLAG");
  709. baseSampleEntity.BatchCnt = row.GetValue("BATCH_CNT");
  710. baseSampleEntity.BatchUnit = row.GetValue("BATCH_UNIT");
  711. baseSampleEntity.AttachPercent = row.GetValue("ATTACH_PERCENT");
  712. baseSampleEntity.AttachCount = row.GetValue("ATTACH_COUNT");
  713. baseSampleEntity.TopStove = row.GetValue("TOP_STOVE");
  714. baseSampleEntity.LoopValue = row.GetValue("LOOP_VALUE");
  715. baseSampleEntity.SscCondition = row.GetValue("SSC_CONDITION");
  716. baseSampleEntity.ExcludePhyMin = row.GetValue("EXCLUDE_PHY_MIN");
  717. parms.Add(JSONFormat.Format(baseSampleEntity));
  718. }
  719. }
  720. return true;
  721. }
  722. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  723. {
  724. }
  725. private void ControlEdit(UltraGridRow row)
  726. {
  727. ultraGrid1.UpdateData();
  728. if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  729. {
  730. for (int j = 0; j < row.Cells.Count; j++)
  731. {
  732. string key = row.Cells[j].Column.Key;
  733. if (key == "DESC_LENGTH" || key == "RATE" || key == "POSITION" ||
  734. key == "DESC_COUNT" || key == "CHK" || key == "SAMPLE_COUNT" || key == "STD_CODE"
  735. || key == "SAMPLE_STYLE" || key == "WIDTH" || key == "MIN_D" || key == "MAX_D"
  736. || key == "MIN_H" || key == "MAX_H" || key == "MIN_D_SIGN" || key == "MAX_D_SIGN"
  737. || key == "MIN_H_SIGN" || key == "MAX_H_SIGN" || key == "STEEL_SELECT" || key == "BATCH_CNT"
  738. || key == "BATCH_UNIT" || key == "MEMO" || key == "ATTACH_PERCENT" || key == "ATTACH_COUNT"
  739. || key == "TOP_STOVE" || key == "LOOP_VALUE" || key == "SSC_CONDITION")
  740. {
  741. row.Cells[j].Activation = Activation.AllowEdit;
  742. }
  743. else
  744. {
  745. row.Cells[j].Activation = Activation.ActivateOnly;
  746. }
  747. }
  748. }
  749. else
  750. {
  751. for (int j = 0; j < row.Cells.Count; j++)
  752. {
  753. string key = row.Cells[j].Column.Key;
  754. if (key != "CHK")
  755. {
  756. row.Cells[j].Activation = Activation.ActivateOnly;
  757. }
  758. }
  759. }
  760. }
  761. private void ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e)
  762. {
  763. var actRow = ultraGrid1.ActiveRow;
  764. if (ultraGrid1.ActiveCell.Column.Key == "STD_NAME")
  765. {
  766. string stdCodes = actRow.GetValue("STD_CODE");
  767. string[] styles = new string[] { "G", "X", "N" };
  768. //if(this.CustomInfo == "2")
  769. //{
  770. // styles = new string[] { "N" };
  771. //}
  772. //else
  773. //{
  774. // styles = new string[] { "G", "X" };
  775. //}
  776. ComBaseStdChoice baseStdChoice = new ComBaseStdChoice(styles, stdCodes, _ob);
  777. if (baseStdChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  778. {
  779. actRow.SetValue("STD_CODE", baseStdChoice.ChoiceStdCodes);
  780. actRow.SetValue("STD_NAME", baseStdChoice.ChoiceStdNames);
  781. }
  782. }
  783. else if (ultraGrid1.ActiveCell.Column.Key == "STEELNAME")
  784. {
  785. FrmRepSteel frms = new FrmRepSteel();
  786. frms.Ob1 = this._ob;
  787. frms.Code = ultraGrid1.ActiveRow.GetValue("STEELCODE");
  788. if (frms.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  789. {
  790. ultraGrid1.ActiveRow.SetValue("STEELCODE", frms.Code);
  791. ultraGrid1.ActiveRow.SetValue("STEELNAME", frms.Desc);
  792. }
  793. }
  794. else if (ultraGrid1.ActiveCell.Column.Key == "PRODUCNAME")
  795. {
  796. this.Cursor = Cursors.WaitCursor;
  797. PopupProductName popupProductName = new PopupProductName(actRow.GetValue("PRODUCCODE"), _ob);
  798. this.Cursor = Cursors.Default;
  799. if (popupProductName.ShowDialog() == DialogResult.OK)
  800. {
  801. actRow.SetValue("PRODUCCODE", popupProductName.ProductCodes);
  802. actRow.SetValue("PRODUCNAME", popupProductName.ProductNames);
  803. }
  804. }
  805. else if (ultraGrid1.ActiveCell.Column.Key == "EXCLUDE_PHY_MIN_NAME")
  806. {
  807. string phyMins = actRow.GetValue("EXCLUDE_PHY_MIN");
  808. string[] styles = new string[] { "G", "X", "N" };
  809. ComBasePhyMinChoice basePhyMinChoice = new ComBasePhyMinChoice(phyMins, _ob);
  810. if (basePhyMinChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  811. {
  812. actRow.SetValue("EXCLUDE_PHY_MIN", basePhyMinChoice.ChoicePhyMinCodes);
  813. actRow.SetValue("EXCLUDE_PHY_MIN_NAME", basePhyMinChoice.ChoicePhyMinNames);
  814. }
  815. }
  816. }
  817. }
  818. }