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

174 lines
4.9 KiB

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 QMFrameWork.Data;
using QMAPP.FJC.Entity.Operation;
using QMAPP.ServicesAgent;
using QMFrameWork.Common.Serialization;
using QMAPP.Entity;
namespace QMAPP.WinForm.Forms.Mend
{
public partial class MainCodeChangeForm : Form
{
MainCodeChange searchModel;
public MainCodeChangeForm()
{
InitializeComponent();
}
#region 加载界面
/// <summary>
/// 加载界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MainCodeChangeForm_Load(object sender, EventArgs e)
{
//时间搜索条件
DateTime dtStart = DateTime.Now;
dpOpeStart.Value = dtStart;
dpOpeEnd.Value = dtStart.AddDays(1);
//初始化分页
this.pager1.Init();
//加载默认查询条件
DataResult result = SetSearchModel();
if (result.IsSuccess != false)
{
BindGirdData();
dataGridView1.ClearSelection();
}
}
#endregion
#region 绑定数据
private DataPage BindGirdData()
{
List<MainCodeChange> recorders = null;//查询结果列表
DataPage dataPage = new DataPage();
//获取前台分页设置信息
dataPage = pager1.DataPage;
try
{
#region 服务查询
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
dataGridView1.AutoGenerateColumns = false;
dataPage = agent.InvokeServiceFunction<DataPage>(B9IPCService.MainCodeChangeBLL_GetList.ToString(), searchModel, dataPage);
recorders = JsonConvertHelper.GetDeserialize<List<MainCodeChange>>(dataPage.Result.ToString());
#endregion
this.dataGridView1.DataSource = recorders;
this.pager1.DataPage = dataPage;
}
catch (Exception ex)
{
throw ex;
}
return dataPage;
}
#endregion
#region 查询
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbSearch_Click(object sender, EventArgs e)
{
DataResult result = SetSearchModel();
if (result.IsSuccess == false)
{
MessageBox.Show("请输入正确时间段值!");
return;
}
else
{
BindGirdData();
dataGridView1.ClearSelection();
}
}
#endregion
#region 设置查询条件
/// <summary>
/// 设置查询条件
/// </summary>
private DataResult SetSearchModel()
{
DataResult result = new DataResult();
result.IsSuccess = true;
searchModel = new MainCodeChange();
searchModel.CREATEDATESTART = Convert.ToDateTime(dpOpeStart.Value.ToString("yyyy-MM-dd") + " 00:00:00");
searchModel.CREATEDATEEND = Convert.ToDateTime(dpOpeEnd.Value.ToString("yyyy-MM-dd") + " 00:00:00");
//产品条码
if (string.IsNullOrEmpty(this.txtProductCode.Text.Trim()) == false)
{
searchModel.PRODUCTCODE = this.txtProductCode.Text.Trim();
}
//原条码
if (string.IsNullOrEmpty(this.txtOrig.Text) == false)
{
searchModel.ORIGMAINCODE = this.txtOrig.Text;
}
if (string.IsNullOrEmpty(this.txtNewMianCode.Text) == false)
{
searchModel.NEWMAINCODE = this.txtNewMianCode.Text;
}
if (searchModel.CREATEDATESTART >= searchModel.CREATEDATEEND)
{
result.IsSuccess = false;
}
return result;
}
#endregion
#region 替换操作
/// <summary>
/// 替换操作
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbCheck_Click(object sender, EventArgs e)
{
MainCodeChangeEditForm editForm = new MainCodeChangeEditForm();
editForm.ShowDialog();
BindGirdData();
dataGridView1.ClearSelection();
}
#endregion
private void tsbtnDPlabelRegenerate_Click(object sender, EventArgs e)
{
DPLabelReplace editForm = new DPLabelReplace();
editForm.ShowDialog();
BindGirdData();
dataGridView1.ClearSelection();
}
}
}