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

147 lines
5.6 KiB

5 months ago
  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 ICSSoft.Frame.User.BLL;
  10. using ICSSoft.Base.Config.AppConfig;
  11. using ICSSoft.Base.Language.Tool;
  12. using ICSSoft.Base.UserControl.MessageControl;
  13. using ICSSoft.Base.Config.DBHelper;
  14. using ICSSoft.Base.ReferForm.AppReferForm;
  15. using ICSSoft.Frame.Data.Entity;
  16. using ICSSoft.Frame.Data.BLL;
  17. namespace ICSSoft.Frame.APP
  18. {
  19. public partial class FormICSONWIPCheckNCRSelect : DevExpress.XtraEditors.XtraForm
  20. {
  21. DataRow[] drs = null;
  22. public Action<string, string> action { get; set; }
  23. bool IsBatch = false;
  24. public FormICSONWIPCheckNCRSelect(DataRow[] drs)
  25. {
  26. InitializeComponent();
  27. IsBatch = Convert.ToBoolean(drs[0]["IsBatch"]);
  28. string CheckMode = drs[0]["CheckMode"].ToString();
  29. bool ISWWRW = Convert.ToBoolean(drs[0]["ISWWRW"]);
  30. string LOTNO = drs[0]["LOTNO"].ToString();
  31. string OPCODE = drs[0]["OPCODE"].ToString();
  32. string OPDESC = drs[0]["OPDESC"].ToString();
  33. int OPSEQ = Convert.ToInt32(drs[0]["OPSEQ"]);
  34. chkIsBatch.Properties.ReadOnly = true;
  35. chkIsBatch.Checked = IsBatch;
  36. this.drs = drs;
  37. //grdDetail.DataSource = this.dataSource;
  38. if (IsBatch)
  39. {
  40. this.listBox.Visible = true;
  41. this.Height = 263;
  42. }
  43. else
  44. {
  45. this.listBox.Visible = false;
  46. this.Height = 133;
  47. }
  48. //结果选项列表(1.非过程2.批量判,且不是委外返工退镀,容许退货)
  49. DataTable dt1 = ICSSys_EnumValuesBLL.GetNcrResultItems(IsBatch && !(OPDESC.Contains("退镀") && ISWWRW), AppConfig.WorkPointCode);
  50. txtResult.Properties.ValueMember = "结果判定";
  51. txtResult.Properties.DisplayMember = "结果判定";
  52. txtResult.Properties.DataSource = dt1;
  53. txtResult.Properties.NullText = "";
  54. txtResult.Properties.ImmediatePopup = true;
  55. txtResult.Properties.ValidateOnEnterKey = true;
  56. txtResult.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
  57. txtResult.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
  58. txtResult.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  59. //获取责任工序选项列表
  60. DataTable dt = ICSResOPBLL.GetResOPList(LOTNO, OPSEQ, AppConfig.WorkPointCode);
  61. lookupErrOP.Properties.ValueMember = "OP";
  62. lookupErrOP.Properties.DisplayMember = "OP";
  63. lookupErrOP.Properties.DataSource = dt;
  64. lookupErrOP.Properties.NullText = "";//空时的值
  65. lookupErrOP.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  66. lookupErrOP.Properties.ValidateOnEnterKey = true;//回车确认
  67. lookupErrOP.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  68. lookupErrOP.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  69. lookupErrOP.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  70. listBox.Items.Clear();
  71. if (IsBatch)
  72. {
  73. List<string> list = new List<string>();
  74. foreach (DataRow dr in drs)
  75. {
  76. if (!Convert.ToBoolean(dr["isSelect"]))
  77. {
  78. list.Add("不良类型:" + dr["UNIT"].ToString() + "数量:" + dr["SetValue"].ToString() + "不良备注:" + dr["不良备注"].ToString());
  79. }
  80. }
  81. if (list.Count > 0)
  82. {
  83. listBox.Items.Add("当前是批量处理,以下不良未选取:");
  84. listBox.Items.AddRange(list.ToArray());
  85. }
  86. }
  87. }
  88. private void btnClose_Click(object sender, EventArgs e)
  89. {
  90. this.DialogResult = DialogResult.Cancel;
  91. this.Close();
  92. }
  93. private void btnOK_Click(object sender, EventArgs e)
  94. {
  95. if (txtResult.Text == "")
  96. {
  97. ICSBaseSimpleCode.AppshowMessageBox("请选择责任判定结果");
  98. return;
  99. }
  100. if (lookupErrOP.Text == "")
  101. {
  102. ICSBaseSimpleCode.AppshowMessageBox("请选择责任工序");
  103. return;
  104. }
  105. try
  106. {
  107. if (listBox.Items.Count > 0)
  108. {
  109. if (MessageBox.Show("未勾选全部不良,是否全部勾选?", "", MessageBoxButtons.OKCancel) != DialogResult.OK)
  110. {
  111. return;
  112. }
  113. foreach (DataRow dr in drs)
  114. {
  115. dr["isSelect"] = true;
  116. }
  117. }
  118. action(txtResult.Text, lookupErrOP.Text);
  119. this.DialogResult = DialogResult.OK;
  120. this.Close();
  121. }
  122. catch (Exception ex)
  123. {
  124. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  125. }
  126. }
  127. private void btnCanncel_Click(object sender, EventArgs e)
  128. {
  129. this.DialogResult = DialogResult.Cancel;
  130. this.Close();
  131. }
  132. }
  133. }