华恒Mes鼎捷代码
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.

134 lines
4.5 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 System.Data.SqlClient;
  10. using ICSSoft.Frame.Data.BLL;
  11. using ICSSoft.Base.Language.Tool;
  12. using ICSSoft.Base.UserControl.MessageControl;
  13. using ICSSoft.Base.Report.Filter;
  14. using ICSSoft.Base.Config.DBHelper;
  15. using ICSSoft.Base.UserControl.FormControl;
  16. using ICSSoft.Base.ReferForm.AppReferForm;
  17. using ICSSoft.Base.Lable.PrintTool;
  18. using ICSSoft.Base.Config.AppConfig;
  19. using ICSSoft.Base.Report.GridReport;
  20. using ICSSoft.Frame.APP.Entity;
  21. using ICSSoft.Frame.APP;
  22. using ICSSoft.Frame.Data.Entity;
  23. using ICSSoft.Frame.Common;
  24. namespace ICSSoft.Frame.APP
  25. {
  26. public partial class FormICSAGVContainer : DevExpress.XtraEditors.XtraForm
  27. {
  28. AGVCreateTaskModel Model;
  29. ICSAGVTASKLOG Log;
  30. public FormICSAGVContainer()
  31. {
  32. InitializeComponent();
  33. }
  34. public FormICSAGVContainer(AGVCreateTaskModel Model, ICSAGVTASKLOG Log)
  35. {
  36. InitializeComponent();
  37. this.Model = Model;
  38. this.Log = Log;
  39. string sql = @"select EnumValue as 点位编码,EnumText as 点位名称 from Sys_EnumValues where enumkey='00089'";
  40. TxtLocation.Properties.ValueMember = "点位编码";
  41. TxtLocation.Properties.DisplayMember = "点位编码";
  42. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  43. TxtLocation.Properties.DataSource = dt;
  44. TxtLocation.Properties.NullText = "";//空时的值
  45. TxtLocation.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  46. TxtLocation.Properties.ValidateOnEnterKey = true;//回车确认
  47. TxtLocation.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  48. TxtLocation.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容 //自适应宽度
  49. TxtLocation.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  50. }
  51. private string check()
  52. {
  53. string msg = "";
  54. if (TxtContainer.Text.Trim() == "")
  55. msg += "请输入"+lableCode.Text+"!\n";
  56. return msg;
  57. }
  58. private void btnOK_Click(object sender, EventArgs e)
  59. {
  60. try
  61. {
  62. string msg = check();
  63. if (!string.IsNullOrEmpty(msg))
  64. {
  65. ICSBaseSimpleCode.AppshowMessageBox(msg);
  66. return;
  67. }
  68. Model.containerCode = TxtContainer.Text.Trim();
  69. Model.station = TxtLocation.EditValue.ToString();
  70. string mes=ICSAGVBLL.CreateAGVTaskJJorBack(new List<AGVCreateTaskModel> { Model }, new List<ICSAGVTASKLOG> { Log }, AppConfig.AppConnectString, AppConfig.WorkPointCode);
  71. if (string.IsNullOrEmpty(mes))
  72. {
  73. ICSBaseSimpleCode.AppshowMessageBox("调用AGV接口成功!");
  74. this.Close();
  75. }
  76. else
  77. {
  78. ICSBaseSimpleCode.AppshowMessageBox(mes);
  79. }
  80. }
  81. catch (Exception ex) {
  82. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  83. }
  84. }
  85. #region 关闭
  86. private void btnCancle_Click(object sender, EventArgs e)
  87. {
  88. this.Close();
  89. //this.DialogResult = DialogResult.Cancel;
  90. }
  91. private void btnClose_Click(object sender, EventArgs e)
  92. {
  93. this.Close();
  94. //this.DialogResult = DialogResult.Cancel;
  95. }
  96. #endregion
  97. private void TxtLocation_EditValueChanged(object sender, EventArgs e)
  98. {
  99. }
  100. private void lableCode_Click(object sender, EventArgs e)
  101. {
  102. }
  103. private void TxtLocation_EditValueChanged_1(object sender, EventArgs e)
  104. {
  105. var o = TxtLocation.Properties.GetRowByKeyValue(TxtLocation.EditValue);
  106. if (o is DataRowView)
  107. {
  108. DataRowView RowView = o as DataRowView;
  109. TxtLocationName.Text = RowView.Row["点位名称"].ToString();
  110. }
  111. }
  112. }
  113. }