F_PC_0101.cs 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0101.cs
  5. * 2.功能描述:成型线信息一览,以及对成型线模具的相关操作
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService;
  22. namespace Dongke.IBOSS.PRD.Client.PCModule
  23. {
  24. /// <summary>
  25. /// 成型线信息一览,以及对成型线模具的相关操作
  26. /// </summary>
  27. public partial class F_PC_0101 : DockPanelBase
  28. {
  29. #region 成员变量
  30. //单例模式
  31. private static F_PC_0101 _instance;
  32. //选择的成型线实体
  33. private GroutingLineEntity _groutingLineEntity = new GroutingLineEntity();
  34. //成型线明细(模具)实体集合
  35. private List<GroutingLineDetailEntity> _detailList = new List<GroutingLineDetailEntity>();
  36. //范围权限
  37. private string _purview;
  38. //操作时间
  39. private DateTime? _startTime;
  40. //换产产品ID
  41. private int? _newGoodsId;
  42. //操作说明/备注
  43. private string _remarksOrRreason = "";
  44. #endregion
  45. #region 构造函数
  46. /// <summary>
  47. /// 成型线一览窗体构造
  48. /// </summary>
  49. public F_PC_0101()
  50. {
  51. InitializeComponent();
  52. this.Text = FormTitles.F_PC_0101;
  53. this.tsbtnRepairMould.Text = ButtonText.TSBTN_REPAIRMOULD;
  54. this.tsbtnRepairMouldEnd.Text = ButtonText.TSBTN_REPAIRMOULDEND;
  55. this.tsbtnChangeMould.Text = ButtonText.TSBTN_CHANGEMOULD;
  56. this.tsbtnChangeMouldEnd.Text = ButtonText.TSBTN_CHANGEMOULDEND;
  57. this.tsbtnDisable.Text = ButtonText.TSBTN_DISABLE;
  58. this.tsbtnChangeMouldAll.Text = ButtonText.TSBTN_CHANGEMOULDENDALL;
  59. this.tsbtnChangeMouldAllEnd.Text = ButtonText.TSBTN_CHANGEMOULDENDALLEND;
  60. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  61. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  62. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  63. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  64. }
  65. #endregion
  66. #region 单例模式
  67. /// <summary>
  68. /// 单例模式,防止重复创建窗体
  69. /// </summary>
  70. public static F_PC_0101 Instance
  71. {
  72. get
  73. {
  74. if (_instance == null)
  75. {
  76. _instance = new F_PC_0101();
  77. }
  78. return _instance;
  79. }
  80. }
  81. #endregion
  82. #region 事件
  83. /// <summary>
  84. /// 窗体加载
  85. /// </summary>
  86. private void F_PC_0101_Load(object sender, EventArgs e)
  87. {
  88. try
  89. {
  90. // 加载权限
  91. FormPermissionManager.FormPermissionControl(this.Name, this,
  92. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  93. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  94. getPurview();
  95. }
  96. catch (Exception ex)
  97. {
  98. // 对异常进行共通处理
  99. ExceptionManager.HandleEventException(this.ToString(),
  100. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  101. }
  102. }
  103. /// <summary>
  104. /// 自动适应列宽
  105. /// </summary>
  106. /// <param name="sender"></param>
  107. /// <param name="e"></param>
  108. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  109. {
  110. this.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  111. }
  112. /// <summary>
  113. /// 关闭按钮事件
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void tsbtnClose_Click(object sender, EventArgs e)
  118. {
  119. this.Close();
  120. }
  121. /// <summary>
  122. /// 获取数据
  123. /// </summary>
  124. private void btnSearch_Click(object sender, EventArgs e)
  125. {
  126. try
  127. {
  128. if (this.dkGrouting.GroutingLineID == null)
  129. {
  130. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  131. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  132. this.dkGrouting.Focus();
  133. return;
  134. }
  135. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  136. {
  137. return GetGroutingLineDetail();
  138. }));
  139. if (dsGroutingLineDetail != null)
  140. {
  141. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  142. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  143. {
  144. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  145. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  146. this.dgvGroutingLineDetail.ReadOnly = true;
  147. }
  148. }
  149. }
  150. catch (Exception ex)
  151. {
  152. // 对异常进行共通处理
  153. ExceptionManager.HandleEventException(this.ToString(),
  154. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  155. }
  156. }
  157. /// <summary>
  158. /// 窗体关闭
  159. /// </summary>
  160. private void F_PC_0101_FormClosed(object sender, FormClosedEventArgs e)
  161. {
  162. _instance = null;
  163. }
  164. /// <summary>
  165. /// 清空条件
  166. /// </summary>
  167. private void btnClearCondition_Click(object sender, EventArgs e)
  168. {
  169. this.dkGrouting.GroutingLineID = null;
  170. this.dkGrouting.Text = null;
  171. this.dgvGroutingLineDetail.DataSource = null;
  172. this.tsbtnChangeMouldAll.Enabled = false;
  173. this.tsbtnChangeMouldAllEnd.Enabled = false;
  174. }
  175. /// <summary>
  176. /// 选择明细
  177. /// </summary>
  178. private void dgvGroutingLineDetail_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  179. {
  180. try
  181. {
  182. if (e.RowIndex == -Constant.INT_IS_ONE || e.ColumnIndex == -Constant.INT_IS_ONE)
  183. {
  184. return;
  185. }
  186. int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
  187. if (this.dkGrouting.GMouldStatus == Constant.INT_IS_THREE)
  188. {
  189. this.tsbtnRepairMould.Enabled = false;
  190. this.tsbtnRepairMouldEnd.Enabled = false;
  191. this.tsbtnChangeMould.Enabled = false;
  192. this.tsbtnChangeMouldEnd.Enabled = false;
  193. this.tsbtnDisable.Enabled = false;
  194. this.tsbtnChangeMouldAll.Enabled = false;
  195. this.tsbtnChangeMouldAllEnd.Enabled = true;
  196. return;
  197. }
  198. GroutingLineDetailEntity detailEntity = _detailList[Index];
  199. if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal))
  200. {
  201. this.tsbtnRepairMould.Enabled = true;
  202. this.tsbtnChangeMould.Enabled = true;
  203. this.tsbtnChangeMouldEnd.Enabled = false;
  204. this.tsbtnRepairMouldEnd.Enabled = false;
  205. this.tsbtnDisable.Enabled = true;
  206. }
  207. if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Repair))
  208. {
  209. this.tsbtnChangeMould.Enabled = true;
  210. this.tsbtnRepairMould.Enabled = false;
  211. this.tsbtnRepairMouldEnd.Enabled = true;
  212. this.tsbtnChangeMouldEnd.Enabled = false;
  213. this.tsbtnDisable.Enabled = true;
  214. }
  215. if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Replac))
  216. {
  217. this.tsbtnRepairMould.Enabled = false;
  218. this.tsbtnRepairMouldEnd.Enabled = false;
  219. this.tsbtnChangeMould.Enabled = false;
  220. this.tsbtnChangeMouldEnd.Enabled = true;
  221. this.tsbtnDisable.Enabled = true;
  222. }
  223. if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Disable))
  224. {
  225. this.tsbtnRepairMould.Enabled = false;
  226. this.tsbtnRepairMouldEnd.Enabled = false;
  227. this.tsbtnChangeMould.Enabled = false;
  228. this.tsbtnChangeMouldEnd.Enabled = false;
  229. this.tsbtnDisable.Enabled = false;
  230. }
  231. if(detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Update))
  232. {
  233. this.tsbtnRepairMould.Enabled = false;
  234. this.tsbtnRepairMouldEnd.Enabled = false;
  235. this.tsbtnChangeMould.Enabled = false;
  236. this.tsbtnChangeMouldEnd.Enabled = false;
  237. this.tsbtnDisable.Enabled = false;
  238. }
  239. }
  240. catch (Exception ex)
  241. {
  242. // 对异常进行共通处理
  243. ExceptionManager.HandleEventException(this.ToString(),
  244. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  245. }
  246. }
  247. /// <summary>
  248. /// 窗体关闭
  249. /// </summary>
  250. private void GroutingLineInfo_FormClosed(object sender, FormClosedEventArgs e)
  251. {
  252. _instance = null;
  253. }
  254. /// <summary>
  255. /// 修模操作
  256. /// </summary>
  257. /// <param name="sender"></param>
  258. /// <param name="e"></param>
  259. private void tsbtnRepairMould_Click(object sender, EventArgs e)
  260. {
  261. try
  262. {
  263. if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
  264. {
  265. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "修模");
  266. DialogResult dialogresult = frmFPC0106.ShowDialog();
  267. if (dialogresult.Equals(DialogResult.OK))
  268. {
  269. string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
  270. int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
  271. //修模处理
  272. GroutingLineDetailEntity detailEntity = _detailList[Index];
  273. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Repair);
  274. GMouldRecordEntity recordEntity = new GMouldRecordEntity();
  275. recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
  276. recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
  277. recordEntity.GOODSID = detailEntity.GOODSID;
  278. recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
  279. recordEntity.MouldCode = detailEntity.MOULDCODE;
  280. recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
  281. recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Repair);
  282. if (_remarksOrRreason == string.Empty)
  283. {
  284. recordEntity.RREASON = "修模";
  285. }
  286. else
  287. {
  288. recordEntity.RREASON = _remarksOrRreason;
  289. }
  290. recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
  291. recordEntity.REMARKS = "";
  292. //准备提交
  293. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  294. {
  295. return PCModuleProxy.Service.RepAirDetail(detailEntity, recordEntity);
  296. }));
  297. if (MyReturn > Constant.INT_IS_ZERO)
  298. {
  299. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  300. {
  301. return GetGroutingLineDetail();
  302. }));
  303. if (dsGroutingLineDetail != null)
  304. {
  305. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  306. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  307. {
  308. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  309. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  310. this.dgvGroutingLineDetail.ReadOnly = true;
  311. }
  312. }
  313. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "修模"), this.Text,
  314. MessageBoxButtons.OK, MessageBoxIcon.Information);
  315. }
  316. else if (MyReturn == -500)
  317. {
  318. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  319. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  320. this.Close();
  321. }
  322. else
  323. {
  324. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "修模"), this.Text,
  325. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  326. }
  327. }
  328. }
  329. else
  330. {
  331. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  332. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  333. }
  334. }
  335. catch (Exception ex)
  336. {
  337. // 对异常进行共通处理
  338. ExceptionManager.HandleEventException(this.ToString(),
  339. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  340. }
  341. }
  342. /// <summary>
  343. /// 修模结束操作
  344. /// </summary>
  345. /// <param name="sender"></param>
  346. /// <param name="e"></param>
  347. private void tsbtnRepairMouldEnd_Click(object sender, EventArgs e)
  348. {
  349. try
  350. {
  351. if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
  352. {
  353. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "修模结束");
  354. DialogResult dialogresult = frmFPC0106.ShowDialog();
  355. if (dialogresult.Equals(DialogResult.OK))
  356. {
  357. string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
  358. int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
  359. //修模完成处理
  360. GroutingLineDetailEntity detailEntity = _detailList[Index];
  361. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
  362. //准备提交
  363. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  364. {
  365. return PCModuleProxy.Service.RepAirDetailEnd(detailEntity, _startTime, _remarksOrRreason);
  366. }));
  367. if (MyReturn > Constant.INT_IS_ZERO)
  368. {
  369. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  370. {
  371. return GetGroutingLineDetail();
  372. }));
  373. if (dsGroutingLineDetail != null)
  374. {
  375. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  376. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  377. {
  378. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  379. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  380. this.dgvGroutingLineDetail.ReadOnly = true;
  381. }
  382. }
  383. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "修模结束"), this.Text,
  384. MessageBoxButtons.OK, MessageBoxIcon.Information);
  385. }
  386. else if (MyReturn == -500)
  387. {
  388. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  389. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  390. this.Close();
  391. }
  392. else
  393. {
  394. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "修模结束"), this.Text,
  395. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  396. }
  397. }
  398. }
  399. else
  400. {
  401. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  402. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  403. }
  404. }
  405. catch (Exception ex)
  406. {
  407. // 对异常进行共通处理
  408. ExceptionManager.HandleEventException(this.ToString(),
  409. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  410. }
  411. }
  412. /// <summary>
  413. /// 换模操作
  414. /// </summary>
  415. /// <param name="sender"></param>
  416. /// <param name="e"></param>
  417. private void tsbtnChangeMould_Click(object sender, EventArgs e)
  418. {
  419. try
  420. {
  421. if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
  422. {
  423. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "换模");
  424. DialogResult dialogresult = frmFPC0106.ShowDialog();
  425. if (dialogresult.Equals(DialogResult.OK))
  426. {
  427. string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
  428. int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
  429. //插入换修履历以及模具履历,并更新成型线明细的新编号,重置注浆次数,开始使用时间。以及换模中的状态
  430. if (Constant.NowUpdateMode == Constant.GroutingLineDetailUpdateMode.Preposition)
  431. {
  432. GroutingLineDetailEntity detailEntity = _detailList[Index];
  433. GMouldRecordEntity recordEntity = new GMouldRecordEntity();
  434. recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
  435. recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
  436. recordEntity.GOODSID = detailEntity.GOODSID;
  437. recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
  438. recordEntity.MouldCode = detailEntity.MOULDCODE;
  439. recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
  440. if (this._remarksOrRreason != string.Empty)
  441. {
  442. recordEntity.RREASON = _remarksOrRreason;
  443. }
  444. else
  445. {
  446. recordEntity.RREASON = Constant.BUTTON_TEXT_CHANGE;
  447. }
  448. recordEntity.REMARKS = recordEntity.RREASON;
  449. if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal))
  450. {
  451. recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Replac);
  452. }
  453. else
  454. {
  455. recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.RepairToReplac);
  456. }
  457. recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
  458. GMouldHistoryEntity historyEntity = new GMouldHistoryEntity();
  459. historyEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
  460. historyEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
  461. historyEntity.GOODSID = detailEntity.GOODSID;
  462. historyEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
  463. historyEntity.MouldCode = detailEntity.MOULDCODE;
  464. historyEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
  465. historyEntity.BEGINUSEDDATE = detailEntity.BEGINUSEDDATE;
  466. historyEntity.ENDUSEDDATE = Convert.ToDateTime(_startTime);
  467. historyEntity.REMARKS = recordEntity.RREASON;//"";
  468. //模具编号要更新
  469. detailEntity.MOULDCODE = Guid.NewGuid().ToString();
  470. detailEntity.GROUTINGCOUNT = 0;
  471. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Replac);
  472. detailEntity.BEGINUSEDDATE = Convert.ToDateTime(_startTime);
  473. detailEntity.REMARKS = this._remarksOrRreason;
  474. //准备提交
  475. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  476. {
  477. return PCModuleProxy.Service.ChangeDetailPreposition(detailEntity, recordEntity, historyEntity);
  478. }));
  479. if (MyReturn > Constant.INT_IS_ZERO)
  480. {
  481. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  482. {
  483. return GetGroutingLineDetail();
  484. }));
  485. if (dsGroutingLineDetail != null)
  486. {
  487. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  488. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  489. {
  490. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  491. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  492. this.dgvGroutingLineDetail.ReadOnly = true;
  493. }
  494. }
  495. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模"), this.Text,
  496. MessageBoxButtons.OK, MessageBoxIcon.Information);
  497. }
  498. else if (MyReturn == -500)
  499. {
  500. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  501. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  502. this.Close();
  503. }
  504. else
  505. {
  506. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模"), this.Text,
  507. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  508. }
  509. }
  510. else //只插入换修履历,并只更新成型线明细的状态(换模中)
  511. {
  512. GroutingLineDetailEntity detailEntity = _detailList[Index];
  513. GMouldRecordEntity recordEntity = new GMouldRecordEntity();
  514. recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
  515. recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
  516. recordEntity.GOODSID = detailEntity.GOODSID;
  517. recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
  518. recordEntity.MouldCode = detailEntity.MOULDCODE;
  519. recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
  520. recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
  521. recordEntity.RREASON = Constant.BUTTON_TEXT_CHANGE;
  522. recordEntity.REMARKS = "";
  523. if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal))
  524. {
  525. recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Replac);
  526. }
  527. else
  528. {
  529. recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.RepairToReplac);
  530. }
  531. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Replac);
  532. //准备提交
  533. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  534. {
  535. return PCModuleProxy.Service.ChangeDetailPostposition(detailEntity, recordEntity);
  536. }));
  537. if (MyReturn > Constant.INT_IS_ZERO)
  538. {
  539. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  540. {
  541. return GetGroutingLineDetail();
  542. }));
  543. if (dsGroutingLineDetail != null)
  544. {
  545. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  546. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  547. {
  548. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  549. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  550. this.dgvGroutingLineDetail.ReadOnly = true;
  551. }
  552. }
  553. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模"), this.Text,
  554. MessageBoxButtons.OK, MessageBoxIcon.Information);
  555. }
  556. else if (MyReturn == -500)
  557. {
  558. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  559. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  560. this.Close();
  561. }
  562. else
  563. {
  564. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模"), this.Text,
  565. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  566. }
  567. }
  568. }
  569. }
  570. else
  571. {
  572. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  573. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  574. }
  575. }
  576. catch (Exception ex)
  577. {
  578. // 对异常进行共通处理
  579. ExceptionManager.HandleEventException(this.ToString(),
  580. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  581. }
  582. }
  583. /// <summary>
  584. /// 换模结束操作
  585. /// </summary>
  586. /// <param name="sender"></param>
  587. /// <param name="e"></param>
  588. private void tsbtnChangeMouldEnd_Click(object sender, EventArgs e)
  589. {
  590. try
  591. {
  592. if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
  593. {
  594. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "换模结束");
  595. DialogResult dialogresult = frmFPC0106.ShowDialog();
  596. if (dialogresult.Equals(DialogResult.OK))
  597. {
  598. string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
  599. int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
  600. if (Constant.NowUpdateMode == Constant.GroutingLineDetailUpdateMode.Preposition) //把明细修改回来即可
  601. {
  602. //换模结束处理
  603. GroutingLineDetailEntity detailEntity = _detailList[Index];
  604. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
  605. detailEntity.REMARKS = this._remarksOrRreason;
  606. //准备提交
  607. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  608. {
  609. return PCModuleProxy.Service.ChangeDetailEndPreposition(detailEntity, _startTime, _remarksOrRreason);
  610. }));
  611. if (MyReturn > Constant.INT_IS_ZERO)
  612. {
  613. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  614. {
  615. return GetGroutingLineDetail();
  616. }));
  617. if (dsGroutingLineDetail != null)
  618. {
  619. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  620. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  621. {
  622. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  623. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  624. this.dgvGroutingLineDetail.ReadOnly = true;
  625. }
  626. }
  627. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模结束"), this.Text,
  628. MessageBoxButtons.OK, MessageBoxIcon.Information);
  629. }
  630. else if (MyReturn == -500)
  631. {
  632. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  633. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  634. this.Close();
  635. }
  636. else
  637. {
  638. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模结束"), this.Text,
  639. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  640. }
  641. }
  642. else //插入模具履历,并更新成型线明细的模具编号,重置开始使用时间,注浆次数,以及把模具状态修改为正常
  643. {
  644. //换模结束处理
  645. GroutingLineDetailEntity detailEntity = this._detailList[Index];
  646. GMouldHistoryEntity historyEntity = new GMouldHistoryEntity();
  647. historyEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
  648. historyEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
  649. historyEntity.GOODSID = detailEntity.GOODSID;
  650. historyEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
  651. historyEntity.MouldCode = detailEntity.MOULDCODE;
  652. historyEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
  653. historyEntity.BEGINUSEDDATE = detailEntity.BEGINUSEDDATE;
  654. historyEntity.ENDUSEDDATE = Convert.ToDateTime(_startTime);
  655. historyEntity.REMARKS = "";
  656. detailEntity.MOULDCODE = Guid.NewGuid().ToString();
  657. detailEntity.GROUTINGCOUNT = 0;
  658. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
  659. detailEntity.BEGINUSEDDATE = Convert.ToDateTime(_startTime);
  660. //准备提交
  661. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  662. {
  663. return PCModuleProxy.Service.ChangeDetailEndPostposition(detailEntity, historyEntity);
  664. }));
  665. if (MyReturn > Constant.INT_IS_ZERO)
  666. {
  667. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  668. {
  669. return GetGroutingLineDetail();
  670. }));
  671. if (dsGroutingLineDetail != null)
  672. {
  673. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  674. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  675. {
  676. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  677. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  678. this.dgvGroutingLineDetail.ReadOnly = true;
  679. }
  680. }
  681. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模结束"), this.Text,
  682. MessageBoxButtons.OK, MessageBoxIcon.Information);
  683. }
  684. else if (MyReturn == -500)
  685. {
  686. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  687. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  688. this.Close();
  689. }
  690. else
  691. {
  692. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模结束"), this.Text,
  693. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  694. }
  695. }
  696. }
  697. }
  698. else
  699. {
  700. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  701. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  702. }
  703. }
  704. catch (Exception ex)
  705. {
  706. // 对异常进行共通处理
  707. ExceptionManager.HandleEventException(this.ToString(),
  708. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  709. }
  710. }
  711. /// <summary>
  712. /// 停用操作
  713. /// </summary>
  714. /// <param name="sender"></param>
  715. /// <param name="e"></param>
  716. private void tsbtnDisable_Click(object sender, EventArgs e)
  717. {
  718. try
  719. {
  720. if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
  721. {
  722. string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
  723. int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
  724. GroutingLineDetailEntity detailEntity = _detailList[Index];
  725. GMouldRecordEntity recordEntity = new GMouldRecordEntity();
  726. recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
  727. recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
  728. recordEntity.GOODSID = detailEntity.GOODSID;
  729. recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
  730. recordEntity.MouldCode = detailEntity.MOULDCODE;
  731. recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
  732. recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
  733. recordEntity.RESUMETYPE = 0;
  734. recordEntity.RREASON = Constant.BUTTON_TEXT_STOP;
  735. recordEntity.REMARKS = "";
  736. if (detailEntity.MOULDSTATUS != Convert.ToInt32(Constant.GMouldStatus.Normal))
  737. {
  738. PCModuleProxy.Service.UpdateMouldRecordEndTime(recordEntity);
  739. }
  740. detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Disable);
  741. //准备提交
  742. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  743. {
  744. return PCModuleProxy.Service.StopDetail(detailEntity, recordEntity);
  745. }));
  746. if (MyReturn > Constant.INT_IS_ZERO)
  747. {
  748. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  749. {
  750. return GetGroutingLineDetail();
  751. }));
  752. if (dsGroutingLineDetail != null)
  753. {
  754. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  755. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  756. {
  757. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  758. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  759. this.dgvGroutingLineDetail.ReadOnly = true;
  760. }
  761. }
  762. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "停用"), this.Text,
  763. MessageBoxButtons.OK, MessageBoxIcon.Information);
  764. }
  765. else if (MyReturn == -500)
  766. {
  767. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  768. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  769. this.Close();
  770. }
  771. else
  772. {
  773. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "停用"), this.Text,
  774. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  775. }
  776. }
  777. else
  778. {
  779. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  780. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  781. }
  782. }
  783. catch (Exception ex)
  784. {
  785. // 对异常进行共通处理
  786. ExceptionManager.HandleEventException(this.ToString(),
  787. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  788. }
  789. }
  790. /// <summary>
  791. /// 全线换模操作
  792. /// </summary>
  793. /// <param name="sender"></param>
  794. /// <param name="e"></param>
  795. private void tsbtnChangeMouldAll_Click(object sender, EventArgs e)
  796. {
  797. try
  798. {
  799. if (this.dkGrouting.GroutingLineID != null)
  800. {
  801. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "整线换模");
  802. DialogResult dialogresult = frmFPC0106.ShowDialog();
  803. if (dialogresult.Equals(DialogResult.OK))
  804. {
  805. int AllReturn = Constant.INT_IS_ZERO;
  806. AllReturn = PCModuleProxy.Service.ChangeAllLine(_groutingLineEntity, _detailList, _startTime, _remarksOrRreason);
  807. if (AllReturn > Constant.INT_IS_ZERO)
  808. {
  809. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  810. {
  811. return GetGroutingLineDetail();
  812. }));
  813. if (dsGroutingLineDetail != null)
  814. {
  815. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  816. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  817. {
  818. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  819. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  820. this.dgvGroutingLineDetail.ReadOnly = true;
  821. }
  822. }
  823. //控件数据源重新绑定
  824. this.dkGrouting.DataSourseBind();
  825. //按钮可用性调整
  826. this.tsbtnChangeMouldAll.Enabled = false;
  827. this.tsbtnChangeMouldAllEnd.Enabled = true;
  828. //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为3
  829. this.dkGrouting.GMouldStatus = 3;
  830. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "整线换模"), this.Text,
  831. MessageBoxButtons.OK, MessageBoxIcon.Information);
  832. }
  833. else if (AllReturn == -500)
  834. {
  835. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  836. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  837. this.Close();
  838. }
  839. else
  840. {
  841. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "整线换模"), this.Text,
  842. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  843. }
  844. }
  845. }
  846. else
  847. {
  848. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  849. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  850. }
  851. }
  852. catch (Exception ex)
  853. {
  854. // 对异常进行共通处理
  855. ExceptionManager.HandleEventException(this.ToString(),
  856. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  857. }
  858. }
  859. /// <summary>
  860. /// 全线换模结束操作
  861. /// </summary>
  862. /// <param name="sender"></param>
  863. /// <param name="e"></param>
  864. private void tsbtnChangeMouldAllEnd_Click(object sender, EventArgs e)
  865. {
  866. try
  867. {
  868. if (this.dkGrouting.GroutingLineID != null)
  869. {
  870. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "整线换模结束");
  871. DialogResult dialogresult = frmFPC0106.ShowDialog();
  872. if (dialogresult.Equals(DialogResult.OK))
  873. {
  874. int AllReturn = Constant.INT_IS_ZERO;
  875. AllReturn = PCModuleProxy.Service.ChangeAllLineEnd(_groutingLineEntity, _detailList, _startTime, _remarksOrRreason);
  876. if (AllReturn > Constant.INT_IS_ZERO)
  877. {
  878. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  879. {
  880. return GetGroutingLineDetail();
  881. }));
  882. if (dsGroutingLineDetail != null)
  883. {
  884. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  885. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  886. {
  887. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  888. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  889. this.dgvGroutingLineDetail.ReadOnly = true;
  890. }
  891. }
  892. //控件数据源重新绑定
  893. this.dkGrouting.DataSourseBind();
  894. //按钮可用性调整
  895. this.tsbtnChangeMouldAll.Enabled = true;
  896. this.tsbtnChangeMouldAllEnd.Enabled = false;
  897. //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为1
  898. this.dkGrouting.GMouldStatus = 1;
  899. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "整线换模"), this.Text,
  900. MessageBoxButtons.OK, MessageBoxIcon.Information);
  901. }
  902. else if (AllReturn == -500)
  903. {
  904. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  905. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  906. this.Close();
  907. }
  908. else
  909. {
  910. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "整线换模"), this.Text,
  911. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  912. }
  913. }
  914. }
  915. else
  916. {
  917. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  918. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  919. }
  920. }
  921. catch (Exception ex)
  922. {
  923. // 对异常进行共通处理
  924. ExceptionManager.HandleEventException(this.ToString(),
  925. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  926. }
  927. }
  928. /// <summary>
  929. /// 成型线改变
  930. /// </summary>
  931. /// <param name="sender"></param>
  932. /// <param name="e"></param>
  933. private void dkGrouting_MouldTypeValueChanged(object sender, Controls.SearchTextBox.dkGroutingLineSearchBox.TextChangeEventArgs e)
  934. {
  935. this.dgvGroutingLineDetail.DataSource = null;
  936. this._groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID;
  937. this._groutingLineEntity.OPTIMESTAMP = this.dkGrouting.OPTimeStamp;
  938. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  939. {
  940. return GetGroutingLineDetail();
  941. }));
  942. if (dsGroutingLineDetail != null)
  943. {
  944. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  945. }
  946. if (this.dkGrouting.GMouldStatus == Convert.ToInt32(Constant.GMouldStatus.Normal))
  947. {
  948. this.tsbtnChangeMouldAll.Enabled = true;
  949. this.tsbtnChangeMouldAllEnd.Enabled = false;
  950. this.tsbtnUpdateLine.Enabled = true;
  951. this.tsbtnUpdateLineEnd.Enabled = false;
  952. }
  953. else if(this.dkGrouting.GMouldStatus == Convert.ToInt32(Constant.GMouldStatus.Update))
  954. {
  955. this.tsbtnChangeMouldAll.Enabled = false;
  956. this.tsbtnChangeMouldAllEnd.Enabled = false;
  957. this.tsbtnUpdateLine.Enabled = false;
  958. this.tsbtnUpdateLineEnd.Enabled = true;
  959. }
  960. else
  961. {
  962. this.tsbtnChangeMouldAll.Enabled = false;
  963. this.tsbtnChangeMouldAllEnd.Enabled = true;
  964. this.tsbtnUpdateLine.Enabled = false;
  965. this.tsbtnUpdateLineEnd.Enabled = false;
  966. }
  967. }
  968. #endregion
  969. #region 私有方法
  970. /// <summary>
  971. /// 将明细DataSet数据集转入集合中
  972. /// </summary>
  973. private void DataTableToListByDetail(DataSet dsDetail)
  974. {
  975. try
  976. {
  977. this._detailList.Clear();
  978. foreach (DataRow dr in dsDetail.Tables[0].Rows)
  979. {
  980. GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity();
  981. detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(dr[0]);
  982. detailEntity.GROUTINGLINEID = Convert.ToInt32(dr[1]);
  983. detailEntity.GROUTINGMOULDCODE = dr[2].ToString();
  984. detailEntity.MOULDCODE = dr[3].ToString();
  985. detailEntity.GOODSID = Convert.ToInt32(dr[4]);
  986. detailEntity.GROUTINGCOUNT = Convert.ToDecimal(dr[5]);
  987. detailEntity.MOULDSTATUS = Convert.ToInt32(dr[6]);
  988. detailEntity.BEGINUSEDDATE = Convert.ToDateTime(dr[7]);
  989. detailEntity.REMARKS = dr[8].ToString();
  990. detailEntity.ACCOUNTID = Convert.ToInt32(dr[9]);
  991. detailEntity.VALUEFLAG = Convert.ToInt32(dr[10]);
  992. detailEntity.CREATETIME = Convert.ToDateTime(dr[11]);
  993. detailEntity.CREATEUSERID = Convert.ToInt32(dr[12]);
  994. detailEntity.UPDATETIME = Convert.ToDateTime(dr[13]);
  995. detailEntity.UPDATEUSERID = Convert.ToInt32(dr[14]);
  996. detailEntity.OPTIMESTAMP = Convert.ToDateTime(dr[15]);
  997. this._detailList.Add(detailEntity);
  998. }
  999. }
  1000. catch (Exception ex)
  1001. {
  1002. throw ex;
  1003. }
  1004. }
  1005. /// <summary>
  1006. /// 根据选择成型线显示模具
  1007. /// </summary>
  1008. /// <returns></returns>
  1009. private DataSet GetGroutingLineDetail()
  1010. {
  1011. return PCModuleProxy.Service.GetGroutingLineDetailByMainId(Convert.ToInt32(this.dkGrouting.GroutingLineID), null, 6);
  1012. }
  1013. /// <summary>
  1014. /// 获取成型线权限
  1015. /// </summary>
  1016. protected void getPurview()
  1017. {
  1018. try
  1019. {
  1020. StringBuilder sbPurview = new StringBuilder();
  1021. DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(6, LogInUserInfo.CurrentUser.UserID);
  1022. if (dsPurview != null)
  1023. {
  1024. foreach (DataRow dr in dsPurview.Tables[0].Rows)
  1025. {
  1026. sbPurview.Append(dr[0].ToString() + ",");
  1027. }
  1028. if (sbPurview.Length != Constant.INT_IS_ZERO)
  1029. {
  1030. this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1);
  1031. }
  1032. }
  1033. this.dkGrouting.Purview = _purview;
  1034. this.dkGrouting.IsEnablePurview = true;
  1035. }
  1036. catch (Exception ex)
  1037. {
  1038. throw ex;
  1039. }
  1040. }
  1041. /// <summary>
  1042. /// 将成型线明细DataSet数据集转入集合中
  1043. /// </summary>
  1044. private void DataTableToListByLineDetail(DataSet dsLineDetail)
  1045. {
  1046. try
  1047. {
  1048. this._detailList.Clear();
  1049. foreach (DataRow drFor in dsLineDetail.Tables[0].Rows)
  1050. {
  1051. GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity();
  1052. detailEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
  1053. detailEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
  1054. detailEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
  1055. detailEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
  1056. detailEntity.GOODSCODE = drFor["GOODSCODE"].ToString();
  1057. detailEntity.GOODSID = Convert.ToInt32(drFor["GOODSID"]);
  1058. detailEntity.GOODSNAME = drFor["GOODSNAME"].ToString();
  1059. detailEntity.GROUTINGCOUNT = Convert.ToDecimal(drFor["GROUTINGCOUNT"]);
  1060. detailEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString();
  1061. detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(drFor["GROUTINGLINEDETAILID"]);
  1062. detailEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
  1063. detailEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString();
  1064. detailEntity.GROUTINGMOULDCODE = drFor["GROUTINGMOULDCODE"].ToString();
  1065. detailEntity.MOULDCODE = drFor["GroutingMouldCode"].ToString();
  1066. detailEntity.MOULDSTATUS = Convert.ToInt32(drFor["GMouldStatus"]);
  1067. detailEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
  1068. detailEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
  1069. detailEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
  1070. detailEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
  1071. this._detailList.Add(detailEntity);
  1072. }
  1073. }
  1074. catch (Exception ex)
  1075. {
  1076. throw ex;
  1077. }
  1078. }
  1079. /// <summary>
  1080. /// 设置起始时间与备注
  1081. /// </summary>
  1082. /// <param name="startTime"></param>
  1083. /// <param name="remarkStr"></param>
  1084. public void SetTimeOrRemarks(DateTime? startTime, string remarkStr)
  1085. {
  1086. this._startTime = startTime;
  1087. this._remarksOrRreason = remarkStr;
  1088. }
  1089. /// <summary>
  1090. /// 成型线换产设置
  1091. /// </summary>
  1092. /// <param name="startTime"></param>
  1093. /// <param name="remarkStr"></param>
  1094. /// <param name="GoodsId"></param>
  1095. public void SetTimeOrRemarksGoodsId(DateTime? startTime,string remarkStr,int? GoodsId)
  1096. {
  1097. this._startTime = startTime;
  1098. this._remarksOrRreason = remarkStr;
  1099. this._newGoodsId = GoodsId;
  1100. }
  1101. #endregion
  1102. private void tsbtnUpdateLine_Click(object sender, EventArgs e)
  1103. {
  1104. try
  1105. {
  1106. if (this.dkGrouting.GroutingLineID != null)
  1107. {
  1108. F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "成型线换产");
  1109. DialogResult dialogresult = frmFPC0106.ShowDialog();
  1110. if (dialogresult.Equals(DialogResult.OK))
  1111. {
  1112. int AllReturn = Constant.INT_IS_ZERO;
  1113. _groutingLineEntity.REMARKS = _remarksOrRreason;
  1114. _groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID;//加这个为了变产结束在重复变产,造成成型线ID不对
  1115. AllReturn = PCModuleProxy.Service.UpdateLine(_groutingLineEntity, _detailList);
  1116. if (AllReturn > Constant.INT_IS_ZERO)
  1117. {
  1118. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  1119. {
  1120. return GetGroutingLineDetail();
  1121. }));
  1122. if (dsGroutingLineDetail != null)
  1123. {
  1124. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  1125. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  1126. {
  1127. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  1128. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  1129. this.dgvGroutingLineDetail.ReadOnly = true;
  1130. }
  1131. }
  1132. //控件数据源重新绑定
  1133. this.dkGrouting.DataSourseBind();
  1134. //按钮可用性调整
  1135. this.tsbtnUpdateLine.Enabled = false;
  1136. this.tsbtnUpdateLineEnd.Enabled = true;
  1137. this.tsbtnChangeMouldAll.Enabled = false;
  1138. this.tsbtnChangeMouldAllEnd.Enabled = false;
  1139. //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为3
  1140. this.dkGrouting.GMouldStatus = 4;
  1141. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "成型线换产"), this.Text,
  1142. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1143. }
  1144. else if (AllReturn == -500)
  1145. {
  1146. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  1147. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1148. this.Close();
  1149. }
  1150. else
  1151. {
  1152. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "成型线换产"), this.Text,
  1153. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1154. }
  1155. }
  1156. }
  1157. else
  1158. {
  1159. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  1160. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1161. }
  1162. }
  1163. catch (Exception ex)
  1164. {
  1165. // 对异常进行共通处理
  1166. ExceptionManager.HandleEventException(this.ToString(),
  1167. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  1168. }
  1169. }
  1170. private void tsbtnUpdateLineEnd_Click(object sender, EventArgs e)
  1171. {
  1172. try
  1173. {
  1174. if (this.dkGrouting.GroutingLineID != null)
  1175. {
  1176. F_PC_0107 frmFPC0107 = new F_PC_0107(_instance, "成型线换产");
  1177. DialogResult dialogresult = frmFPC0107.ShowDialog();
  1178. if (dialogresult.Equals(DialogResult.OK))
  1179. {
  1180. int NewLineId = Constant.INT_IS_ZERO;
  1181. _groutingLineEntity.REMARKS = _remarksOrRreason;
  1182. NewLineId = PCModuleProxy.Service.UpdateLineEnd(_groutingLineEntity, _detailList, Convert.ToInt32(_newGoodsId));
  1183. // modify wangx 2015/07/15
  1184. this.dkGrouting.GroutingLineID = NewLineId;
  1185. this.dkGrouting.DataSource = null;
  1186. // modify wangx 2015/07/15 end
  1187. if (NewLineId > Constant.INT_IS_ZERO)
  1188. {
  1189. this.dkGrouting.GroutingLineID = NewLineId;
  1190. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  1191. {
  1192. return GetGroutingLineDetail();
  1193. }));
  1194. if (dsGroutingLineDetail != null)
  1195. {
  1196. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  1197. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  1198. {
  1199. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  1200. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  1201. this.dgvGroutingLineDetail.ReadOnly = true;
  1202. }
  1203. }
  1204. //控件数据源重新绑定
  1205. this.dkGrouting.DataSourseBind();
  1206. //按钮可用性调整
  1207. this.tsbtnUpdateLine.Enabled = true;
  1208. this.tsbtnUpdateLineEnd.Enabled = false;
  1209. //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为1
  1210. this.dkGrouting.GMouldStatus = 1;
  1211. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "成型线换产"), this.Text,
  1212. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1213. }
  1214. else if (NewLineId == -500)
  1215. {
  1216. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  1217. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1218. this.Close();
  1219. }
  1220. else
  1221. {
  1222. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "成型线换产"), this.Text,
  1223. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1224. }
  1225. }
  1226. }
  1227. else
  1228. {
  1229. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  1230. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1231. }
  1232. }
  1233. catch (Exception ex)
  1234. {
  1235. // 对异常进行共通处理
  1236. ExceptionManager.HandleEventException(this.ToString(),
  1237. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  1238. }
  1239. }
  1240. /// <summary>
  1241. /// 启用按钮事件
  1242. /// </summary>
  1243. /// <param name="sender"></param>
  1244. /// <param name="e"></param>
  1245. private void tsbtnStart_Click(object sender, EventArgs e)
  1246. {
  1247. try
  1248. {
  1249. if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
  1250. {
  1251. string GMouldStatus = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GMouldStatus"].Value.ToString();
  1252. if(GMouldStatus!="0")
  1253. {
  1254. return;
  1255. }
  1256. string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
  1257. //准备提交
  1258. int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  1259. {
  1260. return PCModuleProxy.Service.StartDetail(Convert.ToInt32(detailId));
  1261. }));
  1262. if (MyReturn > Constant.INT_IS_ZERO)
  1263. {
  1264. DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  1265. {
  1266. return GetGroutingLineDetail();
  1267. }));
  1268. if (dsGroutingLineDetail != null)
  1269. {
  1270. this.DataTableToListByLineDetail(dsGroutingLineDetail);
  1271. if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
  1272. {
  1273. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  1274. this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
  1275. this.dgvGroutingLineDetail.ReadOnly = true;
  1276. }
  1277. }
  1278. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "启用"), this.Text,
  1279. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1280. }
  1281. else
  1282. {
  1283. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "启用"), this.Text,
  1284. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1285. }
  1286. }
  1287. else
  1288. {
  1289. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  1290. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1291. }
  1292. }
  1293. catch (Exception ex)
  1294. {
  1295. // 对异常进行共通处理
  1296. ExceptionManager.HandleEventException(this.ToString(),
  1297. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  1298. }
  1299. }
  1300. }
  1301. }