FrmCollarInBound.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. using com.steering.mes.mcp.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Mcp.CollarMaterial;
  6. using Core.StlMes.Client.Mcp.Common;
  7. using Core.StlMes.Client.Mcp.Control;
  8. using Core.StlMes.Client.Mcp.Entity;
  9. using CoreFS.CA06;
  10. using Infragistics.Win;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System;
  13. using System.Collections;
  14. using System.Collections.Generic;
  15. using System.ComponentModel;
  16. using System.Data;
  17. using System.Drawing;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading;
  21. using System.Windows.Forms;
  22. namespace Core.StlMes.Client.Mcp.CollarLibrary
  23. {
  24. public partial class FrmCollarInBound : FrmBase
  25. {
  26. private string strOutbound = "800703";//入库类型编码
  27. private string strOutname = "";//入库类型名称
  28. private TalentICTGXControl.TalentICTGXClass icClass;
  29. public FrmCollarInBound()
  30. {
  31. this.IsLoadUserView = true;
  32. InitializeComponent();
  33. try
  34. {
  35. string[] portnames = System.IO.Ports.SerialPort.GetPortNames(); //获取计算机串口数组
  36. if (portnames is Infragistics.Win.UltraWinGrid.Nullable || portnames.Length < 1)
  37. {
  38. portnames = new string[10] { "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "COM10" };
  39. }
  40. txtCom.DataSource = portnames;
  41. }
  42. catch (Exception eex3)
  43. {
  44. MessageBox.Show(eex3.Message);
  45. }
  46. }
  47. private void FrmCollarInBound_Load(object sender, EventArgs e)
  48. {
  49. StorInfo();
  50. getStoreAll();
  51. RegStartTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00");
  52. RegEndTime.Value = DateTime.Parse(DateTime.Today.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd") + " 23:59:59");
  53. EntityHelper.ShowGridCaption<CouplingMatDealEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  54. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getKepNo", null, this.ob);
  55. cmbMaterial.DataSource = dt;
  56. cmbMaterial.DisplayMember = "KEP_NO";
  57. PipeManageClass.SetComboItemHeight(cmbMaterial);
  58. PipeManageClass.setUltraGridColumnInput(ultraGrid2, new string[] { "DealNum" });//支数
  59. PipeManageClass.setUltraGridColumnMaxInput(ultraGrid2, new string[] { "DealWt" });//重量
  60. }
  61. /// <summary>
  62. /// 重写基类方法
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="ToolbarKey"></param>
  66. public override void ToolBar_Click(object sender, string ToolbarKey)
  67. {
  68. switch (ToolbarKey)
  69. {
  70. case "Query":
  71. doQuery();
  72. break;
  73. case "Add":
  74. doAdd();
  75. break;
  76. case "Delete":
  77. doDelete();
  78. break;
  79. //case "Refresh":
  80. // doRefresh();
  81. // break;
  82. case "Export":
  83. GridHelper.ulGridToExcel(ultraGrid2, "交易实绩表");
  84. break;
  85. case "ReadCard":
  86. readData();
  87. break;
  88. case "Close":
  89. this.Close();
  90. break;
  91. case "clearCard":
  92. clearCard();
  93. break;
  94. }
  95. }
  96. void icClass_OnFindCard()
  97. {
  98. icClass.OnFindCard -= new TalentICTGXControl.ITalentICTGXEvents_OnFindCardEventHandler(icClass_OnFindCard);
  99. icClass.OnDropCard += new TalentICTGXControl.ITalentICTGXEvents_OnDropCardEventHandler(icClass_OnDropCard);
  100. }
  101. void icClass_OnDropCard()
  102. {
  103. //将OnDropCard事件从委托链中删除,并加入OnFindCard事件到委托链中。
  104. //这样就实现了程序中自动寻卡的功能。
  105. icClass.OnDropCard -= new TalentICTGXControl.ITalentICTGXEvents_OnDropCardEventHandler(icClass_OnDropCard);
  106. icClass.OnFindCard += new TalentICTGXControl.ITalentICTGXEvents_OnFindCardEventHandler(icClass_OnFindCard);
  107. }
  108. /// <summary>
  109. /// 读卡
  110. /// </summary>
  111. private void readData()
  112. {
  113. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  114. try
  115. {
  116. string outdoc = "";
  117. if (!ConnectCard(wf))
  118. {
  119. disConnect();
  120. wf.Close();
  121. return;
  122. }
  123. icClass.PrepareReadTemp();
  124. //bool b = icClass.DoReadTemp(1, 39);
  125. if (icClass.DoReadTemp(1, 39))
  126. {
  127. int count = icClass.RecordCount;
  128. if (count == 0) //判断卡上的记录数
  129. {
  130. wf.Close();
  131. MessageUtil.ShowTips("IC卡无记录,请核实!");
  132. disConnect();
  133. return;
  134. }
  135. else
  136. {
  137. outdoc = icClass.taskid.ToString2();
  138. }
  139. //disConnect();
  140. }
  141. else
  142. {
  143. wf.Close();
  144. MessageUtil.ShowTips("读取IC卡出现错误!");
  145. disConnect();
  146. return;
  147. }
  148. doQueryOutList(outdoc);
  149. }
  150. catch (Exception e)
  151. {
  152. MessageUtil.ShowTips(e.Message);
  153. }
  154. finally
  155. {
  156. disConnect();
  157. wf.Close();
  158. }
  159. }
  160. ///<summary>
  161. /// 关闭连接
  162. /// </summary>
  163. /// <returns></returns>
  164. private bool disConnect()
  165. {
  166. try
  167. {
  168. if (icClass.Active)
  169. {
  170. icClass.AlarmBeep(1);
  171. //设置Active属性为false,则断开与读卡器的连接。
  172. icClass.ToFindCard = false;
  173. icClass.Active = false;
  174. return true;
  175. }
  176. else
  177. {
  178. return true;
  179. }
  180. }
  181. catch (Exception e)
  182. {
  183. return true;
  184. }
  185. }
  186. /// <summary>
  187. /// 连接读卡器
  188. /// </summary>
  189. /// <returns></returns>
  190. private bool ConnectCard(WaitingForm2 wf)
  191. {
  192. try
  193. {
  194. //if (icClass == null)
  195. //{
  196. // icClass = new TalentICTGXControl.TalentICTGXClass();
  197. // //委托OnFindCard事件,icClass_OnFindCard是该事件要执行的方法。
  198. // //此事件在当IC卡放到读卡器上时触发。
  199. // icClass.OnFindCard += new TalentICTGXControl.ITalentICTGXEvents_OnFindCardEventHandler(icClass_OnFindCard);
  200. //}
  201. icClass = IcReadWrite.getIcClass();
  202. int comNum = (short)(short.Parse(txtCom.Text.Replace("COM", "")) - 1);
  203. icClass.CommPort = comNum;
  204. if (!icClass.Active)
  205. {
  206. //利用ToFindCard属性连接读卡器,启动OnFindCard事件。
  207. icClass.ToFindCard = true;
  208. if (icClass.Active)
  209. {
  210. //AlarmBeep(int times)方法实现了让IC卡读卡器发出警示音,
  211. //参数为发出几次警示音。
  212. icClass.AlarmBeep(2);
  213. Thread.Sleep(500);
  214. return true;
  215. }
  216. else
  217. {
  218. wf.Close();
  219. MessageUtil.ShowTips("读卡器连接失败!或请切换端口尝试!");
  220. return false;
  221. }
  222. }
  223. }
  224. catch (Exception e)
  225. {
  226. wf.Close();
  227. MessageUtil.ShowTips("读卡器连接失败!或请切换端口尝试!");
  228. return false;
  229. }
  230. finally
  231. {
  232. wf.Close();
  233. }
  234. return true;
  235. }
  236. /// <summary>
  237. /// 清卡
  238. /// </summary>
  239. private void clearCard()
  240. {
  241. string dealOrde = "";
  242. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  243. try
  244. {
  245. if (ConnectCard(wf) == false)
  246. {
  247. return;
  248. }
  249. else
  250. {
  251. icClass.PrepareReadTemp();
  252. if (icClass.DoReadTemp(1, 39))
  253. {
  254. dealOrde = icClass.taskid.ToString2();
  255. if (dealOrde != "")
  256. {
  257. //DataTable ds = ServerHelper.GetData("com.steering.ydm.bc.FrmFilpOutStorage.doQueryCount", new object[] { outDoc }, ob);
  258. DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.CollarLibrary.FrmCollarInBound.doQueryCount", new object[] { dealOrde }, ob);
  259. if (int.Parse(ds.Rows[0][0].ToString2()) > 0)
  260. {
  261. MessageUtil.ShowTips("此卡有未接收倒运记录,不允许清卡!");
  262. return;
  263. }
  264. }
  265. }
  266. else
  267. {
  268. wf.Close();
  269. MessageUtil.ShowTips("读取IC卡出现错误,请联系相关部门!");
  270. }
  271. }
  272. icClass.ClearCard();
  273. icClass.AlarmBeep(1);
  274. }
  275. catch
  276. {
  277. }
  278. finally
  279. {
  280. disConnect();
  281. wf.Close();
  282. }
  283. }
  284. public void doQueryOutList(string dealOrde)
  285. {
  286. List<CouplingMatDealEntity> listSource = EntityHelper.GetData<CouplingMatDealEntity>
  287. ("com.steering.mes.mcp.CollarLibrary.FrmCollarInBound.queryOutPerfo", new object[] { dealOrde }, this.ob);
  288. couplingMatDealEntityBindingSource.DataSource = listSource;
  289. }
  290. private void doQuery()
  291. {
  292. string strRegStart = "";
  293. string strRegEnd = "";
  294. string strWare = "";//仓库号
  295. string strMat = "";//框号
  296. string strFurnace = "";
  297. if (!CheckQuery()) return;
  298. ArrayList pram = new ArrayList();
  299. if (chkWarehous.Checked)
  300. {
  301. strWare = cmbWarehous.Value.ToString();
  302. }
  303. if (chkMaterial.Checked)
  304. {
  305. strMat = cmbMaterial.Value.ToString();
  306. }
  307. if (chkRegTime.Checked)
  308. {
  309. strRegStart = RegStartTime.Value.ToString();
  310. strRegEnd = RegEndTime.Value.ToString();
  311. }
  312. if (chkFurnace.Checked)
  313. {
  314. strFurnace = txtFurnace.Text.Trim();
  315. }
  316. pram.Clear();
  317. pram.Add(strWare);
  318. pram.Add(strMat);
  319. pram.Add(strFurnace);
  320. pram.Add(strRegStart);
  321. pram.Add(strRegStart);
  322. pram.Add(strRegStart);
  323. pram.Add(strRegEnd);
  324. pram.Add(strRegEnd);
  325. string[] str = this.ValidDataPurviewIds;
  326. //获取用户对应科室ID
  327. string User = this.UserInfo.GetDeptid();
  328. string StorageType = "";//根据传递的参数获取仓库类别
  329. string StorageAttr = "";////根据传递的参数获取仓库类型
  330. if (CustomInfo != "")
  331. {
  332. string[] strflg = CustomInfo.ToString().Split(new char[] { ',' });
  333. StorageType = strflg[0];
  334. StorageAttr = strflg[1];
  335. }
  336. string[] arr = null;
  337. DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getStoreNo", new object[] { StorageType, StorageAttr, str }, this.ob);
  338. if (ds.Rows.Count > 0)
  339. {
  340. arr = new string[ds.Rows.Count];
  341. for (int i = 0; i < ds.Rows.Count; i++)
  342. {
  343. arr[i] = ds.Rows[i][0].ToString();
  344. }
  345. }
  346. if (arr == null)
  347. {
  348. MessageUtil.ShowTips("无仓库权限!");
  349. return;
  350. }
  351. if (arr.Length < 1)
  352. {
  353. return;
  354. }
  355. if (ChkOut.Checked)
  356. {
  357. List<CouplingMatDealEntity> listSource = EntityHelper.GetData<CouplingMatDealEntity>
  358. ("com.steering.mes.mcp.CollarLibrary.FrmCollarInBound.queryOutPerfo", new object[] { pram, arr }, this.ob);
  359. couplingMatDealEntityBindingSource.DataSource = listSource;
  360. //GridHelper.RefreshAndAutoSize(ultraGrid2);
  361. }
  362. else
  363. {
  364. List<CouplingMatDealEntity> listSource = EntityHelper.GetData<CouplingMatDealEntity>
  365. ("com.steering.mes.mcp.CollarLibrary.FrmCollarInBound.queryInPerfo", new object[] { pram, arr }, this.ob);
  366. couplingMatDealEntityBindingSource.DataSource = listSource;
  367. //GridHelper.RefreshAndAutoSize(ultraGrid2);
  368. }
  369. }
  370. /// <summary>
  371. /// 获取仓库
  372. /// </summary>
  373. private void StorInfo()
  374. {
  375. string[] str = this.ValidDataPurviewIds;
  376. ArrayList arList = new ArrayList();
  377. //获取用户对应科室ID
  378. string User = this.UserInfo.GetDeptid();
  379. string StorageType = "";//根据传递的参数获取仓库类别
  380. string StorageAttr = "";////根据传递的参数获取仓库类型
  381. if (CustomInfo != "")
  382. {
  383. string[] strflg = CustomInfo.ToString().Split(new char[] { ',' });
  384. StorageType = strflg[0];
  385. StorageAttr = strflg[1];
  386. }
  387. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getStoreNo", new object[] { StorageType, StorageAttr, str }, this.ob);
  388. mbStorage.DataSource = dt;
  389. mbStorage.DisplayMember = "STORAGE_NAME";
  390. mbStorage.ValueMember = "STORAGE_NO";
  391. PipeManageClass.SetComboItemHeight(mbStorage);
  392. cmbWarehous.DataSource = dt;
  393. cmbWarehous.DisplayMember = "STORAGE_NAME";
  394. cmbWarehous.ValueMember = "STORAGE_NO";
  395. PipeManageClass.SetComboItemHeight(cmbWarehous);
  396. }
  397. /// <summary>
  398. /// 获取所有的目标库
  399. /// </summary>
  400. private void getStoreAll()
  401. {
  402. string StorageType = "";//根据传递的参数获取仓库类别
  403. string StorageAttr = "";////根据传递的参数获取仓库类型
  404. //if (CustomInfo != "")
  405. //{
  406. // string[] strflg = CustomInfo.ToString().Split(new char[] { ',' });
  407. // StorageType = strflg[0];
  408. // StorageAttr = strflg[1];
  409. //}
  410. string[] arr = McpBaseHelper.WarehousePermissions(this.CustomInfo, this.ValidDataPurviewIds, this.ob);
  411. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getStoreAll", new object[] { "800206", arr }, this.ob);
  412. //cmbWarehous.DataSource = dt;
  413. //cmbWarehous.DisplayMember = "STORAGE_NAME";
  414. //cmbWarehous.ValueMember = "STORAGE_NO";
  415. //PipeManageClass.SetComboItemHeight(cmbWarehous);
  416. CKstorage.DataSource = dt;
  417. CKstorage.DisplayMember = "STORAGE_NAME";
  418. CKstorage.ValueMember = "STORAGE_NO";
  419. PipeManageClass.SetComboItemHeight(CKstorage);
  420. }
  421. ///查询时验证必填项
  422. private bool CheckQuery()
  423. {
  424. if (DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0)
  425. {
  426. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  427. return false;
  428. }
  429. if (chkWarehous.Checked && string.IsNullOrEmpty(cmbWarehous.Text.Trim()))
  430. {
  431. MessageBox.Show("请选择仓库号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  432. return false;
  433. }
  434. //if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterial.Text.Trim()))
  435. //{
  436. // MessageBox.Show("请选择料位号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  437. // return false;
  438. //}
  439. if (chkFurnace.Checked && string.IsNullOrEmpty(txtFurnace.Text.Trim()))
  440. {
  441. MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  442. return false;
  443. }
  444. return true;
  445. }
  446. /// <summary>
  447. /// 验证Checked是否勾选,显示控件可编辑 打勾表示可编辑,不打勾表示不可编辑
  448. /// </summary>
  449. /// <param name="sender"></param>
  450. /// <param name="e"></param>
  451. private void chk_CheckedChanged(object sender, EventArgs e)
  452. {
  453. if (chkWarehous.Checked) { cmbWarehous.Enabled = true; } else { cmbWarehous.Enabled = false; }
  454. if (chkMaterial.Checked) { cmbMaterial.Enabled = true; } else { cmbMaterial.Enabled = false; }
  455. if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; }
  456. if (chkRegTime.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; }
  457. }
  458. private void FrmCollarInBound_Shown(object sender, EventArgs e)
  459. {
  460. toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.False;
  461. }
  462. /// <summary>
  463. /// 回车键查询
  464. /// </summary>
  465. /// <param name="sender"></param>
  466. /// <param name="e"></param>
  467. private void txtFurnace_KeyDown(object sender, KeyEventArgs e)
  468. {
  469. if (e.KeyValue == 13)
  470. {
  471. doQuery();
  472. }
  473. }
  474. /// <summary>
  475. /// 新增
  476. /// </summary>
  477. private void doAdd()
  478. {
  479. this.ultraGrid2.UpdateData();
  480. ArrayList list = new ArrayList();
  481. //查询入库类型
  482. DataTable dt = PipeManageClass.getComTypeInfo(strOutbound, ob);
  483. if (dt.Rows.Count >= 1)
  484. {
  485. strOutname = dt.Rows[0]["BASENAME"].ToString();
  486. }
  487. else
  488. {
  489. MessageUtil.ShowTips("入库类型不能为空,请确认基础信息是否有对应出库类型信息!");
  490. return;
  491. }
  492. int num = 0;
  493. ArrayList List = new ArrayList();
  494. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  495. {
  496. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  497. {
  498. num++;
  499. ArrayList pram = new ArrayList();
  500. pram.Add(uRow.Cells["resultNo"].Text.ToString());
  501. pram.Add(uRow.Cells["zyPlanId"].Text.ToString());
  502. pram.Add(uRow.Cells["matNo"].Text.ToString());
  503. pram.Add(uRow.Cells["tarKepNo"].Text.ToString());
  504. pram.Add(uRow.Cells["tarStorageNo"].Value.ToString());
  505. pram.Add(uRow.Cells["DealOrde"].Text.ToString());
  506. pram.Add(this.UserInfo.GetUserName());
  507. pram.Add(strOutbound);
  508. pram.Add(strOutname);
  509. pram.Add(uRow.Cells["WoId"].Text.ToString());
  510. List.Add(pram);
  511. }
  512. }
  513. if (num == 0)
  514. {
  515. MessageUtil.ShowTips("请选择需要操作的数据!");
  516. return;
  517. }
  518. if (MessageUtil.ShowYesNoAndQuestion("是否确认收料?") == DialogResult.No) return;
  519. CoreClientParam ccp = new CoreClientParam();
  520. try
  521. {
  522. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  523. if (Constant.WaitingForm == null)
  524. {
  525. Constant.WaitingForm = new WaitingForm();
  526. }
  527. Constant.WaitingForm.ShowToUser = true;
  528. Constant.WaitingForm.Show();
  529. Constant.WaitingForm.Update();
  530. ccp.ServerName = "com.steering.mes.mcp.CollarLibrary.FrmCollarInBound";
  531. ccp.MethodName = "addOutLibResult";
  532. ccp.ServerParams = new object[] { List };
  533. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  534. this.Cursor = Cursors.Default;
  535. Constant.WaitingForm.ShowToUser = false;
  536. Constant.WaitingForm.Close();
  537. Constant.WaitingForm = null;
  538. }
  539. catch (Exception ex)
  540. {
  541. this.Cursor = Cursors.Default;
  542. Constant.WaitingForm.ShowToUser = false;
  543. Constant.WaitingForm.Close();
  544. Constant.WaitingForm = null;
  545. }
  546. if (ccp.ReturnCode == -1) return;
  547. MessageUtil.ShowTips(ccp.ReturnInfo);
  548. if (ccp.ReturnInfo.Equals("收料成功!"))
  549. {
  550. clearCard();
  551. doQuery();
  552. }
  553. }
  554. /// <summary>
  555. /// 作废
  556. /// </summary>
  557. private void doDelete()
  558. {
  559. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  560. int count = 0;
  561. if (ugr == null) return;
  562. ArrayList list = new ArrayList();
  563. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
  564. {
  565. if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
  566. {
  567. count += 1;
  568. ArrayList pram = new ArrayList();
  569. pram.Add(uRow.Cells["resultNo"].Text.Trim());
  570. pram.Add(uRow.Cells["zyPlanId"].Text.Trim());
  571. pram.Add(uRow.Cells["matNo"].Text.Trim());
  572. pram.Add(uRow.Cells["tarKepNo"].Value.ToString());
  573. pram.Add(uRow.Cells["tarStorageNo"].Value.ToString());
  574. pram.Add(this.UserInfo.GetUserName());
  575. pram.Add(uRow.Cells["dealOrde"].Text.ToString());
  576. list.Add(pram);
  577. }
  578. }
  579. if (count == 0) { MessageUtil.ShowTips("请选择要撤销的数据"); return; }
  580. if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销?") == DialogResult.No) return;
  581. CoreClientParam ccp = new CoreClientParam();
  582. try
  583. {
  584. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  585. if (Constant.WaitingForm == null)
  586. {
  587. Constant.WaitingForm = new WaitingForm();
  588. }
  589. Constant.WaitingForm.ShowToUser = true;
  590. Constant.WaitingForm.Show();
  591. Constant.WaitingForm.Update();
  592. ccp.ServerName = "com.steering.mes.mcp.CollarLibrary.FrmCollarInBound";
  593. ccp.MethodName = "deleteOutLibResult";
  594. ccp.ServerParams = new object[] { list };
  595. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  596. this.Cursor = Cursors.Default;
  597. Constant.WaitingForm.ShowToUser = false;
  598. Constant.WaitingForm.Close();
  599. Constant.WaitingForm = null;
  600. }
  601. catch (Exception ex)
  602. {
  603. this.Cursor = Cursors.Default;
  604. Constant.WaitingForm.ShowToUser = false;
  605. Constant.WaitingForm.Close();
  606. Constant.WaitingForm = null;
  607. }
  608. if (ccp.ReturnCode == -1) return;
  609. MessageUtil.ShowTips(ccp.ReturnInfo);
  610. if (ccp.ReturnInfo.Equals("撤销收料成功!"))
  611. {
  612. doQuery();
  613. }
  614. }
  615. private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  616. {
  617. foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
  618. {
  619. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  620. {
  621. uRow.Cells["CHOOSE"].Value = true;
  622. }
  623. }
  624. }
  625. private void ChkOut_CheckedChanged(object sender, EventArgs e)
  626. {
  627. if (ChkOut.Checked)
  628. {
  629. ChkIn.Checked = false;
  630. ultraTabControl1.Tabs[0].Text = "倒库实绩";
  631. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["TarRecFlag"].Hidden = false;
  632. toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.False;
  633. toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True;
  634. toolMenu.Toolbars[0].Tools["ReadCard"].InstanceProps.Visible = DefaultableBoolean.True;
  635. }
  636. else
  637. {
  638. ultraTabControl1.Tabs[0].Text = "收料实绩";
  639. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["TarRecFlag"].Hidden = true;
  640. toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False;
  641. toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.True;
  642. toolMenu.Toolbars[0].Tools["ReadCard"].InstanceProps.Visible = DefaultableBoolean.False;
  643. }
  644. }
  645. private void ChkIn_CheckedChanged(object sender, EventArgs e)
  646. {
  647. if (ChkIn.Checked)
  648. {
  649. ChkOut.Checked = false;
  650. }
  651. }
  652. }
  653. }