华恒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.

135 lines
4.5 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.SqlClient;
using ICSSoft.Frame.Data.BLL;
using ICSSoft.Base.Language.Tool;
using ICSSoft.Base.UserControl.MessageControl;
using ICSSoft.Base.Report.Filter;
using ICSSoft.Base.Config.DBHelper;
using ICSSoft.Base.UserControl.FormControl;
using ICSSoft.Base.ReferForm.AppReferForm;
using ICSSoft.Base.Lable.PrintTool;
using ICSSoft.Base.Config.AppConfig;
using ICSSoft.Base.Report.GridReport;
using ICSSoft.Frame.APP.Entity;
using ICSSoft.Frame.APP;
using ICSSoft.Frame.Data.Entity;
using ICSSoft.Frame.Common;
namespace ICSSoft.Frame.APP
{
public partial class FormICSAGVContainer : DevExpress.XtraEditors.XtraForm
{
AGVCreateTaskModel Model;
ICSAGVTASKLOG Log;
public FormICSAGVContainer()
{
InitializeComponent();
}
public FormICSAGVContainer(AGVCreateTaskModel Model, ICSAGVTASKLOG Log)
{
InitializeComponent();
this.Model = Model;
this.Log = Log;
string sql = @"select EnumValue as 点位编码,EnumText as 点位名称 from Sys_EnumValues where enumkey='00089'";
TxtLocation.Properties.ValueMember = "点位编码";
TxtLocation.Properties.DisplayMember = "点位编码";
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
TxtLocation.Properties.DataSource = dt;
TxtLocation.Properties.NullText = "";//空时的值
TxtLocation.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
TxtLocation.Properties.ValidateOnEnterKey = true;//回车确认
TxtLocation.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
TxtLocation.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容 //自适应宽度
TxtLocation.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
}
private string check()
{
string msg = "";
if (TxtContainer.Text.Trim() == "")
msg += "请输入"+lableCode.Text+"!\n";
return msg;
}
private void btnOK_Click(object sender, EventArgs e)
{
try
{
string msg = check();
if (!string.IsNullOrEmpty(msg))
{
ICSBaseSimpleCode.AppshowMessageBox(msg);
return;
}
Model.containerCode = TxtContainer.Text.Trim();
Model.station = TxtLocation.EditValue.ToString();
string mes=ICSAGVBLL.CreateAGVTaskJJorBack(new List<AGVCreateTaskModel> { Model }, new List<ICSAGVTASKLOG> { Log }, AppConfig.AppConnectString, AppConfig.WorkPointCode);
if (string.IsNullOrEmpty(mes))
{
ICSBaseSimpleCode.AppshowMessageBox("调用AGV接口成功!");
this.Close();
}
else
{
ICSBaseSimpleCode.AppshowMessageBox(mes);
}
}
catch (Exception ex) {
ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
}
}
#region 关闭
private void btnCancle_Click(object sender, EventArgs e)
{
this.Close();
//this.DialogResult = DialogResult.Cancel;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
//this.DialogResult = DialogResult.Cancel;
}
#endregion
private void TxtLocation_EditValueChanged(object sender, EventArgs e)
{
}
private void lableCode_Click(object sender, EventArgs e)
{
}
private void TxtLocation_EditValueChanged_1(object sender, EventArgs e)
{
var o = TxtLocation.Properties.GetRowByKeyValue(TxtLocation.EditValue);
if (o is DataRowView)
{
DataRowView RowView = o as DataRowView;
TxtLocationName.Text = RowView.Row["点位名称"].ToString();
}
}
}
}