320 lines
11 KiB
C#
320 lines
11 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;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmBaseData
|
|||
|
|
{
|
|||
|
|
public partial class FrmLineList : FormBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 线路信息MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
LineInfoModel infomodel = new LineInfoModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 线路明细MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
LineListModel listmodel = new LineListModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 线路明细数据源
|
|||
|
|
/// </summary>
|
|||
|
|
List<LineListModel> SourceList = new List<LineListModel>();
|
|||
|
|
|
|||
|
|
List<LineListModel> copyList = new List<LineListModel>();
|
|||
|
|
List<LineListModel> addList = new List<LineListModel>();
|
|||
|
|
List<LineListModel> upList = new List<LineListModel>();
|
|||
|
|
List<LineListModel> delList = new List<LineListModel>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 业务类型
|
|||
|
|
/// </summary>
|
|||
|
|
int workflag;//0 增加 1 修改 2 删除 ;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 初始化
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="infomodel">线路信息</param>
|
|||
|
|
/// <param name="flag">业务类型</param>
|
|||
|
|
public FrmLineList(LineInfoModel infomodel,int flag)
|
|||
|
|
{
|
|||
|
|
this.infomodel = infomodel;
|
|||
|
|
workflag = flag;
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 页面加载
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void FrmLineList_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
LEPCreate.LoadData();
|
|||
|
|
LEPWay.LoadData();
|
|||
|
|
bindlookupdeit();
|
|||
|
|
bind();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定下拉框
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindlookupdeit()
|
|||
|
|
{
|
|||
|
|
string strAddressAreaModel = Newtonsoft.Json.JsonConvert.SerializeObject(new AddressAreaModel());
|
|||
|
|
string strlistAddressAreaModel = WebLockConfig.Instance.WebAddressArea.GetAddressArea(strAddressAreaModel);
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
List<AddressAreaModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AddressAreaModel>>(strlistAddressAreaModel);
|
|||
|
|
list = list.FindAll(r => r.Lev == "2" || r.Lev == "1");
|
|||
|
|
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";
|
|||
|
|
|
|||
|
|
repositoryItemTreeListLookUpEdit1.DataSource = list;
|
|||
|
|
repositoryItemTreeListLookUpEdit1.DisplayMember = "Add_name";
|
|||
|
|
repositoryItemTreeListLookUpEdit1.ValueMember = "Add_id";
|
|||
|
|
repositoryItemTreeListLookUpEdit1.TreeList.KeyFieldName = "Add_id";
|
|||
|
|
repositoryItemTreeListLookUpEdit1.TreeList.ParentFieldName = "Add_pid";
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定信息
|
|||
|
|
/// </summary>
|
|||
|
|
private void bind()
|
|||
|
|
{
|
|||
|
|
BSLineInfo.DataSource = infomodel;
|
|||
|
|
listmodel.LINE_ID = infomodel.LINE_ID;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string strLineListModel = Newtonsoft.Json.JsonConvert.SerializeObject(listmodel);
|
|||
|
|
string strListLineListModel = WebLockConfig.Instance.WebLineList.execLineListGetList(strLineListModel);
|
|||
|
|
SourceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LineListModel>>(strListLineListModel);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
GCLineList.DataSource = SourceList;
|
|||
|
|
copyList = SourceList.ToList();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 退出按键
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 页面保存按键
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void btnCommit_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
BSLineInfo.EndEdit();
|
|||
|
|
GVLineList.CloseEditor();
|
|||
|
|
|
|||
|
|
infomodel = BSLineInfo.DataSource as LineInfoModel;
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(infomodel.LINE_ID))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("线路编号未填写!");
|
|||
|
|
txtLineID.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(infomodel.LINE_NAME))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("线路名称未填写!");
|
|||
|
|
txtLineID.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(infomodel.ID))
|
|||
|
|
{
|
|||
|
|
infomodel.ID = Guid.NewGuid().ToString();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string strLineInfoModel = Newtonsoft.Json.JsonConvert.SerializeObject(infomodel);
|
|||
|
|
string errtxt = string.Empty;
|
|||
|
|
if (workflag == 0)
|
|||
|
|
{
|
|||
|
|
errtxt = WebLockConfig.Instance.WebLineInfo.execLineInfoAdd(strLineInfoModel);
|
|||
|
|
}
|
|||
|
|
else if (workflag == 1)
|
|||
|
|
{
|
|||
|
|
errtxt = WebLockConfig.Instance.WebLineInfo.execLineInfoUp(strLineInfoModel);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(errtxt))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(errtxt);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("操作成功!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (workflag == 0)
|
|||
|
|
{
|
|||
|
|
infomodel = new LineInfoModel();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 线路明细增加信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void btnADD_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
LineListModel mod = new LineListModel();
|
|||
|
|
mod.LINE_ID = infomodel.LINE_ID;
|
|||
|
|
mod.ID = Guid.NewGuid().ToString();
|
|||
|
|
SourceList.Add(mod);
|
|||
|
|
BSLineList.DataSource = SourceList;
|
|||
|
|
GVLineList.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 线路明细删除信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void btDel_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (GVLineList.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("无需删除的线路信息!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
LineListModel mod = SourceList[GVLineList.FocusedRowHandle];
|
|||
|
|
SourceList.Remove(mod);
|
|||
|
|
if (addList.Contains(mod))
|
|||
|
|
{
|
|||
|
|
addList.Remove(mod);
|
|||
|
|
}
|
|||
|
|
if (upList.Contains(mod))
|
|||
|
|
{
|
|||
|
|
upList.Remove(mod);
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(mod.LINE_CITY))
|
|||
|
|
{
|
|||
|
|
delList.Add(mod);
|
|||
|
|
}
|
|||
|
|
BSLineList.DataSource = SourceList;
|
|||
|
|
GVLineList.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存线路明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void btSave_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (addList.Count == 0 && delList.Count == 0 && upList.Count == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("无需保存的线路信息!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string errtxt = string.Empty;
|
|||
|
|
|
|||
|
|
string straddList = Newtonsoft.Json.JsonConvert.SerializeObject(addList);
|
|||
|
|
string strdelList = Newtonsoft.Json.JsonConvert.SerializeObject(delList);
|
|||
|
|
string strupList = Newtonsoft.Json.JsonConvert.SerializeObject(upList);
|
|||
|
|
errtxt = WebLockConfig.Instance.WebLineList.newLineListFuc(strupList,straddList,strdelList);
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(errtxt))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(errtxt);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("操作成功!");
|
|||
|
|
listmodel.LINE_ID = infomodel.LINE_ID;
|
|||
|
|
string strLineListModel = Newtonsoft.Json.JsonConvert.SerializeObject(listmodel);
|
|||
|
|
string strListLineListModel = WebLockConfig.Instance.WebLineList.execLineListGetList(strLineListModel);
|
|||
|
|
SourceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LineListModel>>(strListLineListModel);
|
|||
|
|
GCLineList.DataSource = SourceList;
|
|||
|
|
copyList = SourceList.ToList();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
addList.Clear();
|
|||
|
|
upList.Clear();
|
|||
|
|
delList.Clear();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 如果已有城市间距信息自动带出
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVLineList_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
labelControl1.Focus();
|
|||
|
|
LineListModel focModel = SourceList[e.RowHandle];
|
|||
|
|
if (!addList.Contains(focModel) && !copyList.Contains(focModel))
|
|||
|
|
{
|
|||
|
|
addList.Add(focModel);
|
|||
|
|
}
|
|||
|
|
if (!upList.Contains(focModel) && copyList.Contains(focModel))
|
|||
|
|
{
|
|||
|
|
upList.Add(focModel);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.ColumnEditName == "repositoryItemLookUpEdit2")
|
|||
|
|
{
|
|||
|
|
InterCityModel mod = new InterCityModel();
|
|||
|
|
if (e.RowHandle > 0)
|
|||
|
|
{
|
|||
|
|
mod.CITY_START = GVLineList.GetRowCellValue(e.RowHandle - 1, "LINE_CITY").ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
mod.CITY_START = infomodel.LINE_START;
|
|||
|
|
}
|
|||
|
|
mod.CITY_EDD = GVLineList.GetRowCellValue(e.RowHandle, "LINE_CITY").ToString();
|
|||
|
|
string strLineListModel = Newtonsoft.Json.JsonConvert.SerializeObject(mod);
|
|||
|
|
string strListInterCityModel = WebLockConfig.Instance.WebInterCity.execInterCityGetList(strLineListModel);
|
|||
|
|
List<InterCityModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<InterCityModel>>(strListInterCityModel);
|
|||
|
|
if (list.Count > 0)
|
|||
|
|
{
|
|||
|
|
focModel.LINE_MILEAGE = list[0].CITY_DISTANCE;
|
|||
|
|
focModel.LINE_TIME = list[0].CITY_TIME;
|
|||
|
|
}
|
|||
|
|
GVLineList.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|