FrmJGCodeManage.cs 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using Infragistics.Win;
  6. using Infragistics.Win.UltraWinEditors;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Windows.Forms;
  15. namespace Core.StlMes.Client.Qcm
  16. {
  17. public partial class FrmJGCodeManage : FrmBase
  18. {
  19. private string _stdName = "";
  20. public string StdName
  21. {
  22. get { return _stdName; }
  23. set { _stdName = value; }
  24. }
  25. private ArrayList _choiceSpecs = new ArrayList();
  26. public FrmJGCodeManage()
  27. {
  28. //base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
  29. //base.UpdateStyles();
  30. //this.SetStyle(ControlStyles.DoubleBuffer, true);
  31. //this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  32. //this.SetStyle(ControlStyles.UserPaint, true);
  33. //this.SetStyle(ControlStyles.ResizeRedraw, true);
  34. InitializeComponent();
  35. this.IsLoadUserView = true;
  36. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
  37. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "");
  38. //ultraPanel2.GetType().GetProperty("DoubleBuffered",
  39. // System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
  40. // .SetValue(ultraPanel2, true, null);
  41. }
  42. protected override CreateParams CreateParams
  43. {
  44. get
  45. {
  46. CreateParams cp = base.CreateParams;
  47. cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
  48. return cp;
  49. }
  50. }
  51. protected override void OnLoad(EventArgs e)
  52. {
  53. base.OnLoad(e);
  54. ultraComboEditor3.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
  55. ultraComboEditor4.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
  56. ultraComboEditor6.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
  57. }
  58. public void PopupLoad(string customInfo, OpeBase ob)
  59. {
  60. this.CustomInfo = customInfo;
  61. this.ob = ob;
  62. this.OnLoad(EventArgs.Empty);
  63. }
  64. private void FrmJGCodeManage_Load(object sender, EventArgs e)
  65. {
  66. InitCombo();
  67. }
  68. ArrayList list = new ArrayList(); //全局变量 存储修改或添加的数据
  69. ArrayList jgDescList = new ArrayList(); //接箍描述决定一个接箍码
  70. /// <summary>
  71. /// 初始化下拉框
  72. /// </summary>
  73. private void InitCombo()
  74. {
  75. //initJGDropDown(ultraComboEditor2, "com.steering.pss.qcm.JGCodeManage.GetJGProduct", "BASECODE", false);
  76. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.getProductName", new object[] { }, ob);
  77. dt.DefaultView.RowFilter = "PRODUCCODE = 'S000012'";
  78. ultraComboEditor2.DataSource = dt.DefaultView;
  79. ultraComboEditor2.ValueMember = "PRODUCCODE";
  80. ultraComboEditor2.DisplayMember = "PRODUCNAME";
  81. if (ultraComboEditor2.Items.Count > 0)
  82. {
  83. ultraComboEditor2.Value = "S000012";
  84. }
  85. initJGDropDown(ultraComboEditor3, "com.steering.pss.qcm.JGCodeManage.GetJGSteel", "STEELCODE", false);
  86. initJGDropDown(ultraComboEditor4, "com.steering.pss.qcm.JGCodeManage.GetJGModel", "MODEL_CODE", false);
  87. initJGDropDown(ultraComboEditor5, "com.steering.pss.qcm.JGCodeManage.GetJGType", "BASECODE", true);
  88. initJGDropDown(ultraComboEditor6, "com.steering.pss.qcm.JGCodeManage.GetCPProduct", "PRODUCCODE", false);
  89. initJGDropDown(ultraComboEditor10, "com.steering.pss.qcm.JGCodeManage.GetJGType", "BASECODE", true);
  90. initJGDropDown(ultraComboEditor11, "com.steering.pss.qcm.JGCodeManage.GetJGAlpha", "STD_CODE", true);
  91. //QcmBaseQuery.NitializeJgStdStyle(ultraComboEditor8, true, ob);
  92. initJGDropDown(ultraComboEditor8, "com.steering.pss.qcm.JGCodeManage.getStdStyleName", "STD_STYLE", true);
  93. ClsBaseInfo.SetComboItemHeight(ultraComboEditor2);
  94. ClsBaseInfo.SetComboItemHeight(ultraComboEditor3);
  95. ClsBaseInfo.SetComboItemHeight(ultraComboEditor4);
  96. ClsBaseInfo.SetComboItemHeight(ultraComboEditor5);
  97. ClsBaseInfo.SetComboItemHeight(ultraComboEditor6);
  98. ClsBaseInfo.SetComboItemHeight(ultraComboEditor10);
  99. ClsBaseInfo.SetComboItemHeight(ultraComboEditor11);
  100. ValueList plnStatusList = new ValueList();
  101. plnStatusList.ValueListItems.Add("0", "计划");
  102. plnStatusList.ValueListItems.Add("1", "生产中");
  103. plnStatusList.ValueListItems.Add("2", "完成");
  104. plnStatusList.ValueListItems.Add("3", "关闭");
  105. plnStatusList.ValueListItems.Add("4", "关闭");
  106. ultraGrid1.DisplayLayout.Bands[0].Columns["JG_PLN_STATUS"].ValueList = plnStatusList;
  107. }
  108. /// <summary>
  109. /// 初始化下拉框
  110. /// </summary>
  111. /// <param name="uce">下拉框名字</param>
  112. /// <param name="MethodId">服务请求:包名+类名+方法名</param>
  113. /// <param name="memberValue">下拉框的值成员</param>
  114. private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue, bool isEmpty)
  115. {
  116. //初始化编辑区域下拉框
  117. DataTable dt = ServerHelper.GetData(MethodId, null, this.ob);
  118. if (isEmpty)
  119. {
  120. DataRow dr = dt.NewRow();
  121. object[] obj = { "", "" };
  122. dr.ItemArray = obj;
  123. dt.Rows.Add(dr);
  124. }
  125. if (dt != null && dt.Rows.Count > 0)
  126. {
  127. uce.DataSource = dt;
  128. uce.ValueMember = memberValue;
  129. }
  130. }
  131. private void doRefresh()
  132. {
  133. InitCombo();
  134. }
  135. /// <summary>
  136. /// 重载平台的工具栏函数
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="ToolbarKey"></param>
  140. public override void ToolBar_Click(object sender, string ToolbarKey)
  141. {
  142. #if !DEBUG
  143. try
  144. {
  145. #endif
  146. switch (ToolbarKey)
  147. {
  148. case "Query":
  149. try
  150. {
  151. this.Cursor = Cursors.WaitCursor;
  152. this.doQuery();
  153. }
  154. finally
  155. {
  156. this.Cursor = Cursors.Default;
  157. }
  158. break;
  159. case "Add":
  160. this.doAdd();
  161. break;
  162. case "Update":
  163. this.doUpdate();
  164. break;
  165. case "Delete":
  166. this.DoDeleteOrResume(true);
  167. break;
  168. case "Resume":
  169. this.DoDeleteOrResume(false);
  170. break;
  171. case "Refresh":
  172. this.doRefresh();
  173. break;
  174. case "Export":
  175. Export();
  176. break;
  177. case "Close":
  178. this.Close();
  179. break;
  180. }
  181. #if !DEBUG
  182. }
  183. catch (Exception ex) { }
  184. #endif
  185. }
  186. private void Export()
  187. {
  188. GridHelper.ulGridToExcel(ultraGrid1, "接箍基础信息");
  189. }
  190. /// <summary>
  191. /// 查询
  192. /// </summary>
  193. private void doQuery()
  194. {
  195. string jg_desc = ""; //接箍规格描述
  196. string jgproduct = ""; //接箍品种描述
  197. string steelname = ""; //接箍钢级名称
  198. string modelname = ""; //接箍扣型名称
  199. string dimaterJg = "";
  200. string stype = ""; //接箍类别
  201. if (this.ultraCheckEditor1.Checked)
  202. {
  203. jg_desc = this.ultraTextEditor1.Text.ToString().Trim();
  204. }
  205. if (this.ultraCheckEditor2.Checked)
  206. {
  207. jgproduct = this.ultraTextEditor3.Text.ToString().Trim();
  208. }
  209. if (this.ultraCheckEditor3.Checked)
  210. {
  211. steelname = this.ultraTextEditor4.Text.ToString().Trim();
  212. }
  213. if (this.ultraCheckEditor4.Checked)
  214. {
  215. modelname = this.ultraTextEditor5.Text.ToString().Trim();
  216. }
  217. if (this.ultraCheckEditor6.Checked)
  218. {
  219. dimaterJg = ultraTextEditor17.Text.Trim();
  220. }
  221. if (this.ultraCheckEditor5.Checked)
  222. {
  223. if (this.ultraComboEditor10.SelectedItem == null)
  224. {
  225. MessageBox.Show("请选择查询类别", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  226. return;
  227. }
  228. else
  229. {
  230. stype = this.ultraComboEditor10.Text.ToString();
  231. }
  232. }
  233. else
  234. {
  235. stype = "%";
  236. }
  237. ArrayList parm = new ArrayList();
  238. parm.Add(jg_desc);
  239. parm.Add(jgproduct);
  240. parm.Add(steelname);
  241. parm.Add(steelname);
  242. parm.Add(steelname);
  243. parm.Add(modelname);
  244. parm.Add(dimaterJg);
  245. parm.Add(dimaterJg);
  246. parm.Add(stype);
  247. parm.Add(_stdName);
  248. parm.Add(_stdName);
  249. parm.Add(_stdName);
  250. if (numDimaterCp.CheckBox.Checked && numDimaterCp.Value != null)
  251. {
  252. parm.Add(numDimaterCp.Value.ToString());
  253. parm.Add(numDimaterCp.Value.ToString());
  254. parm.Add(numDimaterCp.Value.ToString());
  255. parm.Add(numDimaterCp.Value.ToString());
  256. parm.Add(numDimaterCp.Value.ToString());
  257. parm.Add(numDimaterCp.Value.ToString());
  258. }
  259. else
  260. {
  261. parm.Add("");
  262. parm.Add("");
  263. parm.Add("");
  264. parm.Add("");
  265. parm.Add("");
  266. parm.Add("");
  267. }
  268. if (numHeightCp.CheckBox.Checked && numHeightCp.Value != null)
  269. {
  270. parm.Add(numHeightCp.Value.ToString());
  271. parm.Add(numHeightCp.Value.ToString());
  272. parm.Add(numHeightCp.Value.ToString());
  273. parm.Add(numHeightCp.Value.ToString());
  274. parm.Add(numHeightCp.Value.ToString());
  275. parm.Add(numHeightCp.Value.ToString());
  276. }
  277. else
  278. {
  279. parm.Add("");
  280. parm.Add("");
  281. parm.Add("");
  282. parm.Add("");
  283. parm.Add("");
  284. parm.Add("");
  285. }
  286. bool validFlag = chkValid.Checked;
  287. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.doQuery", new Object[] { validFlag, parm }, this.ob);
  288. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  289. UltraGridColumn[] col = new UltraGridColumn[]{this.ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"],
  290. this.ultraGrid1.DisplayLayout.Bands[0].Columns["REP_STEELCODE"],this.ultraGrid1.DisplayLayout.Bands[0].Columns["REP_STEELNAME"]};
  291. //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1,col); 数据多,速度慢。
  292. //不同颜色区分是否有效数据
  293. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  294. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  295. {
  296. row = ultraGrid1.Rows[i];
  297. if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效"))
  298. {
  299. row.Appearance.ForeColor = Color.Red;
  300. }
  301. else
  302. {
  303. row.Appearance.ForeColor = Color.Black;
  304. }
  305. }
  306. if (dt != null && dt.Rows.Count > 0)
  307. {
  308. ultraGrid1.Rows[0].Activate();
  309. }
  310. }
  311. /// <summary>
  312. /// 获取界面编辑区数据
  313. /// </summary>
  314. /// <returns>成功返回0,失败返回-1</returns>
  315. private int GetData()
  316. {
  317. list = new ArrayList();
  318. jgDescList = new ArrayList();
  319. if (ultraTextEditor10.Text == "")
  320. {
  321. MessageBox.Show("请选择规格描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  322. ultraTextEditor10.Focus();
  323. return -1;
  324. }
  325. if (ultraComboEditor2.SelectedItem == null)
  326. {
  327. MessageBox.Show("请选择品种描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  328. ultraComboEditor2.Focus();
  329. return -1;
  330. }
  331. if (ultraComboEditor3.SelectedItem == null)
  332. {
  333. if (ultraComboEditor3.Text != "")
  334. {
  335. MessageUtil.ShowWarning("输入的钢级名称不存在,请重新选择钢级名称!");
  336. ultraComboEditor3.Focus();
  337. return -1;
  338. }
  339. else
  340. {
  341. MessageBox.Show("请选择钢级名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  342. ultraComboEditor3.Focus();
  343. return -1;
  344. }
  345. }
  346. //if (ultraTextEditor9.Text == "")
  347. //{
  348. // MessageBox.Show("请选择标准名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  349. // ultraTextEditor9.Focus();
  350. // return -1;
  351. //}
  352. if (ultraComboEditor4.SelectedItem == null)
  353. {
  354. if (ultraComboEditor4.Text != "")
  355. {
  356. MessageUtil.ShowWarning("输入的扣型描述不存在,请重新选择扣型描述!");
  357. ultraComboEditor4.Focus();
  358. return -1;
  359. }
  360. else
  361. {
  362. MessageBox.Show("请选择扣型描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  363. ultraComboEditor4.Focus();
  364. return -1;
  365. }
  366. }
  367. if (ultraComboEditor5.SelectedItem == null)
  368. {
  369. MessageUtil.ShowWarning("请选择中孔类别");
  370. ultraComboEditor5.Focus();
  371. return -1;
  372. }
  373. if (ultraTextEditor9.Tag.ToString2() != "")
  374. {
  375. MessageUtil.ShowWarning("不能选择标准名称");
  376. ultraTextEditor9.Focus();
  377. return -1;
  378. }
  379. if (ultraComboEditor8.Value.ToString2() != "")
  380. {
  381. MessageUtil.ShowWarning("不能选择标准类别");
  382. ultraComboEditor8.Focus();
  383. return -1;
  384. }
  385. string type = "";
  386. if (ultraComboEditor5.SelectedItem != null)
  387. {
  388. type = this.ultraComboEditor5.Text; //接箍类别
  389. }
  390. if (ultraNumericEditor9.Value == null || ultraNumericEditor9.Value.ToString() == "")
  391. {
  392. MessageBox.Show("请输入接箍外径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  393. ultraNumericEditor9.Focus();
  394. return -1;
  395. }
  396. string height = "";
  397. if (ultraNumericEditor10.Value != null)
  398. {
  399. height = ultraNumericEditor10.Value.ToString().Trim();
  400. }
  401. string radio = "";
  402. if (ultraNumericEditor8.Value != null)
  403. {
  404. radio = ultraNumericEditor8.Value.ToString().Trim();
  405. }
  406. if (ultraNumericEditor11.Value.ToString2() == "")
  407. {
  408. MessageBox.Show("请输入接箍长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  409. ultraNumericEditor11.Focus();
  410. return -1;
  411. }
  412. if (ultraNumericEditor5.Value.ToString2() == "")
  413. {
  414. MessageBox.Show("请输入单个重", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  415. ultraNumericEditor5.Focus();
  416. return -1;
  417. }
  418. else if (decimal.Parse(ultraNumericEditor5.Value.ToString()) <= 0)
  419. {
  420. MessageBox.Show("单个重必须大于0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  421. ultraNumericEditor5.Focus();
  422. return -1;
  423. }
  424. if (ultraNumericEditor10.Value.ToString2() == "")
  425. {
  426. MessageBox.Show("请输入临界壁厚", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  427. ultraNumericEditor10.Focus();
  428. return -1;
  429. }
  430. //else if (decimal.Parse(ultraNumericEditor10.Value.ToString()) <= 0)
  431. //{
  432. // MessageBox.Show("临界壁厚必须大于0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  433. // ultraNumericEditor10.Focus();
  434. // return -1;
  435. //}
  436. if (ultraNumericEditor16.Value.ToString2() == "")
  437. {
  438. MessageBox.Show("请输入测量J值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  439. ultraNumericEditor16.Focus();
  440. return -1;
  441. }
  442. else if (decimal.Parse(ultraNumericEditor16.Value.ToString()) <= 0)
  443. {
  444. MessageBox.Show("测量J值必须大于0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  445. ultraNumericEditor16.Focus();
  446. return -1;
  447. }
  448. if (ultraNumericEditor6.Value.ToString2() == "")
  449. {
  450. MessageBox.Show("请输入接箍料外径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  451. ultraNumericEditor6.Focus();
  452. return -1;
  453. }
  454. if (ultraNumericEditor7.Value.ToString2() == "")
  455. {
  456. MessageBox.Show("请输入接箍料壁厚", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  457. ultraNumericEditor7.Focus();
  458. return -1;
  459. }
  460. if (ultraNumericEditor1.Value.ToString2() == "")
  461. {
  462. MessageBox.Show("请输入坯料外径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  463. ultraNumericEditor1.Focus();
  464. return -1;
  465. }
  466. if (ultraNumericEditor2.Value.ToString2() == "")
  467. {
  468. MessageBox.Show("请输入坯料壁厚", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  469. ultraNumericEditor2.Focus();
  470. return -1;
  471. }
  472. if (ultraNumericEditor3.Value.ToString2() == "")
  473. {
  474. MessageBox.Show("请输入坯料最小长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  475. ultraNumericEditor3.Focus();
  476. return -1;
  477. }
  478. if (ultraNumericEditor4.Value.ToString2() == "")
  479. {
  480. MessageBox.Show("请输入坯料最大长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  481. ultraNumericEditor4.Focus();
  482. return -1;
  483. }
  484. if (Convert.ToDouble(ultraNumericEditor3.Value.ToString()) > Convert.ToDouble(ultraNumericEditor4.Value.ToString()))
  485. {
  486. MessageBox.Show("您输入的接箍坯料长度最小值不能大于接箍坯料长度最大值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  487. return -1;
  488. }
  489. if (ultraComboEditor6.SelectedItem == null)
  490. {
  491. if (ultraComboEditor6.Text != "")
  492. {
  493. MessageUtil.ShowWarning("输入的品名描述不存在,请重新选择品名描述!");
  494. ultraComboEditor6.Focus();
  495. return -1;
  496. }
  497. else
  498. {
  499. MessageBox.Show("请选择品名描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  500. ultraComboEditor6.Focus();
  501. return -1;
  502. }
  503. }
  504. if (ultraNumericEditor14.Value == DBNull.Value)
  505. {
  506. MessageBox.Show("请输入最小外径值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  507. ultraNumericEditor14.Focus();
  508. return -1;
  509. }
  510. if (ultraNumericEditor15.Value == DBNull.Value)
  511. {
  512. MessageBox.Show("请输入最大内径值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  513. ultraNumericEditor15.Focus();
  514. return -1;
  515. }
  516. if (Convert.ToDouble(ultraNumericEditor15.Value.ToString()) < 0)
  517. {
  518. MessageBox.Show("输入的接箍料壁厚和最小外径不合法!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  519. ultraNumericEditor15.Focus();
  520. return -1;
  521. }
  522. if (ultraNumericEditor12.Value.ToString2() != "" && ultraNumericEditor13.Value.ToString2() != "")
  523. {
  524. if (Convert.ToDouble(ultraNumericEditor13.Value) < Convert.ToDouble(ultraNumericEditor12.Value))
  525. {
  526. MessageUtil.ShowWarning("适用成品壁厚最大值不能小于最小值!");
  527. ultraNumericEditor13.Focus();
  528. return -1;
  529. }
  530. }
  531. if (ultraNumericEditor18.Value.ToString2() != "" && ultraNumericEditor17.Value.ToString2() != "")
  532. {
  533. if (Convert.ToDouble(ultraNumericEditor17.Value) < Convert.ToDouble(ultraNumericEditor18.Value))
  534. {
  535. MessageUtil.ShowWarning("适用成品外径最大值不能小于最小值!");
  536. ultraNumericEditor17.Focus();
  537. return -1;
  538. }
  539. }
  540. string testJVal = "";
  541. if (ultraNumericEditor16.Value != null)
  542. testJVal = ultraNumericEditor16.Value.ToString();
  543. list.Add(ultraTextEditor10.Tag.ToString2());
  544. list.Add(ultraTextEditor10.Text);
  545. list.Add(ultraComboEditor2.Value.ToString().Trim());
  546. list.Add(ultraComboEditor2.Text.Trim());
  547. list.Add(ultraComboEditor3.Value.ToString().Trim());
  548. list.Add(ultraComboEditor3.Text.Trim());
  549. list.Add(ultraComboEditor4.Value.ToString().Trim());
  550. list.Add(ultraComboEditor4.Text.Trim());
  551. list.Add(ultraComboEditor5.Value.ToString());
  552. list.Add(ultraNumericEditor6.Value.ToString().Trim());
  553. list.Add(ultraNumericEditor7.Value.ToString().Trim());
  554. list.Add(ultraNumericEditor9.Value.ToString().Trim());
  555. list.Add(height);
  556. list.Add(ultraNumericEditor11.Value.ToString().Trim());
  557. list.Add(ultraNumericEditor5.Value.ToString().Trim());
  558. list.Add(radio);
  559. list.Add(ultraComboEditor11.Text.Trim());
  560. list.Add(ultraNumericEditor1.Value.ToString().Trim());
  561. list.Add(ultraNumericEditor2.Value.ToString().Trim());
  562. list.Add(ultraNumericEditor3.Value.ToString().Trim());
  563. list.Add(ultraNumericEditor4.Value.ToString().Trim());
  564. list.Add(this.UserInfo.GetUserName());
  565. list.Add(ultraTextEditor2.Text.Trim());
  566. list.Add(ultraComboEditor6.Value.ToString());
  567. list.Add(ultraComboEditor6.Text);
  568. list.Add(ultraNumericEditor14.Value.ToString().Trim());
  569. list.Add(ultraNumericEditor15.Value.ToString().Trim());
  570. if (ultraNumericEditor12.Value != null)
  571. list.Add(ultraNumericEditor12.Value.ToString().Trim());
  572. else
  573. list.Add("");
  574. if (ultraNumericEditor13.Value != null)
  575. list.Add(ultraNumericEditor13.Value.ToString2().Trim());
  576. else
  577. list.Add("");
  578. list.Add(ultraTextEditor9.Tag.ToString2());
  579. list.Add(ultraTextEditor9.Text);
  580. list.Add(testJVal);
  581. list.Add(ultraComboEditor8.Value.ToString2());
  582. list.Add(ultraComboEditor8.Text);
  583. list.Add(ultraTextEditor7.Text.Trim());
  584. if (ultraNumericEditor18.Value != null)
  585. list.Add(ultraNumericEditor18.Value.ToString2().Trim());
  586. else
  587. list.Add("");
  588. if (ultraNumericEditor17.Value != null)
  589. list.Add(ultraNumericEditor17.Value.ToString2().Trim());
  590. else
  591. list.Add("");
  592. list.Add(ultraTextEditor11.Text.Trim());
  593. list.Add(ultraTextEditor12.Text.Trim());
  594. list.Add(ultraTextEditor13.Text.Trim());
  595. list.Add(ultraTextEditor14.Text.Trim());
  596. list.Add(ultraTextEditor15.Tag.ToString2());
  597. list.Add(textBox1.Text.Trim() == "" ? "0" : textBox1.Text.Trim());
  598. list.Add(textBox2.Text.Trim() == "" ? "0" : textBox2.Text.Trim());
  599. list.Add(textBox3.Text.Trim() == "" ? "0" : textBox3.Text.Trim());
  600. list.Add(textBox4.Text.Trim() == "" ? "0" : textBox4.Text.Trim());
  601. jgDescList.Add(ultraTextEditor10.Tag.ToString2());
  602. jgDescList.Add(ultraComboEditor2.Value.ToString2());
  603. jgDescList.Add(ultraComboEditor3.Value.ToString2());
  604. jgDescList.Add(ultraTextEditor9.Tag.ToString2());
  605. jgDescList.Add(ultraComboEditor4.Value.ToString2());
  606. jgDescList.Add(ultraComboEditor5.Value.ToString2());
  607. jgDescList.Add(ultraComboEditor8.Value.ToString2());
  608. return 0;
  609. }
  610. /// <summary>
  611. /// 新增记录
  612. /// </summary>
  613. private void doAdd()
  614. {
  615. if (GetData() == 0)
  616. {
  617. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.isExistJGCode", new Object[] { jgDescList }, this.ob);
  618. if (dt != null && dt.Rows.Count > 0)
  619. {
  620. MessageBox.Show("当前接箍描述所约束的接箍码已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  621. return;
  622. }
  623. if (MessageUtil.ShowYesNoAndQuestion("是否确认新增?") == DialogResult.No)
  624. {
  625. return;
  626. }
  627. ArrayList steelList = new ArrayList();
  628. string code = ultraComboEditor3.Value.ToString(); //钢级代码
  629. string desc = ultraComboEditor3.Text.Trim(); //钢级描述
  630. string repcode = txtRepSteelCode.Text.Trim(); //替代钢级代码集合
  631. string repdesc = ultraTextEditor6.Text.Trim(); //替代钢级名称集合
  632. string[] arrcode = repcode.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
  633. string[] arrdesc = repdesc.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
  634. for (int i = 0; i < arrcode.Length; i++)
  635. {
  636. ArrayList tempList = new ArrayList();
  637. tempList.Add(code);
  638. tempList.Add(desc);
  639. tempList.Add(arrcode[i]);
  640. tempList.Add(arrdesc[i]);
  641. tempList.Add(this.UserInfo.GetUserName());
  642. steelList.Add(tempList);
  643. }
  644. int count = ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.doAdd", new Object[] { list, steelList, code, _choiceSpecs }, this.ob);
  645. if (count > 0)
  646. {
  647. MessageUtil.ShowTips("新增成功!");
  648. doQuery();
  649. //高亮显示新增的数据
  650. ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear();
  651. ultraGrid1.DisplayLayout.Bands[0].Columns["CODE_JG"].SortIndicator = SortIndicator.Ascending;
  652. this.ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Activate();
  653. }
  654. }
  655. }
  656. /// <summary>
  657. /// 修改数据
  658. /// </summary>
  659. private void doUpdate()
  660. {
  661. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  662. if (ugr == null)
  663. {
  664. MessageBox.Show("请选择需要操作的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  665. return;
  666. }
  667. if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效")
  668. {
  669. MessageBox.Show("您选择的数据已经无效,无法修改", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  670. return;
  671. }
  672. list = new ArrayList();
  673. jgDescList = new ArrayList();
  674. if (GetData() == 0)
  675. {
  676. if (MessageBox.Show("是否确认修改该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  677. {
  678. return;
  679. }
  680. string getjgcode = ugr.Cells["CODE_JG"].Value.ToString();
  681. list.Add(getjgcode);
  682. jgDescList.Add(getjgcode);
  683. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.isExistJGDescUpdate", new Object[] { jgDescList }, this.ob);
  684. if (dt != null && dt.Rows.Count > 0)
  685. {
  686. MessageBox.Show("当前接箍描述所约束的接箍码已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  687. return;
  688. }
  689. ArrayList steelList = new ArrayList();
  690. string code = ultraComboEditor3.Value.ToString(); //钢级代码
  691. string desc = ultraComboEditor3.Text.Trim(); //钢级描述
  692. string repcode = txtRepSteelCode.Text.Trim(); //替代钢级代码集合
  693. string repdesc = ultraTextEditor6.Text.Trim(); //替代钢级名称集合
  694. string[] arrcode = repcode.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
  695. string[] arrdesc = repdesc.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
  696. for (int i = 0; i < arrcode.Length; i++)
  697. {
  698. ArrayList tempList = new ArrayList();
  699. tempList.Add(code);
  700. tempList.Add(desc);
  701. tempList.Add(arrcode[i]);
  702. tempList.Add(arrdesc[i]);
  703. tempList.Add(this.UserInfo.GetUserName());
  704. steelList.Add(tempList);
  705. }
  706. int count = ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.doUpdate", new Object[] { list, steelList, code, _choiceSpecs }, this.ob);
  707. MessageUtil.ShowTips("修改成功!");
  708. if (count > 0)
  709. {
  710. doQuery();
  711. //高亮显示修改的数据
  712. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  713. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  714. {
  715. row = ultraGrid1.Rows[i];
  716. if (row.Cells["CODE_JG"].Value.ToString().Equals(getjgcode))
  717. {
  718. row.Activate();
  719. break;
  720. }
  721. }
  722. }
  723. }
  724. }
  725. /// <summary>
  726. /// 删除或恢复
  727. /// </summary>
  728. /// <param name="flag">功能区分</param>
  729. private void DoDeleteOrResume(bool flag)
  730. {
  731. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  732. if (ugr == null)
  733. {
  734. MessageBox.Show("请选择需要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  735. return;
  736. }
  737. if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效" && flag == true)
  738. {
  739. MessageBox.Show("您选择的数据已经无效,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  740. return;
  741. }
  742. if (ugr.Cells["VALIDFLAG"].Value.ToString() == "有效" && flag == false)
  743. {
  744. MessageBox.Show("您选择的数据已经有效,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  745. return;
  746. }
  747. if (MessageBox.Show("是否确认" + (flag ? "作废" : "恢复") + "该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  748. {
  749. return;
  750. }
  751. string jgcode = ugr.Cells["CODE_JG"].Value.ToString();
  752. string deletename = this.UserInfo.GetUserName().Trim();
  753. int count = ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.doDelete", new Object[] { jgcode, deletename, flag }, this.ob);
  754. if (count > 0)
  755. {
  756. MessageUtil.ShowTips((flag ? "作废" : "恢复") + "成功!");
  757. doQuery();
  758. if (flag == false)
  759. {
  760. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  761. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  762. {
  763. row = ultraGrid1.Rows[i];
  764. if (row.Cells["CODE_JG"].Value.ToString().Equals(jgcode))
  765. {
  766. row.Activate();
  767. break;
  768. }
  769. }
  770. }
  771. }
  772. }
  773. /// <summary>
  774. /// check控件值改变事件
  775. /// </summary>
  776. /// <param name="sender"></param>
  777. /// <param name="e"></param>
  778. private void ultraCheckEditor1_CheckedValueChanged(object sender, EventArgs e)
  779. {
  780. if (this.ultraCheckEditor1.Checked)
  781. {
  782. this.ultraTextEditor1.ReadOnly = false;
  783. }
  784. else
  785. {
  786. this.ultraTextEditor1.ReadOnly = true;
  787. }
  788. }
  789. private void ultraCheckEditor2_CheckedChanged(object sender, EventArgs e)
  790. {
  791. if (this.ultraCheckEditor2.Checked)
  792. {
  793. this.ultraTextEditor3.ReadOnly = false;
  794. }
  795. else
  796. {
  797. this.ultraTextEditor3.ReadOnly = true;
  798. }
  799. }
  800. private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e)
  801. {
  802. if (this.ultraCheckEditor3.Checked)
  803. {
  804. this.ultraTextEditor4.ReadOnly = false;
  805. }
  806. else
  807. {
  808. this.ultraTextEditor4.ReadOnly = true;
  809. }
  810. }
  811. private void ultraCheckEditor4_CheckedChanged(object sender, EventArgs e)
  812. {
  813. if (this.ultraCheckEditor4.Checked)
  814. {
  815. this.ultraTextEditor5.ReadOnly = false;
  816. }
  817. else
  818. {
  819. this.ultraTextEditor5.ReadOnly = true;
  820. }
  821. }
  822. private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
  823. {
  824. if (this.ultraCheckEditor5.Checked)
  825. {
  826. this.ultraComboEditor10.ReadOnly = false;
  827. }
  828. else
  829. {
  830. this.ultraComboEditor10.ReadOnly = true;
  831. }
  832. }
  833. /// <summary>
  834. /// 行激活事件
  835. /// </summary>
  836. /// <param name="sender"></param>
  837. /// <param name="e"></param>
  838. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  839. {
  840. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  841. if (ugr == null)
  842. return;
  843. ultraTextEditor10.Text = ugr.Cells["SPEC_JG_DESC"].Value.ToString();
  844. ultraTextEditor10.Tag = ugr.Cells["SPEC_JG"].Value.ToString();
  845. this.ultraComboEditor2.Text = ugr.Cells["PRODUCCODE_JG_DESC"].Value.ToString();
  846. this.ultraComboEditor2.Value = ugr.Cells["PRODUCCODE_JG"].Value.ToString();
  847. this.ultraComboEditor3.Text = ugr.Cells["STEELCODE_JG_DESC"].Value.ToString();
  848. this.ultraComboEditor3.Value = ugr.Cells["STEELCODE_JG"].Value.ToString();
  849. this.ultraComboEditor4.Text = ugr.Cells["MODEL_DESC"].Value.ToString();
  850. this.ultraComboEditor4.Value = ugr.Cells["MODEL_CODE"].Value.ToString();
  851. this.ultraComboEditor5.Text = ugr.Cells["STYLE_JG"].Value.ToString();
  852. this.ultraTextEditor6.Text = ugr.Cells["REP_STEELNAME"].Value.ToString();
  853. this.ultraTextEditor6.Tag = ugr.Cells["REP_STEELCODE"].Value.ToString();
  854. this.ultraNumericEditor6.Text = ugr.Cells["MIN_D"].Value.ToString();
  855. this.ultraNumericEditor7.Text = ugr.Cells["MIN_H"].Value.ToString();
  856. this.ultraNumericEditor9.Text = ugr.Cells["DIAMETER_JG"].Value.ToString();
  857. this.ultraNumericEditor10.Text = ugr.Cells["HEIGHT_JG"].Value.ToString();
  858. textBox1.Text = ugr.GetValue("DIAMETER_SPEC");
  859. textBox2.Text = ugr.GetValue("DIAMETER_SPEC2");
  860. textBox3.Text = ugr.GetValue("LENGTH_SPEC");
  861. textBox4.Text = ugr.GetValue("LENGTH_SPEC2");
  862. this.ultraNumericEditor11.Text = ugr.Cells["LENGTH_JG"].Value.ToString();
  863. this.ultraNumericEditor5.Text = ugr.Cells["WEIGHT_JG"].Value.ToString();
  864. this.ultraNumericEditor8.Text = ugr.Cells["DIAMETER"].Value.ToString();
  865. this.ultraComboEditor11.Text = ugr.Cells["ALPHA"].Value.ToString();
  866. this.ultraNumericEditor1.Text = ugr.Cells["DIAMETER_PL"].Value.ToString();
  867. this.ultraNumericEditor2.Text = ugr.Cells["HEIGHT_PL"].Value.ToString();
  868. this.ultraNumericEditor3.Text = ugr.Cells["LENGTH_MIN"].Value.ToString();
  869. this.ultraNumericEditor4.Text = ugr.Cells["LENGTH_MAX"].Value.ToString();
  870. this.ultraTextEditor2.Text = ugr.Cells["MEMO"].Value.ToString();
  871. this.ultraComboEditor6.Value = ugr.Cells["PRODUCCODE"].Value.ToString();
  872. this.ultraComboEditor6.Text = ugr.Cells["PRODUCNAME"].Value.ToString();
  873. ultraTextEditor9.Tag = ugr.Cells["STD_CODE"].Value.ToString();
  874. ultraTextEditor9.Text = ugr.Cells["STD_NAME"].Value.ToString();
  875. this.ultraComboEditor8.Value = ugr.Cells["STD_STYLE"].Value.ToString();
  876. this.ultraNumericEditor14.Text = ugr.Cells["MIN_D_CP"].Value.ToString();
  877. this.ultraNumericEditor15.Text = ugr.Cells["MAX_D_CP"].Value.ToString();
  878. this.ultraNumericEditor12.Text = ugr.Cells["MIN_H_CP"].Value.ToString();
  879. this.ultraNumericEditor13.Text = ugr.Cells["MAX_H_CP"].Value.ToString();
  880. this.ultraNumericEditor16.Text = ugr.Cells["CHECK_J_VAL"].Value.ToString();
  881. ultraTextEditor7.Text = ugr.Cells["TAPER"].Value.ToString();
  882. ultraNumericEditor18.Text = ugr.Cells["MIN_D_JG"].Value.ToString();
  883. ultraNumericEditor17.Text = ugr.Cells["MAX_D_JG"].Value.ToString();
  884. ultraTextEditor8.Text = ugr.GetValue("SPEC_NAME");
  885. ultraTextEditor11.Text = ugr.GetValue("M_STD_NO");
  886. ultraTextEditor12.Text = ugr.GetValue("W_STD_NO");
  887. ultraTextEditor13.Text = ugr.GetValue("M_PRINT_NO");
  888. ultraTextEditor14.Text = ugr.GetValue("W_PRINT_NO");
  889. ultraTextEditor15.Text = ugr.GetValue("FILE_NAME");
  890. ultraTextEditor15.Tag = ugr.GetValue("FILE_PATH");
  891. _choiceSpecs.Clear();
  892. }
  893. private void ultraTextEditor6_EditorButtonClick(object sender, EditorButtonEventArgs e)
  894. {
  895. if (ultraComboEditor3.SelectedItem == null)
  896. {
  897. MessageBox.Show("请先选择钢级名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  898. return;
  899. }
  900. FrmRepSteel frms = new FrmRepSteel();
  901. frms.Ob1 = this.ob;
  902. frms.Code = this.ultraTextEditor6.Tag.ToString2();
  903. frms.ShowDialog();
  904. txtRepSteelCode.Text = frms.Code;
  905. ultraTextEditor6.Text = frms.Desc;
  906. }
  907. private void ultraComboEditor3_ValueChanged(object sender, EventArgs e)
  908. {
  909. if (ultraComboEditor3.Value == null) return;
  910. string code = ultraComboEditor3.Value.ToString();
  911. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.getDynamicSteel", new Object[] { code }, this.ob);
  912. if (dt != null && dt.Rows.Count > 0)
  913. {
  914. ultraTextEditor6.Text = dt.Rows[0][1].ToString();
  915. txtRepSteelCode.Text = dt.Rows[0][0].ToString();
  916. }
  917. }
  918. private void ultraNumericEditor7_ValueChanged(object sender, EventArgs e)
  919. {
  920. double w = 0;
  921. double n = 0;
  922. if (!IsDBNullOrNull(ultraNumericEditor6.Value))
  923. {
  924. w = Convert.ToDouble(ultraNumericEditor6.Value);
  925. }
  926. if (!IsDBNullOrNull(ultraNumericEditor7.Value))
  927. {
  928. n = Convert.ToDouble(ultraNumericEditor7.Value);
  929. }
  930. if (IsDBNullOrNull(ultraNumericEditor6.Value) && IsDBNullOrNull(ultraNumericEditor7.Value))
  931. {
  932. ultraNumericEditor15.Value = "";
  933. }
  934. else
  935. {
  936. ultraNumericEditor15.Value = w - 2 * n;
  937. }
  938. }
  939. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  940. {
  941. this.ultraGrid1.UpdateData();
  942. }
  943. /// <summary>
  944. /// 判断是DBNull或者Null
  945. /// </summary>
  946. /// <param name="value">要判断的值</param>
  947. /// <returns>是否</returns>
  948. private bool IsDBNullOrNull(object value)
  949. {
  950. if (Convert.IsDBNull(value) || value == null)
  951. return true;
  952. return false;
  953. }
  954. private void ultraNumericEditor6_ValueChanged(object sender, EventArgs e)
  955. {
  956. this.ultraNumericEditor14.Value = this.ultraNumericEditor6.Value;
  957. double w = 0;
  958. double n = 0;
  959. if (!IsDBNullOrNull(ultraNumericEditor6.Value))
  960. {
  961. w = Convert.ToDouble(ultraNumericEditor6.Value);
  962. }
  963. if (!IsDBNullOrNull(ultraNumericEditor7.Value))
  964. {
  965. n = Convert.ToDouble(ultraNumericEditor7.Value);
  966. }
  967. if (IsDBNullOrNull(ultraNumericEditor6.Value) && IsDBNullOrNull(ultraNumericEditor7.Value))
  968. {
  969. ultraNumericEditor15.Value = "";
  970. }
  971. else
  972. {
  973. ultraNumericEditor15.Value = w - 2 * n;
  974. }
  975. }
  976. private void ultraPanel2_Scroll(object sender, ScrollEventArgs e)
  977. {
  978. //this.Update();
  979. //this.SuspendLayout();
  980. }
  981. private void ultraTextEditor8_EditorButtonClick(object sender, EditorButtonEventArgs e)
  982. {
  983. string specs = "";
  984. if (_choiceSpecs.Count > 0)
  985. {
  986. foreach (string[] strs in _choiceSpecs)
  987. {
  988. specs += strs[0] + ";";
  989. }
  990. }
  991. else if (ultraGrid1.ActiveRow != null)
  992. {
  993. specs = ultraGrid1.GetActiveRowValue("SPEC_CODE");
  994. }
  995. PopupSpecificationsBasics popup = new PopupSpecificationsBasics(specs, ob);
  996. DialogResult result = popup.ShowDialog();
  997. if (result == DialogResult.OK)
  998. {
  999. ultraTextEditor8.Text = "";
  1000. foreach (string[] strs in popup.ChoiceSpecs)
  1001. {
  1002. ultraTextEditor8.Text += strs[1] + "; ";
  1003. }
  1004. _choiceSpecs = popup.ChoiceSpecs;
  1005. }
  1006. }
  1007. private void ultraTextEditor9_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1008. {
  1009. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.getStdName",
  1010. new object[] { }, ob);
  1011. dt.Columns["STD_NAME"].Caption = "标准名称";
  1012. dt.Columns["STDSTYLE"].Caption = "标准类型";
  1013. DataRow drBlank = dt.NewRow();
  1014. drBlank["STDSTYLE"] = "交付";
  1015. dt.Rows.InsertAt(drBlank, 0);
  1016. BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STD_NAME", "STD_CODE");
  1017. baseInfo.UltraGrid1.DisplayLayout.Bands[0].Columns["STDSTYLE"].Width = 20;
  1018. baseInfo.LabelTextBox1.Caption = "标准名称";
  1019. baseInfo.Shown += new EventHandler((c, d) =>
  1020. {
  1021. var row = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
  1022. a => a.GetValue("STD_CODE") == ultraTextEditor9.Tag.ToString2()).FirstOrDefault();
  1023. if (row != null)
  1024. {
  1025. row.Activate();
  1026. }
  1027. });
  1028. if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  1029. {
  1030. ultraTextEditor9.Text = baseInfo.ChoicedRow.GetValue("STD_NAME");
  1031. ultraTextEditor9.Tag = baseInfo.ChoicedRow.GetValue("STD_CODE");
  1032. }
  1033. }
  1034. private void ultraTextEditor10_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1035. {
  1036. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.GetJGSpec",
  1037. new object[] { }, ob);
  1038. dt.Columns["SPEC_NAME"].Caption = "规格描述";
  1039. dt.DefaultView.RowFilter = "SPEC_NAME NOT LIKE '%.%'";
  1040. BaseInfoPopup baseInfo = new BaseInfoPopup(dt.DefaultView.ToTable(), "SPEC_NAME", "SPEC_CODE");
  1041. baseInfo.LabelTextBox1.Caption = "规格描述";
  1042. baseInfo.Shown += new EventHandler((c, d) =>
  1043. {
  1044. var row = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
  1045. a => a.GetValue("SPEC_CODE") == ultraTextEditor10.Tag.ToString2()).FirstOrDefault();
  1046. if (row != null)
  1047. {
  1048. row.Activate();
  1049. }
  1050. });
  1051. if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  1052. {
  1053. ultraTextEditor10.Text = baseInfo.ChoicedRow.GetValue("SPEC_NAME");
  1054. ultraTextEditor10.Tag = baseInfo.ChoicedRow.GetValue("SPEC_CODE");
  1055. }
  1056. }
  1057. private void ultraGrid1_AfterRowCancelUpdate(object sender, RowEventArgs e)
  1058. {
  1059. }
  1060. private void ultraTextEditor15_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1061. {
  1062. //Qcm/Jg/接箍码/文件名
  1063. var row = ultraGrid1.ActiveRow;
  1064. if (row == null)
  1065. {
  1066. MessageUtil.ShowWarning("请选择一条记录!");
  1067. return;
  1068. }
  1069. string codejg = row.GetValue("CODE_JG");
  1070. string path = "Qcm/Jg/" + row.GetValue("CODE_JG") + "/";
  1071. if (e.Button.Key == "Show")
  1072. {
  1073. FormFileDown down = new FormFileDown(ob, path);
  1074. down.ShowDialog();
  1075. if (down.CtrlFileDown1.List.Count == 0)
  1076. {
  1077. UpdatePath(codejg, "", UserInfo.GetUserName());
  1078. ultraGrid1.ActiveRow.Cells["FILE_NAME"].Value = "";
  1079. ultraGrid1.ActiveRow.Cells["FILE_PATH"].Value = "";
  1080. }
  1081. }
  1082. else
  1083. {
  1084. var serverFileList = FileHelper.Download(path);
  1085. //if (serverFileList.Count > 0)
  1086. //{
  1087. // MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
  1088. // return;
  1089. //}
  1090. List<FileBean> list = new List<FileBean>();
  1091. FileBean bean = new FileBean();
  1092. OpenFileDialog file = new OpenFileDialog();
  1093. file.Multiselect = true;
  1094. file.Title = "选择需要上传的图片";
  1095. file.Filter = "图片文件(*.jpg);(*.gif);(*.png);(*.bmp)|*.jpg;*.gif;*.png;*.bmp";
  1096. DialogResult drStat;
  1097. drStat = file.ShowDialog();
  1098. if (drStat == DialogResult.OK)
  1099. {
  1100. foreach (string fileName in file.FileNames)
  1101. {
  1102. string name = System.IO.Path.GetFileName(fileName);
  1103. if (name.Contains(" "))
  1104. {
  1105. MessageUtil.ShowWarning("上传的图片名称不能包含空格!");
  1106. return;
  1107. }
  1108. if (name.Contains("°"))
  1109. {
  1110. MessageUtil.ShowWarning("上传的图片名称不能包含特殊符号【°】");
  1111. return;
  1112. }
  1113. bean = new FileBean();
  1114. bean.setFileName(name);
  1115. bean.setPathName(path);
  1116. bean.setFile(FileHelper.FileToArray(fileName));
  1117. list.Add(bean);
  1118. }
  1119. bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  1120. if (isSuccess)
  1121. {
  1122. string fileNames = "";
  1123. List<FileBean> fileBeans = FileHelper.Download(path);
  1124. foreach (var fileBean in fileBeans)
  1125. {
  1126. if (fileNames == "")
  1127. {
  1128. fileNames = path + fileBean.getFileName();
  1129. }
  1130. else
  1131. {
  1132. fileNames += "#" + path + fileBean.getFileName();
  1133. }
  1134. }
  1135. UpdatePath(row.GetValue("CODE_JG"), fileNames, UserInfo.GetUserName());
  1136. MessageUtil.ShowTips("上传成功!");
  1137. doQuery();
  1138. var redirectRow = ultraGrid1.Rows.Where(a => a.GetValue("CODE_JG") == codejg).FirstOrDefault();
  1139. if (redirectRow != null)
  1140. {
  1141. redirectRow.Activate();
  1142. }
  1143. }
  1144. else
  1145. {
  1146. MessageUtil.ShowTips("上传失败,请重试!");
  1147. }
  1148. }
  1149. }
  1150. }
  1151. private void UpdatePath(string codeJg, string path, string user)
  1152. {
  1153. ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.updateJgFile",
  1154. new object[] { codeJg, path, user }, ob);
  1155. }
  1156. private void ultraTextEditor16_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1157. {
  1158. //Qcm/Jg/接箍码/文件名
  1159. var row = ultraGrid1.ActiveRow;
  1160. string codejg = row.GetValue("CODE_JG");
  1161. string path = "Qcm/Jg/" + codejg + "/";
  1162. if (e.Button.Key == "Show")
  1163. {
  1164. FormFileDown down = new FormFileDown(ob, path);
  1165. down.ShowDialog();
  1166. if (down.CtrlFileDown1.List.Count == 0)
  1167. {
  1168. UpdatePath(codejg, "", UserInfo.GetUserName());
  1169. ultraGrid1.ActiveRow.Cells["FILE_NAME"].Value = "";
  1170. ultraGrid1.ActiveRow.Cells["FILE_PATH"].Value = "";
  1171. }
  1172. }
  1173. }
  1174. private void ultraTextEditor11_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1175. {
  1176. UltraTextEditor textEditor = (UltraTextEditor)sender;
  1177. PopupTextBox popupText = new PopupTextBox(textEditor.Text, 200);
  1178. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  1179. {
  1180. textEditor.Text = popupText.TextInfo.Trim();
  1181. }
  1182. }
  1183. private void ultraTextEditor12_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1184. {
  1185. ultraTextEditor11_EditorButtonClick(sender, e);
  1186. }
  1187. private void ultraTextEditor13_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1188. {
  1189. ultraTextEditor11_EditorButtonClick(sender, e);
  1190. }
  1191. private void ultraTextEditor14_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1192. {
  1193. ultraTextEditor11_EditorButtonClick(sender, e);
  1194. }
  1195. private void ultraCheckEditor6_CheckedChanged(object sender, EventArgs e)
  1196. {
  1197. ultraTextEditor17.ReadOnly = !ultraCheckEditor6.Checked;
  1198. }
  1199. }
  1200. }