221 lines
5.9 KiB
C#
221 lines
5.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.Frm.Base;
|
|
using WMS.Model.Strategy;
|
|
|
|
using WMS.Common;
|
|
using WMS.Model.Base;
|
|
using WMS.Model.SystemManage;
|
|
using WMS.Business;
|
|
using WMS.Business.Strategy;
|
|
using WMS.Business.SystemManage;
|
|
using WMS.Business.Base;
|
|
|
|
namespace WMS.FrmStrategy
|
|
{
|
|
public partial class FrmAutoTask : FormBase
|
|
{
|
|
/// <summary>
|
|
/// 自动分配任务权限
|
|
/// </summary>
|
|
public List<AutoTaskModel> list = new List<AutoTaskModel>();
|
|
|
|
/// <summary>
|
|
/// 自动分配任务权限实体Model
|
|
/// </summary>
|
|
AutoTaskModel model = new AutoTaskModel();
|
|
|
|
public FrmAutoTask()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
#region 绑定数据
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
public void BindData()
|
|
{
|
|
model = new AutoTaskModel();
|
|
string str_list = "";
|
|
|
|
try
|
|
{
|
|
list = IBussFactory<BussAutoTask>.Instance().GetAutoTask(model);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("网络连接出现错误!");
|
|
return;
|
|
}
|
|
|
|
bs_AutoTask.DataSource = list;
|
|
}
|
|
#endregion
|
|
|
|
#region 按钮事件
|
|
|
|
#region 新增
|
|
/// <summary>
|
|
/// 新增
|
|
/// </summary>
|
|
public void Add()
|
|
{
|
|
FrmAutoTaskDet det = new FrmAutoTaskDet(0, userData);
|
|
det.ShowDialog();
|
|
BindData();
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
public void Edit()
|
|
{
|
|
if (gridView1.FocusedRowHandle < 0)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("请选择需要编辑的策略");
|
|
return;
|
|
}
|
|
FrmAutoTaskDet det = new FrmAutoTaskDet(1, userData);
|
|
model = gridView1.GetFocusedRow() as AutoTaskModel;
|
|
det.au_model = model;
|
|
det.ShowDialog();
|
|
BindData();
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
public void Del()
|
|
{
|
|
model = gridView1.GetFocusedRow() as AutoTaskModel;
|
|
|
|
|
|
string errText = "";
|
|
try
|
|
{
|
|
errText =IBussFactory<BussAutoTask>.Instance().DeleteAutoTask(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|
}
|
|
if (errText == "")
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("删除成功!");
|
|
BindData();
|
|
return;
|
|
}
|
|
SystemCommon.ShowInfoMessageBox("删除失败!");
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 窗体加载
|
|
/// <summary>
|
|
/// 窗体加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void FrmAutoTask_Load(object sender, EventArgs e)
|
|
{
|
|
#region 工种类型
|
|
string errText = "";
|
|
List<DictionaryTabModel> li_worl = IBussFactory<BussDictionaryTab>.Instance().GetDictionaryTab("workkind_type");
|
|
if (li_worl != null)
|
|
{
|
|
lue_worktype.ValueMember = "VC_CHAR_VALUE";
|
|
lue_worktype.DisplayMember = "VC_DICTIONARY_NAME";
|
|
|
|
lue_worktype.DataSource = li_worl;
|
|
}
|
|
#endregion
|
|
|
|
#region 事务类型
|
|
|
|
WorkTypeModel model = new WorkTypeModel();
|
|
|
|
string str_work_list = "";
|
|
try
|
|
{
|
|
List<WorkTypeModel> tran_type = IBussFactory<BussWorkType>.Instance().GetList(model);
|
|
if (tran_type != null)
|
|
{
|
|
lue_tran_type.DataSource = tran_type;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|
return;
|
|
}
|
|
lue_tran_type.ValueMember = "WORK_ID";
|
|
lue_tran_type.DisplayMember = "WORK_NAME";
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
BindData();
|
|
}
|
|
#endregion
|
|
|
|
#region 自定义列显示
|
|
/// <summary>
|
|
/// 自定义列显示
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
if (e.Column.Name == "colIS_AUTO")
|
|
{
|
|
if (e.Value != null)
|
|
{
|
|
switch (e.Value.ToString())
|
|
{
|
|
case "0":
|
|
e.DisplayText = "否";
|
|
break;
|
|
case "1":
|
|
e.DisplayText = "是";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (e.Column.Name == "colIS_AUTOCREATE")
|
|
{
|
|
if (e.Value != null)
|
|
{
|
|
switch (e.Value.ToString())
|
|
{
|
|
case "0":
|
|
e.DisplayText = "否";
|
|
break;
|
|
case "1":
|
|
e.DisplayText = "是";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|