297 lines
9.2 KiB
C#
297 lines
9.2 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.Base;
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.Base.WebService;
|
|||
|
|
using WMS.Ctrl;
|
|||
|
|
using WMS.Frm;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmBaseData
|
|||
|
|
{
|
|||
|
|
public partial class FrmInterCity : FormBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 城际运输MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
InterCityModel intercityModel = new InterCityModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 城际运输数据源
|
|||
|
|
/// </summary>
|
|||
|
|
List<InterCityModel> SourceList = new List<InterCityModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 业务类型
|
|||
|
|
/// </summary>
|
|||
|
|
int workflag;//0 增加 1 修改 2 删除 ;
|
|||
|
|
|
|||
|
|
public FrmInterCity()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void FrmInterCity_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
panelControl1.Enabled = false;
|
|||
|
|
frmButtonItem["Save"].Enabled = false;
|
|||
|
|
FrmSelectModle = new InterCityModel();
|
|||
|
|
bindlookupEdit();
|
|||
|
|
bindGrid();
|
|||
|
|
GCInterCity_Click(null,null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通用查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="table"></param>
|
|||
|
|
public override void LoadListData(DataTable table)
|
|||
|
|
{
|
|||
|
|
SourceList = ConvertHelper<InterCityModel>.ConvertToList(table);
|
|||
|
|
GCInterCity.DataSource = SourceList;
|
|||
|
|
GVInterCity.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定下拉框
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindlookupEdit()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string strAddressAreaModel = Newtonsoft.Json.JsonConvert.SerializeObject(new AddressAreaModel());
|
|||
|
|
string strlistAddressAreaModel = WebLockConfig.Instance.WebAddressArea.GetAddressArea(strAddressAreaModel);
|
|||
|
|
List<AddressAreaModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AddressAreaModel>>(strlistAddressAreaModel);
|
|||
|
|
TLEPSTR.Properties.DataSource = list;
|
|||
|
|
TLEPSTR.Properties.DisplayMember = "Add_name";
|
|||
|
|
TLEPSTR.Properties.ValueMember = "Add_id";
|
|||
|
|
|
|||
|
|
TLEPEDD.Properties.DataSource = list;
|
|||
|
|
TLEPEDD.Properties.DisplayMember = "Add_name";
|
|||
|
|
TLEPEDD.Properties.ValueMember = "Add_id";
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定grid
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindGrid()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string strInterCityeModel = Newtonsoft.Json.JsonConvert.SerializeObject(new InterCityModel());
|
|||
|
|
string Source = WebLockConfig.Instance.WebInterCity.execInterCityGetList(strInterCityeModel);
|
|||
|
|
SourceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<InterCityModel>>(Source);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GCInterCity.DataSource = SourceList;
|
|||
|
|
if (SourceList.Count > 0)
|
|||
|
|
{
|
|||
|
|
GVInterCity.FocusedRowHandle = 0;
|
|||
|
|
}
|
|||
|
|
GVInterCity.RefreshData();
|
|||
|
|
GVInterCity.ExpandAllGroups();
|
|||
|
|
}
|
|||
|
|
#region 以下是继承的按钮事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Add()
|
|||
|
|
{
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
panelControl1.Enabled = true;
|
|||
|
|
workflag = 0;
|
|||
|
|
BSTab.DataSource = new InterCityModel();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Save()
|
|||
|
|
{
|
|||
|
|
FrmOperator(workflag);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Del()
|
|||
|
|
{
|
|||
|
|
workflag = 2;
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定此城际距离数据:" + GVInterCity.GetFocusedRowCellValue("CITY_START").ToString() + "-" +
|
|||
|
|
GVInterCity.GetFocusedRowCellValue("CITY_EDD").ToString()) == System.Windows.Forms.DialogResult.Yes)
|
|||
|
|
{
|
|||
|
|
Save();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 修改按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Edit()
|
|||
|
|
{
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
workflag = 1;
|
|||
|
|
panelControl1.Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 刷新按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void RefreshDataButton()
|
|||
|
|
{
|
|||
|
|
bindGrid();
|
|||
|
|
frmButtonItem["Save"].Enabled = false;
|
|||
|
|
panelControl1.Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 确定按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void ConfrimDataButton() { }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Seach()
|
|||
|
|
{
|
|||
|
|
FrmSelect frm = new FrmSelect(this.FrmSelectModle);
|
|||
|
|
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
this.LoadListData(frm.SelectData);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导出按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void ExportDataButton() { }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 打印按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void PrintDataButton()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 备注
|
|||
|
|
/// </summary>
|
|||
|
|
protected new void NoteDataButton(FormBase fBase) { }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 审核
|
|||
|
|
/// </summary>
|
|||
|
|
public void AuditDataButton() { }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 反审核
|
|||
|
|
/// </summary>
|
|||
|
|
public void ReturnAuditDataButton() { }
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 操作(增、改、删)
|
|||
|
|
/// <summary>
|
|||
|
|
/// 操作(增、改、删)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="flag">0 新增 1修改 2删除 3停用 4启用/param>
|
|||
|
|
private void FrmOperator(int flag)
|
|||
|
|
{
|
|||
|
|
BSTab.EndEdit();
|
|||
|
|
string errtxt = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
intercityModel = BSTab.DataSource as InterCityModel;
|
|||
|
|
if (string.IsNullOrEmpty(intercityModel.CITY_EDD) || string.IsNullOrEmpty(intercityModel.CITY_START))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择起止城市!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
intercityModel.CREATE_TYPE = "0";
|
|||
|
|
if (string.IsNullOrEmpty(intercityModel.ID))
|
|||
|
|
{
|
|||
|
|
intercityModel.ID = Guid.NewGuid().ToString();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (flag == 0)
|
|||
|
|
{
|
|||
|
|
string strintercityAddModel = Newtonsoft.Json.JsonConvert.SerializeObject(intercityModel);
|
|||
|
|
errtxt = WebLockConfig.Instance.WebInterCity.execInterCityAdd(strintercityAddModel);
|
|||
|
|
}
|
|||
|
|
else if (flag == 1)
|
|||
|
|
{
|
|||
|
|
string strintercityUpModel = Newtonsoft.Json.JsonConvert.SerializeObject(intercityModel);
|
|||
|
|
errtxt = WebLockConfig.Instance.WebInterCity.execInterCityUp(strintercityUpModel);
|
|||
|
|
}
|
|||
|
|
else if (flag == 2)
|
|||
|
|
{
|
|||
|
|
errtxt = WebLockConfig.Instance.WebInterCity.execInterCityDel(intercityModel.ID);
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(errtxt))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(errtxt);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("操作成功!");
|
|||
|
|
bindGrid();
|
|||
|
|
frmButtonItem["Save"].Enabled = false;
|
|||
|
|
panelControl1.Enabled = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请规范操作!" + Environment.NewLine + e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private void GCInterCity_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (GVInterCity.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
intercityModel = GVInterCity.GetRow(GVInterCity.FocusedRowHandle) as InterCityModel;
|
|||
|
|
BSTab.DataSource = intercityModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVInterCity_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Value == null || e.Value == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (e.Column.FieldName == "STATUS")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "停用";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "启用";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|