F_RPT_080105.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0401.cs
  5. * 2.功能描述:交坯计件一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2014/09/23 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. public partial class F_RPT_080105 : DockPanelBase
  24. {
  25. #region 成员变量
  26. // 窗体的单例模式
  27. private static F_RPT_080105 _instance;
  28. // 当前工序ID
  29. private int _currentProcedureID = 0;
  30. // 最后选择行
  31. private int _selecedRow;
  32. // 窗体显示的Title
  33. private string _fromTitle;
  34. #endregion
  35. #region 构造函数
  36. public F_RPT_080105()
  37. {
  38. InitializeComponent();
  39. //自动适应列宽
  40. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  41. //关闭
  42. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  43. //查询
  44. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  45. //清空条件
  46. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  47. //查询条件
  48. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  49. this.Text = FormTitles.F_RPT_080105;
  50. }
  51. #endregion
  52. #region 单例模式
  53. /// <summary>
  54. /// 单例模式,防止重复创建窗体
  55. /// </summary>
  56. public static F_RPT_080105 Instance
  57. {
  58. get
  59. {
  60. if (_instance == null || _instance.IsDisposed)
  61. {
  62. _instance = new F_RPT_080105();
  63. }
  64. return _instance;
  65. }
  66. }
  67. #endregion
  68. #region 事件
  69. /// <summary>
  70. /// 窗体加载事件
  71. /// </summary>
  72. /// <param name="sender"></param>
  73. /// <param name="e"></param>
  74. private void F_PM_0401_Load(object sender, System.EventArgs e)
  75. {
  76. try
  77. {
  78. // 加载权限
  79. FormPermissionManager.FormPermissionControl(this.Name, this,
  80. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  81. // 设置表格不自动创建列
  82. this.dgvProduction.AutoGenerateColumns = false;
  83. // 初始化时间控件为当前日期
  84. this.dtpStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  85. this.dtpEndTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(1).AddSeconds(-1);
  86. // 设置ToolStripButton状态
  87. this.SetToolStripButtonEnable();
  88. }
  89. catch (Exception ex)
  90. {
  91. // 对异常进行共通处理
  92. ExceptionManager.HandleEventException(this.ToString(),
  93. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  94. }
  95. }
  96. /// <summary>
  97. /// 窗体关闭事件
  98. /// </summary>
  99. /// <param name="sender"></param>
  100. /// <param name="e"></param>
  101. private void F_PM_0401_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
  102. {
  103. _instance = null;
  104. }
  105. /// <summary>
  106. /// 自动适应列宽
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="e"></param>
  110. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  111. {
  112. this.dgvProduction.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  113. }
  114. /// <summary>
  115. /// 清空条件按钮事件
  116. /// </summary>
  117. /// <param name="sender"></param>
  118. /// <param name="e"></param>
  119. private void btnClearCondition_Click(object sender, EventArgs e)
  120. {
  121. this.txtBarCode.Text = "";
  122. this.txtGoodsCode.Text = "";
  123. this.txtGoodsName.Text = "";
  124. this.txtUserCode.Text = "";
  125. this.scbOrganization.ClearValue();
  126. //this.txtRemarks.Text = "";
  127. this.scbGoodsType.ClearValue();
  128. //this.statusIsReworked.ClearItemCheck();
  129. this.dtpStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  130. this.dtpEndTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(1).AddSeconds(-1);
  131. this.dkproductionLineSearchBox.ClearControl();
  132. this.dkProcedureSearchBox.ClearControl();
  133. }
  134. /// <summary>
  135. /// 查询按钮事件
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void btnSearch_Click(object sender, EventArgs e)
  140. {
  141. try
  142. {
  143. // 记录当前选中行
  144. int selectRowIndex = this._selecedRow;
  145. // 异步处理
  146. this.btnSearch.Enabled = false;
  147. this.btnClearCondition.Enabled = false;
  148. SearchProductionDataEntity requestEntity = CreatesearchProductionDataRequestEntity();
  149. DataTable dtProductionData = (DataTable)DoAsync(new AsyncMethod(() =>
  150. {
  151. return ReportModuleProxy.Service.GetProductionData(requestEntity);
  152. }));
  153. DataSet dsProductionData = new DataSet();
  154. dsProductionData.Tables.Add(dtProductionData);
  155. this.btnSearch.Enabled = true;
  156. this.btnClearCondition.Enabled = true;
  157. if (dsProductionData != null)
  158. {
  159. base.DataSource = dsProductionData;
  160. if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
  161. {
  162. this.dgvProduction.DataSource = this.DataSource.Tables[0];
  163. if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  164. {
  165. // 提示未查找到数据
  166. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  167. MessageBoxButtons.OK, MessageBoxIcon.Information);
  168. }
  169. else
  170. {
  171. if (selectRowIndex >= Constant.INT_IS_ZERO)
  172. {
  173. if (selectRowIndex >= dsProductionData.Tables[0].Rows.Count)
  174. {
  175. this.dgvProduction.Rows[this.dgvProduction.Rows.Count - 1].Selected = true;
  176. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[this.dgvProduction.Rows.Count - 1].Cells["GoodsCode"];
  177. }
  178. else
  179. {
  180. this.dgvProduction.Rows[selectRowIndex].Selected = true;
  181. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[selectRowIndex].Cells["GoodsCode"];
  182. }
  183. }
  184. }
  185. }
  186. //如果生产工序存在 1#登窑1#卸窑1#入窑 增加重烧标识列 fenglinyong add 2022-06-04
  187. //如果工序为null 空指针异常
  188. if (string.IsNullOrWhiteSpace(this.dkProcedureSearchBox.ProcedureIDS)
  189. || this.dkProcedureSearchBox.ProcedureIDS.Contains("44")
  190. || this.dkProcedureSearchBox.ProcedureIDS.Contains("45")
  191. || this.dkProcedureSearchBox.ProcedureIDS.Contains("46"))
  192. {
  193. this.IsRefireFlag.Visible = true;
  194. }
  195. else
  196. {
  197. this.IsRefireFlag.Visible = false;
  198. }
  199. //如果生产工序存在 干坯库入,阴干库入,烘干库入,烘干库出 增加成型线编码列 fenglinyong add 2022-06-10
  200. //如果工序为null 空指针异常
  201. if (string.IsNullOrWhiteSpace(this.dkProcedureSearchBox.ProcedureIDS)
  202. || this.dkProcedureSearchBox.ProcedureIDS.Contains("28")
  203. || this.dkProcedureSearchBox.ProcedureIDS.Contains("29")
  204. || this.dkProcedureSearchBox.ProcedureIDS.Contains("30")
  205. || this.dkProcedureSearchBox.ProcedureIDS.Contains("50"))
  206. {
  207. this.GROUTINGLINECODE.Visible = true;
  208. }
  209. else
  210. {
  211. this.GROUTINGLINECODE.Visible = false;
  212. }
  213. }
  214. }
  215. catch (Exception ex)
  216. {
  217. this.btnSearch.Enabled = true;
  218. this.btnClearCondition.Enabled = true;
  219. // 对异常进行共通处理
  220. ExceptionManager.HandleEventException(this.ToString(),
  221. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  222. }
  223. }
  224. /// <summary>
  225. /// 关闭按钮事件
  226. /// </summary>
  227. /// <param name="sender"></param>
  228. /// <param name="e"></param>
  229. private void tsbtnClose_Click(object sender, EventArgs e)
  230. {
  231. this.Close();
  232. }
  233. #endregion
  234. #region 私有方法
  235. /// <summary>
  236. /// 设置工具按钮的可用状态
  237. /// </summary>
  238. private void SetToolStripButtonEnable()
  239. {
  240. }
  241. /// <summary>
  242. /// 搜索条件
  243. /// </summary>
  244. /// <returns></returns>
  245. private SearchProductionDataEntity CreatesearchProductionDataRequestEntity()
  246. {
  247. SearchProductionDataEntity result = new SearchProductionDataEntity();
  248. result.ProductionLineID = this.dkproductionLineSearchBox.ProductionLineID;
  249. result.ProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  250. result.BarCode = this.txtBarCode.Text.Trim();
  251. result.GoodsCode = this.txtGoodsCode.Text.Trim();
  252. result.GoodsName = this.txtGoodsName.Text.Trim();
  253. result.UserCode = this.txtUserCode.Text.Trim();
  254. result.OrganizationID = this.scbOrganization.SearchedPKMember;
  255. result.Remarks = "";// this.txtRemarks.Text.Trim();
  256. result.BeginDate = this.dtpStartTime.Value;
  257. result.EndDate = this.dtpEndTime.Value;
  258. result.ProcedureID = _currentProcedureID;
  259. result.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  260. return result;
  261. }
  262. #endregion
  263. }
  264. }