天津投入产出系统后端
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.
 
 
 
 
 
 

170 lines
5.4 KiB

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Windows.Forms;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.Injection;
using QMAPP.FJC.Entity.Operation;
using QMAPP.ServicesAgent;
using QMAPP.WinForm.Common;
using QMFrameWork.Common.Serialization;
using QMFrameWork.Data;
using QMAPP.Entity;
using QMAPP.FJC.Entity.ProduceManage;
using QMAPP.FJC.Entity.FIS;
namespace QMAPP.WinForm.Forms.InformationSearch
{
/// <summary>
/// 模块编号:M15-1
/// 作 用:FIS M100生产信息查询
/// 作 者:王丹丹
/// 编写日期:2015年07月10日
///</summary>
public partial class FisM100ListForm : Form
{
FISInfo searchModel = new FISInfo();//查询条件
public FisM100ListForm()
{
InitializeComponent();
}
#region 窗体载入
private void Form_Load(object sender, EventArgs e)
{
//初始化控件属性
this.DGFisInfo.AutoGenerateColumns = false;
//初始化分页
this.pager1.Init();
//加载默认查询条件
SetSearchModel();
BindGirdData();
}
#endregion
#region 绑定数据
/// <summary>
/// 绑定数据列表
/// </summary>
/// <returns></returns>
private DataPage BindGirdData()
{
List<FISInfo> fisInfoList = null;//查询结果列表
DataPage dataPage = new DataPage();
DataResult<DataPage> result = new DataResult<DataPage>();
//获取前台分页设置信息
dataPage = pager1.DataPage;
try
{
#region 服务查询
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
result = agent.InvokeServiceFunction<DataResult<DataPage>>(B9IPCService.FISInfoBLL_GetList.ToString(), searchModel, dataPage);
fisInfoList = JsonConvertHelper.GetDeserialize<List<FISInfo>>(result.Result.Result.ToString());
#endregion
this.DGFisInfo.DataSource = fisInfoList;
this.pager1.DataPage = result.Result;
}
catch (Exception ex)
{
throw ex;
}
return dataPage;
}
#endregion
#region 事件
/// <summary>
/// 分页事件
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
private DataPage pager1_EventPaging(Controls.EventPagingArg e)
{
return BindGirdData();
}
/// <summary>
/// 查询事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbSearch_Click(object sender, EventArgs e)
{
bool issuccess = ExistSearchModel();
if (issuccess)
{
SetSearchModel();
this.pager1.Init();
BindGirdData();
}
}
#endregion
#region 设置查询条件
/// <summary>
/// 设置查询条件
/// </summary>
private void SetSearchModel()
{
searchModel = new FISInfo();
//searchModel.MACHINETYPE = EnumGeter.MACHINETYPE.tangsu.GetHashCode().ToString();//默认条件
//上线开始时间
if (string.IsNullOrEmpty(this.dtpONLINETIMESTART.Text.Trim()) == false)
{
searchModel.ONLINETIMESTART = Convert.ToDateTime(this.dtpONLINETIMESTART.Text).ToString("yyyy-MM-dd") + " 00:00:00";
}
//上线结束时间
if (string.IsNullOrEmpty(this.dtpONLINETIMEEND.Text.Trim()) == false)
{
searchModel.ONLINETIMEEND = Convert.ToDateTime(this.dtpONLINETIMEEND.Text).ToString("yyyy-MM-dd") + " 23:59:59";
}
}
#endregion
#region 校验查询条件
/// <summary>
/// 校验查询条件
/// </summary>
private bool ExistSearchModel()
{
//操作开始时间
if (!string.IsNullOrEmpty(this.dtpONLINETIMESTART.Text.Trim()) && !string.IsNullOrEmpty(this.dtpONLINETIMEEND.Text.Trim()))
{
DateTime startTime = Convert.ToDateTime(this.dtpONLINETIMESTART.Text);
DateTime endTime = Convert.ToDateTime(this.dtpONLINETIMEEND.Text);
if (startTime > endTime)
{
MessageBox.Show(Resource1.DateTimeValidate, Resource1.DateTimeValidate, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
}
return true;
}
#endregion
/// <summary>
/// 行序号
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DG_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, this.DGFisInfo.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), new Font("宋体", 12, FontStyle.Bold), rectangle, this.DGFisInfo.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
}
}