| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- 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 Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.SA06;
- using Infragistics.Win;
- using Pur.Entity;
- using Pur.Entity.require_planEntiy;
- using Pur.require_plan;
- namespace Pur.require_plan
- {
- public partial class frmPopReqDReport : FrmPmsBase
- {
- public frmPopReqDReport()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- //load
- private void frmPopReqDReport_Load(object sender, EventArgs e)//load
- {
- CK_Ctime.Checked = true;
- CK_ptime.Checked = true;
- checkBox1.Checked = true;
- txtMrPeriodStart.Value =DateTime.Now.AddMonths(-2);
- txtMrPeriodEnd.Value = DateTime.Now < DateTime.Parse(DateTime.Now.ToString("yyyy/MM/26")) ? DateTime.Now.AddMonths(-1) : DateTime.Now;
- txt_createTimeStart.Value = DateTime.Now.AddMonths(-1).ToString();
- txt_createTimeEnd.Value = DateTime.Now.AddDays(7).ToString();
- String strYear = DateTime.Now.Year + "";
- String strMouth = DateTime.Now.Month + "";
- String strStart = strYear + "-" + strMouth + "-" + "20 00:00:00";
- String strEnd = strYear + "-" + strMouth + "-" + "26 00:00:00";
- txtAuditedStart.Value = Convert.ToDateTime(strStart);
- txtAuditedEnd.Value = Convert.ToDateTime(strEnd);
- if (this.CustomInfo == "1")//生产厂
- {
- txt_Mstatus.ReadOnly = false;
- txt_Mstatus.SelectedIndex = 0;//默认全部
- }
- else
- {
- txt_Mstatus.ReadOnly = true;
- txt_Mstatus.SelectedIndex = 6;//默认全部
- }
- txt_style.SelectedIndex = 1;//默认有效
- txt_Dstatus.SelectedIndex = 0;//默认全部
- Init();
- //GetPUR_REQUIRE_PLAND();
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
- }
- //初始化
- private void Init()//初始化
- {
- //初始化业务角色选择Combo
- DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatService", "get_UsedPlanner", new object[] { });
- //DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1221" }, this.ob);
- comm.FilComboboxAdd(txt_businessName, dt1, "PLANNERROLEID", "plannerrolename", null, true, "全部", "");
- txt_businessName.SelectedIndex = 0;//默认全部
- //初始化业务人员选择Combo
- DataTable dt2 = this.execute<DataTable>("com.hnshituo.core.service.AppUserRoleService", "getMatUser", new object[] { });
- //DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1221" }, this.ob);
- comm.FilComboboxAdd(txt_businessUser, dt2, "userid", "roleid", null, true, "全部", "");
- txt_businessUser.SelectedIndex = 0;//默认全部
- }
- //菜单按钮
- public override void ToolBar_Click(object sender, string ToolbarKey)//菜单按钮
- {
- switch (ToolbarKey)
- {
- case "Query"://刷新数据
- GetPUR_REQUIRE_PLAND();
- break;
- case "doReport"://导出Excel
- ReportPUR_REQUIRE_PLAND();
- break;
- case "doClose"://关闭
- this.Close();
- break;
- }
- }
- private void ReportPUR_REQUIRE_PLAND()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- //获取导出的采购计划行表
- 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);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void GetPUR_REQUIRE_PLAND()
- {
- dataTable2.Clear();
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string adm = CoreUserInfo.UserInfo.GetUserID();
- Dictionary<string, object> ReqPnew = new Dictionary<string, object>();
- //创建时间
- if (CK_Ctime.Checked == true)
- {
- if (txt_createTimeStart.Text != "")
- {
- DateTime Start = Convert.ToDateTime(txt_createTimeStart.Value);
- ReqPnew.Add("createTimeStart", Start);
- }
- if (txt_createTimeEnd.Text != "")
- {
- DateTime End = Convert.ToDateTime(txt_createTimeEnd.Value);
- ReqPnew.Add("createTimeEnd", End);
- }
- }
- //计划时间
- if (CK_ptime.Checked == true)
- {
- if (txtMrPeriodStart.Text != "")
- {
- DateTime Start1 = DateTime.Parse(Convert.ToDateTime(txtMrPeriodStart.Value).ToString("yyyy/MM"));
- ReqPnew.Add("mrPeriodStart", Start1);
- }
- if (txtMrPeriodEnd.Text != "")
- {
- DateTime End1 = DateTime.Parse(Convert.ToDateTime(txtMrPeriodEnd.Value).ToString("yyyy/MM"));
- ReqPnew.Add("mrPeriodEnd", End1);
- }
- }
- //审批时间
- if (checkBox1.Checked)
- {
- if (txtAuditedStart.Text != "")
- {
- DateTime Start2 = Convert.ToDateTime(txtAuditedStart.Value);
- ReqPnew.Add("auditedTimeStart", Start2);
- }
- if (txtAuditedEnd.Text != "")
- {
- DateTime End2 = Convert.ToDateTime(txtAuditedEnd.Value);
- ReqPnew.Add("auditedTimeEnd", End2);
- }
- }
- //导出类型
- if (txt_style.SelectedIndex != -1)
- {
- ReqPnew.Add("style", txt_style.Value.ToString().Trim());
- }
- //角色
- if (txt_businessName.SelectedIndex != -1)
- {
- ReqPnew.Add("roleId", txt_businessName.Value.ToString().Trim());
- }
- //计划员
- if (txt_businessUser.SelectedIndex != -1)
- {
- ReqPnew.Add("buyerName", txt_businessUser.Value.ToString().Trim());
- }
- //头状态
- if (txt_Mstatus.SelectedIndex != -1)
- {
- ReqPnew.Add("mStatus", txt_Mstatus.Value.ToString().Trim());
- }
- //行状态
- if (txt_Dstatus.SelectedIndex != -1)
- {
- ReqPnew.Add("dStatus", txt_Dstatus.Value.ToString().Trim());
- }
- ReqPnew.Add("itemName", txt_itemName.Text.Trim());
- ReqPnew.Add("itemCode", txt_itemCode.Text.Trim());
- DataTable dt2 = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.RequirePlanDService", "get_RePDM", new object[] { ReqPnew });
- foreach (DataRow row in dt2.Rows)
- {
- row["itemDescE"] = Convert.ToDateTime(row["itemDescE"]).ToString("yyyy/MM");
- }
- GridHelper.CopyDataToDatatable(dt2, dataTable2, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("加载数据失败:" + ex);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 计划时间处理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void CK_ptime_CheckedChanged(object sender, EventArgs e)// 计划时间处理
- {
- if (CK_ptime.Checked == false)
- {
- txtMrPeriodStart.Enabled = false;
- txtMrPeriodEnd.Enabled = false;
- }
- else
- {
- txtMrPeriodStart.Enabled = true;
- txtMrPeriodEnd.Enabled = true;
- }
- }
- /// <summary>
- /// 创建时间处理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void CK_Ctime_CheckedChanged(object sender, EventArgs e)// 创建时间处理
- {
- if (CK_Ctime.Checked == false)
- {
- txt_createTimeEnd.Enabled = false;
- txt_createTimeStart.Enabled = false;
- }
- else
- {
- txt_createTimeEnd.Enabled = true;
- txt_createTimeStart.Enabled = true;
- }
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- txtAuditedStart.Enabled = checkBox1.Checked;
- txtAuditedEnd.Enabled = checkBox1.Checked;
- // txtMrPeriodEnd.Enabled = checkBox1.Checked;
- }
- }
- }
|