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

649 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. using DevExpress.XtraPrinting;
  26. using ICSSoft.Frame.Data.Entity;
  27. using ICSSoft.Base.Lable.PrintTool;
  28. using System.Data.SqlClient;
  29. namespace ICSSoft.Frame.APP
  30. {
  31. public partial class FormICSTuiKu_IN : DevExpress.XtraEditors.XtraForm
  32. {
  33. private string sqltxt = "";
  34. private string sqlconn = "";
  35. public string MinTime = "";
  36. public int status = 0;
  37. String guid = AppConfig.GetGuid();
  38. private DataTable dataSource = null;
  39. #region 构造函数
  40. public FormICSTuiKu_IN()
  41. {
  42. InitializeComponent();
  43. this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  44. this.WindowState = FormWindowState.Maximized;
  45. }
  46. #endregion
  47. #region 操作权限
  48. public DataTable RightOfExute()
  49. {
  50. DataTable rData = new DataTable();
  51. rData.Columns.Add("BtnName");
  52. rData.Columns.Add("ActionName");
  53. //查看权限(必须有)
  54. DataRow seeRow = rData.NewRow();
  55. seeRow["BtnName"] = "see";
  56. seeRow["ActionName"] = "查看";
  57. rData.Rows.Add(seeRow);
  58. List<Control> ControlList = new List<Control>();
  59. ControlList.Add(btnAdd);
  60. ControlList.Add(btnModify);
  61. ControlList.Add(btnDel);
  62. ControlList.Add(simpleButton1);
  63. ControlList.Add(btnRefresh);
  64. foreach (Control ctr in ControlList)
  65. {
  66. if (ctr.GetType() == typeof(SimpleButton))
  67. {
  68. DataRow dr = rData.NewRow();
  69. dr["BtnName"] = ctr.Name;
  70. dr["ActionName"] = ctr.Text;
  71. rData.Rows.Add(dr);
  72. }
  73. }
  74. rData.AcceptChanges();
  75. return rData;
  76. }
  77. public DataTable RightOfData()// 数据权限
  78. {
  79. DataTable rData = new DataTable();
  80. rData.Columns.Add("BodyName");
  81. rData.Columns.Add("ControlName");
  82. rData.Columns.Add("ControlCaption");
  83. rData.AcceptChanges();
  84. return rData;
  85. }
  86. #endregion
  87. #region 退出
  88. private void btnClose_Click(object sender, EventArgs e)
  89. {
  90. AppConfig.CloseFormShow(this.Text);
  91. this.Close();
  92. }
  93. private void btnExit_Click(object sender, EventArgs e)
  94. {
  95. AppConfig.CloseFormShow(this.Text);
  96. this.Close();
  97. }
  98. #endregion
  99. #region 移动窗体
  100. private const int WM_NCHITTEST = 0x84;
  101. private const int HTCLIENT = 0x1;
  102. private const int HTCAPTION = 0x2;
  103. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  104. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  105. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  106. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  107. //重写窗体,使窗体可以不通过自带标题栏实现移动
  108. protected override void WndProc(ref Message m)
  109. {
  110. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  111. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  112. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  113. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  114. switch (m.Msg)
  115. {
  116. case WM_NCHITTEST:
  117. base.WndProc(ref m);
  118. if ((int)m.Result == HTCLIENT)
  119. m.Result = (IntPtr)HTCAPTION;
  120. return;
  121. }
  122. //拦截双击标题栏、移动窗体的系统消息
  123. if (m.Msg != 0xA3)
  124. {
  125. base.WndProc(ref m);
  126. }
  127. }
  128. #endregion
  129. #region 列表
  130. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  131. {
  132. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  133. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  134. }
  135. #endregion
  136. #region 过滤
  137. private string tempTableName = "";
  138. private void btnFilter_Click(object sender, EventArgs e)
  139. {
  140. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name));
  141. filter.OldTempTableName = tempTableName;
  142. if (filter.ShowDialog() == DialogResult.OK)
  143. {
  144. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  145. try
  146. {
  147. _wait.Show();
  148. tempTableName = filter.NewTempTableName;
  149. sqltxt = filter.SqlText;
  150. sqlconn = filter.FilterConnectString;
  151. dataSource = filter.FilterData.Tables[0];
  152. grdDetail.DataSource = dataSource;
  153. grvDetail.BestFitColumns();
  154. rptPage.RecordNum = dataSource.Rows.Count;
  155. rptPage.PageSize = 499;
  156. rptPage.PageIndex = 1;
  157. rptPage.ReLoad();
  158. rptPage.PageSize = 500;
  159. rptPage.PageIndex = 1;
  160. rptPage.ReLoad();
  161. _wait.Close();
  162. }
  163. catch (Exception ex)
  164. {
  165. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  166. _wait.Close();
  167. }
  168. }
  169. }
  170. #endregion
  171. #region 绑定数据源
  172. private void btnConfig_Click(object sender, EventArgs e)
  173. {
  174. if (AppConfig.UserCode.ToLower() != "demo")
  175. {
  176. ICSBaseSimpleCode.AppshowMessageBox("您没有权限设置数据源,请联系软件提供商!");
  177. return;
  178. }
  179. FormDataSource fdata = new FormDataSource(AppConfig.GetMenuId(this.Tag.ToString()), btnConfig.Name);
  180. fdata.ShowDialog();
  181. }
  182. #endregion
  183. #region 分页
  184. private void rptPage_PageIndexChanged(object Sender, EventArgs e)
  185. {
  186. DataTable data = AppConfig.GetPageData(dataSource, rptPage.PageIndex, rptPage.PageSize).Copy();
  187. grdDetail.DataSource = data;
  188. }
  189. #endregion
  190. #region 过滤方法
  191. private void FormContainerManager_FormClosing(object sender, FormClosingEventArgs e)
  192. {
  193. AppConfig.DropTemTable(tempTableName);
  194. }
  195. #endregion
  196. #region 全选
  197. private void btnSelectAll_Click(object sender, EventArgs e)
  198. {
  199. grvDetail.PostEditor();
  200. this.Validate();
  201. for (int i = 0; i < grvDetail.RowCount; i++)
  202. {
  203. grvDetail.SetRowCellValue(i, colisSelect, "Y");
  204. }
  205. }
  206. #endregion
  207. #region 全消
  208. private void btnCancelAll_Click(object sender, EventArgs e)
  209. {
  210. grvDetail.PostEditor();
  211. this.Validate();
  212. for (int i = 0; i < grvDetail.RowCount; i++)
  213. {
  214. grvDetail.SetRowCellValue(i, colisSelect, "");
  215. }
  216. }
  217. #endregion
  218. #region 双击
  219. private void grvDetail_DoubleClick(object sender, EventArgs e)
  220. {
  221. if (grvDetail.FocusedRowHandle < 0)
  222. {
  223. return;
  224. }
  225. if (grvDetail.FocusedColumn == colisSelect)
  226. {
  227. if (grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colisSelect).ToString() == "")
  228. {
  229. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "Y");
  230. }
  231. else
  232. {
  233. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "");
  234. }
  235. }
  236. }
  237. #endregion
  238. #region 刷新
  239. private void btnRefresh_Click(object sender, EventArgs e)
  240. {
  241. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  242. try
  243. {
  244. _wait.Show();
  245. FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name), false);
  246. filter.OldTempTableName = tempTableName;
  247. dataSource = DBHelper.ExecuteDataset(sqlconn, CommandType.Text, sqltxt).Tables[0];
  248. grdDetail.DataSource = dataSource;
  249. grvDetail.BestFitColumns();
  250. rptPage.RecordNum = dataSource.Rows.Count;
  251. rptPage.PageIndex = 1;
  252. rptPage.ReLoad();
  253. _wait.Close();
  254. }
  255. catch (Exception ex)
  256. {
  257. MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
  258. _wait.Close();
  259. }
  260. }
  261. #endregion
  262. #region 新增
  263. private void btnAdd_Click(object sender, EventArgs e)
  264. {
  265. SimpleButton btntemp = (SimpleButton)sender;
  266. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  267. {
  268. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  269. return;
  270. }
  271. FormICSTuiKuAdd add = new FormICSTuiKuAdd();
  272. add.ShowDialog();
  273. btnRefresh_Click(null, null);
  274. }
  275. #endregion
  276. private void ICSItemLot_FormClosing(object sender, FormClosingEventArgs e)
  277. {
  278. AppConfig.DropTemTable(tempTableName);
  279. }
  280. private void FormICSChuKu_IN_Load(object sender, EventArgs e)
  281. {
  282. btnFilter_Click(sender, e);
  283. }
  284. private void grvDetail_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
  285. {
  286. if (e.RowHandle >= 0 && e.Column.FieldName == "DCTCODE")
  287. {
  288. e.CellValue = "cccc";
  289. }
  290. }
  291. #region 编辑
  292. private void btnModify_Click(object sender, EventArgs e)
  293. {
  294. SimpleButton btntemp = (SimpleButton)sender;
  295. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  296. {
  297. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  298. return;
  299. }
  300. int count = 0;
  301. for (int i = 0; i < grvDetail.RowCount; i++)
  302. {
  303. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  304. {
  305. count++;
  306. }
  307. }
  308. if (count != 1)
  309. {
  310. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  311. return;
  312. }
  313. try
  314. {
  315. string moid;
  316. for (int i = 0; i < grvDetail.RowCount; i++)
  317. {
  318. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  319. {
  320. FormICSTuiKuAdd add = new FormICSTuiKuAdd(grvDetail.GetRowCellValue(i, colVouchCode).ToString(), grvDetail.GetRowCellValue(i, colVouchRow).ToString(), grvDetail.GetRowCellValue(i, colSubInvCode).ToString(), grvDetail.GetRowCellValue(i, colWHCode).ToString(), grvDetail.GetRowCellValue(i, colQuantity).ToString(), grvDetail.GetRowCellValue(i, colMUSER).ToString());
  321. add.ShowDialog();
  322. }
  323. }
  324. btnRefresh_Click(null, null);
  325. }
  326. catch (Exception ex)
  327. {
  328. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  329. }
  330. }
  331. #endregion
  332. #region 保存
  333. private void save_Click(object sender, EventArgs e)
  334. {
  335. int Count = 0;
  336. SimpleButton btntemp = (SimpleButton)sender;
  337. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  338. {
  339. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  340. return;
  341. }
  342. for (int i = 0; i < grvDetail.RowCount; i++)
  343. {
  344. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  345. {
  346. Count++;
  347. }
  348. }
  349. if (Count == 0)
  350. {
  351. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
  352. return;
  353. }
  354. if (ICSBaseSimpleCode.AppshowMessageBoxRepose("确定保存该单据吗?单据保存后需要审核,确定吗?") != DialogResult.OK)
  355. {
  356. return;
  357. }
  358. else
  359. {
  360. try
  361. {
  362. for (int i = 0; i < grvDetail.RowCount; i++)
  363. {
  364. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  365. {
  366. FormICSTuiKuAdd add = new FormICSTuiKuAdd(grvDetail.GetRowCellValue(i, colVouchCode).ToString(), grvDetail.GetRowCellValue(i, colVouchRow).ToString(), grvDetail.GetRowCellValue(i, colSubInvCode).ToString(), grvDetail.GetRowCellValue(i, colWHCode).ToString(), grvDetail.GetRowCellValue(i, colQuantity).ToString(), grvDetail.GetRowCellValue(i, colMUSER).ToString());
  367. }
  368. }
  369. ICSBaseSimpleCode.AppshowMessageBox(0, "保存成功");
  370. btnRefresh_Click(null, null);
  371. }
  372. catch (Exception ex)
  373. {
  374. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  375. return;
  376. }
  377. }
  378. }
  379. #endregion
  380. #region 删除
  381. private void btnDel_Click(object sender, EventArgs e)
  382. {
  383. int Count = 0;
  384. grvDetail.PostEditor();
  385. this.Validate();
  386. if (grvDetail.RowCount == 0)
  387. return;
  388. SimpleButton btntemp = (SimpleButton)sender;
  389. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  390. {
  391. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  392. return;
  393. }
  394. for (int i = 0; i < grvDetail.RowCount; i++)
  395. {
  396. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  397. {
  398. Count++;
  399. }
  400. }
  401. if (Count == 0)
  402. {
  403. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
  404. return;
  405. }
  406. if (ICSBaseSimpleCode.AppshowMessageBoxRepose("确定删除该单据吗?单据删除后无法恢复,确定吗?") != DialogResult.OK)
  407. {
  408. return;
  409. }
  410. else
  411. {
  412. try
  413. {
  414. for (int i = 0; i < grvDetail.RowCount; i++)
  415. {
  416. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  417. {
  418. FormICSTuiKuAdd add = new FormICSTuiKuAdd(grvDetail.GetRowCellValue(i, colVouchCode).ToString(), grvDetail.GetRowCellValue(i, colSubInvCode).ToString(), grvDetail.GetRowCellValue(i, colVouchRow).ToString(), grvDetail.GetRowCellValue(i, colWHCode).ToString(), grvDetail.GetRowCellValue(i, colQuantity).ToString());
  419. }
  420. }
  421. ICSBaseSimpleCode.AppshowMessageBox(0, "删除成功");
  422. btnRefresh_Click(null, null);
  423. }
  424. catch (Exception ex)
  425. {
  426. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  427. return;
  428. }
  429. }
  430. }
  431. #endregion
  432. #region
  433. private void btnPrint_Click(object sender, EventArgs e)
  434. {
  435. string LotNO = "";
  436. int Count = 0, Sum = 0;
  437. SimpleButton btntemp = (SimpleButton)sender;
  438. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  439. {
  440. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  441. return;
  442. }
  443. List<ICSITEMLot> InfoList = new List<ICSITEMLot>();
  444. List<PrintPara> parasList = new List<PrintPara>();
  445. for (int i = 0; i < grvDetail.RowCount; i++)
  446. {
  447. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  448. {
  449. if (grvDetail.GetRowCellValue(i, colVouchRow).ToString() == "")
  450. {
  451. Count++;
  452. }
  453. else
  454. {
  455. Sum++;
  456. }
  457. }
  458. }
  459. if (Sum > 0)
  460. {
  461. if (Count == 0)
  462. {
  463. for (int i = 0; i < grvDetail.RowCount; i++)
  464. {
  465. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  466. {
  467. if (!(grvDetail.GetRowCellValue(i, colVouchRow).ToString() == ""))
  468. {
  469. ICSITEMLot Info = new ICSITEMLot();
  470. Info.LotNO = grvDetail.GetRowCellValue(i, colVouchRow).ToString();
  471. InfoList.Add(Info);
  472. PrintPara para = new PrintPara();
  473. para.PrintKey = "LotNO";
  474. para.PrintValues = new object[] { grvDetail.GetRowCellValue(i, colVouchRow).ToString() };
  475. parasList.Add(para);
  476. ICSRdrecord2LOTBLL.updatePrint(InfoList, AppConfig.AppConnectString);
  477. }
  478. }
  479. }
  480. FormPrintDialog f = new FormPrintDialog("007", this.Text, parasList, false, null);
  481. f.ShowDialog();
  482. btnRefresh_Click(null, null);
  483. return;
  484. }
  485. else
  486. {
  487. ICSBaseSimpleCode.AppshowMessageBox("不能同时选择已经生成条码和未生成条码的退料单");
  488. return;
  489. }
  490. }
  491. if (Count == 0)
  492. {
  493. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
  494. return;
  495. }
  496. for (int i = 0; i < grvDetail.RowCount; i++)
  497. {
  498. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  499. {
  500. SqlConnection conn = new System.Data.SqlClient.SqlConnection(AppConfig.AppConnectString);
  501. conn.Open();
  502. SqlTransaction sqlTran = conn.BeginTransaction();
  503. SqlCommand cmd = new SqlCommand();
  504. cmd.Transaction = sqlTran;
  505. cmd.Connection = conn;
  506. try
  507. {
  508. DateTime time = DateTime.Now;
  509. string timeStr = "T" + time.ToString("yyMMdd");
  510. int m = 0;
  511. string sql = @"SELECT MAX(A.LotNO) AS LOTNO FROM ICSITEMLot A WHERE A.LotNO LIKE '{0}%' AND LEN(a.LotNO) = 10";
  512. sql = string.Format(sql, timeStr);
  513. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
  514. if (dt != null && dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["LotNO"].ToString()))
  515. {
  516. LotNO = dt.Rows[0]["LOTNO"].ToString();
  517. m = int.Parse(LotNO.Substring(7, 3));
  518. }
  519. ICSITEMLot Info = new ICSITEMLot();
  520. Info.ID = "";
  521. Info.LOTQTY = Decimal.Parse(grvDetail.GetRowCellValue(i, colQuantity).ToString());
  522. string add = "";
  523. if (m + i + 1 < 9)
  524. {
  525. add = "00" + (m + i + 1).ToString();
  526. }
  527. else if (m + i + 1 < 99)
  528. {
  529. add = "0" + (m + i + 1).ToString();
  530. }
  531. else
  532. {
  533. add = (m + i + 1).ToString();
  534. }
  535. Info.LotNO = timeStr + add;
  536. Info.LOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQuantity).ToString());
  537. Info.TransNO = grvDetail.GetRowCellValue(i, colVouchCode).ToString();
  538. Info.TransLine = grvDetail.GetRowCellValue(i, colVouchRow).ToString();
  539. Info.ItemCode = grvDetail.GetRowCellValue(i, colSubInvCode).ToString();
  540. Info.VenderLotNO = Info.LotNO + (m + 1).ToString().PadLeft(4, '0');
  541. Info.PRODUCTDATE = time;
  542. Info.ACTIVE = "Y";
  543. Info.Exdate = Convert.ToDateTime("2999-12-31");
  544. Info.TYPE = "退料";
  545. string sqlText = @"UPDATE ICSMaterialPick SET SubInvCode = '{0}' WHERE VouchCode = '" + Info.TransNO + "' AND VouchRow = '" + Info.TransLine + "'";
  546. sqlText = string.Format(sqlText, Info.LotNO);
  547. cmd.CommandText = sqlText;
  548. cmd.ExecuteNonQuery();
  549. cmd.Transaction.Commit();
  550. #region
  551. Info.lastPrintUSERID = AppConfig.UserId;
  552. Info.lastPrintTime = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  553. Info.WorkPoint = AppConfig.WorkPointCode;
  554. InfoList.Add(Info);
  555. PrintPara para = new PrintPara();
  556. para.PrintKey = "LotNO";
  557. para.PrintValues = new object[] { Info.LotNO };
  558. parasList.Add(para);
  559. #endregion
  560. }
  561. catch
  562. {
  563. cmd.Transaction.Rollback();
  564. }
  565. }
  566. }
  567. ICSRdrecord2LOTBLL.Add(InfoList, AppConfig.AppConnectString);
  568. FormPrintDialog x = new FormPrintDialog("007", this.Text, parasList, false, null);
  569. x.ShowDialog();
  570. ICSRdrecord2LOTBLL.updatePrint(InfoList, AppConfig.AppConnectString);
  571. btnRefresh_Click(null, null);
  572. }
  573. #endregion
  574. #region 打印
  575. private void btnPrintM_Click(object sender, EventArgs e)
  576. {
  577. SimpleButton btntemp = (SimpleButton)sender;
  578. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  579. {
  580. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  581. return;
  582. }
  583. if (grvDetail.FocusedRowHandle < 0)
  584. {
  585. return;
  586. }
  587. try
  588. {
  589. List<PrintPara> barCodeList = new List<PrintPara>();
  590. for (int i = 0; i < grvDetail.RowCount; i++)
  591. {
  592. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  593. {
  594. string barCode = grvDetail.GetRowCellValue(i, colVouchCode).ToString();
  595. PrintPara printInfo = new PrintPara();
  596. printInfo.PrintKey = "VouchCode";
  597. printInfo.PrintValues = new object[] { barCode };
  598. barCodeList.Add(printInfo);
  599. }
  600. }
  601. if (barCodeList.Count == 0)
  602. {
  603. ICSBaseSimpleCode.AppshowMessageBox("没有选择数据");
  604. return;
  605. }
  606. FormPrintDialog printDialog = new FormPrintDialog("015", "ICSProduct", barCodeList, false, null);
  607. printDialog.ShowDialog();
  608. }
  609. catch (Exception ex)
  610. {
  611. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  612. }
  613. }
  614. #endregion
  615. }
  616. }