锐腾搅拌上料功能
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.

714 lines
26 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. FormOutExcel foe = new FormOutExcel(this.Tag.ToString(), grdDetail);
  279. foe.ShowDialog();
  280. }
  281. #endregion
  282. #region 刷新
  283. private void btnRefresh_Click(object sender, EventArgs e)
  284. {
  285. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  286. try
  287. {
  288. _wait.Show();
  289. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name), false);
  290. filter.OldTempTableName = tempTableName;
  291. dataSource = DBHelper.ExecuteDataset(sqlconn, CommandType.Text, sqltxt).Tables[0];
  292. grdDetail.DataSource = dataSource;
  293. grvDetail.BestFitColumns();
  294. rptPage.RecordNum = dataSource.Rows.Count;
  295. rptPage.PageIndex = 1;
  296. rptPage.ReLoad();
  297. _wait.Close();
  298. }
  299. catch (Exception ex)
  300. {
  301. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  302. _wait.Close();
  303. }
  304. }
  305. #endregion
  306. #region 新增
  307. private void btnCreate_Click(object sender, EventArgs e)
  308. {
  309. SimpleButton btntemp = (SimpleButton)sender;
  310. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  311. {
  312. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  313. return;
  314. }
  315. FormICSMOAdd add = new FormICSMOAdd();
  316. add.ShowDialog();
  317. btnRefresh_Click(null, null);
  318. }
  319. #endregion
  320. #region 修改
  321. private void btnModify_Click(object sender, EventArgs e)
  322. {
  323. SimpleButton btntemp = (SimpleButton)sender;
  324. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  325. {
  326. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  327. return;
  328. }
  329. int count = 0;
  330. for (int i = 0; i < grvDetail.RowCount; i++)
  331. {
  332. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  333. {
  334. count++;
  335. }
  336. }
  337. if (count != 1)
  338. {
  339. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  340. return;
  341. }
  342. try
  343. {
  344. string moid;
  345. for (int i = 0; i < grvDetail.RowCount; i++)
  346. {
  347. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  348. {
  349. moid = grvDetail.GetRowCellValue(i, colID).ToString();
  350. FormICSMOAdd add = new FormICSMOAdd(moid);
  351. add.ShowDialog();
  352. }
  353. }
  354. btnRefresh_Click(null, null);
  355. }
  356. catch (Exception ex)
  357. {
  358. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  359. }
  360. }
  361. #endregion
  362. private void ICSItemLot_FormClosing(object sender, FormClosingEventArgs e)
  363. {
  364. AppConfig.DropTemTable(tempTableName);
  365. }
  366. private void FormICSMO_Load(object sender, EventArgs e)
  367. {
  368. btnFilter_Click(sender, e);
  369. }
  370. private void grvDetail_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
  371. {
  372. if (e.RowHandle >= 0 && e.Column.FieldName == "DCTCODE")
  373. {
  374. e.CellValue = "cccc";
  375. }
  376. }
  377. private void repSerialButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
  378. {
  379. try
  380. {
  381. string moID;
  382. string moCode;
  383. decimal qty = 0.00m;
  384. moID = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colID).ToString();
  385. moCode = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colMOCODE).ToString();
  386. qty = Convert.ToDecimal(grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colMOPLANQTY).ToString());
  387. FormICSMO2RCARDAdd rec = new FormICSMO2RCARDAdd(moID, moCode, qty);
  388. rec.ShowDialog();
  389. btnRefresh_Click(null, null);
  390. }
  391. catch (Exception ex)
  392. {
  393. throw ex;
  394. }
  395. }
  396. #region
  397. //下发
  398. private void txtsend_Click(object sender, EventArgs e)
  399. {
  400. SimpleButton btntemp = (SimpleButton)sender;
  401. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  402. {
  403. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  404. return;
  405. }
  406. int count = 0;
  407. for (int i = 0; i < grvDetail.RowCount; i++)
  408. {
  409. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  410. {
  411. count++;
  412. }
  413. }
  414. if (count != 1)
  415. {
  416. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  417. return;
  418. }
  419. try
  420. {
  421. string mocode="";
  422. string state = "";
  423. string moseq = "";
  424. for (int i = 0; i < grvDetail.RowCount; i++)
  425. {
  426. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  427. {
  428. mocode = grvDetail.GetRowCellValue(i,colMOCODE).ToString();
  429. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  430. }
  431. }
  432. //判断是否是初始状态
  433. if (state.Equals("初始"))
  434. {
  435. //判断是否在工单首检记录表中
  436. if (ICSMOBLL.isInFirstCheck(mocode, AppConfig.AppConnectString))
  437. {
  438. //判断(最近的时间)是否合格
  439. if (ICSMOBLL.isQualified(mocode, AppConfig.AppConnectString))
  440. {
  441. ICSMOBLL.Send(mocode,moseq,AppConfig.AppConnectString);
  442. ICSBaseSimpleCode.AppshowMessageBox("下发成功");
  443. }
  444. else
  445. {
  446. ICSBaseSimpleCode.AppshowMessageBox("不合格,不能下发");
  447. return;
  448. }
  449. }
  450. else
  451. {
  452. ICSBaseSimpleCode.AppshowMessageBox("不存在工单首检记录中");
  453. return;
  454. }
  455. }
  456. else
  457. {
  458. ICSBaseSimpleCode.AppshowMessageBox("不是初始状态,不能下发");
  459. return;
  460. }
  461. btnRefresh_Click(null, null);
  462. }
  463. catch (Exception ex)
  464. {
  465. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  466. }
  467. }
  468. //取消下发
  469. private void txtcancelSend_Click(object sender, EventArgs e)
  470. {
  471. SimpleButton btntemp = (SimpleButton)sender;
  472. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  473. {
  474. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  475. return;
  476. }
  477. int count = 0;
  478. for (int i = 0; i < grvDetail.RowCount; i++)
  479. {
  480. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  481. {
  482. count++;
  483. }
  484. }
  485. if (count != 1)
  486. {
  487. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  488. return;
  489. }
  490. try
  491. {
  492. string mocode = "";
  493. string state = "";
  494. string moseq = "";
  495. for (int i = 0; i < grvDetail.RowCount; i++)
  496. {
  497. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  498. {
  499. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  500. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  501. }
  502. }
  503. //判断是否是下发状态
  504. if (state.Equals("下发"))
  505. {
  506. ICSMOBLL.cancelSend(mocode,moseq,AppConfig.AppConnectString);
  507. ICSBaseSimpleCode.AppshowMessageBox("取消下发成功");
  508. }
  509. else
  510. {
  511. ICSBaseSimpleCode.AppshowMessageBox("不是下发状态,不能取消下发");
  512. return;
  513. }
  514. btnRefresh_Click(null, null);
  515. }
  516. catch (Exception ex)
  517. {
  518. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  519. }
  520. }
  521. //暂停
  522. private void txtstop_Click(object sender, EventArgs e)
  523. {
  524. SimpleButton btntemp = (SimpleButton)sender;
  525. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  526. {
  527. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  528. return;
  529. }
  530. int count = 0;
  531. for (int i = 0; i < grvDetail.RowCount; i++)
  532. {
  533. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  534. {
  535. count++;
  536. }
  537. }
  538. if (count != 1)
  539. {
  540. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  541. return;
  542. }
  543. try
  544. {
  545. string mocode = "";
  546. string state = "";
  547. for (int i = 0; i < grvDetail.RowCount; i++)
  548. {
  549. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  550. {
  551. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  552. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  553. }
  554. }
  555. //判断是否是生产中状态
  556. if (state.Equals("生产中"))
  557. {
  558. ICSMOBLL.stop(mocode, AppConfig.AppConnectString);
  559. ICSBaseSimpleCode.AppshowMessageBox("暂停成功");
  560. }
  561. else
  562. {
  563. ICSBaseSimpleCode.AppshowMessageBox("不是生产中状态,不能暂停");
  564. return;
  565. }
  566. btnRefresh_Click(null, null);
  567. }
  568. catch (Exception ex)
  569. {
  570. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  571. }
  572. }
  573. //取消暂停
  574. private void txtcancelStop_Click(object sender, EventArgs e)
  575. {
  576. SimpleButton btntemp = (SimpleButton)sender;
  577. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  578. {
  579. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  580. return;
  581. }
  582. int count = 0;
  583. for (int i = 0; i < grvDetail.RowCount; i++)
  584. {
  585. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  586. {
  587. count++;
  588. }
  589. }
  590. if (count != 1)
  591. {
  592. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  593. return;
  594. }
  595. try
  596. {
  597. string mocode = "";
  598. string state = "";
  599. for (int i = 0; i < grvDetail.RowCount; i++)
  600. {
  601. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  602. {
  603. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  604. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  605. }
  606. }
  607. //判断是否是暂停状态
  608. if (state.Equals("暂停"))
  609. {
  610. ICSMOBLL.cancelStop(mocode, AppConfig.AppConnectString);
  611. ICSBaseSimpleCode.AppshowMessageBox("取消暂停成功");
  612. }
  613. else
  614. {
  615. ICSBaseSimpleCode.AppshowMessageBox("不是暂停状态,不能取消暂停");
  616. return;
  617. }
  618. btnRefresh_Click(null, null);
  619. }
  620. catch (Exception ex)
  621. {
  622. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  623. }
  624. }
  625. //关单
  626. private void txtcloseDan_Click(object sender, EventArgs e)
  627. {
  628. SimpleButton btntemp = (SimpleButton)sender;
  629. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  630. {
  631. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  632. return;
  633. }
  634. int count = 0;
  635. for (int i = 0; i < grvDetail.RowCount; i++)
  636. {
  637. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  638. {
  639. count++;
  640. }
  641. }
  642. if (count != 1)
  643. {
  644. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  645. return;
  646. }
  647. try
  648. {
  649. string mocode = "";
  650. string state = "";
  651. for (int i = 0; i < grvDetail.RowCount; i++)
  652. {
  653. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  654. {
  655. mocode = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  656. state = grvDetail.GetRowCellValue(i, colMOSTATUS).ToString();
  657. }
  658. }
  659. //判断是否是关单状态
  660. if (!(state.Equals("关单")))
  661. {
  662. ICSMOBLL.closeDan(mocode, AppConfig.AppConnectString);
  663. ICSBaseSimpleCode.AppshowMessageBox("关单成功");
  664. }
  665. else
  666. {
  667. ICSBaseSimpleCode.AppshowMessageBox("已经是关单状态");
  668. return;
  669. }
  670. btnRefresh_Click(null, null);
  671. }
  672. catch (Exception ex)
  673. {
  674. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  675. }
  676. }
  677. #endregion?
  678. }
  679. }