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

208 lines
6.1 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.Basic;
using QMAPP.FJC.Entity.Operation;
using QMAPP.FJC.Entity.SendPlan;
using QMAPP.ServicesAgent;
using QMAPP.WinForm.Common;
using QMFrameWork.Common.Serialization;
using QMFrameWork.Data;
using QMAPP.FJC.Entity;
using QMAPP.Entity;
using QMAPP.WinForm.Forms.TianJin;
namespace QMAPP.WinForm.Forms.WarehouseManage
{
/// <summary>
/// 日 期:2018年4月2日
/// 模 块:计划外出库
/// 作 者:郭兆福
/// </summary>
public partial class SendFinalForm : Form
{
List<ProductOut> outList = new List<ProductOut>();
ProductOut searchModel;
//int pagesize = 20;
public SendFinalForm()
{
InitializeComponent();
}
#region 窗体载入
private void Form_Load(object sender, EventArgs e)
{
BasicData basicData = new BasicData();
//初始化控件属性
this.DGView.AutoGenerateColumns = false;
//初始化分页
this.pager1.Init();
//加载默认查询条件
SetSearchModel();
BindGirdData();
}
#endregion
/// <summary>
/// 分页事件
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
private DataPage pager1_EventPaging(Controls.EventPagingArg e)
{
return BindGirdData();
}
#region 打印
/// <summary>
/// 打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbPrint_Click(object sender, EventArgs e)
{
string barCode = "";
PrintBarCode(barCode);
}
#endregion
#region 打印条码
/// <summary>
/// 打印条码
/// </summary>
/// <param name="barCode"></param>
private void PrintBarCode(string barCode)
{
string xmlPath = @"E:\富维江森\代码\B9\APPB9\QMAPP.WinForm\XMLResources\SendInfo.xml";
BarcodeLib.BarCodeGenerate generate = new BarcodeLib.BarCodeGenerate(xmlPath);
generate.PrintBarCode(barCode);
}
#endregion
#region 行序号
/// <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);
}
#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();
DGView.ClearSelection();
}
}
/// <summary>
/// 设置查询条件
/// </summary>
private DataResult SetSearchModel()
{
DataResult result = new DataResult();
result.IsSuccess = true;
searchModel = new ProductOut();
searchModel.CREATEDATESTART = Convert.ToDateTime(startTime.Value.ToString("yyyy-MM-dd") + " 00:00:00");
searchModel.CREATEDATEEND = Convert.ToDateTime(endTime.Value.ToString("yyyy-MM-dd") + " 23:59:59");
if (searchModel.CREATEDATESTART >= searchModel.CREATEDATEEND)
{
result.IsSuccess = false;
}
return result;
}
#endregion
#region 绑定数据
public DataPage BindGirdData()
{
List<ProductOut> recorders = null;//查询结果列表
DataPage dataPage = new DataPage();
//获取前台分页设置信息
dataPage = pager1.DataPage;
try
{
#region 服务查询
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
dataPage = agent.InvokeServiceFunction<DataPage>("ProductOutBLL_GetList", searchModel, dataPage);
recorders = JsonConvertHelper.GetDeserialize<List<ProductOut>>(dataPage.Result.ToString());
#endregion
this.DGView.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 stbAdd_Click(object sender, EventArgs e)
{
TJSendCodeForm form = new TJSendCodeForm();
DialogResult result = form.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)//判断是否操作成功
{
this.pager1.Init();
BindGirdData();
}
}
#endregion
#region 回车事件
/// <summary>
/// 回车事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SendPlanPrintForm_KeyDown(object sender, KeyEventArgs e)
{
}
#endregion
}
}