255 lines
7.9 KiB
C#
255 lines
7.9 KiB
C#
|
|
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 WMS.Model.Strategy;
|
|||
|
|
using WMS.Frm.Base;
|
|||
|
|
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.Ctrl;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Strategy;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmStrategy
|
|||
|
|
{
|
|||
|
|
public partial class FrmDownStrategy : FormBase
|
|||
|
|
{
|
|||
|
|
#region 变量
|
|||
|
|
//public static FrmDownStrategy frmDownStrategy;
|
|||
|
|
private List<DownStrategyModel> listDownStrategyModel = new List<DownStrategyModel>();
|
|||
|
|
private DownStrategyModel model = new DownStrategyModel();
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 初始化
|
|||
|
|
/// <summary>
|
|||
|
|
/// 构造函数
|
|||
|
|
/// </summary>
|
|||
|
|
public FrmDownStrategy()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//public static FrmDownStrategy getInstance()
|
|||
|
|
//{
|
|||
|
|
// if (frmDownStrategy == null || frmDownStrategy.IsDisposed)
|
|||
|
|
// {
|
|||
|
|
// frmDownStrategy = new FrmDownStrategy();
|
|||
|
|
// }
|
|||
|
|
// return frmDownStrategy;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 本窗体加载的时候
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void FrmDownStrategy_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
bindGrid();
|
|||
|
|
FrmSelectModle = new DownStrategyModel();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 绑定数据
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定数据
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindGrid()
|
|||
|
|
{
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
string strDataSet = string.Empty;
|
|||
|
|
DownStrategyModel downStrategyModel = new DownStrategyModel();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
listDownStrategyModel = IBussFactory<BussDownStrategy>.Instance().GetDownStrategyList(downStrategyModel);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (errText == string.Empty)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (listDownStrategyModel.Count > 0) {
|
|||
|
|
|
|||
|
|
bsDownStrategy.DataSource = listDownStrategyModel;
|
|||
|
|
GVDownStrategy.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通用查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="table"></param>
|
|||
|
|
public override void LoadListData(DataTable table)
|
|||
|
|
{
|
|||
|
|
listDownStrategyModel = ConvertHelper<DownStrategyModel>.ConvertToList(table);
|
|||
|
|
bsDownStrategy.DataSource = listDownStrategyModel;
|
|||
|
|
|
|||
|
|
GVDownStrategy.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 按钮事件
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Add()
|
|||
|
|
{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 10);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载窗体,请等待....");
|
|||
|
|
|
|||
|
|
FrmDownStrategyDet frmDownStrategyDet = new FrmDownStrategyDet();
|
|||
|
|
frmDownStrategyDet.userData = this.userData;
|
|||
|
|
frmDownStrategyDet.ShowDialog();
|
|||
|
|
bindGrid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 编辑按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Edit()
|
|||
|
|
{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 10);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载窗体,请等待....");
|
|||
|
|
model = GVDownStrategy.GetFocusedRow() as DownStrategyModel;
|
|||
|
|
FrmDownStrategyDet frmDownStrategyDet = new FrmDownStrategyDet(model);
|
|||
|
|
frmDownStrategyDet.userData = this.userData;
|
|||
|
|
frmDownStrategyDet.Show();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 刷新按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Refresh()
|
|||
|
|
{
|
|||
|
|
bindGrid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Del()
|
|||
|
|
{
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
if (DialogResult.Yes == SystemCommon.ShowMessageBoxResult("确定删除"))
|
|||
|
|
{
|
|||
|
|
model = GVDownStrategy.GetFocusedRow() as DownStrategyModel;
|
|||
|
|
string str = model.DOWNSTRATEGY_ID;
|
|||
|
|
if (!string.IsNullOrEmpty(str))
|
|||
|
|
{
|
|||
|
|
errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText= IBussFactory<BussStrAreaRep>.Instance().DeleteStrAreaRepAndTab(str);//删除
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(errText))//如果成功
|
|||
|
|
{
|
|||
|
|
bindGrid();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("删除失败" + errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择一条记录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private void GVDownStrategy_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName == "DOWNSTRATEGY_STATE")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "启用";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "停用";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (e.Column.FieldName == "PRODUCE_FLAG")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "否";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "是";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (e.Column.FieldName == "ADDED_FLAG")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "否";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "是";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (e.Column.FieldName == "NULL_FLAG")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "否";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "是";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVDownStrategy_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
Edit();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|