F_PM_2401.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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. }
  180. catch (Exception ex)
  181. {
  182. // 对异常进行共通处理
  183. ExceptionManager.HandleEventException(this.ToString(),
  184. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  185. }
  186. }
  187. /// <summary>
  188. /// 窗体第一次显示事件
  189. /// </summary>
  190. /// <param name="sender"></param>
  191. /// <param name="e"></param>
  192. private void F_PM_2401_Shown(object sender, EventArgs e)
  193. {
  194. //this.tsbtnTradeMark.Visible = this.tsbtnFinishedHandover.Visible;
  195. this.tsbtnChangeOrderNoForPlate.Visible = this.tsbtnChangeOrderNo.Visible;
  196. }
  197. /// <summary>
  198. /// 释放成员变量
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. private void FrmOrganization_FormClosed(object sender, FormClosedEventArgs e)
  203. {
  204. _instance = null;
  205. }
  206. /// <summary>
  207. /// 关闭按钮
  208. /// </summary>
  209. /// <param name="sender"></param>
  210. /// <param name="e"></param>
  211. private void tsbtnClose_Click(object sender, EventArgs e)
  212. {
  213. this.Close();
  214. }
  215. /// <summary>
  216. /// 自适应列宽按钮事件
  217. /// </summary>
  218. /// <param name="sender"></param>
  219. /// <param name="e"></param>
  220. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  221. {
  222. this.dgvOrder.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  223. }
  224. /// <summary>
  225. /// 编辑按钮事件
  226. /// </summary>
  227. /// <param name="sender"></param>
  228. /// <param name="e"></param>
  229. private void tsbtnCancelFinishedHandover_Click(object sender, EventArgs e)
  230. {
  231. try
  232. {
  233. //撤销产成品交接
  234. F_PM_2403 frm2104 = new F_PM_2403();
  235. DialogResult dialogResult = frm2104.ShowDialog();
  236. }
  237. catch (Exception ex)
  238. {
  239. // 对异常进行共通处理
  240. ExceptionManager.HandleEventException(this.ToString(),
  241. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  242. }
  243. }
  244. /// <summary>
  245. /// 新建按钮事件
  246. /// </summary>
  247. /// <param name="sender"></param>
  248. /// <param name="e"></param>
  249. private void tsbtnAdd_Click(object sender, EventArgs e)
  250. {
  251. try
  252. {
  253. F_PM_2402 frmPM0402 = new F_PM_2402();
  254. DialogResult dialogResult = frmPM0402.ShowDialog();
  255. // 重新加载GridView
  256. if (dialogResult == DialogResult.OK)
  257. {
  258. //SearchProductionDataEntity requestEntity = CreatesearchProductionDataRequestEntity();
  259. //DataTable dtProductionData = (DataTable)DoAsync(new AsyncMethod(() =>
  260. //{
  261. // return PMModuleProxy.Service.GetProductionData(requestEntity);
  262. //}));
  263. //if (dtProductionData != null && dtProductionData.Rows.Count > Constant.INT_IS_ZERO)
  264. //{
  265. // this.dgvProduction.DataSource = null;
  266. // this.dgvProduction.DataSource = dtProductionData;
  267. // // 设置ToolStripButton按钮状态
  268. // this.SetToolStripButtonEnable();
  269. // this.dgvProduction.ReadOnly = true;
  270. //}
  271. }
  272. }
  273. catch (Exception ex)
  274. {
  275. // 对异常进行共通处理
  276. ExceptionManager.HandleEventException(this.ToString(),
  277. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  278. }
  279. }
  280. /// <summary>
  281. /// 更改标识按钮事件
  282. /// </summary>
  283. /// <param name="sender"></param>
  284. /// <param name="e"></param>
  285. private void tsbtnValueFlag_Click(object sender, EventArgs e)
  286. {
  287. try
  288. {
  289. //变更单号
  290. F_PM_2404 frm2404 = new F_PM_2404();
  291. DialogResult dialogResult = frm2404.ShowDialog();
  292. }
  293. catch (Exception ex)
  294. {
  295. // 对异常进行共通处理
  296. ExceptionManager.HandleEventException(this.ToString(),
  297. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  298. }
  299. }
  300. /// <summary>
  301. /// 变更商标事件
  302. /// </summary>
  303. /// <param name="sender"></param>
  304. /// <param name="e"></param>
  305. private void tsbtnTradeMark_Click(object sender, EventArgs e)
  306. {
  307. // 变更商标
  308. F_PM_2405 frm2405 = new F_PM_2405();
  309. DialogResult dialogResult = frm2405.ShowDialog();
  310. }
  311. /// <summary>
  312. /// 变更单号整板事件
  313. /// </summary>
  314. /// <param name="sender"></param>
  315. /// <param name="e"></param>
  316. private void tsbtnChangeOrderNoForPlate_Click(object sender, EventArgs e)
  317. {
  318. // 变更单号整板
  319. F_PM_2406 frm2406 = new F_PM_2406();
  320. DialogResult dialogResult = frm2406.ShowDialog();
  321. }
  322. /// <summary>
  323. /// 复选框按钮事件
  324. /// </summary>
  325. /// <param name="sender"></param>
  326. /// <param name="e"></param>
  327. private void chkDateTime_CheckedChanged(object sender, EventArgs e)
  328. {
  329. this.dtpStartTime.Enabled = chkDateTime.Checked;
  330. this.dtpEndTime.Enabled = chkDateTime.Checked;
  331. }
  332. #endregion
  333. #region 私有方法
  334. /// <summary>
  335. /// 获取输入的订单信息
  336. /// </summary>
  337. /// <returns></returns>
  338. private SearchFinishedProductEntity GetOrderEntityFromLayout()
  339. {
  340. this._orderEntity = new SearchFinishedProductEntity();
  341. this._orderEntity.OrderNo = this.txtOrderNo.Text.Trim();
  342. this._orderEntity.FHUserCode = this.txtFHUserCode.Text.Trim();
  343. if (this.chkDateTime.Checked)
  344. {
  345. this._orderEntity.FHTimeStart = this.dtpStartTime.Value;
  346. this._orderEntity.FHTimeEnd = this.dtpEndTime.Value;
  347. }
  348. this._orderEntity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  349. this._orderEntity.GoodsModel = this.txtGoodsModel.Text.Trim();
  350. this._orderEntity.LogoIDS = this.dkLogoSearchBox1.LogoIDS;
  351. return this._orderEntity;
  352. }
  353. /// <summary>
  354. /// 获取订单列表
  355. /// </summary>
  356. /// <returns></returns>
  357. private DataSet GetFinishedHandover()
  358. {
  359. try
  360. {
  361. return PMModuleProxy.Service.GetFinishedHandover(this._orderEntity);
  362. }
  363. catch (Exception ex)
  364. {
  365. throw ex;
  366. }
  367. }
  368. #endregion
  369. }
  370. }