天津康师傅调度系统
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.

127 lines
4.8 KiB

1 month ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using DBFactory;
namespace wcfControlMonitorClient
{
/// <summary>
/// Creator:Richard.liu
/// 黑匣子维护
/// </summary>
public partial class FrmPalletKindSetting : Form
{
private static FrmPalletKindSetting _formInstance;
public static FrmPalletKindSetting FormInstance
{
get
{
if (_formInstance == null)
{
_formInstance = new FrmPalletKindSetting();
isFirstShow = false;
}
return _formInstance;
}
set { _formInstance = value; }
}
public FrmPalletKindSetting()
{
InitializeComponent();
_formInstance = this;
}
static bool isFirstShow = false;
DBOperator dbo = CStaticClass.dbo;
private void button1_Click(object sender, EventArgs e)
{
try
{
int a = 0;
string searchstr = string.Empty;
if (this.cb_PalletCacheLocation.Text.Trim().Length == 0 && this.cb_PalletKind.Text.Trim().Length == 0)
{
MessageBox.Show("请选择托盘位置和托盘种类!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string sql = string.Format(" update t_base_plc_ask set F_HaveFirstProject = {0} where F_askKind = 18 and F_BindingDevice = {1}", this.cb_PalletKind.SelectedIndex+1, this.cb_PalletCacheLocation.Text);
dbo.ExceSQL(sql);
this.Close();
}
catch (Exception ex)
{
throw ex;
}
}
private void FrmDarkCasket_Load(object sender, EventArgs e)
{
if (isFirstShow == false)
{
try
{
DataView dvs = dbo.ExceSQL(" Select F_BindingDevice from t_base_plc_ask Where F_askKind = 18 and f_havefirstproject = 1 or f_havefirstproject = 2").Tables[0].DefaultView;
//cbstartposition
cb_PalletCacheLocation.ValueMember = "F_BindingDevice";
cb_PalletCacheLocation.DisplayMember = "F_BindingDevice";
cb_PalletCacheLocation.DataSource = dvs;
cb_PalletCacheLocation.SelectedIndex = -1;
//dvs = dbo.ExceSQL(" Select F_BindingDevice from t_base_plc_ask Where F_askKind = 18 and f_havefirstproject = 1 or f_havefirstproject = 2").Tables[0].DefaultView;
cb_PalletKind.ValueMember = "kind";
cb_PalletKind.DisplayMember = "kind";
//cb_PalletKind.DataSource = dvs;
cb_PalletKind.SelectedIndex = -1;
////string sql = string.Format("Delete from T_Manage_Task_BAK where FBEGTIME ='-' or ABS(datediff(day,FBEGTIME,getdate()))>{0}", CStaticClass.SaveDays);
////dbo.ExceSQL(sql);
////string sql = string.Format("Delete from T_Base_Device_Error_Log where ABS(datediff(day,F_DateTime,getdate()))>{0}", 180);
//string sql = string.Format("Delete from T_Base_Device_Error_Log where CONVERT (varchar(19) ,F_DateTime) < dateadd(day,{0},getdate())", -60);
//dbo.ExceSQL(sql);
isFirstShow = true;
}
catch (Exception ex)
{
throw ex;
}
}
}
private void FrmDarkCasket_FormClosing(object sender, FormClosingEventArgs e)
{
_formInstance = null;
}
private void cb_PalletKind_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cb_PalletCacheLocation_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.cb_PalletCacheLocation.Text.Trim().Length == 0)
{
this.currentkind.Text = "";
return;
}
string sql = string.Format(" Select F_HaveFirstProject from t_base_plc_ask Where F_askKind = 18 and F_BindingDevice ={0}", this.cb_PalletCacheLocation.Text);
DataView dvs = dbo.ExceSQL(sql).Tables[0].DefaultView;
//cbstartposition
if (dvs.Count > 0)
{
int currentindex= Convert.ToInt32(dvs[0]["F_HaveFirstProject"]);
this.currentkind.Text = this.cb_PalletKind.Items[currentindex-1].ToString();
}
}
}
}