F_RPT_030110.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030110.cs
  5. * 2.功能描述:半检信息汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/07/11 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Basics.DockPanel;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  19. using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
  20. namespace Dongke.IBOSS.PRD.Client.ReportModule
  21. {
  22. /// <summary>
  23. /// 半检信息汇总表
  24. /// </summary>
  25. public partial class F_RPT_030110 : DockPanelBase
  26. {
  27. #region 成员变量
  28. //单例模式
  29. private static F_RPT_030110 _instance;
  30. #endregion
  31. #region 构造函数
  32. /// <summary>
  33. /// 废弃一览构造
  34. /// </summary>
  35. public F_RPT_030110()
  36. {
  37. InitializeComponent();
  38. this.Text = FormTitles.F_RPT_030110;
  39. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  40. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  41. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  42. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_RPT_030110 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null)
  54. {
  55. _instance = new F_RPT_030110();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件
  62. /// <summary>
  63. /// 查询事件
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void btnSearch_Click(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. //if(!cbSemiCheck.Checked)
  72. //{
  73. // MessageBox.Show("半检时间必须填写.", this.Text,
  74. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  75. // return;
  76. //}
  77. DataSet dsSemiCheck = (DataSet)DoAsync(new AsyncMethod(() =>
  78. {
  79. return this.GetSemiCheck();
  80. }));
  81. if (dsSemiCheck != null)
  82. {
  83. if (dsSemiCheck.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  84. {
  85. this.dgvSemiCheck.DataSource = ((DataSet)dsSemiCheck).Tables[Constant.INT_IS_ZERO];
  86. this.dgvSemiCheck.ReadOnly = true;
  87. this.dgvSemiCheck.Rows[0].Selected = true;
  88. }
  89. else
  90. {
  91. this.dgvSemiCheck.DataSource = null;
  92. // 提示未查找到数据
  93. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  94. MessageBoxButtons.OK, MessageBoxIcon.Information);
  95. }
  96. }
  97. else
  98. {
  99. this.dgvSemiCheck.DataSource = null;
  100. // 提示未查找到数据
  101. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  102. MessageBoxButtons.OK, MessageBoxIcon.Information);
  103. }
  104. }
  105. catch (Exception ex)
  106. {
  107. // 对异常进行共通处理
  108. ExceptionManager.HandleEventException(this.ToString(),
  109. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  110. }
  111. }
  112. /// <summary>
  113. /// 时间有效性切换
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void cbCDateTime_CheckedChanged(object sender, EventArgs e)
  118. {
  119. this.txtCDateTimeStart.Enabled = this.cbCDateTime.Checked;
  120. this.txtCDateTimeEnd.Enabled = this.cbCDateTime.Checked;
  121. }
  122. /// <summary>
  123. /// 清空条件
  124. /// </summary>
  125. /// <param name="sender"></param>
  126. /// <param name="e"></param>
  127. private void btnClearCondition_Click(object sender, EventArgs e)
  128. {
  129. this.dkCProcedureSearchBox.ClearControl();
  130. this.cbCDateTime.Checked = false;
  131. //this.txtCDateTimeStart.Value = DateTime.Now;
  132. //this.txtCDateTimeEnd.Value = DateTime.Now;
  133. this.txtCUserCode.Text = string.Empty;
  134. this.scbGoodsType.ClearValue();
  135. this.txtGoodsCode.Text = string.Empty;
  136. this.txtGroutingUserCode.Text = string.Empty;
  137. this.cbGroutingDate.Checked = false;
  138. //this.txtGroutingDateTimeStart.Value = DateTime.Now;
  139. //this.txtGroutingDateTimeEnd.Value = DateTime.Now;
  140. this.cbDeliveryDate.Checked = false;
  141. // this.txtDeliveryDateTimeStart.Value = DateTime.Now;
  142. // this.txtDeliveryDateTimeEnd.Value = DateTime.Now;
  143. this.chkSemiCheckType.SelectedValues = new object[] { -1 };
  144. this.cbSemiCheck.Checked = true;
  145. //this.txtSemiCheckDateTimeStart.Value = DateTime.Now;
  146. //this.txtSemiCheckDateTimeEnd.Value = DateTime.Now;
  147. this.txtSemiCheckUserCode.Text = string.Empty;
  148. this.dkRProcedureSearchBox.ClearControl();
  149. this.txtReworkUserCode.Text = string.Empty;
  150. this.chkReSemiCheckType.SelectedValues = new object[] { -1 };
  151. this.cbReSemiCheck.Checked = false;
  152. //this.txtReSemiCheckDateTimeStart.Value = DateTime.Now;
  153. //this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now;
  154. this.txtReSemiCheckUserCode.Text = string.Empty;
  155. this.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  156. this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  157. this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  158. this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  159. this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  160. this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  161. this.txtReSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  162. this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  163. this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  164. this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  165. }
  166. /// <summary>
  167. /// 关闭一览窗体
  168. /// </summary>
  169. /// <param name="sender"></param>
  170. /// <param name="e"></param>
  171. private void tsbtnClose_Click(object sender, EventArgs e)
  172. {
  173. this.Close();
  174. }
  175. /// <summary>
  176. /// 窗体关闭事件
  177. /// </summary>
  178. /// <param name="sender"></param>
  179. /// <param name="e"></param>
  180. private void F_RPT_030110_FormClosed(object sender, FormClosedEventArgs e)
  181. {
  182. _instance = null;
  183. }
  184. /// <summary>
  185. /// 自动列宽
  186. /// </summary>
  187. /// <param name="sender"></param>
  188. /// <param name="e"></param>
  189. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  190. {
  191. this.dgvSemiCheck.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  192. }
  193. /// <summary>
  194. /// 窗体加载
  195. /// </summary>
  196. /// <param name="sender"></param>
  197. /// <param name="e"></param>
  198. private void F_RPT_030110_Load(object sender, EventArgs e)
  199. {
  200. try
  201. {
  202. // 加载权限
  203. FormPermissionManager.FormPermissionControl(this.Name, this,
  204. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  205. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  206. this.dgvSemiCheck.AutoGenerateColumns = false;
  207. // 设置日期控件默认值
  208. this.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  209. this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  210. this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  211. this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  212. this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  213. this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  214. this.txtReSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  215. this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  216. this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  217. this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  218. // 加载半检,复检状态数据源
  219. DataSet dsGetSemiCheckType = SystemModuleProxy.Service.GetSemiCheckType();
  220. if (dsGetSemiCheckType != null && dsGetSemiCheckType.Tables[0].Rows.Count > 0)
  221. {
  222. DataRow[] drSemiCheckType = dsGetSemiCheckType.Tables[0].Select("Semichecktype=1");
  223. if (drSemiCheckType.Length > 0)
  224. {
  225. this.chkSemiCheckType.ValueMember = "Semichecktypeid";
  226. this.chkSemiCheckType.DisplayMember = "Semichecktypename";
  227. this.chkSemiCheckType.DataSource = drSemiCheckType.CopyToDataTable();
  228. }
  229. DataRow[] drReSemiCheckType = dsGetSemiCheckType.Tables[0].Select("Semichecktype=2");
  230. if (drReSemiCheckType.Length > 0)
  231. {
  232. this.chkReSemiCheckType.ValueMember = "Semichecktypeid";
  233. this.chkReSemiCheckType.DisplayMember = "Semichecktypename";
  234. this.chkReSemiCheckType.DataSource = drReSemiCheckType.CopyToDataTable();
  235. }
  236. }
  237. }
  238. catch (Exception ex)
  239. {
  240. // 对异常进行共通处理
  241. ExceptionManager.HandleEventException(this.ToString(),
  242. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  243. }
  244. }
  245. /// <summary>
  246. /// 注浆时间复选框改变事件
  247. /// </summary>
  248. /// <param name="sender"></param>
  249. /// <param name="e"></param>
  250. private void cbGroutingDate_CheckedChanged(object sender, EventArgs e)
  251. {
  252. this.txtGroutingDateTimeStart.Enabled = this.cbGroutingDate.Checked;
  253. this.txtGroutingDateTimeEnd.Enabled = this.cbGroutingDate.Checked;
  254. }
  255. /// <summary>
  256. /// 半检时间复选框改变事件
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. private void cbSemiCheck_CheckedChanged(object sender, EventArgs e)
  261. {
  262. this.txtSemiCheckDateTimeStart.Enabled = this.cbSemiCheck.Checked;
  263. this.txtSemiCheckDateTimeEnd.Enabled = this.cbSemiCheck.Checked;
  264. }
  265. /// <summary>
  266. /// 复检时间复选框改变事件
  267. /// </summary>
  268. /// <param name="sender"></param>
  269. /// <param name="e"></param>
  270. private void cbReSemiCheck_CheckedChanged(object sender, EventArgs e)
  271. {
  272. this.txtReSemiCheckDateTimeStart.Enabled = this.cbReSemiCheck.Checked;
  273. this.txtReSemiCheckDateTimeEnd.Enabled = this.cbReSemiCheck.Checked;
  274. }
  275. private void cbDeliveryDate_CheckedChanged(object sender, EventArgs e)
  276. {
  277. this.txtDeliveryDateTimeStart.Enabled = this.cbDeliveryDate.Checked;
  278. this.txtDeliveryDateTimeEnd.Enabled = this.cbDeliveryDate.Checked;
  279. }
  280. #endregion
  281. #region 私有方法
  282. /// <summary>
  283. /// 根据界面查询条件获取数据集
  284. /// </summary>
  285. private DataSet GetSemiCheck()
  286. {
  287. try
  288. {
  289. SemiCheckEntity entity = new SemiCheckEntity();
  290. entity.CProcedureIDS = this.dkCProcedureSearchBox.ProcedureIDS;
  291. if (cbCDateTime.Checked)
  292. {
  293. entity.CDateTimeStart = this.txtCDateTimeStart.Value;// DateTime.Parse(this.txtCDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  294. entity.CDateTimeEnd = this.txtCDateTimeEnd.Value;// DateTime.Parse(this.txtCDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  295. }
  296. entity.CUserCode = this.txtCUserCode.Text.Trim();
  297. entity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  298. entity.GoodsCode = this.txtGoodsCode.Text.Trim();
  299. entity.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
  300. if (cbGroutingDate.Checked)
  301. {
  302. entity.GroutingDateTimeStart = this.txtGroutingDateTimeStart.Value;// DateTime.Parse(this.txtGroutingDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  303. entity.GroutingDateTimeEnd = this.txtGroutingDateTimeEnd.Value;// DateTime.Parse(this.txtGroutingDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  304. }
  305. if (cbDeliveryDate.Checked)
  306. {
  307. entity.DeliveryDateTimeStart = this.txtDeliveryDateTimeStart.Value;// DateTime.Parse(this.txtDeliveryDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  308. entity.DeliveryDateTimeEnd = this.txtDeliveryDateTimeEnd.Value;// DateTime.Parse(this.txtDeliveryDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  309. }
  310. object[] objSemiCheckType = this.chkSemiCheckType.SelectedValues;
  311. string strSemiCheckType = "";
  312. if (objSemiCheckType.Length > 0)
  313. {
  314. for (int i = 0; i < objSemiCheckType.Length; i++)
  315. {
  316. strSemiCheckType += objSemiCheckType[i].ToString() + ",";
  317. }
  318. strSemiCheckType = strSemiCheckType.TrimEnd(',');
  319. }
  320. entity.SemiCheckType = strSemiCheckType;
  321. if (cbSemiCheck.Checked)
  322. {
  323. entity.SemiCheckDateTimeStart = this.txtSemiCheckDateTimeStart.Value;// DateTime.Parse(this.txtSemiCheckDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  324. entity.SemiCheckDateTimeEnd = this.txtSemiCheckDateTimeEnd.Value;// DateTime.Parse(this.txtSemiCheckDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  325. }
  326. entity.SemiCheckUserCode = this.txtSemiCheckUserCode.Text.Trim();
  327. entity.RProcedureIDS = this.dkRProcedureSearchBox.ProcedureIDS;
  328. entity.ReworkUserCode = this.txtReworkUserCode.Text.Trim();
  329. object[] objReSemiCheckType = this.chkReSemiCheckType.SelectedValues;
  330. string strReSemiCheckType = "";
  331. if (objReSemiCheckType.Length > 0)
  332. {
  333. for (int i = 0; i < objReSemiCheckType.Length; i++)
  334. {
  335. strReSemiCheckType += objReSemiCheckType[i].ToString() + ",";
  336. }
  337. strReSemiCheckType = strReSemiCheckType.TrimEnd(',');
  338. }
  339. entity.ReSemiCheckType = strReSemiCheckType;
  340. if (cbReSemiCheck.Checked)
  341. {
  342. entity.ReSemiCheckDateTimeStart = this.txtReSemiCheckDateTimeStart.Value;// DateTime.Parse(this.txtReSemiCheckDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  343. entity.ReSemiCheckDateTimeEnd = this.txtReSemiCheckDateTimeEnd.Value;// DateTime.Parse(this.txtReSemiCheckDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  344. }
  345. entity.ReSemiCheckUserCode = this.txtReSemiCheckUserCode.Text.Trim();
  346. ServiceResultEntity resultEntity = ReportModuleProxy.Service.GetRPT030110Data(entity);
  347. return resultEntity.Data;
  348. }
  349. catch (Exception ex)
  350. {
  351. throw ex;
  352. }
  353. }
  354. #endregion
  355. }
  356. }