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

177 lines
5.8 KiB

3 years ago
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.MD.Entity.TianJin;
namespace QMAPP.WinForm.Forms.TianJin
{
/// <summary>
/// 模块编号:M13-3
/// 作 用:出库操作
/// 作 者:王丹丹
/// 编写日期:2015年07月13日
///</summary>
public partial class TJOutWarehouseForm : Form
{
Storage searchModel = new Storage();//查询条件
Storage product = new Storage();
Main main = new Main();
3 years ago
//int isValidate = 0;//0:未校验 1:已校验
3 years ago
public TJOutWarehouseForm()
{
InitializeComponent();
}
#region 窗体载入
private void Form_Load(object sender, EventArgs e)
{
//初始化控件属性
3 years ago
this.DGMendRecorder.AutoGenerateColumns = false;
//出库原因下拉
BasicData basicData = new BasicData();
//comINTTYPE
this.comINTTYPE.DataSource = basicData.GetOutReasonList(true);
this.comINTTYPE.DisplayMember = "OUTREASON_NAME";
this.comINTTYPE.ValueMember = "OUTREASON_CODE";
3 years ago
//初始化分页
3 years ago
this.pager1.Init();
//加载默认查询条件
SetSearchModel();
BindGirdData();
3 years ago
}
#endregion
#region 绑定数据
/// <summary>
/// 绑定数据列表
/// </summary>
/// <returns></returns>
private DataPage BindGirdData()
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataResult<Storage> resultProduct = new DataResult<Storage>();
DataResult<Main> resultMain = new DataResult<Main>();
List<Product> listProduct = new List<Product>();
List<Main> listMain = new List<Main>();
DataPage dataPage = new DataPage();
//获取前台分页设置信息
3 years ago
dataPage = pager1.DataPage;
3 years ago
try
{
3 years ago
searchModel.State = "2";
3 years ago
//获取零件信息
var result = agent.InvokeServiceFunction<DataResult<DataPage>>("StorageBLL_GetList", searchModel, dataPage);
3 years ago
this.DGMendRecorder.DataSource = JsonConvertHelper.GetDeserialize<List<Storage>>(result.Result.Result.ToString());
this.pager1.DataPage = dataPage;
3 years ago
}
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)
{
3 years ago
BindGirdData();
3 years ago
}
/// <summary>
/// 出库
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbOutWarehouse_Click(object sender, EventArgs e)
{
3 years ago
var form = new TJSendCodeForm();
//form.StartPosition = FormStartPosition.CenterScreen;
form.ShowDialog();
this.pager1.Init();
BindGirdData();
3 years ago
}
#endregion
#region 设置查询条件
/// <summary>
/// 设置查询条件
/// </summary>
private void SetSearchModel()
{
searchModel = new Storage();
//条码
if (string.IsNullOrEmpty(this.txtPRODUCTCODE.Text.Trim()) == false)
{
searchModel.ProductCode = this.txtPRODUCTCODE.Text.Trim();
}
//入库类型
if (this.comINTTYPE.SelectedValue != null && string.IsNullOrEmpty(this.comINTTYPE.SelectedValue.ToString().Trim()) == false)
{
searchModel.InStorageType = this.comINTTYPE.SelectedValue.ToString().Trim();
}
//操作开始时间
if (string.IsNullOrEmpty(this.dtpCREATEDATESTART.Text.Trim()) == false)
{
searchModel.BeginTime = Convert.ToDateTime((this.dtpCREATEDATESTART.Value).ToString("yyyy-MM-dd") + " 00:00:00");
}
//操作结束时间
if (string.IsNullOrEmpty(this.dtpCREATEDATEEND.Text.Trim()) == false)
{
searchModel.EndTime = Convert.ToDateTime((this.dtpCREATEDATEEND.Value).ToString("yyyy-MM-dd") + " 23:59:59");
}
}
#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.DGMendRecorder.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), new Font("宋体", 12, FontStyle.Bold), rectangle, this.DGMendRecorder.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
3 years ago
3 years ago
}
}