frmPipeMoveIn.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Tool;
  11. using Core.Mes.Client.Comm.Control;
  12. using System.Collections;
  13. using Core.Mes.Client.Comm.Server;
  14. using Core.StlMes.Client.YdmPipeManage.Controls;
  15. using Infragistics.Win.UltraWinGrid;
  16. using Infragistics.Win;
  17. using Core.StlMes.Client.YdmPipeManage.Tool;
  18. namespace Core.StlMes.Client.YdmPipeManage
  19. {
  20. public partial class frmPipeMoveIn : FrmBase
  21. {
  22. private string strOutbound = "800703";//入库类型编码
  23. private string strOutname = "";//入库类型名称
  24. private string strInMemo = "";//入库简码
  25. private int isSelect = 0;//新增
  26. private int isDelete = 0;//废除
  27. public frmPipeMoveIn()
  28. {
  29. InitializeComponent();
  30. }
  31. private void frmPipeMoveIn_Load(object sender, EventArgs e)
  32. {
  33. this.txtOutList.Enabled = false;
  34. RegStartTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00");
  35. //DateTime.Today;// ;
  36. RegEndTime.Value = DateTime.Parse(DateTime.Today.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd") + " 23:59:59");// DateTime.Parse(DateTime.Now.ToString("yyyy年MM月dd日") + " 23:59:59");
  37. ProEndTime.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy年MM月dd日") + " 23:59:59");
  38. //ClsBaseInfo.SetComboItemHeight(cmbProvin);//车号
  39. if (CustomInfo != "A")
  40. {
  41. BaseMethod.InitStorage(cmbWareEdi, CustomInfo, this.ValidDataPurviewIds, this.ob);
  42. BaseMethod.InitStorage(cmbWarehous, CustomInfo, this.ValidDataPurviewIds, this.ob);
  43. }else
  44. {
  45. BaseMethod.InitStorage(cmbWareEdi,this.ValidDataPurviewIds, this.ob);
  46. BaseMethod.InitStorage(cmbWarehous,this.ValidDataPurviewIds, this.ob);
  47. }
  48. }
  49. /// <summary>
  50. /// 重写基类方法
  51. /// </summary>
  52. /// <param name="sender"></param>
  53. /// <param name="ToolbarKey"></param>
  54. public override void ToolBar_Click(object sender, string ToolbarKey)
  55. {
  56. switch (ToolbarKey)
  57. {
  58. case "Query":
  59. doQuery();
  60. break;
  61. case "Add":
  62. doAdd();
  63. break;
  64. case "Delete":
  65. doDelete();
  66. break;
  67. case "Refresh":
  68. doRefresh();
  69. break;
  70. case "Export":
  71. if (ultraTabControl1.SelectedTab.Key.Equals("Out"))
  72. {
  73. GridHelper.ulGridToExcel(ultraGrid1, "倒库实绩表");
  74. }
  75. else
  76. {
  77. GridHelper.ulGridToExcel(ultraGrid2, "收料入库实绩表");
  78. }
  79. break;
  80. case "Close":
  81. this.Close();
  82. break;
  83. }
  84. }
  85. /// <summary>
  86. /// 绑定原料位号下拉框
  87. /// </summary>
  88. private void Init()
  89. {
  90. //绑定料位号
  91. string strStorage = "";
  92. if (cmbWarehous.SelectedIndex != -1)
  93. {
  94. strStorage = cmbWarehous.Value.ToString();
  95. }
  96. ArrayList pram = new ArrayList();
  97. pram.Add(strStorage);
  98. PipeManageClass.BindLocationInfo(pram, cmbMaterial, ob);
  99. }
  100. /// <summary>
  101. /// 绑定目标料位号下拉框
  102. /// </summary>
  103. private void InitM()
  104. {
  105. //绑定料位号
  106. string strStorage = "";
  107. if (cmbWareEdi.Value == null)
  108. {
  109. return;
  110. }
  111. else
  112. {
  113. strStorage = cmbWareEdi.Value.ToString();
  114. }
  115. ArrayList pram = new ArrayList();
  116. pram.Add(strStorage);
  117. PipeManageClass.BindLocationInfo(pram, cmbMaterialEdi, ob);
  118. }
  119. /// <summary>
  120. /// 查询
  121. /// </summary>
  122. private void doQuery()
  123. {
  124. if (!CheckQuery()) return;
  125. string strRegStart = "1999-01-01 00:00:00";
  126. string strRegEnd = "2100-01-01 00:00:00";
  127. string strProStart = "";
  128. string strProEnd = "";
  129. string strWare = "";//仓库号
  130. string strMat = "";//料位号
  131. string strFurnace = "";
  132. string strBatch = "";
  133. string moveInDoc = "";
  134. string userId = UserInfo.GetDeptid();//科室
  135. string userMent = BaseMethod.GetDepartIdBySectionId(UserInfo.GetDeptid(), ob);//部门
  136. if (chkWarehous.Checked)
  137. {
  138. strWare = cmbWarehous.Value.ToString();
  139. }
  140. if (chkMaterial.Checked)
  141. {
  142. strMat = cmbMaterial.Value.ToString();
  143. }
  144. if (chkRegTime.Checked)
  145. {
  146. strRegStart = RegStartTime.Value.ToString();
  147. strRegEnd = RegEndTime.Value.ToString();
  148. }
  149. if (chkProTime.Checked)
  150. {
  151. strProStart = ProStartTime.Value.ToString();
  152. strProEnd = ProEndTime.Value.ToString();
  153. }
  154. if (chkFurnace.Checked)
  155. {
  156. strFurnace = txtFurnace.Text.Trim();
  157. }
  158. if (chkBatch.Checked)
  159. {
  160. strBatch = txtBatch.Text.Trim();
  161. }
  162. if (chkDk.Checked)
  163. {
  164. moveInDoc = txtOutList.Text.Trim();
  165. }
  166. ArrayList pram = new ArrayList();
  167. pram.Add(strWare);
  168. pram.Add(strMat);
  169. pram.Add(strFurnace);
  170. pram.Add(strRegStart);
  171. pram.Add(strRegEnd);
  172. pram.Add(moveInDoc);
  173. string[] storges = null;
  174. if (CustomInfo != "A")
  175. {
  176. storges = BaseMethod.WarehousePermissions(CustomInfo, this.ValidDataPurviewIds, this.ob);
  177. if (storges == null) return;
  178. if (ultraTabControl1.SelectedTab.Key.Equals("Out"))
  179. {
  180. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryOutPerfo", new object[] { pram, storges }, ob);
  181. GridHelper.CopyDataToDatatable(dt, this.dataMove, true);
  182. UltraGridBand ugb = this.ultraGrid1.DisplayLayout.Bands[0];
  183. UltraGridColumn[] col = new UltraGridColumn[] { ugb.Columns["STD_NAME"], ugb.Columns["MODEL_DESC"], ugb.Columns["PLINE_NAME"] };
  184. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
  185. this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  186. }
  187. else
  188. {
  189. DataTable dtIn = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryInListInfo", new object[] { pram, storges, strOutbound }, ob);
  190. GridHelper.CopyDataToDatatable(dtIn, this.dataIn, true);
  191. UltraGridBand ugb = this.ultraGrid2.DisplayLayout.Bands[0];
  192. UltraGridColumn[] col = new UltraGridColumn[] { ugb.Columns["STD_NAME"], ugb.Columns["MODEL_DESC"], ugb.Columns["PLINE_NAME"] };
  193. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col);
  194. this.ultraGrid2.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  195. }
  196. }
  197. else
  198. {
  199. storges = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob);
  200. if (storges == null) return;
  201. if (ultraTabControl1.SelectedTab.Key.Equals("Out"))
  202. {
  203. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryOutPerfo1", new object[] { pram, storges,"0" }, ob);
  204. GridHelper.CopyDataToDatatable(dt, this.dataMove, true);
  205. UltraGridBand ugb = this.ultraGrid1.DisplayLayout.Bands[0];
  206. UltraGridColumn[] col = new UltraGridColumn[] { ugb.Columns["STD_NAME"], ugb.Columns["MODEL_DESC"], ugb.Columns["PLINE_NAME"] };
  207. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
  208. this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  209. }
  210. else
  211. {
  212. DataTable dtIn = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryInListInfo1", new object[] { pram, storges, strOutbound,"0" }, ob);
  213. GridHelper.CopyDataToDatatable(dtIn, this.dataIn, true);
  214. UltraGridBand ugb = this.ultraGrid2.DisplayLayout.Bands[0];
  215. UltraGridColumn[] col = new UltraGridColumn[] { ugb.Columns["STD_NAME"], ugb.Columns["MODEL_DESC"], ugb.Columns["PLINE_NAME"] };
  216. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col);
  217. this.ultraGrid2.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
  218. }
  219. }
  220. }
  221. /// <summary>
  222. /// 新增倒库入库
  223. /// </summary>
  224. private void doAdd()
  225. {
  226. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  227. if (ugr == null) return;
  228. //if(cmbWareEdi.SelectedIndex==-1)
  229. //{
  230. // MessageUtil.ShowTips("目标仓库号不能为空,请选择!");
  231. // return;
  232. //}
  233. DataTable dt = PipeManageClass.getComTypeInfo(strOutbound, ob);
  234. if (dt.Rows.Count <= 0)
  235. {
  236. MessageUtil.ShowTips("入库类型不能为空,请确认基础信息是否有对应的入库类型信息!");
  237. return;
  238. }
  239. else
  240. {
  241. strOutname = dt.Rows[0]["BASENAME"].ToString();
  242. strInMemo = dt.Rows[0]["MEMO"].ToString();
  243. }
  244. int n = 0;
  245. // string strCar = cmbProvin.Text.ToString() + txtCar.Text.Trim();
  246. ArrayList list = new ArrayList();
  247. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  248. {
  249. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  250. {
  251. n += 1;
  252. ArrayList addList = new ArrayList();
  253. addList.Add(uRow.Cells["ACT_COUNT"].Text.Trim());
  254. addList.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
  255. addList.Add(uRow.Cells["BATCH_NO"].Text.Trim());
  256. addList.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
  257. addList.Add(uRow.Cells["OUTSTOCK_DOC"].Text.Trim());
  258. addList.Add(this.UserInfo.GetUserOrder());//班次
  259. addList.Add(this.UserInfo.GetUserGroup());//班组
  260. addList.Add(this.UserInfo.GetUserName());
  261. addList.Add(strOutbound);
  262. addList.Add(strOutname);
  263. addList.Add(cmbWareEdi.Value.ToString());
  264. addList.Add(cmbMaterialEdi.Text.ToString());
  265. addList.Add(uRow.Cells["VEHICLE_NO"].Text.Trim());
  266. list.Add(addList);
  267. }
  268. }
  269. if (n ==0)
  270. {
  271. MessageUtil.ShowTips("请选择需要收料入库的数据!");
  272. return;
  273. }
  274. if (MessageUtil.ShowYesNoAndQuestion("是否确认收料入库?") == DialogResult.No) return;
  275. CoreClientParam ccp = new CoreClientParam();
  276. try
  277. {
  278. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  279. if (Constant.WaitingForm == null)
  280. {
  281. Constant.WaitingForm = new WaitingForm();
  282. }
  283. Constant.WaitingForm.ShowToUser = true;
  284. Constant.WaitingForm.Show();
  285. Constant.WaitingForm.Update();
  286. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeMoveIn";
  287. ccp.MethodName = "addInList";
  288. ccp.ServerParams = new object[] { list, strInMemo };
  289. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  290. this.Cursor = Cursors.Default;
  291. Constant.WaitingForm.ShowToUser = false;
  292. Constant.WaitingForm.Close();
  293. Constant.WaitingForm = null;
  294. }
  295. catch (Exception e)
  296. {
  297. this.Cursor = Cursors.Default;
  298. Constant.WaitingForm.ShowToUser = false;
  299. Constant.WaitingForm.Close();
  300. Constant.WaitingForm = null;
  301. }
  302. if (ccp.ReturnCode != -1)
  303. {
  304. MessageUtil.ShowTips(ccp.ReturnInfo);
  305. if (ccp.ReturnInfo.Equals("收料入库成功!"))
  306. {
  307. doQuery();
  308. }
  309. }
  310. }
  311. /// <summary>
  312. /// 入库作废
  313. /// </summary>
  314. private void doDelete()
  315. {
  316. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  317. int count = 0;
  318. if (ugr == null) return;
  319. ArrayList list = new ArrayList();
  320. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  321. {
  322. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  323. {
  324. count += 1;
  325. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryOutCount", new object[] { uRow.Cells["JUDGE_STOVE_NO"].Text.Trim(), uRow.Cells["BATCH_NO"].Text.Trim(), uRow.Cells["BATCH_GROUD_NO"].Text.Trim() }, ob);
  326. if (dt.Rows.Count <= 0)
  327. {
  328. MessageUtil.ShowTips("该炉已不在库,不能作废!");
  329. return;
  330. }
  331. else
  332. {
  333. for (int i = 0; i < dt.Rows.Count; i++)
  334. {
  335. if (dt.Rows[0]["MAT_STATUS"].ToString().Equals("80150302"))
  336. {
  337. MessageUtil.ShowTips("该炉已编提单,不能作废!");
  338. return;
  339. }
  340. }
  341. //if (dt.Rows[0]["act_count"].ToString() == "")
  342. //{
  343. // MessageUtil.ShowTips("该入库单号支数与出库支数不匹配,不能作废!");
  344. // return;
  345. }
  346. ArrayList pram = new ArrayList();
  347. pram.Add(uRow.Cells["INSTOCK_DOC"].Text.Trim());
  348. pram.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
  349. pram.Add(uRow.Cells["BATCH_NO"].Text.Trim());
  350. pram.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
  351. pram.Add(uRow.Cells["act_count"].Text.Trim());
  352. pram.Add(this.UserInfo.GetUserName());
  353. list.Add(pram);
  354. }
  355. } if (count == 0)
  356. {
  357. MessageUtil.ShowTips("请选择您要撤销的记录!");
  358. return;
  359. }
  360. if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销?") == DialogResult.No) return;
  361. CoreClientParam ccp = new CoreClientParam();
  362. try
  363. {
  364. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  365. if (Constant.WaitingForm == null)
  366. {
  367. Constant.WaitingForm = new WaitingForm();
  368. }
  369. Constant.WaitingForm.ShowToUser = true;
  370. Constant.WaitingForm.Show();
  371. Constant.WaitingForm.Update();
  372. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeMoveIn";
  373. ccp.MethodName = "upDateInfo";
  374. ccp.ServerParams = new object[] { list, strOutbound };
  375. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  376. this.Cursor = Cursors.Default;
  377. Constant.WaitingForm.ShowToUser = false;
  378. Constant.WaitingForm.Close();
  379. Constant.WaitingForm = null;
  380. }
  381. catch (Exception e)
  382. {
  383. this.Cursor = Cursors.Default;
  384. Constant.WaitingForm.ShowToUser = false;
  385. Constant.WaitingForm.Close();
  386. Constant.WaitingForm = null;
  387. }
  388. if (ccp.ReturnCode != -1)
  389. {
  390. MessageUtil.ShowTips(ccp.ReturnInfo);
  391. if (ccp.ReturnInfo.Equals("撤销收料成功!"))
  392. {
  393. doQuery();
  394. }
  395. }
  396. }
  397. /// <summary>
  398. /// 刷新
  399. /// </summary>
  400. private void doRefresh()
  401. {
  402. cmbWarehous.SelectedIndex = -1;
  403. //cmbWareEdi.SelectedIndex = -1;
  404. //BaseMethod.InitStorage(cmbWareEdi, CustomInfo, this.ValidDataPurviewIds, this.ob);
  405. BaseMethod.InitStorage(cmbWarehous, CustomInfo, this.ValidDataPurviewIds, this.ob);
  406. //Init();
  407. //InitM();
  408. }
  409. ///查询时验证必填项
  410. private bool CheckQuery()
  411. {
  412. if (DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0)
  413. {
  414. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  415. return false;
  416. }
  417. if (DataTimeUtil.JudgeTime(DateTime.Parse(ProStartTime.Value.ToString()), DateTime.Parse(ProEndTime.Value.ToString())) == 0)
  418. {
  419. MessageUtil.ShowTips("生产开始时间不能大于结束时间!");
  420. return false;
  421. }
  422. if (chkWarehous.Checked && string.IsNullOrEmpty(cmbWarehous.Text.Trim()))
  423. {
  424. MessageBox.Show("请选择仓库号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  425. return false;
  426. }
  427. if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterial.Text.Trim()))
  428. {
  429. MessageBox.Show("请选择料位号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  430. return false;
  431. }
  432. if (chkFurnace.Checked && string.IsNullOrEmpty(txtFurnace.Text.Trim()))
  433. {
  434. MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  435. return false;
  436. }
  437. if (chkBatch.Checked && string.IsNullOrEmpty(txtBatch.Text.Trim()))
  438. {
  439. MessageBox.Show("请输入批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  440. return false;
  441. }
  442. if (chkDk.Checked && string.IsNullOrEmpty(txtOutList.Text.Trim()))
  443. {
  444. MessageBox.Show("请输入单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  445. return false;
  446. }
  447. return true;
  448. }
  449. /// <summary>
  450. /// 验证Checked是否勾选,显示控件可编辑 打勾表示可编辑,不打勾表示不可编辑
  451. /// </summary>
  452. /// <param name="sender"></param>
  453. /// <param name="e"></param>
  454. private void chk_CheckedChanged(object sender, EventArgs e)
  455. {
  456. if (chkWarehous.Checked) { cmbWarehous.Enabled = true; } else { cmbWarehous.Enabled = false; }
  457. if (chkMaterial.Checked) { cmbMaterial.Enabled = true; } else { cmbMaterial.Enabled = false; }
  458. if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false;}
  459. if (chkBatch.Checked) { txtBatch.Enabled = true; } else { txtBatch.Enabled = false; }
  460. if (chkRegTime.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; }
  461. if (chkProTime.Checked) { ProStartTime.Enabled = true; ProEndTime.Enabled = true; } else { ProStartTime.Enabled = false; ProEndTime.Enabled = false; }
  462. }
  463. /// <summary>
  464. /// 根据原仓库号改变绑定原料位号
  465. /// </summary>
  466. /// <param name="sender"></param>
  467. /// <param name="e"></param>
  468. private void cmbWarehous_TextChanged(object sender, EventArgs e)
  469. {
  470. Init();
  471. }
  472. /// <summary>
  473. /// 根据目标仓库号改变绑定目标料位号
  474. /// </summary>
  475. /// <param name="sender"></param>
  476. /// <param name="e"></param>
  477. private void cmbWareEdi_TextChanged(object sender, EventArgs e)
  478. {
  479. InitM();
  480. }
  481. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  482. {
  483. if (toolMenu == null) return;
  484. if (ultraTabControl1.SelectedTab.Key.Equals("Out"))
  485. {
  486. this.chkRegTime.Text = "倒库时间";
  487. chkDk.Text = "倒库单号";
  488. toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.False;
  489. toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True;
  490. //chkMaterial.Visible = false;
  491. //cmbMaterial.Visible = false;
  492. //chkWarehous.Visible = false;
  493. //cmbWarehous.Visible = false;
  494. //chkDk.Visible = true;
  495. //txtOutList.Visible = true;
  496. }
  497. else
  498. {
  499. this.chkRegTime.Text = "收料时间";
  500. chkDk.Text = "入库单号";
  501. toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.True;
  502. toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False;
  503. //chkMaterial.Visible = true;
  504. //cmbMaterial.Visible = true;
  505. //chkWarehous.Visible = true;
  506. //cmbWarehous.Visible = true;
  507. //chkDk.Visible = false;
  508. //txtOutList.Visible = false;
  509. }
  510. }
  511. private void txtOutList_KeyUp(object sender, KeyEventArgs e)
  512. {
  513. ArrayList list = new ArrayList();
  514. switch (e.KeyCode)
  515. {
  516. case Keys.Enter:
  517. if (txtOutList.Text.Trim() != "")
  518. {
  519. if (!PipeManageClass.IsOnlyLetterAndDigit(txtOutList.Text))
  520. { return; }
  521. string[] strflg = txtOutList.Text.Trim().ToString().Split(new char[] { '/' });
  522. for (int i = 0; i < strflg.Length; i++)
  523. {
  524. list.Add(strflg[i]);
  525. }
  526. }
  527. else
  528. {
  529. list.Add("");
  530. }
  531. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryOutListSend", new object[] { list }, ob);
  532. GridHelper.CopyDataToDatatable(dt, this.dataMove, true);
  533. GridHelper.RefreshAndAutoSize(ultraGrid1);
  534. break;
  535. }
  536. }
  537. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  538. {
  539. ultraGrid1.UpdateData();
  540. if (e.Cell.Column.Key.Equals("CHOOSE"))
  541. {
  542. txtOutList.Text = "";
  543. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
  544. {
  545. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Value))
  546. {
  547. // txtOutList.Text += uRow.Cells["OUTSTOCK_DOC"].Text.Trim() + "/";
  548. }
  549. }
  550. //if (txtOutList.Text.Trim() == "") return;
  551. //txtOutList.Text = txtOutList.Text.Substring(0, txtOutList.Text.Length - 1);
  552. if (Convert.ToBoolean(e.Cell.Value))
  553. {
  554. isSelect += 1;
  555. }
  556. else
  557. isSelect -= 1;
  558. }
  559. }
  560. private void txtOutList_KeyPress(object sender, KeyPressEventArgs e)
  561. {
  562. if (!PipeManageClass.IsOnlyLetterAndDigit(txtOutList.Text)&&e.KeyChar!=(char)13&&e.KeyChar!=(char)8)
  563. {
  564. e.Handled = true;
  565. MessageUtil.ShowTips("只能输入数字、字母和/!");
  566. txtOutList.Focus();//让文本框获取焦点
  567. txtOutList.Select(txtOutList.TextLength, 0);//设置光标的位置到文本尾
  568. txtOutList.ScrollToCaret();//滚动到控件光标处
  569. }
  570. else { e.Handled = false; }
  571. }
  572. private void ultraGrid2_CellChange(object sender, CellEventArgs e)
  573. {
  574. if (e.Cell.Column.Key.Equals("CHOOSE"))
  575. {
  576. if (Convert.ToBoolean(e.Cell.Text) == true)
  577. {
  578. isDelete += 1;
  579. }
  580. else
  581. isDelete -= 1;
  582. }
  583. }
  584. private void frmPipeMoveIn_Shown(object sender, EventArgs e)
  585. {
  586. toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.False;
  587. }
  588. private void txtFurnace_KeyDown(object sender, KeyEventArgs e)
  589. {
  590. if (e.KeyValue == 13)
  591. {
  592. doQuery();
  593. }
  594. }
  595. private void chkDk_CheckedChanged(object sender, EventArgs e)
  596. {
  597. txtOutList.Enabled = chkDk.Checked;
  598. }
  599. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  600. {
  601. foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
  602. {
  603. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  604. {
  605. uRow.Cells["CHOOSE"].Value = true;
  606. }
  607. }
  608. }
  609. private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  610. {
  611. foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
  612. {
  613. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  614. {
  615. uRow.Cells["CHOOSE"].Value = true;
  616. }
  617. }
  618. }
  619. }
  620. }