using com.hnshituo.pur.vo; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Pur.Entity; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Pur.require_plan; using Core.Mes.Client.Comm.Server; using Pur.PublicTools; using Pur.Entity.configureEntity; using Pur.configure; namespace Pur.FrmTransceiver1 { public partial class frmCkOutReport : FrmPmsBase { public frmCkOutReport() { InitializeComponent(); } private void frmCkOutBillManaYB_Load(object sender, EventArgs e) { txt_CreateTimeStart.Value = DateTime.Now.AddMonths(-1); txt_CreateTimeEnd.Value = DateTime.Now.AddDays(1); getdropDownList(); ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true; GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { "CHK" }); GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { }); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": getOutbillData(""); break; case "doClose": this.Close(); break; case "doExcel"://导出出口单 UltraGridToExcel(); break; } } private void getOutbillData(String strOutBill) { try { dataSet1.Clear(); CkOutBill el = new CkOutBill(); String strDept = txt_Dept.Value == null ? "" : txt_Dept.Value.ToString(); el.UseOrgId = strDept; String strReqDept = txt_reqDepart.Value == null ? "" : txt_reqDepart.Value.ToString(); el.UseOrgName = strReqDept; if (txt_CreateTimeStart.Text != null) { el.CreateTime = Convert.ToDateTime(txt_CreateTimeStart.Value); } if (txt_CreateTimeEnd.Text != null) { el.UpdateTime = Convert.ToDateTime(txt_CreateTimeEnd.Value); } //if (txt_InvPhysic.SelectedIndex != -1) //{ // el.DeliverAddress = txt_InvPhysic.Value.ToString(); //} if (txt_ItemClass.SelectedIndex != -1) { el.ItemAttrId = txt_ItemClass.Value.ToString(); } el.ItemName = txt_itemName.Text.Trim(); DataTable dt = this.execute("com.hnshituo.pur.ck.service.CkOutBillService", "getoutReport", new object[] { el }); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); GridHelper.RefreshAndAutoSize(ultraGrid1); if (!String.IsNullOrEmpty(strOutBill)) { publicPms.doActiveSelRow(ultraGrid1, "outStockno", strOutBill); } } catch (Exception ex) { MessageUtil.ShowTips("查询失败:"+ex); } } /// /// 加载dropdownlist /// private void getdropDownList() { //加载成本中心 DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1230" }, this.ob); if (dt1.Rows.Count > 0) { dt1.DefaultView.Sort = "BASENAME"; dt1 = dt1.DefaultView.ToTable(); } publicPms.FilComboboxAdd(txt_Dept, dt1, "baseCode", "baseName", "validflag NOT in ('0')", true, "/", ""); //加载领用单位 CkOutBill el = new CkOutBill(); if (txt_CreateTimeStart.Text != null) { el.CreateTime = Convert.ToDateTime(txt_CreateTimeStart.Value); } if (txt_CreateTimeEnd.Text != null) { el.UpdateTime = Convert.ToDateTime(txt_CreateTimeEnd.Value); } DataTable dt11 = this.execute("com.hnshituo.pur.ck.service.CkOutBillService", "get_depart", new object[] { el }); if (dt11.Rows.Count > 0) { dt11.DefaultView.Sort = "useOrgName"; dt11 = dt11.DefaultView.ToTable(); } publicPms.FilComboboxAdd(txt_reqDepart, dt11, "useOrgId", "useOrgName", "", true, "/", ""); } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uge = ultraGrid1.ActiveRow; if (uge == null) return; dataSet2.Clear(); CkOutBill el = new CkOutBill(); String strDept = txt_Dept.Value == null ? "" : txt_Dept.Value.ToString(); el.UseOrgId = strDept; String strReqDept = txt_reqDepart.Value == null ? "" : txt_reqDepart.Value.ToString(); el.UseOrgName = strReqDept; if (txt_CreateTimeStart.Text != null) { el.CreateTime = Convert.ToDateTime(txt_CreateTimeStart.Value); } if (txt_CreateTimeEnd.Text != null) { el.UpdateTime = Convert.ToDateTime(txt_CreateTimeEnd.Value); } if (txt_ItemClass.SelectedIndex != -1) { el.ItemAttrId = txt_ItemClass.Value.ToString(); } el.ItemName = txt_itemName.Text.Trim(); el.Unit = ultraGrid1.ActiveRow.Cells["unit"].Text; DataTable dt = this.execute("com.hnshituo.pur.ck.service.CkOutBillService", "getoutReportDetail", new object[] { el }); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); GridHelper.RefreshAndAutoSize(ultraGrid2); } /// /// 导出Excel /// private void UltraGridToExcel() { try { //获取导出的采购计划行表 ArrayList alUltraGrid = new ArrayList(); alUltraGrid.Add(ultraGrid1); ArrayList alSheeft = new ArrayList(); alSheeft.Add("出库单"); if (ultraGrid1.Rows.Count > 0) { GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "出库单");//导出excel } MessageUtil.ShowTips("导出成功"); } catch (Exception e) { MessageUtil.ShowTips("导出失败" + e.Message); } } } }