F_MST_1102.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_1102.cs
  5. * 2.功能描述:工艺配置一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/07/20 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. namespace Dongke.IBOSS.PRD.Client.SystemModule
  19. {
  20. /// <summary>
  21. /// 工艺配置一览
  22. /// </summary>
  23. public partial class F_MST_1102 : DockPanelBase
  24. {
  25. #region 成员变量
  26. //单例模式
  27. private static F_MST_1102 _instance;
  28. #endregion
  29. #region 构造函数
  30. /// <summary>
  31. /// 废弃一览构造
  32. /// </summary>
  33. public F_MST_1102()
  34. {
  35. InitializeComponent();
  36. this.Text = FormTitles.F_MST_1102;
  37. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  38. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  39. this.tsbtnCopy.Text = ButtonText.TSBTN_COPY;
  40. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  41. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  42. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  43. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  44. }
  45. #endregion
  46. #region 单例模式
  47. /// <summary>
  48. /// 单例模式,防止重复创建窗体
  49. /// </summary>
  50. public static F_MST_1102 Instance
  51. {
  52. get
  53. {
  54. if (_instance == null)
  55. {
  56. _instance = new F_MST_1102();
  57. }
  58. return _instance;
  59. }
  60. }
  61. #endregion
  62. #region 事件
  63. /// <summary>
  64. /// 查询事件
  65. /// </summary>
  66. /// <param name="sender"></param>
  67. /// <param name="e"></param>
  68. private void btnSearch_Click(object sender, EventArgs e)
  69. {
  70. try
  71. {
  72. DataSet dsTransfer = (DataSet)DoAsync(new AsyncMethod(() =>
  73. {
  74. return this.GetTransfer();
  75. }));
  76. if (dsTransfer != null)
  77. {
  78. if (dsTransfer.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  79. {
  80. this.dgvTransfer.DataSource = ((DataSet)dsTransfer).Tables[Constant.INT_IS_ZERO];
  81. this.dgvTransfer.ReadOnly = true;
  82. this.dgvTransfer.Rows[0].Selected = true;
  83. this.tsbtnEdit.Enabled = true;
  84. this.tsbtnCopy.Enabled = true;
  85. }
  86. else
  87. {
  88. this.dgvTransfer.DataSource = null;
  89. this.dgvTransferSetting.DataSource = null;
  90. this.tsbtnEdit.Enabled = false;
  91. this.tsbtnCopy.Enabled = false;
  92. // 提示未查找到数据
  93. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  94. MessageBoxButtons.OK, MessageBoxIcon.Information);
  95. }
  96. }
  97. else
  98. {
  99. this.dgvTransfer.DataSource = null;
  100. this.dgvTransferSetting.DataSource = null;
  101. // 提示未查找到数据
  102. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  103. MessageBoxButtons.OK, MessageBoxIcon.Information);
  104. }
  105. }
  106. catch (Exception ex)
  107. {
  108. // 对异常进行共通处理
  109. ExceptionManager.HandleEventException(this.ToString(),
  110. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  111. }
  112. }
  113. /// <summary>
  114. /// 清空条件
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. private void btnClearCondition_Click(object sender, EventArgs e)
  119. {
  120. this.txtName.Text = string.Empty;
  121. this.txtRemarks.Text = string.Empty;
  122. this.dkproductionLineSearchBox1.ClearControl();
  123. this.chkVYes.Checked = true;
  124. this.chkVNo.Checked = false;
  125. }
  126. /// <summary>
  127. /// 关闭一览窗体
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. private void tsbtnClose_Click(object sender, EventArgs e)
  132. {
  133. this.Close();
  134. }
  135. /// <summary>
  136. /// 窗体关闭事件
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="e"></param>
  140. private void F_PM_2201_FormClosed(object sender, FormClosedEventArgs e)
  141. {
  142. _instance = null;
  143. }
  144. /// <summary>
  145. /// 自动列宽
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  150. {
  151. this.dgvTransfer.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  152. this.dgvTransferSetting.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  153. }
  154. /// <summary>
  155. /// 审批按钮事件
  156. /// </summary>
  157. /// <param name="sender"></param>
  158. /// <param name="e"></param>
  159. private void tsbtnApprover_Click(object sender, EventArgs e)
  160. {
  161. try
  162. {
  163. //DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  164. //if (currentRow != null)
  165. //{
  166. // string barCode = currentRow.Cells["BarCode"].Value.ToString();
  167. // int ScrapProductID = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value);
  168. // string GoodsLevelTypeID = currentRow.Cells["GoodsLevelTypeID"].Value.ToString();
  169. // if (GoodsLevelTypeID != _goodsLevelTypeID.ToString())
  170. // {
  171. // return;
  172. // }
  173. // F_PM_1103 frmFPM1103 = new F_PM_1103(barCode, 0, ScrapProductID);
  174. // DialogResult dialogresult = frmFPM1103.ShowDialog();
  175. // if (dialogresult.Equals(DialogResult.OK))
  176. // {
  177. // this.dgvScrapProduct.DataSource = null;
  178. // object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  179. // if (obScrapResult != null)
  180. // {
  181. // DataSet dsScrap = (DataSet)obScrapResult;
  182. // if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  183. // {
  184. // this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  185. // this.dgvScrapProduct.ReadOnly = true;
  186. // }
  187. // }
  188. // }
  189. //}
  190. //else
  191. //{
  192. // MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  193. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  194. //}
  195. }
  196. catch (Exception ex)
  197. {
  198. // 对异常进行共通处理
  199. ExceptionManager.HandleEventException(this.ToString(),
  200. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  201. }
  202. }
  203. /// <summary>
  204. /// 窗体加载
  205. /// </summary>
  206. /// <param name="sender"></param>
  207. /// <param name="e"></param>
  208. private void F_PM_2201_Load(object sender, EventArgs e)
  209. {
  210. try
  211. {
  212. // 加载权限
  213. FormPermissionManager.FormPermissionControl(this.Name, this,
  214. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  215. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  216. this.dgvTransfer.AutoGenerateColumns = false;
  217. this.dgvTransferSetting.AutoGenerateColumns = false;
  218. // 设置日期控件默认值
  219. //this.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  220. //this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  221. //this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  222. //this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  223. //this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  224. //this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  225. //this.txtReSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  226. //this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  227. //this.txtBackOutTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  228. //this.txtBackOutTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  229. //this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  230. //this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  231. // 加载半检,复检状态数据源
  232. //DataSet dsGetSemiCheckType = SystemModuleProxy.Service.GetSemiCheckType();
  233. //if (dsGetSemiCheckType != null && dsGetSemiCheckType.Tables[0].Rows.Count > 0)
  234. //{
  235. // DataRow[] drSemiCheckType = dsGetSemiCheckType.Tables[0].Select("Semichecktype=1");
  236. // if (drSemiCheckType.Length > 0)
  237. // {
  238. // this.chkSemiCheckType.ValueMember = "Semichecktypeid";
  239. // this.chkSemiCheckType.DisplayMember = "Semichecktypename";
  240. // this.chkSemiCheckType.DataSource = drSemiCheckType.CopyToDataTable();
  241. // }
  242. // DataRow[] drReSemiCheckType = dsGetSemiCheckType.Tables[0].Select("Semichecktype=2");
  243. // if (drReSemiCheckType.Length > 0)
  244. // {
  245. // this.chkReSemiCheckType.ValueMember = "Semichecktypeid";
  246. // this.chkReSemiCheckType.DisplayMember = "Semichecktypename";
  247. // this.chkReSemiCheckType.DataSource = drReSemiCheckType.CopyToDataTable();
  248. // }
  249. //}
  250. }
  251. catch (Exception ex)
  252. {
  253. // 对异常进行共通处理
  254. ExceptionManager.HandleEventException(this.ToString(),
  255. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  256. }
  257. }
  258. /// <summary>
  259. /// 选定项改变事件
  260. /// </summary>
  261. /// <param name="sender"></param>
  262. /// <param name="e"></param>
  263. private void dgvTransfer_SelectionChanged(object sender, EventArgs e)
  264. {
  265. try
  266. {
  267. if (this.dgvTransfer.CurrentCell != null)
  268. {
  269. if (!this.txtName.ReadOnly)
  270. {
  271. this.dgvTransferSetting.DataSource = null;
  272. int ptid = Convert.ToInt32(this.dgvTransfer.Rows[this.dgvTransfer.CurrentCell.RowIndex].Cells["PTID"].Value.ToString());
  273. DataSet dsDetail = (DataSet)DoAsync(new AsyncMethod(() =>
  274. {
  275. return SystemModuleProxy.Service.GetTransferInfo(ptid);
  276. }));
  277. if (dsDetail != null && dsDetail.Tables.Count > Constant.INT_IS_ZERO
  278. && dsDetail.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  279. {
  280. this.dgvTransferSetting.DataSource = dsDetail.Tables[0];
  281. }
  282. this.dgvTransfer.Focus();
  283. }
  284. }
  285. }
  286. catch (Exception ex)
  287. {
  288. // 对异常进行共通处理
  289. ExceptionManager.HandleEventException(this.ToString(),
  290. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  291. }
  292. }
  293. #endregion
  294. #region 私有方法
  295. /// <summary>
  296. /// 根据界面查询条件获取数据集
  297. /// </summary>
  298. private DataSet GetTransfer()
  299. {
  300. try
  301. {
  302. TecDepEntity entity = new TecDepEntity();
  303. entity.Name = this.txtName.Text.Trim();
  304. entity.LineIDS = this.dkproductionLineSearchBox1.ProductionLineIDS;
  305. entity.Remarks = this.txtRemarks.Text.Trim();
  306. if(this.chkVNo.Checked && this.chkVYes.Checked)
  307. {
  308. entity.ValueFlag = 2;
  309. }
  310. else
  311. {
  312. if(this.chkVNo.Checked)
  313. {
  314. entity.ValueFlag = 0;
  315. }
  316. else
  317. {
  318. entity.ValueFlag = 1;
  319. }
  320. }
  321. return SystemModuleProxy.Service.GetTransfer(entity);
  322. }
  323. catch (Exception ex)
  324. {
  325. throw ex;
  326. }
  327. }
  328. #endregion
  329. /// <summary>
  330. /// 撤销复检按钮事件
  331. /// </summary>
  332. /// <param name="sender"></param>
  333. /// <param name="e"></param>
  334. private void tsbtnBackReSemiCheck_Click(object sender, EventArgs e)
  335. {
  336. try
  337. {
  338. //F_PM_2205 frmFPM2205 = new F_PM_2205(0, "撤销复检");
  339. //DialogResult dialogresult = frmFPM2205.ShowDialog();
  340. //if (dialogresult.Equals(DialogResult.OK))
  341. //{
  342. // btnSearch_Click(sender, e);
  343. //}
  344. }
  345. catch (Exception ex)
  346. {
  347. // 对异常进行共通处理
  348. ExceptionManager.HandleEventException(this.ToString(),
  349. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  350. }
  351. }
  352. /// <summary>
  353. /// 新建
  354. /// </summary>
  355. /// <param name="sender"></param>
  356. /// <param name="e"></param>
  357. private void tsbtnAdd_Click(object sender, EventArgs e)
  358. {
  359. try
  360. {
  361. F_MST_1103 frmMST1103 = new F_MST_1103(0);
  362. DialogResult dialogresult = frmMST1103.ShowDialog();
  363. if (dialogresult.Equals(DialogResult.OK))
  364. {
  365. btnSearch_Click(sender, e);
  366. }
  367. }
  368. catch (Exception ex)
  369. {
  370. // 对异常进行共通处理
  371. ExceptionManager.HandleEventException(this.ToString(),
  372. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  373. }
  374. }
  375. /// <summary>
  376. /// 编辑
  377. /// </summary>
  378. /// <param name="sender"></param>
  379. /// <param name="e"></param>
  380. private void tsbtnEdit_Click(object sender, EventArgs e)
  381. {
  382. try
  383. {
  384. DataGridViewRow currentRow = this.dgvTransfer.CurrentRow;
  385. if (currentRow != null)
  386. // 获取相应节点数据
  387. {
  388. F_MST_1103 frmMST1103 = new F_MST_1103(
  389. Convert.ToInt32(currentRow.Cells["PTID"].Value));
  390. DialogResult dialogresult = frmMST1103.ShowDialog();
  391. if (dialogresult.Equals(DialogResult.OK))
  392. {
  393. // 刷新窗口数据
  394. btnSearch_Click(sender, e);
  395. }
  396. }
  397. }
  398. catch (Exception ex)
  399. {
  400. // 对异常进行共通处理
  401. ExceptionManager.HandleEventException(this.ToString(),
  402. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  403. }
  404. }
  405. /// <summary>
  406. /// 复制
  407. /// </summary>
  408. /// <param name="sender"></param>
  409. /// <param name="e"></param>
  410. private void tsbtnCopy_Click(object sender, EventArgs e)
  411. {
  412. try
  413. {
  414. DataGridViewRow currentRow = this.dgvTransfer.CurrentRow;
  415. if (currentRow != null)
  416. // 获取相应节点数据
  417. {
  418. F_MST_1103 frmMST1103 = new F_MST_1103(
  419. 0 - Convert.ToInt32(currentRow.Cells["PTID"].Value));
  420. DialogResult dialogresult = frmMST1103.ShowDialog();
  421. if (dialogresult.Equals(DialogResult.OK))
  422. {
  423. // 刷新窗口数据
  424. btnSearch_Click(sender, e);
  425. }
  426. }
  427. }
  428. catch (Exception ex)
  429. {
  430. // 对异常进行共通处理
  431. ExceptionManager.HandleEventException(this.ToString(),
  432. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  433. }
  434. }
  435. }
  436. }