frmOrderLenPln.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  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 System.Collections;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.PlnSaleOrd.Entity;
  16. namespace Core.StlMes.Client.PlnSaleOrd
  17. {
  18. public partial class frmOrderLenPln : FrmBase
  19. {
  20. private string lenNo; //长度编码
  21. private string lengthdiscN; //长度编码
  22. private SlmOrderLenEntity orderEntity = new SlmOrderLenEntity();
  23. public SlmOrderLenEntity OrderEntity
  24. {
  25. get { return orderEntity; }
  26. set { orderEntity = value; }
  27. }
  28. public string LengthdiscN
  29. {
  30. get { return lengthdiscN; }
  31. set { lengthdiscN = value; }
  32. }
  33. private string lenNo1; //合同长度编码
  34. private string lenNoN;//推荐长度编码
  35. public frmOrderLenPln(OpeBase ob, string _lenNo, string _LenNoN)
  36. {
  37. InitializeComponent();
  38. lenNo1 = _lenNo;
  39. lenNoN = _LenNoN;
  40. this.ob = ob;
  41. }
  42. public string LenNo
  43. {
  44. get { return lenNo; }
  45. set { lenNo = value; }
  46. }
  47. private void frmOrderLen_Load(object sender, EventArgs e)
  48. {
  49. doQuery();
  50. //DataTable unLoad = new DataTable();
  51. //unLoad.Columns.Add("Name", typeof(System.String));
  52. //unLoad.Rows.Add("/");
  53. //unLoad.Rows.Add("短尺随炉");
  54. //cmbShrtStove.DataSource = unLoad;
  55. ClsBaseInfo.SetComboItemHeight(cmbShrtStove);
  56. }
  57. /// <summary>
  58. /// 查询功能
  59. /// </summary>
  60. private void doQuery()
  61. {
  62. string len = "";
  63. if (lenNoN.Equals(""))
  64. {
  65. len = lenNo1;
  66. }
  67. else
  68. {
  69. len = lenNoN;
  70. }
  71. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order.CoreOrderLenPln.doQuery", new object[] { len }, this.ob);
  72. if (dt.Rows.Count > 0)
  73. {
  74. cmbLenUnit.Value = dt.Rows[0]["LEN_UNIT"].ToString();
  75. txtLenMin.Value = dt.Rows[0]["LEN_MIN"].ToString();
  76. txtLenMax.Value = dt.Rows[0]["LEN_MAX"].ToString();
  77. txtShrtLenRato.Value = dt.Rows[0]["SHRT_LEN_RATO"].ToString();
  78. txtShortest.Value = dt.Rows[0]["SHORTEST"].ToString();
  79. cmbShrtStove.Text = dt.Rows[0]["SHRT_STOVE"].ToString();
  80. txtLongLenRato.Value = dt.Rows[0]["LONG_LEN_RATO"].ToString();
  81. txtLongest.Value = dt.Rows[0]["LONGEST"].ToString();
  82. txtSiglLen.Value = dt.Rows[0]["SIGL_LEN"].ToString();
  83. txtAvgLenMin.Value = dt.Rows[0]["AVG_LEN_MIN"].ToString();
  84. txtDifrncLenMax.Value = dt.Rows[0]["ENDLEN_SPECSTD"].ToString();
  85. ultraNumericEditor1.Value = dt.Rows[0]["DIFRNC_LEN_MAX"].ToString();
  86. }
  87. }
  88. /// <summary>
  89. /// Toolbar方法。
  90. /// </summary>
  91. /// <param name="sender"></param>
  92. /// <param name="e"></param>
  93. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  94. {
  95. if ("doAdd".Equals(e.Tool.Key))
  96. {
  97. if (e.Tool.Index == -1)
  98. {
  99. return;
  100. }
  101. //提交
  102. doAdd();
  103. }
  104. else
  105. {
  106. this.Close();
  107. }
  108. }
  109. /// <summary>
  110. /// 确认,返回当前选中行给主界面,同时该长度使用次数+1
  111. /// </summary>
  112. public void doUpdate(string lenNo3, string lenDesc)
  113. {
  114. //使用次数与创建时间更新。
  115. ArrayList parm = new ArrayList();
  116. parm.Add(lenNo3);
  117. CoreClientParam ccp = new CoreClientParam();
  118. ccp.ServerName = "com.steering.pss.plnsaleord.order.CoreOrderLenPln";
  119. ccp.MethodName = "doUpdate";
  120. ccp.ServerParams = new object[] { parm };
  121. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  122. if (ccp.ReturnCode == -1) return;
  123. lenNo = lenNo3;
  124. lengthdiscN = lenDesc;
  125. this.DialogResult = DialogResult.OK;
  126. this.Close();
  127. return;
  128. }
  129. /// <summary>
  130. /// 验证非空字段。
  131. /// </summary>
  132. /// <returns></returns>
  133. private bool ValidInput()
  134. {
  135. if (cmbLenUnit.Value == null || cmbLenUnit.Value == System.DBNull.Value)
  136. {
  137. this.cmbLenUnit.Focus();
  138. this.cmbLenUnit.SelectAll();
  139. MessageBox.Show("请选择长度单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  140. return false;
  141. }
  142. if (txtLenMin.Value == null || txtLenMin.Value == System.DBNull.Value)
  143. {
  144. MessageBox.Show("长度下限不允许为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  145. this.txtLenMin.Focus();
  146. this.txtLenMin.SelectAll();
  147. return false;
  148. }
  149. if (txtLenMax.Value == null || txtLenMax.Value == System.DBNull.Value)
  150. {
  151. MessageBox.Show("长度上限不允许为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  152. this.txtLenMax.Focus();
  153. this.txtLenMax.SelectAll();
  154. return false;
  155. }
  156. if (Convert.ToDouble(txtLenMin.Text) > Convert.ToDouble(txtLenMax.Text))
  157. {
  158. this.txtLenMin.Focus();
  159. this.txtLenMin.SelectAll();
  160. MessageBox.Show("长度下限不能大于长度上限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  161. return false;
  162. }
  163. return true;
  164. }
  165. /// <summary>
  166. /// 提交
  167. /// </summary>
  168. public void doAdd()
  169. {
  170. DataRow dRow = dataTable1.NewRow();
  171. //长度下限、上限、单位为必填值;
  172. if (ValidInput())
  173. {
  174. //长度单位
  175. string lenUnit = cmbLenUnit.Value.ToString();
  176. //长度下限
  177. string lenMin = txtLenMin.Value.ToString();
  178. //长度上限
  179. string lenMax = txtLenMax.Value.ToString();
  180. //长度描述
  181. string lenDesc = lenMin + "-" + lenMax + lenUnit;
  182. //短尺率
  183. string shrtLenRato = "";
  184. if (txtShrtLenRato.Value != System.DBNull.Value && txtShrtLenRato.Value != null && Convert.ToDouble(txtShrtLenRato.Value) != 0)
  185. {
  186. shrtLenRato = txtShrtLenRato.Value.ToString();
  187. if (!string.IsNullOrEmpty(shrtLenRato))
  188. {
  189. lenDesc += ",短尺率" + txtShrtLenRato.Value.ToString() + "%";
  190. }
  191. if (txtShortest.Text.Trim() == "")
  192. {
  193. MessageUtil.ShowWarning("短尺率存在,请输入短尺最短!");
  194. return;
  195. }
  196. }
  197. //短尺最短
  198. string shortest = "";
  199. if (txtShortest.Value != System.DBNull.Value && txtShortest.Value != null && Convert.ToDouble(txtShortest.Value) != 0)
  200. {
  201. shortest = txtShortest.Value.ToString();
  202. if (!string.IsNullOrEmpty(shortest))
  203. {
  204. lenDesc += ",短尺最短" + txtShortest.Value.ToString() + lenUnit;
  205. }
  206. if (txtShrtLenRato.Text.Trim() == "")
  207. {
  208. MessageUtil.ShowWarning("短尺最短存在,请输入短尺率!");
  209. return;
  210. }
  211. if (Convert.ToDouble(shortest) > Convert.ToDouble(txtLenMin.Text))
  212. {
  213. MessageUtil.ShowWarning("短尺最短不能超过长度下限");
  214. return;
  215. }
  216. }
  217. //短尺随炉
  218. string shrtStove = "";
  219. if (cmbShrtStove.Value != null)
  220. {
  221. shrtStove = cmbShrtStove.Value.ToString().Trim();
  222. if (!string.IsNullOrEmpty(shrtStove))
  223. {
  224. if (shrtStove.Equals("短尺随炉"))
  225. {
  226. if ((txtShrtLenRato.Value != System.DBNull.Value && txtShrtLenRato.Value != null && Convert.ToDouble(txtShrtLenRato.Value) != 0) ||
  227. (ultraNumericEditor1.Value != System.DBNull.Value && ultraNumericEditor1.Value != null && Convert.ToDouble(ultraNumericEditor1.Value) != 0) ||
  228. (txtSiglLen.Value != System.DBNull.Value && txtSiglLen.Value != null && Convert.ToDouble(txtSiglLen.Value) != 0) ||
  229. (txtShortest.Value != System.DBNull.Value && txtShortest.Value != null && Convert.ToDouble(txtShortest.Value) != 0) ||
  230. (txtDifrncLenMax.Value != System.DBNull.Value && txtDifrncLenMax.Value != null && Convert.ToDouble(txtDifrncLenMax.Value) != 0) ||
  231. (txtLongLenRato.Value != System.DBNull.Value && txtLongLenRato.Value != null && Convert.ToDouble(txtLongLenRato.Value) != 0) ||
  232. (txtLongest.Value != System.DBNull.Value && txtLongest.Value != null && Convert.ToDouble(txtLongest.Value) != 0) ||
  233. (txtAvgLenMin.Value != System.DBNull.Value && txtAvgLenMin.Value != null && Convert.ToDouble(txtAvgLenMin.Value) != 0)
  234. )
  235. {
  236. MessageUtil.ShowWarning("您选择了'短尺随炉',除长度上下限数值外一律不能录入(短尺随炉具有排他性)!");
  237. txtShrtLenRato.Focus();
  238. txtShrtLenRato.SelectAll();
  239. return;
  240. }
  241. }
  242. lenDesc += "," + cmbShrtStove.Value.ToString();
  243. }
  244. }
  245. //长尺率
  246. string longLenRato = "";
  247. if (txtLongLenRato.Value != System.DBNull.Value && txtLongLenRato.Value != null && Convert.ToDouble(txtLongLenRato.Value) != 0)
  248. {
  249. longLenRato = txtLongLenRato.Value.ToString();
  250. if (!string.IsNullOrEmpty(longLenRato))
  251. {
  252. lenDesc += ",长尺率" + txtLongLenRato.Value.ToString() + "%";
  253. }
  254. if (txtLongest.Text.Trim() == "")
  255. {
  256. MessageUtil.ShowWarning("长尺率存在,请输入长尺最长!");
  257. return;
  258. }
  259. }
  260. //长尺最长
  261. string longest = "";
  262. if (txtLongest.Value != System.DBNull.Value && txtLongest.Value != null && Convert.ToDouble(txtLongest.Value) != 0)
  263. {
  264. longest = txtLongest.Value.ToString();
  265. if (!string.IsNullOrEmpty(longest))
  266. {
  267. lenDesc += ",长尺最长" + txtLongest.Value.ToString() + lenUnit;
  268. }
  269. if (txtLongLenRato.Text.Trim() == "")
  270. {
  271. MessageUtil.ShowWarning("长尺最长存在,请输入长尺率!");
  272. return;
  273. }
  274. if (Convert.ToDouble(longest) < Convert.ToDouble(txtLenMax.Text))
  275. {
  276. MessageUtil.ShowWarning("长尺最长不能小于长度上限");
  277. return;
  278. }
  279. }
  280. //质保书燕建鹏要求长短尺率都必须录
  281. //if (txtShrtLenRato.Value != System.DBNull.Value && txtShrtLenRato.Value != null && Convert.ToDouble(txtShrtLenRato.Value) != 0
  282. // && txtLongLenRato.Value != System.DBNull.Value && txtLongLenRato.Value != null && Convert.ToDouble(txtLongLenRato.Value) != 0
  283. // )
  284. //{
  285. // MessageUtil.ShowWarning("短尺率与长尺率不能同时存在!");
  286. // this.txtShrtLenRato.Focus();
  287. // this.txtShrtLenRato.SelectAll();
  288. // return;
  289. //}
  290. //单倍尺长
  291. string siglLen = "";
  292. if (txtSiglLen.Value != System.DBNull.Value && txtSiglLen.Value != null && Convert.ToDouble(txtSiglLen.Value) != 0)
  293. {
  294. siglLen = txtSiglLen.Value.ToString();
  295. if (txtDifrncLenMax.Value == null || txtDifrncLenMax.Value == System.DBNull.Value) //成品公差
  296. {
  297. MessageBox.Show("请输入成品公差!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  298. return;
  299. }
  300. //if (!StringUtil.IsInt(siglLen))
  301. //{
  302. // MessageUtil.ShowWarning("单倍尺长必须是整数!");
  303. // return;
  304. //}
  305. //一般判断整数的正则表示无法判断 11.0 11.0000这样的字符
  306. System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^[1-9]\d*[.]{0,1}[0]*$");
  307. if (!string.IsNullOrEmpty(siglLen))
  308. {
  309. //长度下限
  310. if (!txtLenMin.Text.Equals(""))
  311. {
  312. string remain = (Convert.ToDecimal(txtLenMin.Text) / Convert.ToDecimal(siglLen)).ToString();
  313. if (!reg.IsMatch(remain))
  314. {
  315. MessageBox.Show("长度要求中,长度下限/单倍尺长必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  316. return;
  317. }
  318. }
  319. if (!txtLenMax.Text.Equals(""))
  320. {
  321. string remain = ((Convert.ToDecimal(txtLenMax.Text) - Convert.ToDecimal(txtDifrncLenMax.Text)) / Convert.ToDecimal(siglLen)).ToString();
  322. if (!reg.IsMatch(remain))
  323. {
  324. MessageUtil.ShowWarning("(长度上限-成品公差)应该是单倍尺长的整数倍!");
  325. return;
  326. }
  327. }
  328. //(长度上限-成品公差-下限值)>0
  329. lenDesc += ",单倍尺长" + txtSiglLen.Value.ToString() + lenUnit;
  330. }
  331. }
  332. //平均长度大于
  333. string avgLenMin = "";
  334. if (txtAvgLenMin.Value != System.DBNull.Value && txtAvgLenMin.Value != null && Convert.ToDouble(txtAvgLenMin.Value) != 0)
  335. {
  336. avgLenMin = txtAvgLenMin.Value.ToString();
  337. if (!string.IsNullOrEmpty(avgLenMin))
  338. {
  339. double a = 0;
  340. double b = 0;
  341. if (txtLenMin.Text.Equals(""))
  342. {
  343. a = 0;
  344. }
  345. else
  346. {
  347. a = Convert.ToDouble(txtLenMin.Text);
  348. }
  349. if (txtLenMax.Text.Equals(""))
  350. {
  351. b = 0;
  352. }
  353. else
  354. {
  355. b = Convert.ToDouble(txtLenMax.Text);
  356. }
  357. double c = Convert.ToDouble(txtAvgLenMin.Value.ToString());
  358. if (c < a || c > b)
  359. {
  360. MessageUtil.ShowWarning("'平均长度大于'应该在长度下限和长度上限之间!");
  361. txtAvgLenMin.Focus();
  362. return;
  363. }
  364. lenDesc += ",平均长度大于" + txtAvgLenMin.Value.ToString() + lenUnit;
  365. }
  366. }
  367. //成品公差
  368. string difrncLenMax = "";
  369. if (txtDifrncLenMax.Value != System.DBNull.Value && txtDifrncLenMax.Value != null && Convert.ToDouble(txtDifrncLenMax.Value) != 0)
  370. {
  371. difrncLenMax = txtDifrncLenMax.Value.ToString();
  372. if (!string.IsNullOrEmpty(difrncLenMax))
  373. {
  374. lenDesc += ",成品公差" + txtDifrncLenMax.Value.ToString() + lenUnit;
  375. }
  376. }
  377. //最长最短差小于
  378. string maxmin = "";
  379. if (ultraNumericEditor1.Value != System.DBNull.Value && ultraNumericEditor1.Value != null && Convert.ToDouble(ultraNumericEditor1.Value) != 0)
  380. {
  381. maxmin = ultraNumericEditor1.Value.ToString();
  382. if (!string.IsNullOrEmpty(maxmin))
  383. {
  384. lenDesc += ",最长最短差小于" + maxmin + lenUnit;
  385. }
  386. }
  387. if (!lenNoN.Equals(""))
  388. {
  389. //OrderEntity.LenNo = autoLenNo;
  390. //OrderEntity.LenDesc = lenDesc;
  391. //OrderEntity.LenTyp = "自选";
  392. //OrderEntity.LenMin = int.Parse(lenMin);
  393. //OrderEntity.LenMax = int.Parse(lenMax);
  394. //OrderEntity.LenUnit = lenUnit;
  395. //OrderEntity.Longest = int.Parse(longest);
  396. //OrderEntity.LongLenRato = int.Parse(longLenRato);
  397. //OrderEntity.Shortest = int.Parse(shortest);
  398. //OrderEntity.ShrtLenRato = int.Parse(shrtLenRato);
  399. //OrderEntity.ShrtStove = shrtStove;
  400. //OrderEntity.SiglLen = int.Parse(siglLen);
  401. //OrderEntity.AvgLenMin = int.Parse(avgLenMin);
  402. //OrderEntity.EndlenSpecstd = int.Parse(difrncLenMax);
  403. //OrderEntity.DifrncLenMax = int.Parse(maxmin);
  404. //OrderEntity.CreateName = UserInfo.GetUserName();
  405. //OrderEntity.UseTime = "1";
  406. //将该行记录插入数据库。
  407. ArrayList parm = new ArrayList();
  408. //长度描述
  409. parm.Add(lenDesc);
  410. //长度分类
  411. parm.Add("轧管推荐");
  412. //长度单位
  413. parm.Add(lenUnit);
  414. //长度下限
  415. parm.Add(lenMin);
  416. //长度上限
  417. parm.Add(lenMax);
  418. //短尺率
  419. parm.Add(shrtLenRato);
  420. //短尺最短
  421. parm.Add(shortest);
  422. //长尺率
  423. parm.Add(longLenRato);
  424. //长尺最长
  425. parm.Add(longest);
  426. //短尺随炉
  427. parm.Add(shrtStove);
  428. //平均长度大于
  429. parm.Add(avgLenMin);
  430. //最长最短差小于
  431. parm.Add(maxmin);
  432. //单倍尺长
  433. parm.Add(siglLen);
  434. //成品公差
  435. parm.Add(difrncLenMax);
  436. //创建人
  437. parm.Add(UserInfo.GetUserName());
  438. //长度编号
  439. parm.Add(lenNoN);
  440. CoreClientParam ccp = new CoreClientParam();
  441. ccp.ServerName = "com.steering.pss.plnsaleord.order.CoreOrderLenPln";
  442. ccp.MethodName = "doupdateLen";
  443. ccp.ServerParams = new object[] { parm };
  444. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  445. if (ccp.ReturnCode == -1) return;
  446. lenNo = lenNoN;
  447. lengthdiscN = lenDesc;
  448. this.DialogResult = DialogResult.OK;
  449. this.Close();
  450. }
  451. else
  452. {
  453. //获取长度描述所对应的编号。
  454. //string lenNo2 = isRepeat(lenDesc);
  455. //if (!string.IsNullOrEmpty(lenNo2))
  456. //{
  457. // //不为空,存在则执行确认操作。
  458. // //不为空,创建时间与使用次数更新,返回该行记录给主界面。
  459. // if (lenNo1 != lenNo2)
  460. // {
  461. // //if (MessageUtil.ShowYesNoCancelAndQuestion("该长度描述已存在,是否启用?") == DialogResult.No)
  462. // //{
  463. // // return;
  464. // //}
  465. // //长度描述相同时修改
  466. // doUpdate(lenNo2, lenDesc);
  467. // }
  468. // this.Close();
  469. //}
  470. //else
  471. //{
  472. string autoLenNo = GetLenNo();
  473. //将该行记录插入数据库。
  474. ArrayList parm = new ArrayList();
  475. //长度编号
  476. parm.Add(autoLenNo);
  477. //长度描述
  478. parm.Add(lenDesc);
  479. //长度分类
  480. parm.Add("轧管推荐");
  481. //长度单位
  482. parm.Add(lenUnit);
  483. //长度下限
  484. parm.Add(lenMin);
  485. //长度上限
  486. parm.Add(lenMax);
  487. //短尺率
  488. parm.Add(shrtLenRato);
  489. //短尺最短
  490. parm.Add(shortest);
  491. //短尺随炉
  492. parm.Add(shrtStove);
  493. //长尺率
  494. parm.Add(longLenRato);
  495. //长尺最长
  496. parm.Add(longest);
  497. //单倍尺长
  498. parm.Add(siglLen);
  499. //平均长度大于
  500. parm.Add(avgLenMin);
  501. //成品公差
  502. parm.Add(difrncLenMax);
  503. //最长最短差小于
  504. parm.Add(maxmin);
  505. //创建人
  506. parm.Add(UserInfo.GetUserName());
  507. //创建时间
  508. //使用次数
  509. parm.Add(1);
  510. CoreClientParam ccp = new CoreClientParam();
  511. ccp.ServerName = "com.steering.pss.plnsaleord.order.CoreOrderLenPln";
  512. ccp.MethodName = "doAdd";
  513. ccp.ServerParams = new object[] { parm };
  514. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  515. if (ccp.ReturnCode == -1) return;
  516. lenNo = autoLenNo;
  517. lengthdiscN = lenDesc;
  518. this.DialogResult = DialogResult.OK;
  519. this.Close();
  520. return;
  521. }
  522. //}
  523. }
  524. }
  525. /// <summary>
  526. /// 自动生成编号。
  527. /// </summary>
  528. /// <returns></returns>
  529. private string GetLenNo()
  530. {
  531. //获取最大编号加一L0000010,L+7位流水号,不足7位,补0
  532. DataTable dt = new DataTable();
  533. dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order.CoreOrderLenPln.GetLenNo", null, this.ob);
  534. string lenNoNew = "";
  535. if (dt.Rows.Count > 0)
  536. {
  537. lenNoNew = dt.Rows[0][0].ToString();
  538. }
  539. while (lenNoNew.Length < 7)
  540. {
  541. lenNoNew = "0" + lenNoNew;
  542. }
  543. return "L" + lenNoNew;
  544. }
  545. /// <summary>
  546. /// 判断长度描述是否已存在
  547. /// </summary>
  548. /// <param name="lenDesc"></param>
  549. /// <returns></returns>
  550. private string isRepeat(string lenDesc)
  551. {
  552. //获取已存在长度描述信息对应的编号。
  553. DataTable dt = new DataTable();
  554. dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order.CoreOrderLenPln.isRepeat", new Object[] { lenDesc }, this.ob);
  555. if (dt.Rows.Count > 0)
  556. {
  557. return dt.Rows[0][0].ToString();
  558. }
  559. else
  560. {
  561. return "";
  562. }
  563. }
  564. private void ultraButton1_Click(object sender, EventArgs e)
  565. {
  566. txtSiglLen.Text = "";
  567. txtDifrncLenMax.Text = "";
  568. txtShrtLenRato.Text = "";
  569. txtLongLenRato.Text = "";
  570. txtLenMin.Text = "";
  571. txtShortest.Text = "";
  572. txtLongest.Text = "";
  573. txtLenMax.Text = "";
  574. cmbShrtStove.SelectedIndex = -1;
  575. txtAvgLenMin.Text = "";
  576. ultraNumericEditor1.Text = "";
  577. this.txtLenMin.Focus();
  578. }
  579. private void txtShrtLenRato_ValueChanged(object sender, EventArgs e)
  580. {
  581. if (txtShrtLenRato.Text.Trim() == "")
  582. {
  583. txtShortest.Text = "";
  584. }
  585. }
  586. private void txtLongLenRato_ValueChanged(object sender, EventArgs e)
  587. {
  588. if (txtLongLenRato.Text.Trim() == "")
  589. {
  590. txtLongest.Text = "";
  591. }
  592. }
  593. private void txtSiglLen_KeyDown(object sender, KeyEventArgs e)//单倍尺长
  594. {
  595. if (e.KeyCode != Keys.Enter) return;
  596. this.txtShrtLenRato.Focus();
  597. }
  598. private void txtDifrncLenMax_KeyDown(object sender, KeyEventArgs e)//成品公差
  599. {
  600. if (e.KeyCode != Keys.Enter) return;
  601. this.txtLongLenRato.Focus();
  602. this.txtLongLenRato.SelectAll();
  603. }
  604. private void txtLenMin_KeyDown(object sender, KeyEventArgs e)//长度下限
  605. {
  606. if (e.KeyCode != Keys.Enter) return;
  607. this.txtLenMax.Focus();
  608. }
  609. private void txtShrtLenRato_KeyDown(object sender, KeyEventArgs e)//短尺率
  610. {
  611. if (e.KeyCode != Keys.Enter) return;
  612. this.txtShortest.Focus();
  613. }
  614. private void txtLongLenRato_KeyDown(object sender, KeyEventArgs e)//长尺率
  615. {
  616. if (e.KeyCode != Keys.Enter) return;
  617. this.txtLongest.Focus();
  618. }
  619. private void txtLenMax_KeyDown(object sender, KeyEventArgs e)//长度上限
  620. {
  621. if (e.KeyCode != Keys.Enter) return;
  622. this.ultraNumericEditor1.Focus();
  623. }
  624. private void txtShortest_KeyDown(object sender, KeyEventArgs e)//短尺最短
  625. {
  626. if (e.KeyCode != Keys.Enter) return;
  627. this.cmbShrtStove.Focus();
  628. }
  629. private void txtLongest_KeyDown(object sender, KeyEventArgs e)//长尺最长
  630. {
  631. if (e.KeyCode != Keys.Enter) return;
  632. this.txtAvgLenMin.Focus();
  633. }
  634. private void ultraNumericEditor1_KeyDown(object sender, KeyEventArgs e)//最大最长差小于
  635. {
  636. if (e.KeyCode != Keys.Enter) return;
  637. this.txtSiglLen.Focus();
  638. }
  639. private void cmbShrtStove_KeyDown(object sender, KeyEventArgs e)
  640. {
  641. if (e.KeyCode != Keys.Enter) return;
  642. this.txtDifrncLenMax.Focus();
  643. }
  644. private void txtAvgLenMin_KeyDown(object sender, KeyEventArgs e)//平均长度大于
  645. {
  646. if (e.KeyCode != Keys.Enter) return;
  647. this.doAdd();
  648. }
  649. private void cmbShrtStove_TextChanged(object sender, EventArgs e)
  650. {
  651. //if (cmbShrtStove.Text.Equals("短尺随炉"))
  652. //{
  653. // if ((txtShrtLenRato.Value != System.DBNull.Value && txtShrtLenRato.Value != null && Convert.ToDouble(txtShrtLenRato.Value) != 0) ||
  654. // (ultraNumericEditor1.Value != System.DBNull.Value && ultraNumericEditor1.Value != null && Convert.ToDouble(ultraNumericEditor1.Value) != 0) ||
  655. // (txtSiglLen.Value != System.DBNull.Value && txtSiglLen.Value != null && Convert.ToDouble(txtSiglLen.Value) != 0) ||
  656. // (txtShortest.Value != System.DBNull.Value && txtShortest.Value != null && Convert.ToDouble(txtShortest.Value) != 0) ||
  657. // (txtDifrncLenMax.Value != System.DBNull.Value && txtDifrncLenMax.Value != null && Convert.ToDouble(txtDifrncLenMax.Value) != 0) ||
  658. // (txtLongLenRato.Value != System.DBNull.Value && txtLongLenRato.Value != null && Convert.ToDouble(txtLongLenRato.Value) != 0) ||
  659. // (txtLongest.Value != System.DBNull.Value && txtLongest.Value != null && Convert.ToDouble(txtLongest.Value) != 0) ||
  660. // (txtAvgLenMin.Value != System.DBNull.Value && txtAvgLenMin.Value != null && Convert.ToDouble(txtAvgLenMin.Value) != 0)
  661. // )
  662. // {
  663. // MessageUtil.ShowWarning("您选择了'短尺随炉',除长度上下限数值外一律不能录入(短尺随炉具有排他性)!");
  664. // txtShrtLenRato.Focus();
  665. // txtShrtLenRato.SelectAll();
  666. // return;
  667. // }
  668. //}
  669. }
  670. }
  671. }