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

153 lines
5.0 KiB

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Windows.Forms;
using QM.Common;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.Operation;
using QMAPP.ServicesAgent;
using QMAPP.WinForm.Common;
using QMFrameWork.Common.Serialization;
using QMFrameWork.Data;
using QMAPP.Entity;
namespace QMAPP.WinForm.Forms.Operation
{
/// <summary>
/// 原材料投料
/// </summary>
public partial class SetProcessPassForm : Form
{
MainOperation searchModel = new MainOperation();//查询条件
public SetProcessPassForm()
{
InitializeComponent();
}
#region 窗体载入
private void Form_Load(object sender, EventArgs e)
{
//初始化窗口最大化
this.WindowState = FormWindowState.Maximized;
BasicData basicData = new BasicData();
//初始化控件属性
this.DGView.AutoGenerateColumns = false;
//初始化分页
this.pager1.Init();
}
#endregion
#region 绑定数据
private DataPage BindGirdData()
{
List<MainOperation> recorders = null;//查询结果列表
DataPage dataPage = new DataPage();
//获取前台分页设置信息
dataPage = pager1.DataPage;
try
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
dataPage = agent.InvokeServiceFunction<DataPage>(B9BasicService.MainOperationBLL_GetList.ToString(), searchModel, dataPage);
recorders = JsonConvertHelper.GetDeserialize<List<MainOperation>>(dataPage.Result.ToString());
this.DGView.DataSource = recorders;
this.pager1.DataPage = dataPage;
}
catch (Exception ex)
{
throw ex;
}
return dataPage;
}
#endregion
/// <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)
{
SetSearchModel();
this.pager1.Init();
BindGirdData();
}
/// <summary>
/// 设置查询条件
/// </summary>
private void SetSearchModel()
{
searchModel = new MainOperation();
searchModel.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
if (string.IsNullOrEmpty(this.txtCode.Text.Trim()) == false)
{
searchModel.PRODUCTCODE = this.txtCode.Text.Trim();
}
}
/// <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.DGView.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), new Font("宋体", 12, FontStyle.Bold), rectangle, this.DGView.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
/// <summary>
/// 放行
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbPass_Click(object sender, EventArgs e)
{
if (this.DGView.SelectedRows.Count > 0)
{
MainOperation mainOperation = (DGView.DataSource as List<MainOperation>).Find(m => m.OPERATESTATE == EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString());
if (mainOperation == null)
{
MessageBox.Show(Resource1.SetPassNoNeed);
return;
}
string selectKey = this.DGView.SelectedRows[0].Cells["PRODUCTCODE"].Value.ToString();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataResult result = agent.InvokeServiceFunction<DataResult>(B9BasicService.MainOperationBLL_SetPassProcess.ToString(), new Product { PRODUCTCODE = selectKey });
MessageBox.Show(result.Msg);
if (result.IsSuccess)
{
BindGirdData();
}
}
}
private void txtCode_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.tsbSearch_Click(sender, e);
}
}
}
}