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

107 lines
3.1 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using DevExpress.XtraEditors;
  9. using System.Data.SqlClient;
  10. using ICSSoft.Frame.APP;
  11. using System.Configuration;
  12. using ICSSoft.Frame.APP.Helper;
  13. using ICSSoft.Frame.APP.Model;
  14. using DevExpress.XtraGrid.Columns;
  15. using System.Linq;
  16. namespace ICSSoft.Frame.APP
  17. {
  18. public partial class FormItemLotBatchInput : DevExpress.XtraEditors.XtraForm
  19. {
  20. public DataTable itemLotnoMsg { get; set; }
  21. Func<List<string>, DataTable> Func { get; set; }
  22. public FormItemLotBatchInput(Func<List<string>,DataTable> func)
  23. {
  24. InitializeComponent();
  25. this.Func = func;
  26. }
  27. private void btnOK_Click(object sender, EventArgs e)
  28. {
  29. if (this.itemLotnoMsg == null || this.itemLotnoMsg.Rows.Count <= 0)
  30. {
  31. ICSBaseSimpleCode.AppshowMessageBox("请先扫描物料条码!");
  32. return;
  33. }
  34. this.DialogResult = DialogResult.OK;
  35. this.Close();
  36. }
  37. private void FormEcAdd_Load(object sender, EventArgs e)
  38. {
  39. }
  40. private void btnEditDel_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
  41. {
  42. try
  43. {
  44. var selectValue = grvDetail.GetFocusedRowCellValue(colItemLotNo).ToString();
  45. itemLotnoMsg.Rows.Remove(itemLotnoMsg.AsEnumerable().Where(a => a["ItemLotNo"].ToString() == selectValue).FirstOrDefault());
  46. grvDetail.RefreshData();
  47. }
  48. catch (Exception ex)
  49. {
  50. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  51. }
  52. }
  53. private void btnCancle_Click(object sender, EventArgs e)
  54. {
  55. this.DialogResult = DialogResult.Cancel;
  56. this.Close();
  57. }
  58. private void btnClose_Click(object sender, EventArgs e)
  59. {
  60. this.DialogResult = DialogResult.Cancel;
  61. this.Close();
  62. }
  63. private void txtItemLotNo_KeyPress(object sender, KeyPressEventArgs e)
  64. {
  65. try
  66. {
  67. if (e.KeyChar != (char)Keys.Enter)
  68. return;
  69. List<string> itemlotNos = new List<string>();
  70. if (itemLotnoMsg != null && itemLotnoMsg.Rows.Count > 0)
  71. {
  72. itemlotNos = itemLotnoMsg.AsEnumerable().Select(a => a["ItemLotNo"].ToString()).ToList();
  73. }
  74. itemlotNos.Add(this.txtItemLotNo.Text);
  75. var table=Func.Invoke(itemlotNos);
  76. itemLotnoMsg = table;
  77. this.grdDetail.DataSource = itemLotnoMsg;
  78. this.grvDetail.BestFitColumns();
  79. txtItemLotNo.Focus();
  80. txtItemLotNo.Text = "";
  81. }
  82. catch (Exception ex)
  83. {
  84. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  85. }
  86. }
  87. }
  88. }