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

611 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 ICSSoft.Base.Lable.PrintTool;
  26. using DevExpress.XtraPrinting;
  27. using ICSSoft.Frame.Data.Entity;
  28. namespace ICSSoft.Frame.APP
  29. {
  30. public partial class FormICSItemBackNew : DevExpress.XtraEditors.XtraForm
  31. {
  32. private string sqltxt = "";
  33. private string sqlconn = "";
  34. String guid = AppConfig.GetGuid();
  35. private DataTable dataSource = null;
  36. private DataTable dataSourceAll = null;
  37. private string MoId = "";
  38. private string MoCode = "";
  39. private decimal Qty = 0.00m;
  40. #region 构造函数
  41. public FormICSItemBackNew()
  42. {
  43. InitializeComponent();
  44. this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  45. this.WindowState = FormWindowState.Maximized;
  46. }
  47. public FormICSItemBackNew(string moID, string moCode, decimal qty)
  48. {
  49. InitializeComponent();
  50. this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  51. this.WindowState = FormWindowState.Maximized;
  52. MoId = moID;
  53. MoCode = moCode;
  54. Qty = qty;
  55. }
  56. #endregion
  57. #region 操作权限
  58. public DataTable RightOfExute()
  59. {
  60. DataTable rData = new DataTable();
  61. rData.Columns.Add("BtnName");
  62. rData.Columns.Add("ActionName");
  63. //查看权限(必须有)
  64. DataRow seeRow = rData.NewRow();
  65. seeRow["BtnName"] = "see";
  66. seeRow["ActionName"] = "查看";
  67. rData.Rows.Add(seeRow);
  68. List<Control> ControlList = new List<Control>();
  69. ControlList.Add(btnPrint);
  70. ControlList.Add(btnOutPut);
  71. ControlList.Add(btnModify);
  72. //ControlList.Add(btnCreate);
  73. ControlList.Add(simpleButton1);
  74. foreach (Control ctr in ControlList)
  75. {
  76. if (ctr.GetType() == typeof(SimpleButton))
  77. {
  78. DataRow dr = rData.NewRow();
  79. dr["BtnName"] = ctr.Name;
  80. dr["ActionName"] = ctr.Text;
  81. rData.Rows.Add(dr);
  82. }
  83. }
  84. rData.AcceptChanges();
  85. return rData;
  86. }
  87. public DataTable RightOfData()// 数据权限
  88. {
  89. DataTable rData = new DataTable();
  90. rData.Columns.Add("BodyName");
  91. rData.Columns.Add("ControlName");
  92. rData.Columns.Add("ControlCaption");
  93. rData.AcceptChanges();
  94. return rData;
  95. }
  96. #endregion
  97. #region 退出
  98. private void btnClose_Click(object sender, EventArgs e)
  99. {
  100. AppConfig.CloseFormShow(this.Text);
  101. this.Close();
  102. }
  103. private void btnExit_Click(object sender, EventArgs e)
  104. {
  105. AppConfig.CloseFormShow(this.Text);
  106. this.Close();
  107. }
  108. #endregion
  109. #region 移动窗体
  110. private const int WM_NCHITTEST = 0x84;
  111. private const int HTCLIENT = 0x1;
  112. private const int HTCAPTION = 0x2;
  113. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  114. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  115. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  116. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  117. //重写窗体,使窗体可以不通过自带标题栏实现移动
  118. protected override void WndProc(ref Message m)
  119. {
  120. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  121. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  122. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  123. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  124. switch (m.Msg)
  125. {
  126. case WM_NCHITTEST:
  127. base.WndProc(ref m);
  128. if ((int)m.Result == HTCLIENT)
  129. m.Result = (IntPtr)HTCAPTION;
  130. return;
  131. }
  132. //拦截双击标题栏、移动窗体的系统消息
  133. if (m.Msg != 0xA3)
  134. {
  135. base.WndProc(ref m);
  136. }
  137. }
  138. #endregion
  139. #region 列表
  140. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  141. {
  142. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  143. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  144. }
  145. #endregion
  146. #region 双击
  147. private void grvDetail_DoubleClick(object sender, EventArgs e)
  148. {
  149. if (grvDetail.FocusedRowHandle < 0)
  150. {
  151. return;
  152. }
  153. if (grvDetail.FocusedColumn == colisSelect)
  154. {
  155. if (grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colisSelect).ToString() == "")
  156. {
  157. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "Y");
  158. }
  159. else
  160. {
  161. grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "");
  162. }
  163. }
  164. }
  165. #endregion
  166. //加载
  167. private void FormICSItemBackNew_Load(object sender, EventArgs e)
  168. {
  169. init();
  170. }
  171. #region 初始化查询条件
  172. private void init()
  173. {
  174. #region 生产订单号
  175. string sql = "SELECT DISTINCT MOCODE AS [生产订单号] FROM ICSMO WHERE WorkPoint='{0}' ORDER BY MOCODE ";
  176. sql = string.Format(sql, AppConfig.WorkPointCode);
  177. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  178. txtMOCode.Properties.ValueMember = "生产订单号";
  179. txtMOCode.Properties.DisplayMember = "生产订单号";
  180. txtMOCode.Properties.DataSource = dt;
  181. txtMOCode.Properties.NullText = "";//空时的值
  182. txtMOCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  183. txtMOCode.Properties.ValidateOnEnterKey = true;//回车确认
  184. txtMOCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  185. txtMOCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  186. //自适应宽度
  187. txtMOCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  188. #endregion
  189. }
  190. #endregion
  191. private void loadData()
  192. {
  193. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  194. try
  195. {
  196. _wait.Show();
  197. dataSourceAll = null;
  198. dataSource = null;
  199. if (string.IsNullOrWhiteSpace(txtMOCode.Text.Trim()))
  200. {
  201. _wait.Close();
  202. ICSBaseSimpleCode.AppshowMessageBox("请输入生产订单号!");
  203. return;
  204. }
  205. string Where = txtMOCode.Text.Trim();
  206. #region 查询
  207. if (!string.IsNullOrWhiteSpace(cmbSEQ.Text.Trim()))
  208. {
  209. Where += "' AND e.MOSEQ='" + cmbSEQ.Text.Trim() + " ";
  210. }
  211. string sql = @" SELECT '' AS isSelect,
  212. e.MOCODE,
  213. e.MOSEQ,
  214. e.ITEMCODE,
  215. b.INVNAME,
  216. b.INVSTD AS INVTYPE,
  217. c.MOBITEMCODE,
  218. d.INVNAME AS CINVNAME,
  219. d.INVSTD AS CINVTYPE,
  220. d.INVUOM,
  221. CAST(ISNULL(c.MOBITEMQTY, 0)*e.MOPLANQTY AS DECIMAL(18,2)) AS QTY,
  222. f.LotNO,
  223. CASE WHEN f.LotNO IS NULL THEN '0' ELSE '1' END AS HasLotNO,
  224. CASE WHEN d.INVCODE LIKE '3%' THEN '' WHEN d.INVCODE LIKE '2%' THEN '' ELSE '' END AS TYPE,
  225. CAST(ISNULL(g.QTY, 0) AS DECIMAL(18,2)) AS QTYB,
  226. g.STATUS,
  227. g.MUSERName,
  228. g.MTIME,
  229. g.ID
  230. FROM
  231. ICSMO e
  232. LEFT JOIN ICSINVENTORY b ON e.ITEMCODE = b.INVCODE
  233. LEFT JOIN ICSMOBOM c ON e.MOCODE = c.MOCODE AND c.SEQ=e.MOSEQ AND e.ITEMCODE = c.ITEMCODE
  234. LEFT JOIN ICSINVENTORY d ON c.MOBITEMCODE = d.INVCODE
  235. LEFT JOIN ICSItemBack g ON c.MOCODE=g.MOCODE AND c.SEQ=g.MOSEQ AND c.MOBITEMCODE=g.INVCode
  236. LEFT JOIN
  237. (
  238. SELECT DISTINCT
  239. h.TransNO,
  240. h.TransLine,
  241. h.ITEMCODE,
  242. i.LotNO,
  243. j.MTIME
  244. FROM
  245. ICSITEMTrans h
  246. INNER JOIN ICSITEMTransLot i ON h.ID=i.ITEMTransID AND h.WorkPoint=i.WorkPoint
  247. INNER JOIN ICSWareHouseLotInfo j ON i.LotNO=j.LotNO AND i.WorkPoint=j.WorkPoint
  248. WHERE h.TransType='' AND h.TransNO='{2}' AND h.WorkPoint='{1}'
  249. AND j.MTIME=
  250. (
  251. SELECT MIN(m.MTIME)
  252. FROM
  253. ICSITEMTrans k
  254. INNER JOIN ICSITEMTransLot l ON k.ID=l.ITEMTransID AND k.WorkPoint=l.WorkPoint
  255. INNER JOIN ICSWareHouseLotInfo m ON l.LotNO=m.LotNO AND l.WorkPoint=m.WorkPoint
  256. WHERE k.TransType='' AND h.TransNO=k.TransNO AND h.ITEMCODE=k.ITEMCODE
  257. GROUP BY k.TransNO,k.TransLine,k.ITEMCODE
  258. )
  259. ) f ON c.MOCODE=f.TransNO AND c.MOBITEMCODE=f.ITEMCODE
  260. WHERE e.MOCODE='{0}' AND
  261. e.WorkPoint = '{1}'
  262. ORDER BY e.MOSEQ,c.MOBOMLINE,c.MOBITEMCODE
  263. ";
  264. sql = string.Format(sql, Where, AppConfig.WorkPointCode, txtMOCode.Text.Trim());
  265. DataSet ds = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql);
  266. if (ds != null && ds.Tables.Count == 1)
  267. {
  268. dataSourceAll = ds.Tables[0];
  269. DataView dv = dataSourceAll.Copy().DefaultView;
  270. dv.RowFilter = "HasLotNO='1'";
  271. dataSource = dv.ToTable().Copy();
  272. if (chkAll.Checked)
  273. grdDetail.DataSource = dataSourceAll;
  274. else
  275. grdDetail.DataSource = dataSource;
  276. grvDetail.BestFitColumns();
  277. }
  278. #endregion
  279. _wait.Close();
  280. }
  281. catch (Exception ex)
  282. {
  283. _wait.Close();
  284. ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
  285. }
  286. }
  287. private void txtMOCode_EditValueChanged(object sender, EventArgs e)
  288. {
  289. grdDetail.DataSource = null;
  290. cmbSEQ.Text = "";
  291. cmbSEQ.Properties.Items.Clear();
  292. string MOCode = txtMOCode.EditValue.ToString();
  293. string sql = "SELECT MOSEQ FROM ICSMO WHERE WorkPoint='{0}' AND MOCODE='{1}' ORDER BY MOSEQ";
  294. sql = string.Format(sql, AppConfig.WorkPointCode, MOCode);
  295. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  296. cmbSEQ.Properties.Items.Add("");
  297. cmbSEQ.Properties.Items.AddRange(dt.AsEnumerable().Select(a=>a["MOSEQ"]).ToList());
  298. loadData();
  299. }
  300. private void cmbSEQ_SelectedIndexChanged(object sender, EventArgs e)
  301. {
  302. grdDetail.DataSource = null;
  303. loadData();
  304. }
  305. #region 导出
  306. private void btnOutPut_Click(object sender, EventArgs e)
  307. {
  308. SimpleButton btntemp = (SimpleButton)sender;
  309. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  310. {
  311. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  312. return;
  313. }
  314. FormOutExcel foe = new FormOutExcel(this.Tag.ToString(), grdDetail);
  315. foe.ShowDialog();
  316. }
  317. #endregion
  318. #region 打印
  319. private void btnPrint_Click(object sender, EventArgs e)
  320. {
  321. try
  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. if (string.IsNullOrWhiteSpace(txtMOCode.EditValue.ToString()))
  330. {
  331. ICSBaseSimpleCode.AppshowMessageBox("请选择生产订单号!");
  332. return;
  333. }
  334. List<PrintPara> parasList = new List<PrintPara>();
  335. PrintPara para = new PrintPara();
  336. para.PrintKey = "MOCODE";
  337. para.PrintValues = new object[] { txtMOCode.EditValue };
  338. parasList.Add(para);
  339. if (parasList.Count == 0)
  340. {
  341. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
  342. return;
  343. }
  344. FormPrintDialog f = new FormPrintDialog("018", this.Text, parasList, false, null);
  345. f.ShowDialog();
  346. }
  347. catch (Exception ex)
  348. {
  349. MessageBox.Show(ex.ToString());
  350. }
  351. }
  352. #endregion
  353. #region 保存
  354. private void btnModify_Click(object sender, EventArgs e)
  355. {
  356. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  357. try
  358. {
  359. _wait.Show();
  360. SimpleButton btntemp = (SimpleButton)sender;
  361. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  362. {
  363. _wait.Close();
  364. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  365. return;
  366. }
  367. List<ICSItemBack> editList = new List<ICSItemBack>();
  368. for (int i = 0; i < grvDetail.RowCount; i++)
  369. {
  370. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  371. {
  372. if (grvDetail.GetRowCellValue(i, colSTATUS).ToString() == "已退")
  373. {
  374. _wait.Close();
  375. ICSBaseSimpleCode.AppshowMessageBox("已退状态不能保存!");
  376. return;
  377. }
  378. if (Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString()) <= 0)
  379. {
  380. _wait.Close();
  381. ICSBaseSimpleCode.AppshowMessageBox("请填写正确的退库数量!");
  382. return;
  383. }
  384. ICSItemBack entity = new ICSItemBack();
  385. entity.ID = grvDetail.GetRowCellValue(i, colID).ToString();
  386. entity.MOCODE = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  387. entity.MOSEQ = grvDetail.GetRowCellValue(i, colMOSEQ).ToString();
  388. entity.INVCode = grvDetail.GetRowCellValue(i, colMOBITEMCODE).ToString();
  389. entity.QTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString());
  390. entity.STATUS = "初始";
  391. editList.Add(entity);
  392. }
  393. }
  394. if (editList.Count <= 0)
  395. {
  396. _wait.Close();
  397. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!!!");
  398. return;
  399. }
  400. ICSItemBackBLL.AddandEditList(editList, AppConfig.AppConnectString);
  401. _wait.Close();
  402. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  403. loadData();
  404. }
  405. catch (Exception ex)
  406. {
  407. _wait.Close();
  408. MessageBox.Show(ex.ToString());
  409. }
  410. }
  411. #endregion
  412. #region 生成条码
  413. private void btnCreate_Click(object sender, EventArgs e)
  414. {
  415. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
  416. try
  417. {
  418. _wait.Show();
  419. SimpleButton btntemp = (SimpleButton)sender;
  420. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  421. {
  422. _wait.Close();
  423. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  424. return;
  425. }
  426. List<ICSITEMLot> InfoList = new List<ICSITEMLot>();
  427. for (int i = 0; i < grvDetail.RowCount; i++)
  428. {
  429. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  430. {
  431. if (grvDetail.GetRowCellValue(i, colLotNO).ToString() != "")
  432. {
  433. _wait.Close();
  434. ICSBaseSimpleCode.AppshowMessageBox("已生成条码不能再次生成!");
  435. return;
  436. }
  437. if (Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString()) <= 0)
  438. {
  439. _wait.Close();
  440. ICSBaseSimpleCode.AppshowMessageBox("请填写正确的退库数量!");
  441. return;
  442. }
  443. ICSITEMLot Info = new ICSITEMLot();
  444. DateTime time = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
  445. Info.ID = "";
  446. Info.LOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString());
  447. Info.LotNO = time.ToString("yyyyMMddHHmmss") + grvDetail.GetRowCellValue(i, colMOBITEMCODE).ToString();
  448. Info.ItemCode = grvDetail.GetRowCellValue(i, colMOBITEMCODE).ToString();
  449. Info.TransNO = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
  450. //Info.TransLine =Convert.ToInt32(grvDetail.GetRowCellValue(i, colMOSEQ).ToString());
  451. Info.TransLine = grvDetail.GetRowCellValue(i, colMOSEQ).ToString();
  452. Info.VenderLotNO = time.ToString("yyMMdd").Substring(time.ToString("yyMMdd").Length - 6) + "0001"; //生产批号,每个工单一个
  453. Info.PRODUCTDATE = time.Date;
  454. Info.ACTIVE = "Y";
  455. Info.Exdate = Convert.ToDateTime("2999-12-31");
  456. Info.TYPE = grvDetail.GetRowCellValue(i, colTYPE).ToString();
  457. InfoList.Add(Info);
  458. }
  459. }
  460. if (InfoList.Count <= 0)
  461. {
  462. _wait.Close();
  463. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!!!");
  464. return;
  465. }
  466. ICSRdrecord2LOTBLL.Add(InfoList, AppConfig.AppConnectString);
  467. _wait.Close();
  468. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  469. loadData();
  470. }
  471. catch (Exception ex)
  472. {
  473. _wait.Close();
  474. MessageBox.Show(ex.ToString());
  475. }
  476. }
  477. #endregion
  478. #region 打印条码
  479. private void simpleButton1_Click(object sender, EventArgs e)
  480. {
  481. try
  482. {
  483. SimpleButton btntemp = (SimpleButton)sender;
  484. if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
  485. {
  486. ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
  487. return;
  488. }
  489. bool identical = true;
  490. string type = "";
  491. List<PrintPara> parasList = new List<PrintPara>();
  492. List<ICSITEMLot> InfoList = new List<ICSITEMLot>();
  493. for (int i = 0; i < grvDetail.RowCount; i++)
  494. {
  495. if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  496. {
  497. if (grvDetail.GetRowCellValue(i, colLotNO).ToString() == "")
  498. {
  499. ICSBaseSimpleCode.AppshowMessageBox("没有此物料对应的领料信息!");
  500. return;
  501. }
  502. if (!string.IsNullOrWhiteSpace(type) && !type.Equals(grvDetail.GetRowCellValue(i, colTYPE).ToString()))
  503. {
  504. identical = false;
  505. break;
  506. }
  507. type = grvDetail.GetRowCellValue(i, colTYPE).ToString();
  508. PrintPara para = new PrintPara();
  509. para.PrintKey = "LOTNO";
  510. para.PrintValues = new object[] { grvDetail.GetRowCellValue(i, colLotNO).ToString() };
  511. parasList.Add(para);
  512. ICSITEMLot Info = new ICSITEMLot();
  513. Info.LotNO = grvDetail.GetRowCellValue(i, colLotNO).ToString();
  514. //Info.PrintTimes = Convert.ToInt32(grvDetail.GetRowCellValue(i, colPrintTimes).ToString()) + 1;
  515. Info.lastPrintUSERID = AppConfig.UserId;
  516. Info.lastPrintTime = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  517. Info.WorkPoint = AppConfig.WorkPointCode;
  518. InfoList.Add(Info);
  519. }
  520. }
  521. if (!identical)
  522. {
  523. ICSBaseSimpleCode.AppshowMessageBox("类型不同,不能打印!");
  524. return;
  525. }
  526. if (parasList.Count == 0)
  527. {
  528. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
  529. return;
  530. }
  531. if (type.Equals("半成品"))
  532. {
  533. FormPrintDialog f = new FormPrintDialog("007", this.Text, parasList, false, null);
  534. f.ShowDialog();
  535. }
  536. else if (type.Equals("成品"))
  537. {
  538. FormPrintDialog f = new FormPrintDialog("008", this.Text, parasList, false, null);
  539. f.ShowDialog();
  540. }
  541. else
  542. {
  543. FormPrintDialog f = new FormPrintDialog("006", this.Text, parasList, false, null);
  544. f.ShowDialog();
  545. }
  546. //更新打印信息
  547. ICSRdrecord2LOTBLL.updatePrint(InfoList, AppConfig.AppConnectString);
  548. }
  549. catch (Exception ex)
  550. {
  551. MessageBox.Show(ex.ToString());
  552. }
  553. }
  554. #endregion
  555. private void chkAll_CheckedChanged(object sender, EventArgs e)
  556. {
  557. if (chkAll.Checked)
  558. grdDetail.DataSource = dataSourceAll;
  559. else
  560. grdDetail.DataSource = dataSource;
  561. grvDetail.BestFitColumns();
  562. }
  563. }
  564. }