华恒Mes鼎捷代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

749 lines
28 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.Linq;
  6. using System.Linq;
  7. using System.Drawing;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using DevExpress.XtraEditors;
  11. using DevExpress.XtraGrid.Views.BandedGrid;
  12. using DevExpress.XtraGrid.Columns;
  13. using DevExpress.XtraGrid;
  14. using System.IO;
  15. using System.Threading;
  16. using ICSSoft.Base.Language.Tool;
  17. using ICSSoft.Base.Config.AppConfig;
  18. using ICSSoft.Base.UserControl.MessageControl;
  19. using ICSSoft.Base.Config.DBHelper;
  20. using ICSSoft.Base.Report.Filter;
  21. using ICSSoft.Base.UserControl.FormControl;
  22. using ICSSoft.Base.Report.GridReport;
  23. using ICSSoft.Base.ReferForm.AppReferForm;
  24. using ICSSoft.Frame.Data.BLL;
  25. namespace ICSSoft.Frame.APP
  26. {
  27. public partial class FormICSMOX : DevExpress.XtraEditors.XtraForm
  28. {
  29. private string sqltxt = "";
  30. private string sqlconn = "";
  31. String guid = AppConfig.GetGuid();
  32. private DataTable dataSource = null;
  33. #region 构造函数
  34. public FormICSMOX()
  35. {
  36. InitializeComponent();
  37. this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  38. this.WindowState = FormWindowState.Maximized;
  39. foreach (DevExpress.XtraGrid.Columns.GridColumn col in grvDetail.Columns)
  40. {
  41. col.OptionsColumn.AllowEdit = col.Name == colSerial.Name;
  42. // col.OptionsColumn.ReadOnly = true;
  43. }
  44. }
  45. #endregion
  46. #region 操作权限
  47. public DataTable RightOfExute()
  48. {
  49. DataTable rData = new DataTable();
  50. rData.Columns.Add("BtnName");
  51. rData.Columns.Add("ActionName");
  52. //查看权限(必须有)
  53. DataRow seeRow = rData.NewRow();
  54. seeRow["BtnName"] = "see";
  55. seeRow["ActionName"] = "查看";
  56. rData.Rows.Add(seeRow);
  57. List<Control> ControlList = new List<Control>();
  58. ControlList.Add(btnCreate);
  59. ControlList.Add(btnModify);
  60. ControlList.Add(btnDel);
  61. ControlList.Add(btnOutPut);
  62. foreach (Control ctr in ControlList)
  63. {
  64. if (ctr.GetType() == typeof(SimpleButton))
  65. {
  66. DataRow dr = rData.NewRow();
  67. dr["BtnName"] = ctr.Name;
  68. dr["ActionName"] = ctr.Text;
  69. rData.Rows.Add(dr);
  70. }
  71. }
  72. rData.AcceptChanges();
  73. return rData;
  74. }
  75. public DataTable RightOfData()// 数据权限
  76. {
  77. DataTable rData = new DataTable();
  78. rData.Columns.Add("BodyName");
  79. rData.Columns.Add("ControlName");
  80. rData.Columns.Add("ControlCaption");
  81. rData.AcceptChanges();
  82. return rData;
  83. }
  84. #endregion
  85. #region 退出
  86. private void btnClose_Click(object sender, EventArgs e)
  87. {
  88. AppConfig.CloseFormShow(this.Text);
  89. this.Close();
  90. }
  91. private void btnExit_Click(object sender, EventArgs e)
  92. {
  93. AppConfig.CloseFormShow(this.Text);
  94. this.Close();
  95. }
  96. #endregion
  97. #region 移动窗体
  98. private const int WM_NCHITTEST = 0x84;
  99. private const int HTCLIENT = 0x1;
  100. private const int HTCAPTION = 0x2;
  101. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  102. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  103. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  104. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  105. //重写窗体,使窗体可以不通过自带标题栏实现移动
  106. protected override void WndProc(ref Message m)
  107. {
  108. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  109. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  110. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  111. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  112. switch (m.Msg)
  113. {
  114. case WM_NCHITTEST:
  115. base.WndProc(ref m);
  116. if ((int)m.Result == HTCLIENT)
  117. m.Result = (IntPtr)HTCAPTION;
  118. return;
  119. }
  120. //拦截双击标题栏、移动窗体的系统消息
  121. if (m.Msg != 0xA3)
  122. {
  123. base.WndProc(ref m);
  124. }
  125. }
  126. #endregion
  127. #region 列表
  128. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  129. {
  130. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  131. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  132. }
  133. #endregion
  134. #region 过滤
  135. private string tempTableName = "";
  136. private void btnFilter_Click(object sender, EventArgs e)
  137. {
  138. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name));
  139. filter.OldTempTableName = tempTableName;
  140. if (filter.ShowDialog() == DialogResult.OK)
  141. {
  142. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  143. try
  144. {
  145. _wait.Show();
  146. tempTableName = filter.NewTempTableName;
  147. sqltxt = filter.SqlText;
  148. sqlconn = filter.FilterConnectString;
  149. dataSource = filter.FilterData.Tables[0];
  150. grdDetail.DataSource = dataSource;
  151. grvDetail.BestFitColumns();
  152. rptPage.RecordNum = dataSource.Rows.Count;
  153. rptPage.PageSize = 499;
  154. rptPage.PageIndex = 1;
  155. rptPage.ReLoad();
  156. rptPage.PageSize = 500;
  157. rptPage.PageIndex = 1;
  158. rptPage.ReLoad();
  159. _wait.Close();
  160. }
  161. catch (Exception ex)
  162. {
  163. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  164. _wait.Close();
  165. }
  166. }
  167. }
  168. #endregion
  169. #region 绑定数据源
  170. private void btnConfig_Click(object sender, EventArgs e)
  171. {
  172. if (AppConfig.UserCode.ToLower() != "demo")
  173. {
  174. ICSBaseSimpleCode.AppshowMessageBox("您没有权限设置数据源,请联系软件提供商!");
  175. return;
  176. }
  177. FormDataSource fdata = new FormDataSource(AppConfig.GetMenuId(this.Tag.ToString()), btnConfig.Name);
  178. fdata.ShowDialog();
  179. }
  180. #endregion
  181. #region 分页
  182. private void rptPage_PageIndexChanged(object Sender, EventArgs e)
  183. {
  184. DataTable data = AppConfig.GetPageData(dataSource, rptPage.PageIndex, rptPage.PageSize).Copy();
  185. grdDetail.DataSource = data;
  186. }
  187. #endregion
  188. #region 过滤方法
  189. private void FormContainerManager_FormClosing(object sender, FormClosingEventArgs e)
  190. {
  191. AppConfig.DropTemTable(tempTableName);
  192. }
  193. #endregion
  194. #region 全选
  195. private void btnSelectAll_Click(object sender, EventArgs e)
  196. {
  197. grvDetail.PostEditor();
  198. this.Validate();
  199. for (int i = 0; i < grvDetail.RowCount; i++)
  200. {
  201. grvDetail.SetRowCellValue(i, colisSelect, "Y");
  202. }
  203. }
  204. #endregion
  205. #region 全消
  206. private void btnCancelAll_Click(object sender, EventArgs e)
  207. {
  208. grvDetail.PostEditor();
  209. this.Validate();
  210. for (int i = 0; i < grvDetail.RowCount; i++)
  211. {
  212. grvDetail.SetRowCellValue(i, colisSelect, "");
  213. }
  214. }
  215. #endregion
  216. #region 双击
  217. private void grvDetail_DoubleClick(object sender, EventArgs e)
  218. {
  219. if (grvDetail.FocusedRowHandle < 0)
  220. {
  221. return;
  222. }
  223. if (grvDetail.FocusedColumn == colisSelect)
  224. {
  225. if (grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colisSelect).ToString() == "")
  226. {
  227. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "Y");
  228. }
  229. else
  230. {
  231. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "");
  232. }
  233. }
  234. }
  235. #endregion
  236. #region 删除
  237. private void btnDel_Click(object sender, EventArgs e)
  238. {
  239. SimpleButton btntemp = (SimpleButton)sender;
  240. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  241. {
  242. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  243. return;
  244. }
  245. List<string> moidList = new List<string>();
  246. for (int i = 0; i < grvDetail.RowCount; i++)
  247. {
  248. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  249. {
  250. moidList.Add(grvDetail.GetRowCellValue(i, colID).ToString());
  251. }
  252. }
  253. if (moidList.Count == 0 || moidList == null)
  254. {
  255. ICSBaseSimpleCode.AppshowMessageBox("请选择数据");
  256. return;
  257. }
  258. if (ICSBaseSimpleCode.AppshowMessageBoxRepose("确定删除工单吗?删除后无法恢复,确定吗?") != DialogResult.OK)
  259. {
  260. btnCancelAll_Click(sender, e);
  261. return;
  262. }
  263. try
  264. {
  265. ICSMOBLL.deleteInfo(moidList, AppConfig.AppConnectString);
  266. ICSBaseSimpleCode.AppshowMessageBox("删除成功");
  267. }
  268. catch (Exception ex)
  269. {
  270. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  271. }
  272. btnRefresh_Click(null, null);
  273. }
  274. #endregion
  275. #region 导出
  276. private void btnOutPut_Click(object sender, EventArgs e)
  277. {
  278. try
  279. {
  280. FormOutExcel foe = new FormOutExcel(this.Tag.ToString(), grdDetail);
  281. foe.ShowDialog();
  282. }
  283. catch (Exception ex)
  284. {
  285. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  286. }
  287. //FormOutExcel foe = new FormOutExcel();
  288. //if (foe.ShowDialog() == DialogResult.OK)
  289. //{
  290. // try
  291. // {
  292. // string outtype = foe._OutType;
  293. // string exceltype = foe._ExcelType;
  294. // string filename = foe._FileName;
  295. // string url = foe._Url;
  296. // string sheetname = foe._SheetName;
  297. // if (outtype.ToLower() == "excel")
  298. // {
  299. // DevExpress.XtraPrinting.XlsExportOptions op = new DevExpress.XtraPrinting.XlsExportOptions();
  300. // op.SheetName = sheetname;
  301. // grdDetail.MainView.ExportToXls((url + "\\" + filename + (exceltype == "2003" ? ".xls" : ".xlsx")), op);
  302. // }
  303. // else
  304. // {
  305. // grdDetail.MainView.ExportToPdf(url + "\\" + filename + ".pdf");
  306. // }
  307. // MessageBox.Show("导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  308. // }
  309. // catch (Exception ex)
  310. // {
  311. // MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  312. // }
  313. //}
  314. }
  315. #endregion
  316. #region 刷新
  317. private void btnRefresh_Click(object sender, EventArgs e)
  318. {
  319. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  320. try
  321. {
  322. _wait.Show();
  323. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name), false);
  324. filter.OldTempTableName = tempTableName;
  325. dataSource = DBHelper.ExecuteDataset(sqlconn, CommandType.Text, sqltxt).Tables[0];
  326. grdDetail.DataSource = dataSource;
  327. grvDetail.BestFitColumns();
  328. rptPage.RecordNum = dataSource.Rows.Count;
  329. rptPage.PageIndex = 1;
  330. rptPage.ReLoad();
  331. _wait.Close();
  332. }
  333. catch (Exception ex)
  334. {
  335. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  336. _wait.Close();
  337. }
  338. }
  339. #endregion
  340. #region 新增
  341. private void btnCreate_Click(object sender, EventArgs e)
  342. {
  343. SimpleButton btntemp = (SimpleButton)sender;
  344. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  345. {
  346. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  347. return;
  348. }
  349. FormICSMOAdd add = new FormICSMOAdd();
  350. add.ShowDialog();
  351. btnRefresh_Click(null, null);
  352. }
  353. #endregion
  354. #region 修改
  355. private void btnModify_Click(object sender, EventArgs e)
  356. {
  357. SimpleButton btntemp = (SimpleButton)sender;
  358. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  359. {
  360. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  361. return;
  362. }
  363. int count = 0;
  364. for (int i = 0; i < grvDetail.RowCount; i++)
  365. {
  366. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  367. {
  368. count++;
  369. }
  370. }
  371. if (count != 1)
  372. {
  373. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  374. return;
  375. }
  376. try
  377. {
  378. string moid;
  379. for (int i = 0; i < grvDetail.RowCount; i++)
  380. {
  381. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  382. {
  383. moid = grvDetail.GetRowCellValue(i, colID).ToString();
  384. FormICSMOAdd add = new FormICSMOAdd(moid);
  385. add.ShowDialog();
  386. }
  387. }
  388. btnRefresh_Click(null, null);
  389. }
  390. catch (Exception ex)
  391. {
  392. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  393. }
  394. }
  395. #endregion
  396. private void ICSItemLot_FormClosing(object sender, FormClosingEventArgs e)
  397. {
  398. AppConfig.DropTemTable(tempTableName);
  399. }
  400. private void FormICSMO_Load(object sender, EventArgs e)
  401. {
  402. btnFilter_Click(sender, e);
  403. }
  404. private void grvDetail_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
  405. {
  406. if (e.RowHandle >= 0 && e.Column.FieldName == "DCTCODE")
  407. {
  408. e.CellValue = "cccc";
  409. }
  410. }
  411. private void repSerialButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
  412. {
  413. try
  414. {
  415. string moID;
  416. string moCode;
  417. decimal qty = 0.00m;
  418. moID = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colID).ToString();
  419. moCode = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colMOCODE).ToString();
  420. qty = Convert.ToDecimal(grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colMOPLANQTY).ToString());
  421. FormICSMO2RCARDAdd rec = new FormICSMO2RCARDAdd(moID, moCode, qty);
  422. rec.ShowDialog();
  423. btnRefresh_Click(null, null);
  424. }
  425. catch (Exception ex)
  426. {
  427. throw ex;
  428. }
  429. }
  430. #region
  431. //下发
  432. private void txtsend_Click(object sender, EventArgs e)
  433. {
  434. SimpleButton btntemp = (SimpleButton)sender;
  435. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  436. {
  437. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  438. return;
  439. }
  440. int count = 0;
  441. for (int i = 0; i < grvDetail.RowCount; i++)
  442. {
  443. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  444. {
  445. count++;
  446. }
  447. }
  448. if (count != 1)
  449. {
  450. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  451. return;
  452. }
  453. try
  454. {
  455. string mocode="";
  456. string state = "";
  457. string moseq = "";
  458. for (int i = 0; i < grvDetail.RowCount; i++)
  459. {
  460. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  461. {
  462. mocode = grvDetail.GetRowCellValue(i,colMOCODE).ToString();
  463. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  464. }
  465. }
  466. //判断是否是初始状态
  467. if (state.Equals("初始"))
  468. {
  469. //判断是否在工单首检记录表中
  470. if (ICSMOBLL.isInFirstCheck(mocode, AppConfig.AppConnectString))
  471. {
  472. //判断(最近的时间)是否合格
  473. if (ICSMOBLL.isQualified(mocode, AppConfig.AppConnectString))
  474. {
  475. ICSMOBLL.Send(mocode,moseq,AppConfig.AppConnectString);
  476. ICSBaseSimpleCode.AppshowMessageBox("下发成功");
  477. }
  478. else
  479. {
  480. ICSBaseSimpleCode.AppshowMessageBox("不合格,不能下发");
  481. return;
  482. }
  483. }
  484. else
  485. {
  486. ICSBaseSimpleCode.AppshowMessageBox("不存在工单首检记录中");
  487. return;
  488. }
  489. }
  490. else
  491. {
  492. ICSBaseSimpleCode.AppshowMessageBox("不是初始状态,不能下发");
  493. return;
  494. }
  495. btnRefresh_Click(null, null);
  496. }
  497. catch (Exception ex)
  498. {
  499. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  500. }
  501. }
  502. //取消下发
  503. private void txtcancelSend_Click(object sender, EventArgs e)
  504. {
  505. SimpleButton btntemp = (SimpleButton)sender;
  506. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  507. {
  508. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  509. return;
  510. }
  511. int count = 0;
  512. for (int i = 0; i < grvDetail.RowCount; i++)
  513. {
  514. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  515. {
  516. count++;
  517. }
  518. }
  519. if (count != 1)
  520. {
  521. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  522. return;
  523. }
  524. try
  525. {
  526. string mocode = "";
  527. string state = "";
  528. string moseq = "";
  529. for (int i = 0; i < grvDetail.RowCount; i++)
  530. {
  531. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  532. {
  533. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  534. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  535. }
  536. }
  537. //判断是否是下发状态
  538. if (state.Equals("下发"))
  539. {
  540. ICSMOBLL.cancelSend(mocode,moseq,AppConfig.AppConnectString);
  541. ICSBaseSimpleCode.AppshowMessageBox("取消下发成功");
  542. }
  543. else
  544. {
  545. ICSBaseSimpleCode.AppshowMessageBox("不是下发状态,不能取消下发");
  546. return;
  547. }
  548. btnRefresh_Click(null, null);
  549. }
  550. catch (Exception ex)
  551. {
  552. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  553. }
  554. }
  555. //暂停
  556. private void txtstop_Click(object sender, EventArgs e)
  557. {
  558. SimpleButton btntemp = (SimpleButton)sender;
  559. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  560. {
  561. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  562. return;
  563. }
  564. int count = 0;
  565. for (int i = 0; i < grvDetail.RowCount; i++)
  566. {
  567. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  568. {
  569. count++;
  570. }
  571. }
  572. if (count != 1)
  573. {
  574. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  575. return;
  576. }
  577. try
  578. {
  579. string mocode = "";
  580. string state = "";
  581. for (int i = 0; i < grvDetail.RowCount; i++)
  582. {
  583. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  584. {
  585. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  586. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  587. }
  588. }
  589. //判断是否是生产中状态
  590. if (state.Equals("生产中"))
  591. {
  592. ICSMOBLL.stop(mocode, AppConfig.AppConnectString);
  593. ICSBaseSimpleCode.AppshowMessageBox("暂停成功");
  594. }
  595. else
  596. {
  597. ICSBaseSimpleCode.AppshowMessageBox("不是生产中状态,不能暂停");
  598. return;
  599. }
  600. btnRefresh_Click(null, null);
  601. }
  602. catch (Exception ex)
  603. {
  604. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  605. }
  606. }
  607. //取消暂停
  608. private void txtcancelStop_Click(object sender, EventArgs e)
  609. {
  610. SimpleButton btntemp = (SimpleButton)sender;
  611. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  612. {
  613. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  614. return;
  615. }
  616. int count = 0;
  617. for (int i = 0; i < grvDetail.RowCount; i++)
  618. {
  619. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  620. {
  621. count++;
  622. }
  623. }
  624. if (count != 1)
  625. {
  626. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  627. return;
  628. }
  629. try
  630. {
  631. string mocode = "";
  632. string state = "";
  633. for (int i = 0; i < grvDetail.RowCount; i++)
  634. {
  635. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  636. {
  637. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  638. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  639. }
  640. }
  641. //判断是否是暂停状态
  642. if (state.Equals("暂停"))
  643. {
  644. ICSMOBLL.cancelStop(mocode, AppConfig.AppConnectString);
  645. ICSBaseSimpleCode.AppshowMessageBox("取消暂停成功");
  646. }
  647. else
  648. {
  649. ICSBaseSimpleCode.AppshowMessageBox("不是暂停状态,不能取消暂停");
  650. return;
  651. }
  652. btnRefresh_Click(null, null);
  653. }
  654. catch (Exception ex)
  655. {
  656. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  657. }
  658. }
  659. //关单
  660. private void txtcloseDan_Click(object sender, EventArgs e)
  661. {
  662. SimpleButton btntemp = (SimpleButton)sender;
  663. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  664. {
  665. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  666. return;
  667. }
  668. int count = 0;
  669. for (int i = 0; i < grvDetail.RowCount; i++)
  670. {
  671. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  672. {
  673. count++;
  674. }
  675. }
  676. if (count != 1)
  677. {
  678. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  679. return;
  680. }
  681. try
  682. {
  683. string mocode = "";
  684. string state = "";
  685. for (int i = 0; i < grvDetail.RowCount; i++)
  686. {
  687. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  688. {
  689. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  690. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  691. }
  692. }
  693. //判断是否是关单状态
  694. if (!(state.Equals("关单")))
  695. {
  696. ICSMOBLL.closeDan(mocode, AppConfig.AppConnectString);
  697. ICSBaseSimpleCode.AppshowMessageBox("关单成功");
  698. }
  699. else
  700. {
  701. ICSBaseSimpleCode.AppshowMessageBox("已经是关单状态");
  702. return;
  703. }
  704. btnRefresh_Click(null, null);
  705. }
  706. catch (Exception ex)
  707. {
  708. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  709. }
  710. }
  711. #endregion?
  712. }
  713. }