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 FormICSAgvKgOrWg : DevExpress.XtraEditors.XtraForm { string Lotno; string Opcode; string Eqpcode; string Type;string Itemcode;decimal OnQty; public FormICSAgvKgOrWg() { InitializeComponent(); } public FormICSAgvKgOrWg(string Lotno,string Opcode,string Eqpcode,string Type,string Itemcode, decimal OnQty) { InitializeComponent(); this.Lotno = Lotno; this.Opcode = Opcode; this.Eqpcode = Eqpcode; this.Type = Type; this.Itemcode = Itemcode; this.OnQty = OnQty; init(); } private string check() { string msg = ""; if (TxtLocation.Text.Trim() == "") msg += "请选择点位!\n"; return msg; } private void btnOK_Click(object sender, EventArgs e) { try { string msg = check(); if (!string.IsNullOrEmpty(msg)) { ICSBaseSimpleCode.AppshowMessageBox(msg); return; } ICSAGVTASKLOG Log = new ICSAGVTASKLOG(); AGVCreateTaskModel model = new AGVCreateTaskModel(); Log.ID = AppConfig.GetGuid(); Log.Lotno = Lotno; Log.Opcode = Opcode; Log.Itemcode = Itemcode; Log.LocationCode = TxtLocation.EditValue.ToString(); Log.Mtime= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Log.MuserName = AppConfig.UserName; Log.Qty = OnQty; switch (Type) { case "开工"://区域到点位 Log.TaskType = "中间工序开工"; Log.Area = ICSAGVBLL.GetAreaCode("00088", "7", AppConfig.AppConnectString,AppConfig.WorkPointCode).Split('@')[0].Split(':')[0]; model.type = "true"; break; case "完工"://点位到待检区域 Log.TaskType = "工序完工"; Log.Area = ICSAGVBLL.GetAreaCode("00088", "1", AppConfig.AppConnectString, AppConfig.WorkPointCode).Split('@')[1].Split(':')[0]; model.type = "false"; break; default: throw new Exception("类型参数不正确"); } model.area = Log.Area; model.station = Log.LocationCode; model.materialCode = Log.Itemcode; model.trackingNumber = Lotno; model.qty = (int)OnQty; model.trackingNumber = Lotno; var mes=ICSAGVBLL.CreateAGVTaskJJorBack(new List() { model },new List() { Log },AppConfig.AppConnectString,AppConfig.WorkPointCode); if (string.IsNullOrEmpty(mes)) { ICSBaseSimpleCode.AppshowMessageBox("调用成功!"); this.Close(); } else throw new Exception(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 #region 初始化查询条件 private void init() { #region 点位 string sql = @"select a.locationcode as 点位编码,b.LocationName as 点位名称 from IcsEqpWithLocation a left join IcsAGVLocation b on a.locationcode=b.locationcode where eqpcode='{0}'"; sql = string.Format(sql,Eqpcode); DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0]; TxtLocation.Properties.ValueMember = "点位编码"; TxtLocation.Properties.DisplayMember = "点位编码"; 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; #endregion } #endregion private void TxtLocation_EditValueChanged(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(); } } } }