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.
222 lines
7.6 KiB
222 lines
7.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DBFactory;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
public partial class FrmDemoSet : Form
|
|
{
|
|
private static FrmDemoSet _formInstance;
|
|
public static FrmDemoSet FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmDemoSet();
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
StringBuilder sql = new StringBuilder();
|
|
DBOperator dbo = new DBOperator();
|
|
DataView dv = new DataView();
|
|
|
|
|
|
public FrmDemoSet()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
|
|
private void FrmDemoSet_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
string warehouseType = string.Empty;
|
|
sql.Remove(0, sql.Length);
|
|
sql.Append("select * from T_WareHouse_DemoSet");
|
|
dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
|
for (int i = 0; i < dv.Count; i++)
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
warehouseType = dv[i]["FWarehouseType"].ToString();
|
|
|
|
switch (warehouseType)
|
|
{
|
|
case "B":
|
|
|
|
|
|
if (Convert.ToInt32(dv[i]["FDemoFlag"]) == 1)
|
|
{
|
|
liaoxiang_Demo_Yes.Checked = true;
|
|
liaoxiang_Demo_No.Checked = false;
|
|
}
|
|
else if (Convert.ToInt32(dv[i]["FDemoFlag"]) == 0)
|
|
{
|
|
liaoxiang_Demo_Yes.Checked = false;
|
|
liaoxiang_Demo_No.Checked = true;
|
|
}
|
|
|
|
break;
|
|
case "T":
|
|
|
|
|
|
|
|
if (Convert.ToInt32(dv[i]["FDemoFlag"]) == 1)
|
|
{
|
|
tuopan_Demo_Yes.Checked = true;
|
|
tuopan_Demo_No.Checked = false;
|
|
}
|
|
else if (Convert.ToInt32(dv[i]["FDemoFlag"]) == 0)
|
|
{
|
|
tuopan_Demo_Yes.Checked = false;
|
|
tuopan_Demo_No.Checked = true;
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
}
|
|
catch (Exception ee) { }
|
|
}
|
|
}
|
|
|
|
|
|
private void liaoxiang_save_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
int flag = 0;
|
|
string mode = string.Empty;
|
|
if (liaoxiang_Demo_Yes.Checked == true)
|
|
{
|
|
if (MessageBox.Show("您确定要开启料箱库的演示模式吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
flag = 1;
|
|
}
|
|
else if (liaoxiang_Demo_No.Checked == true)
|
|
{
|
|
if (MessageBox.Show("您确定要关闭料箱库的演示模式吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
flag = 0;
|
|
}
|
|
|
|
sql.Remove(0, sql.Length);
|
|
sql.Append("update T_WareHouse_DemoSet set FDemoFlag=").Append(flag).Append(" where FWarehouseType='B'");
|
|
|
|
int aa = dbo.ExecuteSql(sql.ToString());
|
|
if(flag==1)
|
|
{
|
|
mode="演示模式开启";
|
|
|
|
}
|
|
else if (flag == 0)
|
|
{
|
|
mode = "演示模式关闭";
|
|
|
|
}
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("料箱库", "sql语句影响行数:"+aa.ToString(), "料箱库演示模式设置:"+flag.ToString(), "-----------");
|
|
MessageBox.Show("料箱库"+mode+"成功", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void tuopan_save_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
int tflag = 0;
|
|
string tmode = string.Empty;
|
|
Model.MDevice devicee;
|
|
Model.MDevice deviceee;
|
|
DataView dv6;
|
|
if (tuopan_Demo_Yes.Checked == true)
|
|
{
|
|
devicee = Model.CGetInfo.GetDeviceInfo(12096);
|
|
deviceee = Model.CGetInfo.GetDeviceInfo(12090);
|
|
if (devicee.SplitByte_1 != 0 || deviceee.SplitByte_1 != 0)
|
|
{
|
|
MessageBox.Show("输送线12096或者12090上有货,不能切换演示模式", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
sql.Remove(0,sql.Length);
|
|
sql.Append("select * from T_Manage_Task where FENDDEVICE in ('12090','12096')");
|
|
dv6 = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
|
if(dv6.Count>0)
|
|
{
|
|
MessageBox.Show("目标位置为输送线12096或者12090有正在执行的任务,不能切换演示模式", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (MessageBox.Show("您确定要开启托盘库的演示模式吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
tflag = 1;
|
|
}
|
|
else if (tuopan_Demo_No.Checked == true)
|
|
{
|
|
if (MessageBox.Show("您确定要关闭托盘库的演示模式吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
tflag = 0;
|
|
}
|
|
|
|
sql.Remove(0, sql.Length);
|
|
sql.Append("update T_WareHouse_DemoSet set FDemoFlag=").Append(tflag).Append(" where FWarehouseType='T'");
|
|
|
|
int taa = dbo.ExecuteSql(sql.ToString());
|
|
if(tflag==1)
|
|
{
|
|
tmode="演示模式开启";
|
|
|
|
}
|
|
else if (tflag == 0)
|
|
{
|
|
tmode = "演示模式关闭";
|
|
|
|
}
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("托盘库", "sql语句影响行数:"+taa.ToString(), "托盘库演示模式设置:"+tflag.ToString(), "-----------");
|
|
MessageBox.Show("托盘库"+tmode+"成功", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void FrmDemoSet_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
|
|
_formInstance = null;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|