| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- /*******************************************************************************
- * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_RPT_040116.cs
- * 2.功能描述:月度成品入库预算表-恒洁三水(定制)
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 张庭莲 2022/11/25 1.00 新建
- *******************************************************************************/
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using System;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.ReportModule.R04.M01
- {
- public partial class F_RPT_040116 : DKDockPanelBase
- {
- #region 成员变量
- // 窗体的单例模式
- private static F_RPT_040116 _instance;
- private ClientRequestEntity _cre = null;
- #endregion
- #region 构造函数
- public F_RPT_040116()
- {
- InitializeComponent();
- this.Text = "月度成品入库预算表";
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_RPT_040116 Instance
- {
- get
- {
- if (_instance == null || _instance.IsDisposed)
- {
- _instance = new F_RPT_040116();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 页面加载事件
- /// </summary>
- private void F_RPT_040116_Load(object sender, EventArgs e)
- {
- try
- {
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- // 设置表格不自动创建列
- this.dgvGroutingAdobeTotal.AutoGenerateColumns = false;
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 清空事件
- /// </summary>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- cleared();
- }
- /// <summary>
- /// 查询事件
- /// </summary>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- this.dgvGroutingAdobeTotal.DataSource = null;
- _cre = new ClientRequestEntity();
- _cre.NameSpace = "R04";
- _cre.Name = "R040116";
- this.SetDate();
- ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
- {
- return ReportModuleProxy.Service.DoRequest(_cre);
- });
- if (resultEntity != null && resultEntity.Data != null &&
- resultEntity.Data.Tables.Count > 0)
- {
- this.dgvGroutingAdobeTotal.DataSource = resultEntity.Data.Tables[0];
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自动适应列宽
- /// </summary>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvGroutingAdobeTotal.AutoResizeColumns();
- }
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_RPT_040116_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 获取日期以及条件查询
- /// </summary>
- private void SetDate()
- {
- //获得当前的年月
- string GDateStart = DateTime.Now.ToString("yyyy-MM");
- string MonthDays = this.dtpGDateStart.Text;
- _cre.Properties["Month"] = MonthDays;
- //判断当前的年月和数据的年月是否相等
- if (GDateStart.Equals(this.dtpGDateStart.Value.ToString("yyyy-MM")))
- {
- //开始时间 timebegin
- string timebegin;
- //结束时间 timeend
- string timeend = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- object timeendd = DateTime.Now.ToString("dd");
- if (Convert.ToInt32(timeendd) < 15)
- {
- int days = 15 - Convert.ToInt32(timeendd);
- //上个月最后一天 MonthDay
- DateTime MonthDay = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-01")).AddDays(-1);
- int MonthDayint = Convert.ToInt32(MonthDay.ToString("dd"));
- int timebegind = MonthDayint - days;
- //上个月的开始日期
- timebegin = MonthDay.ToString("yyyy-MM") + "-" + timebegind + " " + "00:00:00";
- }
- else if (Convert.ToInt32(timeendd) == 15)
- {
- timebegin = DateTime.Now.ToString("yyyy-MM") + "-01" + " " + "00:00:00";
- }
- else
- {
- int timebegindd = (Convert.ToInt32(timeendd) - 15);
- if (timebegindd < 10)
- {
- timebegindd.ToString().PadLeft(2, '0');
- timebegin = DateTime.Now.ToString("yyyy-MM") + "-0" + timebegindd.ToString() + " " + "00:00:00";
- }
- else
- {
- timebegin = DateTime.Now.ToString("yyyy-MM") + "-" + timebegindd.ToString() + " " + "00:00:00";
- }
- }
- string timebeginq = DateTime.Now.ToString("yyyy-MM") + "-01" + " " + "00:00:00";
- _cre.Properties["TimeBegin"] = timebegin;
- _cre.Properties["TimeBeginTwo"] = timebeginq;
- _cre.Properties["TimeEnd"] = timeend;
- }
- else
- {
- string timeendy = this.dtpGDateStart.Value.ToString("yyyy");
- string timeendm = this.dtpGDateStart.Value.ToString("MM");
- object timeendd = System.DateTime.DaysInMonth(Convert.ToInt32(timeendy), Convert.ToInt32(timeendm));
- //结束时间 timeend
- string timeend = timeendy + "-" + timeendm + "-" + timeendd.ToString() + " " + "23:59:59";
- int timebegindd = Convert.ToInt32(timeendd) - 15;
- //开始时间 timebegin
- string timebegin = timeendy + "-" + timeendm + "-" + timebegindd.ToString() + " " + "00:00:00";
- string timebeginq = this.dtpGDateStart.Value.ToString("yyyy-MM") + "-01" + " " + "00:00:00";
- _cre.Properties["TimeBeginTwo"] = timebeginq;
- _cre.Properties["TimeBegin"] = timebegin;
- _cre.Properties["TimeEnd"] = timeend;
- }
- _cre.Properties["GroutingLineCode"] = this.txtGroutingLineCode.Text;
- _cre.Properties["GroutingUserCode"] = this.txtGroutingUserCode.Text;
- _cre.Properties["GoodCode"] = this.txtGoodCode.Text;
- _cre.Properties["GoodsType"] = this.scbGoodsType.SearchedValue + "";
- if (this.c_CheckBox1.Checked)
- {
- _cre.Properties["Subtotal"] = 1;
- }
- }
- /// <summary>
- /// 清空文本框
- /// </summary>
- private void cleared()
- {
- this.txtGroutingLineCode.Text = string.Empty;
- this.txtGroutingUserCode.Text = string.Empty;
- this.txtGoodCode.Text = string.Empty;
- this.scbGoodsType.ClearValue();
- string GDateStart = DateTime.Now.ToString("yyyy-MM");
- this.dtpGDateStart.Text = GDateStart;
- this.c_CheckBox1.Checked = false;
- }
- #endregion
- }
- }
|