F_PM_2401.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /*******************************************************************************
  2. * Copyright(c) 2017 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2401.cs
  5. * 2.功能描述:成品交接一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2017/2/8 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.Client.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. namespace Dongke.IBOSS.PRD.Client.PMModule
  20. {
  21. public partial class F_PM_2401 : DockPanelBase
  22. {
  23. #region 成员变量
  24. // 单例模式
  25. private static F_PM_2401 _instance;
  26. // 存储查询条件
  27. private SearchFinishedProductEntity _orderEntity = new SearchFinishedProductEntity();
  28. // 最后选择行
  29. private int _selecedRow;
  30. #endregion
  31. #region 单例模式
  32. /// <summary>
  33. /// 单例模式,防止重复创建窗体
  34. /// </summary>
  35. public static F_PM_2401 Instance
  36. {
  37. get
  38. {
  39. if (_instance == null)
  40. {
  41. _instance = new F_PM_2401();
  42. }
  43. return _instance;
  44. }
  45. }
  46. #endregion
  47. #region 构造函数
  48. public F_PM_2401()
  49. {
  50. InitializeComponent();
  51. //窗体标题
  52. this.Text = FormTitles.F_PM_2401;
  53. //交接
  54. this.tsbtnFinishedHandover.Text = ButtonText.TSBTN_FINISHEDHANDOVER;
  55. //撤销
  56. this.tsbtnCancelFinishedHandover.Text = ButtonText.TSBTN_FINISHEDCANCELHANDOVER;
  57. //自适应列宽
  58. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  59. // 变更
  60. this.tsbtnChangeOrderNo.Text = ButtonText.TSBTN_FINISHEDCHANGEHANDOVER;
  61. // 商标
  62. this.tsbtnTradeMark.Text = ButtonText.TSBTN_TRADEMARK;
  63. // 变更单号整板
  64. this.tsbtnChangeOrderNoForPlate.Text = ButtonText.TSBTN_CHANGEORDERNOFORPLATE;
  65. //关闭
  66. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  67. //查询
  68. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  69. //清空条件
  70. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  71. //查询条件
  72. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  73. }
  74. #endregion
  75. #region 事件
  76. /// <summary>
  77. /// 清空条件按钮事件
  78. /// </summary>
  79. /// <param name="sender"></param>
  80. /// <param name="e"></param>
  81. private void btnClearCondition_Click(object sender, EventArgs e)
  82. {
  83. this.txtOrderNo.Clear();
  84. this.txtFHUserCode.Clear();
  85. this.chkDateTime.Checked = false;
  86. this.dtpStartTime.Value = DateTime.Now.Date;
  87. this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
  88. this.scbGoodsType.ClearValue();
  89. this.txtGoodsModel.Clear();
  90. this.dkLogoSearchBox1.ClearControl();
  91. }
  92. /// <summary>
  93. /// 查询按钮点击事件
  94. /// </summary>
  95. /// <param name="sender"></param>
  96. /// <param name="e"></param>
  97. private void btnSearch_Click(object sender, EventArgs e)
  98. {
  99. try
  100. {
  101. // 根据页面设定订单实体值
  102. this.GetOrderEntityFromLayout();
  103. // 记录当前选中行
  104. int selectRowIndex = this._selecedRow;
  105. // 异步处理
  106. this.dgvOrder.DataSource = null;
  107. this.btnSearch.Enabled = false;
  108. this.btnClearCondition.Enabled = false;
  109. DataSet userDataSet = (DataSet)DoAsync(new AsyncMethod(this.GetFinishedHandover));
  110. this.btnSearch.Enabled = true;
  111. this.btnClearCondition.Enabled = true;
  112. if (userDataSet != null)
  113. {
  114. base.DataSource = (DataSet)userDataSet;
  115. if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
  116. {
  117. this.dgvOrder.DataSource = this.DataSource.Tables[0];
  118. if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  119. {
  120. this.tsbtnCancelFinishedHandover.Enabled = false;
  121. this.tsbtnChangeOrderNo.Enabled = false;
  122. // 提示未查找到数据
  123. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  124. MessageBoxButtons.OK, MessageBoxIcon.Information);
  125. }
  126. else
  127. {
  128. if (selectRowIndex >= Constant.INT_IS_ZERO)
  129. {
  130. if (selectRowIndex >= userDataSet.Tables[0].Rows.Count)
  131. {
  132. this.dgvOrder.Rows[this.dgvOrder.Rows.Count - 1].Selected = true;
  133. this.dgvOrder.CurrentCell = this.dgvOrder.Rows[this.dgvOrder.Rows.Count - 1].Cells["OrderNo"];
  134. }
  135. else
  136. {
  137. this.dgvOrder.Rows[selectRowIndex].Selected = true;
  138. this.dgvOrder.CurrentCell = this.dgvOrder.Rows[selectRowIndex].Cells["OrderNo"];
  139. }
  140. }
  141. }
  142. }
  143. }
  144. else
  145. {
  146. this.tsbtnCancelFinishedHandover.Enabled = false;
  147. this.tsbtnChangeOrderNo.Enabled = false;
  148. // 提示未查找到数据
  149. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  150. MessageBoxButtons.OK, MessageBoxIcon.Information);
  151. }
  152. }
  153. catch (Exception ex)
  154. {
  155. this.btnSearch.Enabled = true;
  156. this.btnClearCondition.Enabled = true;
  157. // 对异常进行共通处理
  158. ExceptionManager.HandleEventException(this.ToString(),
  159. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  160. }
  161. }
  162. /// <summary>
  163. /// 画面加载
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. private void FrmOrganization_Load(object sender, EventArgs e)
  168. {
  169. try
  170. {
  171. //// 加载权限
  172. FormPermissionManager.FormPermissionControl(this.Name, this,
  173. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  174. this.dgvOrder.AutoGenerateColumns = false;
  175. this.dtpStartTime.Enabled = false;
  176. this.dtpEndTime.Enabled = false;
  177. this.dtpStartTime.Value = DateTime.Now.Date;
  178. this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
  179. this.tsbtnCancelFinishedHandover.Visible = false;
  180. this.tsbtnTradeMark.Visible = false;
  181. this.tsbtnChangeOrderNo.Visible = false;
  182. this.tsbtnChangeOrderNoForPlate.Visible = false;
  183. }
  184. catch (Exception ex)
  185. {
  186. // 对异常进行共通处理
  187. ExceptionManager.HandleEventException(this.ToString(),
  188. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  189. }
  190. }
  191. /// <summary>
  192. /// 窗体第一次显示事件
  193. /// </summary>
  194. /// <param name="sender"></param>
  195. /// <param name="e"></param>
  196. private void F_PM_2401_Shown(object sender, EventArgs e)
  197. {
  198. //this.tsbtnTradeMark.Visible = this.tsbtnFinishedHandover.Visible;
  199. //this.tsbtnChangeOrderNoForPlate.Visible = this.tsbtnChangeOrderNo.Visible;
  200. }
  201. /// <summary>
  202. /// 释放成员变量
  203. /// </summary>
  204. /// <param name="sender"></param>
  205. /// <param name="e"></param>
  206. private void FrmOrganization_FormClosed(object sender, FormClosedEventArgs e)
  207. {
  208. _instance = null;
  209. }
  210. /// <summary>
  211. /// 关闭按钮
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. private void tsbtnClose_Click(object sender, EventArgs e)
  216. {
  217. this.Close();
  218. }
  219. /// <summary>
  220. /// 自适应列宽按钮事件
  221. /// </summary>
  222. /// <param name="sender"></param>
  223. /// <param name="e"></param>
  224. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  225. {
  226. this.dgvOrder.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  227. }
  228. /// <summary>
  229. /// 编辑按钮事件
  230. /// </summary>
  231. /// <param name="sender"></param>
  232. /// <param name="e"></param>
  233. private void tsbtnCancelFinishedHandover_Click(object sender, EventArgs e)
  234. {
  235. try
  236. {
  237. //撤销产成品交接
  238. F_PM_2403 frm2104 = new F_PM_2403();
  239. DialogResult dialogResult = frm2104.ShowDialog();
  240. }
  241. catch (Exception ex)
  242. {
  243. // 对异常进行共通处理
  244. ExceptionManager.HandleEventException(this.ToString(),
  245. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  246. }
  247. }
  248. /// <summary>
  249. /// 产成品撤销交接
  250. /// </summary>
  251. /// <param name="sender"></param>
  252. /// <param name="e"></param>
  253. private void tsbtnBackFinishHandover_Click(object sender, EventArgs e)
  254. {
  255. try
  256. {
  257. //撤销产成品交接
  258. F_PM_2407 frm2104 = new F_PM_2407();
  259. DialogResult dialogResult = frm2104.ShowDialog();
  260. }
  261. catch (Exception ex)
  262. {
  263. // 对异常进行共通处理
  264. ExceptionManager.HandleEventException(this.ToString(),
  265. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  266. }
  267. }
  268. /// <summary>
  269. /// 新建按钮事件
  270. /// </summary>
  271. /// <param name="sender"></param>
  272. /// <param name="e"></param>
  273. private void tsbtnAdd_Click(object sender, EventArgs e)
  274. {
  275. try
  276. {
  277. F_PM_2402 frmPM0402 = new F_PM_2402();
  278. DialogResult dialogResult = frmPM0402.ShowDialog();
  279. // 重新加载GridView
  280. if (dialogResult == DialogResult.OK)
  281. {
  282. //SearchProductionDataEntity requestEntity = CreatesearchProductionDataRequestEntity();
  283. //DataTable dtProductionData = (DataTable)DoAsync(new AsyncMethod(() =>
  284. //{
  285. // return PMModuleProxy.Service.GetProductionData(requestEntity);
  286. //}));
  287. //if (dtProductionData != null && dtProductionData.Rows.Count > Constant.INT_IS_ZERO)
  288. //{
  289. // this.dgvProduction.DataSource = null;
  290. // this.dgvProduction.DataSource = dtProductionData;
  291. // // 设置ToolStripButton按钮状态
  292. // this.SetToolStripButtonEnable();
  293. // this.dgvProduction.ReadOnly = true;
  294. //}
  295. }
  296. }
  297. catch (Exception ex)
  298. {
  299. // 对异常进行共通处理
  300. ExceptionManager.HandleEventException(this.ToString(),
  301. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  302. }
  303. }
  304. /// <summary>
  305. /// 更改标识按钮事件
  306. /// </summary>
  307. /// <param name="sender"></param>
  308. /// <param name="e"></param>
  309. private void tsbtnValueFlag_Click(object sender, EventArgs e)
  310. {
  311. try
  312. {
  313. //变更单号
  314. F_PM_2404 frm2404 = new F_PM_2404();
  315. DialogResult dialogResult = frm2404.ShowDialog();
  316. }
  317. catch (Exception ex)
  318. {
  319. // 对异常进行共通处理
  320. ExceptionManager.HandleEventException(this.ToString(),
  321. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  322. }
  323. }
  324. /// <summary>
  325. /// 变更商标事件
  326. /// </summary>
  327. /// <param name="sender"></param>
  328. /// <param name="e"></param>
  329. private void tsbtnTradeMark_Click(object sender, EventArgs e)
  330. {
  331. // 变更商标
  332. F_PM_2405 frm2405 = new F_PM_2405();
  333. DialogResult dialogResult = frm2405.ShowDialog();
  334. }
  335. /// <summary>
  336. /// 变更单号整板事件
  337. /// </summary>
  338. /// <param name="sender"></param>
  339. /// <param name="e"></param>
  340. private void tsbtnChangeOrderNoForPlate_Click(object sender, EventArgs e)
  341. {
  342. // 变更单号整板
  343. F_PM_2406 frm2406 = new F_PM_2406();
  344. DialogResult dialogResult = frm2406.ShowDialog();
  345. }
  346. /// <summary>
  347. /// 复选框按钮事件
  348. /// </summary>
  349. /// <param name="sender"></param>
  350. /// <param name="e"></param>
  351. private void chkDateTime_CheckedChanged(object sender, EventArgs e)
  352. {
  353. this.dtpStartTime.Enabled = chkDateTime.Checked;
  354. this.dtpEndTime.Enabled = chkDateTime.Checked;
  355. }
  356. #endregion
  357. #region 私有方法
  358. /// <summary>
  359. /// 获取输入的订单信息
  360. /// </summary>
  361. /// <returns></returns>
  362. private SearchFinishedProductEntity GetOrderEntityFromLayout()
  363. {
  364. this._orderEntity = new SearchFinishedProductEntity();
  365. this._orderEntity.OrderNo = this.txtOrderNo.Text.Trim();
  366. this._orderEntity.FHUserCode = this.txtFHUserCode.Text.Trim();
  367. if (this.chkDateTime.Checked)
  368. {
  369. this._orderEntity.FHTimeStart = this.dtpStartTime.Value;
  370. this._orderEntity.FHTimeEnd = this.dtpEndTime.Value;
  371. }
  372. this._orderEntity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  373. this._orderEntity.GoodsModel = this.txtGoodsModel.Text.Trim();
  374. this._orderEntity.LogoIDS = this.dkLogoSearchBox1.LogoIDS;
  375. return this._orderEntity;
  376. }
  377. /// <summary>
  378. /// 获取订单列表
  379. /// </summary>
  380. /// <returns></returns>
  381. private DataSet GetFinishedHandover()
  382. {
  383. try
  384. {
  385. return PMModuleProxy.Service.GetFinishedHandover(this._orderEntity);
  386. }
  387. catch (Exception ex)
  388. {
  389. throw ex;
  390. }
  391. }
  392. #endregion
  393. }
  394. }