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; namespace QMAPP.WinForm.Forms.WarehouseManage { /// /// 日 期:2018年4月2日 /// 模 块:计划外出库 /// 作 者:郭兆福 /// public partial class SendFinalForm : Form { List outList = new List(); 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 /// /// 分页事件 /// /// /// private DataPage pager1_EventPaging(Controls.EventPagingArg e) { return BindGirdData(); } #region 打印 /// /// 打印 /// /// /// private void tsbPrint_Click(object sender, EventArgs e) { string barCode = ""; PrintBarCode(barCode); } #endregion #region 打印条码 /// /// 打印条码 /// /// 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 行序号 /// /// 行序号 /// /// /// 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 查询 /// /// 查询 /// /// /// private void tsbSearch_Click(object sender, EventArgs e) { DataResult result = SetSearchModel(); if (result.IsSuccess == false) { MessageBox.Show("请输入正确时间!"); return; } else { BindGirdData(); DGView.ClearSelection(); } } /// /// 设置查询条件 /// 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 recorders = null;//查询结果列表 DataPage dataPage = new DataPage(); //获取前台分页设置信息 dataPage = pager1.DataPage; try { #region 服务查询 QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent(); dataPage = agent.InvokeServiceFunction("ProductOutBLL_GetList", searchModel, dataPage); recorders = JsonConvertHelper.GetDeserialize>(dataPage.Result.ToString()); #endregion this.DGView.DataSource = recorders; this.pager1.DataPage = dataPage; } catch (Exception ex) { throw ex; } return dataPage; } #endregion #region 点击出库,弹出条码扫描界面 /// /// 点击出库,弹出条码扫描界面 /// /// /// private void stbAdd_Click(object sender, EventArgs e) { SendCodeForm form = new SendCodeForm(); DialogResult result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK)//判断是否操作成功 { this.pager1.Init(); BindGirdData(); } } #endregion #region 回车事件 /// /// 回车事件 /// /// /// private void SendPlanPrintForm_KeyDown(object sender, KeyEventArgs e) { } #endregion } }