F_PC_0103_1.cs 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0103_1.cs
  5. * 2.功能描述:编辑成型线信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/09/25 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. using Dongke.IBOSS.PRD.Basics.BaseControls;
  17. using Dongke.IBOSS.PRD.Basics.BaseResources;
  18. using Dongke.IBOSS.PRD.Client.CommonModule;
  19. using Dongke.IBOSS.PRD.Client.Controls;
  20. using Dongke.IBOSS.PRD.Client.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.DataModels;
  22. using Dongke.IBOSS.PRD.WCF.Proxys;
  23. namespace Dongke.IBOSS.PRD.Client.PCModule
  24. {
  25. public partial class F_PC_0103_1 : FormBase
  26. {
  27. #region 成员变量
  28. //当前编辑成型线ID
  29. private int _groutingLineId;
  30. //当前编辑成型线实体
  31. private GroutingLineEntity _lineEntity = new GroutingLineEntity();
  32. //当前编辑成型线明细集合
  33. private List<GroutingLineDetailEntity> _detailList = new List<GroutingLineDetailEntity>();
  34. //当前编辑成型线新增明细集合
  35. private List<GroutingLineDetailEntity> _AddDetailList = new List<GroutingLineDetailEntity>();
  36. //需要添加的成型工号明细集合
  37. public List<GroutingLineUserEntity> _addDetailUserList = new List<GroutingLineUserEntity>();
  38. //模具总数量
  39. private int _mouldCount = 0;
  40. //修改前成型线编号
  41. private string _lineCode = "";
  42. //范围权限
  43. private string _purview;
  44. private string _userCodeValue;
  45. private bool _ShowFlag = true;
  46. //默认条数
  47. private int defaultRow = 0;
  48. /// <summary>
  49. /// 模具操作状态
  50. /// </summary>
  51. private int _gmouldstatus = 0;
  52. /// <summary>
  53. /// 整线变产原数据
  54. /// </summary>
  55. private DataTable _oldDetail = null;
  56. #endregion
  57. #region 构造函数
  58. /// <summary>
  59. /// 编辑成型线窗体构造
  60. /// </summary>
  61. public F_PC_0103_1(int GroutingLineId)
  62. {
  63. InitializeComponent();
  64. this._groutingLineId = GroutingLineId;
  65. this.Text = FormTitles.F_PC_0103;
  66. this.btnSave.Text = ButtonText.BTN_SAVE;
  67. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  68. this.btnAddMould.Text = ButtonText.BTN_ADDMOULD;
  69. this.btnDeleteSelected.Text = ButtonText.BTN_DELETESELECTED;
  70. this.scbUser1.DisplayMember = "USERNAMECode";
  71. this.scbUser1.ValueMember = "UserID";
  72. DataTable dtUser = new DataTable();
  73. dtUser.Columns.Add("UserID");
  74. dtUser.Columns.Add("UserCode");
  75. dtUser.Columns.Add("UserName");
  76. dtUser.Columns.Add("StaffNames");
  77. dtUser.Columns.Add("Remark");
  78. dtUser.Columns["UserID"].Unique = true;
  79. this.dgvUser.DataSource = dtUser;
  80. }
  81. /// <summary>
  82. /// 模具操作
  83. /// </summary>
  84. /// <param name="GroutingLineId"></param>
  85. /// <param name="GMouldStatus">0:上模,4:结束变产</param>
  86. public F_PC_0103_1(int GroutingLineId, int GMouldStatus)
  87. : this(GroutingLineId)
  88. {
  89. this._gmouldstatus = GMouldStatus;
  90. this.tabControl1.SelectedIndex = 1;
  91. this.dgvUser.AllowUserToAddRows = false;
  92. this.dgvUser.ReadOnly = true;
  93. this.c_GroupBox1.Enabled = false;
  94. this.scbUser1.DisplayMember = "UserCode";
  95. this.scbUser1.ValueMember = "UserID";
  96. if (this._gmouldstatus == 0)
  97. {
  98. this.Text = "模具管理-上模";
  99. }
  100. if (this._gmouldstatus == 4)
  101. {
  102. this.Text = "模具管理-结束整线变产";
  103. }
  104. }
  105. #endregion
  106. #region 事件
  107. /// <summary>
  108. /// 窗体加载
  109. /// </summary>
  110. private void F_PC_0103_Load(object sender, EventArgs e)
  111. {
  112. try
  113. {
  114. this.dgvUser.AutoGenerateColumns = false;
  115. this.dgvDetail.AutoGenerateColumns = false;
  116. this.BindGrouting();
  117. //_groutingLineId
  118. ////DataSet dsUserList = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  119. ////{
  120. //// return PCModuleProxy.Service.GetGroutingLineUserDetailByMainId(_groutingLineId);
  121. ////}));
  122. DataSet dsUserList = PCModuleProxy.Service.GetGroutingLineUserDetailByMainId(_groutingLineId);
  123. if (dsUserList != null && dsUserList.Tables.Count > 0)
  124. {
  125. this.dgvUser.DataSource = dsUserList.Tables[0];
  126. dsUserList.Tables[0].Columns["userid"].Unique = true;
  127. }
  128. DataSet dsSetting = SystemModuleProxy.Service.GetSystemSettingDataByCode(Constant.SettingType.S_PC_001.ToString());
  129. if (dsSetting != null && dsSetting.Tables[0].Rows.Count > 0)
  130. {
  131. string flag = dsSetting.Tables[0].Rows[0]["SettingValue"].ToString();
  132. if (flag == "2")
  133. {
  134. this.rabBinding.Checked = true;
  135. this.rabAuto.Enabled = false;
  136. }
  137. else if (flag == "1")
  138. {
  139. this.rabBinding.Checked = true;
  140. }
  141. else
  142. {
  143. this.rabAuto.Checked = true;
  144. }
  145. }
  146. }
  147. catch (Exception ex)
  148. {
  149. // 对异常进行共通处理
  150. ExceptionManager.HandleEventException(this.ToString(),
  151. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  152. }
  153. }
  154. /// <summary>
  155. /// 提交编辑
  156. /// </summary>
  157. private void btnSave_Click(object sender, EventArgs e)
  158. {
  159. try
  160. {
  161. int ErrorId = ValidationText();
  162. if (ErrorId != Constant.INT_IS_ZERO)
  163. {
  164. string errorAddress = "";
  165. switch (ErrorId)
  166. {
  167. case 4:
  168. this.txtGroutingLineCode.Focus();
  169. errorAddress = "成型线编码";
  170. break;
  171. case 5:
  172. this.txtGroutingLineName.Focus();
  173. errorAddress = "成型线名称";
  174. break;
  175. //case 7:
  176. // this.dkUser.Focus();
  177. // errorAddress = "工号";
  178. // break;
  179. case 8:
  180. this.scbGMouldType.Focus();
  181. errorAddress = "成型线类别";
  182. break;
  183. default:
  184. break;
  185. };
  186. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, errorAddress),
  187. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  188. return;
  189. }
  190. //this._lineEntity.BUILDINGNO = this.txtBuildingNo.Text.Trim();
  191. //this._lineEntity.FLOORNO = this.txtFloorNo.Text.Trim();
  192. //this._lineEntity.GROUTINGLINENO = this.txtGroutingLineNo.Text.Trim();
  193. this._lineEntity.GROUTINGLINECODE = this.txtGroutingLineCode.Text.Trim();
  194. this._lineEntity.GROUTINGLINENAME = this.txtGroutingLineName.Text.Trim();
  195. this._lineEntity.REMARKS = this.txtRemarks.Text.Trim();
  196. //xuwei add 2019-11-13 高压注浆
  197. this._lineEntity.HIGHPRESSUREFLAG = HighPressureFlag.Checked ? 1 : 0;
  198. //xuwei end
  199. //this._lineEntity.USERID = this.dkUser.UserID;
  200. this._lineEntity.MOULDTYPEID = this.scbGMouldType.SearchedPKMember;
  201. if (this.scbUser1.SearchedItem != null)
  202. {
  203. this._lineEntity.MonitorID = Convert.ToInt32(this.scbUser1.SearchedValue);
  204. this._lineEntity.MonitorCode = this.scbUser1.SearchedItem["Usercode"] + "";
  205. }
  206. else
  207. {
  208. this._lineEntity.MonitorID = null;
  209. this._lineEntity.MonitorCode = null;
  210. }
  211. //this._lineEntity.CANMANYTIMES = this.dkType.IsCanManyTimes;
  212. //this._lineEntity.MOULDQUANTITY = _detailList.Count + _AddDetailList.Count;
  213. this._lineEntity.MOULDQUANTITY = this.dgvDetail.RowCount;
  214. //if (this.cbValueFlag.Checked == false)
  215. //{
  216. // this._lineEntity.VALUEFLAG = Convert.ToInt32(Constant.ValueFlag.Invalid);
  217. //}
  218. //else
  219. //{
  220. // this._lineEntity.VALUEFLAG = Convert.ToInt32(Constant.ValueFlag.Effective);
  221. //}
  222. if (this.chkEnable.Checked)
  223. {
  224. this._lineEntity.ValueFlag2 = "1";
  225. }
  226. else
  227. {
  228. this._lineEntity.ValueFlag2 = "2";
  229. }
  230. if (this._lineCode != this._lineEntity.GROUTINGLINECODE)
  231. {
  232. bool isHaveGroutingLineCode = (bool)DoAsync(new BaseAsyncMethod(() =>
  233. {
  234. return PCModuleProxy.Service.GroutingLineCodeIsRepeat(this.txtGroutingLineCode.Text);
  235. }));
  236. if (isHaveGroutingLineCode == false)
  237. {
  238. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线编码"),
  239. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  240. return;
  241. }
  242. }
  243. DataTable dtUser = this.dgvUser.DataSource as DataTable;
  244. dtUser.TableName = "dtUser";
  245. dtUser.AcceptChanges();
  246. //this._addDetailUserList.Clear();
  247. //foreach (DataRow r in dtUser.Rows)
  248. //{
  249. // GroutingLineUserEntity entity = new GroutingLineUserEntity();
  250. // entity.USERID = Convert.ToInt32(r["USERID"]);
  251. // entity.REMARK = r["REMARK"].ToString();
  252. // this._addDetailUserList.Add(entity);
  253. //}
  254. if (dtUser.Rows.Count == Constant.INT_IS_ZERO)
  255. {
  256. /* 成型线可以不绑定成型工号 chenxy 2019-10-08
  257. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型工号"), this.Text,
  258. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  259. this.tabControl1.SelectTab(0);
  260. return;
  261. */
  262. }
  263. else
  264. {
  265. DataRow[] dr = dtUser.Select("UserName='' or UserName is null");
  266. if (dr.Length > 0)
  267. {
  268. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型工号"), this.Text,
  269. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  270. this.tabControl1.SelectTab(0);
  271. return;
  272. }
  273. }
  274. if (dtUser.Rows.Count > 0)
  275. {
  276. _lineEntity.USERID = Convert.ToInt32(dtUser.Rows[0]["UserID"]);
  277. }
  278. else
  279. {
  280. _lineEntity.USERID = null;
  281. }
  282. //更新注浆次数
  283. DataTable dtDetail = this.dgvDetail.DataSource as DataTable;
  284. //if (dtDetail == null || dtDetail.Rows.Count == Constant.INT_IS_ZERO)
  285. //{
  286. // MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "模具信息"), this.Text,
  287. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  288. // return;
  289. //}
  290. DataTable dt1 = null;
  291. DataRow[] drNewFlag_Zero = dtDetail.Select("NewFlag=0");
  292. if (drNewFlag_Zero.Length > 0)
  293. {
  294. dt1 = drNewFlag_Zero.CopyToDataTable();
  295. dt1.TableName = "dt1";
  296. }
  297. DataTable dt2 = null;
  298. DataRow[] drNewFlag_One = dtDetail.Select("NewFlag=1");
  299. if (drNewFlag_One.Length > 0)
  300. {
  301. dt2 = drNewFlag_One.CopyToDataTable();
  302. dt2.TableName = "dt2";
  303. }
  304. //for (int i = 0; i < _AddDetailList.Count; i++)
  305. //{
  306. // _AddDetailList[i].GROUTINGCOUNT = Convert.ToDecimal(dtDetail.Rows[defaultRow + i]["GROUTINGCOUNT"]);
  307. // _AddDetailList[i].REMARKS = dtDetail.Rows[defaultRow + i]["REMARKS"].ToString();
  308. //}
  309. //DataTable dt = this.dgvDetail1.DataSource as DataTable;
  310. //if (dt != null)
  311. //{
  312. //for (int i = 0; i < _detailList.Count; i++)
  313. //{
  314. // this._detailList[i].REMARKS = dtDetail.Rows[i]["Remarks"].ToString();
  315. //}
  316. //}
  317. if (!this.c_GroupBox1.Enabled)
  318. {
  319. // 上摸 或 整线变产
  320. _lineEntity.GROUTINGLINEIDS = "0";
  321. }
  322. ServiceResultEntity myReturn = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  323. {
  324. if (this._gmouldstatus != 4)
  325. {
  326. return PCModuleProxy.Service.UpdateGroutingLine_NewLine(_lineEntity, dt2, dtUser, dt1);
  327. }
  328. else
  329. {
  330. // 整线变产
  331. return PCModuleProxy.Service.UpdateAllLineEndGroutingLineDetail(dt2, _oldDetail, this._lineEntity.GROUTINGLINEID.Value, this._lineEntity.OPTIMESTAMP);
  332. }
  333. }));
  334. if (myReturn != null)
  335. {
  336. if (myReturn.Status == Constant.ServiceResultStatus.Success)
  337. {
  338. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线信息", "保存"),
  339. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  340. this.DialogResult = DialogResult.OK;
  341. return;
  342. }
  343. else if (myReturn.OtherStatus == -500)
  344. {
  345. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  346. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  347. this.Close();
  348. }
  349. else if (myReturn.OtherStatus == -2)
  350. {
  351. MessageBox.Show(Messages.MSG_CMN_W029,
  352. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  353. }
  354. else
  355. {
  356. MessageBox.Show(myReturn.Message,
  357. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  358. }
  359. }
  360. else
  361. {
  362. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线信息", "保存"),
  363. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  364. }
  365. }
  366. catch (Exception ex)
  367. {
  368. // 对异常进行共通处理
  369. ExceptionManager.HandleEventException(this.ToString(),
  370. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  371. }
  372. }
  373. /// <summary>
  374. /// 关闭窗体
  375. /// </summary>
  376. private void btnCancel_Click(object sender, EventArgs e)
  377. {
  378. this.Close();
  379. }
  380. /// <summary>
  381. /// 工号单元格开始编辑事件
  382. /// </summary>
  383. /// <param name="sender"></param>
  384. /// <param name="e"></param>
  385. private void dgvUser_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
  386. {
  387. try
  388. {
  389. if (this.dgvUser.Rows.Count <= 1)
  390. {
  391. return;
  392. }
  393. DataGridViewColumn columnItem = this.dgvUser.Columns[e.ColumnIndex];
  394. if ("UserCode".Equals(columnItem.Name))
  395. {
  396. _userCodeValue = this.dgvUser.Rows[e.RowIndex].Cells[columnItem.Name].Value + "";
  397. }
  398. }
  399. catch (Exception ex)
  400. {
  401. // 对异常进行共通处理
  402. ExceptionManager.HandleEventException(this.ToString(),
  403. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  404. }
  405. }
  406. /// <summary>
  407. /// 删除新建明细信息
  408. /// </summary>
  409. private void btnDeleteSelected_Click(object sender, EventArgs e)
  410. {
  411. try
  412. {
  413. DataRowView drv = this.dgvDetail.CurrentRow.DataBoundItem as DataRowView;
  414. if (drv == null)
  415. {
  416. return;
  417. }
  418. if (Convert.ToInt32(drv["NewFlag"]) == 1)
  419. {
  420. ////DataTable dt = drv.Row.Table;
  421. //drv.Delete();
  422. ////dt.AcceptChanges();
  423. // 一模多产时,同一模具一同清除。 add by chenxy 2018-10-29
  424. if (drv["MouldID"] != DBNull.Value)
  425. {
  426. DataTable dt = this.dgvDetail.DataSource as DataTable;
  427. DataRow[] drs = dt.Select("MouldID = " + drv["MouldID"]);
  428. if (drs.Length > 1)
  429. {
  430. foreach (DataRow item in drs)
  431. {
  432. item.Delete();
  433. }
  434. }
  435. else
  436. {
  437. drv.Delete();
  438. }
  439. }
  440. else
  441. {
  442. drv.Delete();
  443. }
  444. }
  445. else
  446. {
  447. MessageBox.Show(Messages.MSG_PC_W002, this.Text,
  448. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  449. return;
  450. }
  451. //DataTable dt = this.dgvDetail.DataSource as DataTable;
  452. //dt.Rows[currentRow.Index].Delete();
  453. //dt.AcceptChanges();
  454. //this.dgvDetail.DataSource = dt;// ListToTable();
  455. //this.dgvDetail1.DataSource = this.ListToTable();
  456. //this.dgvUser.IsSetInputColumnsColor = true;
  457. //this.dgvDetail.IsSetInputColumnsColor = true;
  458. // 重置哪个单元格是只读
  459. //foreach (DataGridViewRow row in this.dgvDetail.Rows)
  460. //{
  461. // //遍历以前模具编号
  462. // for (int i = 0; i < this._detailList.Count; i++)
  463. // {
  464. // if (row.Cells["GroutingMouldCode"].Value.ToString() == _detailList[i].GROUTINGMOULDCODE)
  465. // {
  466. // row.Cells["GROUTINGCOUNT"].ReadOnly = true;
  467. // break;
  468. // }
  469. // else
  470. // {
  471. // row.Cells["GROUTINGCOUNT"].ReadOnly = false;
  472. // }
  473. // }
  474. //}
  475. //this.dgvDetail.IsSetInputColumnsColor = true;
  476. }
  477. catch (Exception ex)
  478. {
  479. // 对异常进行共通处理
  480. ExceptionManager.HandleEventException(this.ToString(),
  481. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  482. }
  483. }
  484. /// <summary>
  485. /// 新建明细信息
  486. /// </summary>
  487. private void btnAddMould_Click(object sender, EventArgs e)
  488. {
  489. try
  490. {
  491. if (this.txtGroutingLineCode.Text == string.Empty)
  492. {
  493. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线编码"), this.Text,
  494. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  495. return;
  496. }
  497. if (this.txtCount.Text == "")
  498. {
  499. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "模具数量"), this.Text,
  500. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  501. return;
  502. }
  503. if (this.txtStandardGroutingCount.Text == "")
  504. {
  505. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "标准注浆次数"), this.Text,
  506. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  507. return;
  508. }
  509. if (this.scbGoods.SearchedPKMember == 0)
  510. {
  511. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "模具产品"), this.Text,
  512. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  513. return;
  514. }
  515. if (Convert.ToInt32(txtBeginNum.Text) + Convert.ToInt32(txtCount.Text) > 999)
  516. {
  517. MessageBox.Show("成型线模具数量不可超过999个!", this.Text,
  518. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  519. return;
  520. }
  521. //if (this._mouldCount == 999)
  522. //{
  523. // MessageBox.Show("成型线模具数量不可超过999个!", this.Text,
  524. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  525. // return;
  526. //}
  527. //for (int i = 0; i < Convert.ToInt32(this.txtCount.Text); i++)
  528. //{
  529. // int GroutingMouldCodeNum = i + _mouldCount;
  530. // GroutingLineDetailEntity detailInfo = new GroutingLineDetailEntity();
  531. // detailInfo.GROUTINGMOULDCODE = this.txtGroutingLineCode.Text + "-" + (GroutingMouldCodeNum + 1).ToString().PadLeft(3, '0');
  532. // detailInfo.MOULDCODE = Guid.NewGuid().ToString();
  533. // detailInfo.GOODSID = Convert.ToInt32(this.dkGoods.GoodsID);
  534. // detailInfo.GOODSNAME = this.dkGoods.GoodsName;
  535. // detailInfo.GOODSCODE = this.dkGoods.GoodsCode;
  536. // detailInfo.GoodsSpecification = this.dkGoods.GoodsSpecification;
  537. // detailInfo.GROUTINGCOUNT = Constant.INT_IS_ZERO;
  538. // detailInfo.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
  539. // detailInfo.REMARKS = "";
  540. // detailInfo.VALUEFLAG = 1;
  541. // this._AddDetailList.Add(detailInfo);
  542. //}
  543. bool isError = false;
  544. DataTable dtDetail = this.dgvDetail.DataSource as DataTable;
  545. int BeginNum = Convert.ToInt32(this.txtBeginNum.Text);
  546. for (int i = 0; i < Convert.ToInt32(this.txtCount.Text); i++)
  547. {
  548. // int GroutingMouldCodeNum = BeginNum + _mouldCount;
  549. int GroutingMouldCodeNum = BeginNum;
  550. //GroutingLineDetailEntity detailInfo = new GroutingLineDetailEntity();
  551. string MOULDCODE = this.txtGroutingLineCode.Text + "-" + (GroutingMouldCodeNum).ToString().PadLeft(3, '0');
  552. DataTable dtInfo = this.dgvDetail.DataSource as DataTable;
  553. DataRow[] dr = dtInfo.Select("GroutingMouldCode='" + MOULDCODE + "'");
  554. if (dr.Length > 0)
  555. {
  556. isError = true;
  557. break;
  558. };
  559. //detailInfo.GROUTINGMOULDCODE = this.txtGroutingLineCode.Text + "-" + (GroutingMouldCodeNum).ToString().PadLeft(3, '0');
  560. //if (dtDetail != null)
  561. //{
  562. // DataRow[] dr = dtDetail.Select("GROUTINGMOULDCODE='" + detailInfo.GROUTINGMOULDCODE + "'");
  563. // if (dr.Length > 0)
  564. // {
  565. // isError = true;
  566. // break;
  567. // }
  568. //}
  569. //detailInfo.MOULDCODE = Guid.NewGuid().ToString();
  570. //detailInfo.GOODSID = Convert.ToInt32(this.dkGoods.GoodsID);
  571. //detailInfo.GOODSNAME = this.dkGoods.GoodsName;
  572. //detailInfo.GOODSCODE = this.dkGoods.GoodsCode;
  573. //detailInfo.GoodsSpecification = this.dkGoods.GoodsSpecification;
  574. //detailInfo.GROUTINGCOUNT = Constant.INT_IS_ZERO;
  575. //detailInfo.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
  576. //detailInfo.REMARKS = "";
  577. //detailInfo.VALUEFLAG = 1;
  578. //this._AddDetailList.Add(detailInfo);
  579. DataRow r = dtInfo.NewRow();
  580. r["GroutingMouldCode"] = MOULDCODE;
  581. r["MouldSource"] = "0";
  582. r["MOULDCODE"] = Guid.NewGuid().ToString();
  583. r["GOODSID"] = scbGoods.SearchedPKMember;
  584. r["GOODSNAME"] = scbGoods.SearchedItem["GOODSNAME"];
  585. r["GOODSCODE"] = scbGoods.SearchedItem["GOODSCODE"];
  586. r["GoodsSpecification"] = scbGoods.SearchedItem["GOODSSPECIFICATION"];
  587. r["GROUTINGCOUNT"] = 0;
  588. r["StandardGroutingCount"] = Convert.ToInt32(this.txtStandardGroutingCount.DataValue.Value);
  589. //r["MOULDSTATUS"] = Convert.ToInt32(Constant.GMouldStatus.Normal);
  590. //r["REMARKS"] = "";
  591. r["NewFlag"] = 1;
  592. r["VALUEFLAG"] = 1;
  593. dtInfo.Rows.Add(r);
  594. BeginNum = BeginNum + 1;
  595. }
  596. if (isError)
  597. {
  598. BeginNum = Convert.ToInt32(this.txtBeginNum.Text);
  599. //有错误
  600. MessageBox.Show("存在相同的模具编号");
  601. return;
  602. }
  603. else
  604. {
  605. this.txtBeginNum.DataValue = BeginNum;
  606. }
  607. this._mouldCount += Convert.ToInt32(this.txtCount.Text);
  608. //this.dgvDetail.AutoGenerateColumns = false;
  609. //this.dgvDetail1.DataSource = ListToTable();
  610. // 重置哪个单元格是只读
  611. //foreach (DataGridViewRow row in this.dgvDetail.Rows)
  612. //{
  613. // //遍历以前模具编号
  614. // for (int i = 0; i < this._detailList.Count; i++)
  615. // {
  616. // if (row.Cells["GroutingMouldCode"].Value.ToString() == _detailList[i].GROUTINGMOULDCODE)
  617. // {
  618. // row.Cells["GROUTINGCOUNT"].ReadOnly = true;
  619. // break;
  620. // }
  621. // else
  622. // {
  623. // row.Cells["GROUTINGCOUNT"].ReadOnly = false;
  624. // }
  625. // }
  626. //}
  627. //this.dgvDetail.IsSetInputColumnsColor = true;
  628. }
  629. catch (Exception ex)
  630. {
  631. // 对异常进行共通处理
  632. ExceptionManager.HandleEventException(this.ToString(),
  633. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  634. }
  635. }
  636. /// <summary>
  637. /// 工号单元格值改变事件
  638. /// </summary>
  639. /// <param name="sender"></param>
  640. /// <param name="e"></param>
  641. private void dgvUser_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  642. {
  643. try
  644. {
  645. if (this.dgvUser.Rows.Count <= 1 || !_ShowFlag)
  646. {
  647. return;
  648. }
  649. DataGridViewRow rowItem = this.dgvUser.Rows[e.RowIndex];
  650. DataGridViewColumn columnItem = this.dgvUser.Columns[e.ColumnIndex];
  651. // 用编号获取产品信息
  652. if ("UserCode".Equals(columnItem.Name))
  653. {
  654. _ShowFlag = false;
  655. FormUtility.BindUserRowDataSource(this.dgvUser,
  656. e.RowIndex, columnItem.Name, _userCodeValue);
  657. // 设置可输入单元格的颜色
  658. this.dgvUser.IsSetInputColumnsColor = true;
  659. }
  660. _ShowFlag = true;
  661. }
  662. catch (Exception ex)
  663. {
  664. //_ShowFlag = true;
  665. // 对异常进行共通处理
  666. ExceptionManager.HandleEventException(this.ToString(),
  667. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  668. }
  669. }
  670. /// <summary>
  671. /// 窗体加载后显示事件
  672. /// </summary>
  673. /// <param name="sender"></param>
  674. /// <param name="e"></param>
  675. private void F_PC_0103_1_Shown(object sender, EventArgs e)
  676. {
  677. //dgvDetail.IsSetInputColumnsColor = true;
  678. dgvUser.IsSetInputColumnsColor = true;
  679. }
  680. /// <summary>
  681. /// 容器切换事件
  682. /// </summary>
  683. /// <param name="sender"></param>
  684. /// <param name="e"></param>
  685. private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
  686. {
  687. //dgvDetail.IsSetInputColumnsColor = true;
  688. this.dgvUser.IsSetInputColumnsColor = true;
  689. }
  690. /// <summary>
  691. /// 工号排序事件
  692. /// </summary>
  693. /// <param name="sender"></param>
  694. /// <param name="e"></param>
  695. private void dgvUser_Sorted(object sender, EventArgs e)
  696. {
  697. this.dgvUser.IsSetInputColumnsColor = true;
  698. }
  699. /// <summary>
  700. /// 单元格只读
  701. /// </summary>
  702. /// <param name="sender"></param>
  703. /// <param name="e"></param>
  704. private void dgvDetail1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
  705. {
  706. if (this.dgvDetail.ReadOnly || e.RowIndex < 0)
  707. {
  708. return;
  709. }
  710. try
  711. {
  712. //e.InheritedRowStyle.BackColor = Color.White;
  713. if (!string.IsNullOrEmpty(dgvDetail.Rows[e.RowIndex].Cells["MouldID"].Value + ""))
  714. {
  715. // 模具档案
  716. this.dgvDetail.Rows[e.RowIndex].Cells["GroutingCount"].ReadOnly = true;
  717. this.dgvDetail.Rows[e.RowIndex].Cells["StandardGroutingCount"].ReadOnly = true;
  718. //this.dgvDetail.Rows[e.RowIndex].Cells["GroutingCount"].Style.BackColor
  719. // = Color.White;
  720. //this.dgvDetail.Rows[e.RowIndex].Cells["StandardGroutingCount"].Style.BackColor
  721. // = Color.White;
  722. }
  723. else if (dgvDetail.Rows[e.RowIndex].Cells["NewFlag"].Value + "" == "0")
  724. {
  725. // 自动生成模具
  726. this.dgvDetail.Rows[e.RowIndex].Cells["GroutingCount"].ReadOnly = true;
  727. this.dgvDetail.Rows[e.RowIndex].Cells["StandardGroutingCount"].ReadOnly = false;
  728. //this.dgvDetail.Rows[e.RowIndex].Cells["GroutingCount"].Style.BackColor
  729. // = ColorTranslator.FromHtml(ControlsConst.ALLOW_MODIFY_AREA_BACKGROUND_COLOR);
  730. //this.dgvDetail.Rows[e.RowIndex].Cells["StandardGroutingCount"].Style.BackColor
  731. // = Color.White;
  732. }
  733. else
  734. {
  735. // 新加模具
  736. this.dgvDetail.Rows[e.RowIndex].Cells["GroutingCount"].ReadOnly = false;
  737. this.dgvDetail.Rows[e.RowIndex].Cells["StandardGroutingCount"].ReadOnly = false;
  738. //this.dgvDetail.Rows[e.RowIndex].Cells["GroutingCount"].Style.BackColor
  739. // = ColorTranslator.FromHtml(ControlsConst.ALLOW_MODIFY_AREA_BACKGROUND_COLOR);
  740. //this.dgvDetail.Rows[e.RowIndex].Cells["StandardGroutingCount"].Style.BackColor
  741. // = ColorTranslator.FromHtml(ControlsConst.ALLOW_MODIFY_AREA_BACKGROUND_COLOR);
  742. }
  743. foreach (DataGridViewColumn item in dgvDetail.Columns)
  744. {
  745. if (!item.Visible)
  746. {
  747. continue;
  748. }
  749. if (item.ReadOnly || this.dgvDetail.Rows[e.RowIndex].Cells[item.Index].ReadOnly)
  750. {
  751. this.dgvDetail.Rows[e.RowIndex].Cells[item.Index].Style.BackColor
  752. = Color.White;
  753. }
  754. else
  755. {
  756. this.dgvDetail.Rows[e.RowIndex].Cells[item.Index].Style.BackColor
  757. = ColorTranslator.FromHtml(ControlsConst.ALLOW_MODIFY_AREA_BACKGROUND_COLOR);
  758. }
  759. }
  760. }
  761. catch (Exception ex)
  762. {
  763. // 对异常进行共通处理
  764. ExceptionManager.HandleEventException(this.ToString(),
  765. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  766. }
  767. }
  768. /// <summary>
  769. /// 自适应列宽
  770. /// </summary>
  771. /// <param name="sender"></param>
  772. /// <param name="e"></param>
  773. private void btnAdaptive_Click(object sender, EventArgs e)
  774. {
  775. this.dgvUser.AutoResizeColumns();
  776. this.dgvDetail.AutoResizeColumns();
  777. }
  778. /// <summary>
  779. /// 切换模具来源
  780. /// </summary>
  781. /// <param name="sender"></param>
  782. /// <param name="e"></param>
  783. private void rabAuto_CheckedChanged(object sender, EventArgs e)
  784. {
  785. this.pnlAuto.Enabled = this.rabAuto.Checked;
  786. this.pnlBinding.Enabled = this.rabBinding.Checked;
  787. }
  788. /// <summary>
  789. /// 验证模具号
  790. /// </summary>
  791. /// <param name="sender"></param>
  792. /// <param name="e"></param>
  793. private void txtGMouldCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
  794. {
  795. if (this.txtGMouldCode.Text == "" || this.dgvDetail.Rows.Count == 0)
  796. {
  797. return;
  798. }
  799. try
  800. {
  801. string gMouldCode = this.txtGroutingLineCode.Text + "-" + this.txtGMouldCode.DataValue.Value.ToString().PadLeft(3, '0');
  802. DataTable dtInfo = this.dgvDetail.DataSource as DataTable;
  803. DataRow[] dr = dtInfo.Select("GroutingMouldCode='" + gMouldCode + "'");
  804. if (dr.Length > 0)
  805. {
  806. MessageBox.Show("存在相同的模具编号", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  807. e.Cancel = true;
  808. return;
  809. };
  810. }
  811. catch (Exception ex)
  812. {
  813. //_ShowFlag = true;
  814. // 对异常进行共通处理
  815. ExceptionManager.HandleEventException(this.ToString(),
  816. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  817. }
  818. }
  819. /// <summary>
  820. /// 验证模具条码
  821. /// </summary>
  822. /// <param name="sender"></param>
  823. /// <param name="e"></param>
  824. private void txtBarcode_KeyDown(object sender, KeyEventArgs e)
  825. {
  826. if (e.KeyCode == Keys.Enter)
  827. {
  828. this.btnAddMouldBarcode_Click(null, null);
  829. }
  830. }
  831. /// <summary>
  832. /// 添加模具
  833. /// </summary>
  834. /// <param name="sender"></param>
  835. /// <param name="e"></param>
  836. private void btnAddMouldBarcode_Click(object sender, EventArgs e)
  837. {
  838. if (this.txtGroutingLineCode.Text == string.Empty)
  839. {
  840. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线编码"), this.Text,
  841. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  842. return;
  843. }
  844. if (this.txtGMouldCode.Text == "")
  845. {
  846. MessageBox.Show("没有设定模具号", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  847. this.txtGMouldCode.Focus();
  848. return;
  849. }
  850. string barcode = this.txtBarcode.Text.Trim();
  851. if (barcode == "")
  852. {
  853. MessageBox.Show("没有输入模具条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  854. this.txtBarcode.Focus();
  855. return;
  856. }
  857. try
  858. {
  859. string gMouldCode = this.txtGroutingLineCode.Text + "-" + this.txtGMouldCode.DataValue.Value.ToString().PadLeft(3, '0');
  860. DataTable dtInfo = this.dgvDetail.DataSource as DataTable;
  861. DataRow[] dr = dtInfo.Select("GroutingMouldCode='" + gMouldCode + "'");
  862. if (dr.Length > 0)
  863. {
  864. MessageBox.Show("存在相同的模具编号", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  865. this.txtGMouldCode.Focus();
  866. this.txtGMouldCode.SelectAll();
  867. return;
  868. }
  869. // 模具ID存在 是正常状态的成型模具
  870. dr = dtInfo.Select("MouldID is not null and MouldBarcode = '" + barcode + "'");
  871. if (dr.Length > 0)
  872. {
  873. MessageBox.Show("存在相同的模具条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  874. this.txtBarcode.Focus();
  875. this.txtBarcode.SelectAll();
  876. return;
  877. };
  878. // 验证模具条码状态
  879. ClientRequestEntity cre = new ClientRequestEntity();
  880. cre.NameSpace = "PC_Mould";
  881. cre.Name = "GetMouldData";
  882. cre.Properties["MouldBarcode"] = barcode;
  883. ServiceResultEntity sre = PCModuleProxyNew.Service.HandleRequest(cre);
  884. if (sre == null || sre.Data == null || sre.Data.Tables.Count == 0 || sre.Data.Tables[0].Rows.Count == 0)
  885. {
  886. MessageBox.Show("无效模具条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  887. this.txtBarcode.Focus();
  888. this.txtBarcode.SelectAll();
  889. return;
  890. }
  891. DataRow item = sre.Data.Tables["InfoData"].Rows[0];
  892. int mouldStatus = Convert.ToInt32(item["MouldStatus"]);
  893. if (mouldStatus != 1 && mouldStatus != 3)
  894. {
  895. MessageBox.Show("此模具当前状态为【" + item["MouldStatusName"] + "】,不能添加到成型线。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  896. this.txtBarcode.Focus();
  897. this.txtBarcode.SelectAll();
  898. return;
  899. }
  900. //DataRow r = dtInfo.NewRow();
  901. //r["GroutingMouldCode"] = gMouldCode;
  902. //r["MouldSource"] = "1";
  903. //r["MOULDID"] = item["MOULDID"];
  904. //r["MOULDCODE"] = item["MOULDCODE"];
  905. //r["MOULDBarcode"] = item["MOULDBarcode"];
  906. //r["GOODSID"] = item["GOODSID"];
  907. //r["GOODSNAME"] = item["GOODSNAME"];
  908. //r["GOODSCODE"] = item["GOODSCODE"];
  909. //r["GoodsSpecification"] = item["GoodsSpecification"];
  910. //r["GROUTINGCOUNT"] = item["GroutingNum"];
  911. //r["StandardGroutingCount"] = item["StandardGroutingNum"];
  912. ////r["MOULDSTATUS"] = Convert.ToInt32(Constant.GMouldStatus.Normal);
  913. ////r["REMARKS"] = "";
  914. //r["VALUEFLAG"] = "1";
  915. //r["NEWFLAG"] = "1";
  916. //dtInfo.Rows.Add(r);
  917. int outputCount = Convert.ToInt32(item["OutputCount"]);
  918. if (outputCount == 1)
  919. {
  920. DataRow r = dtInfo.NewRow();
  921. r["GroutingMouldCode"] = gMouldCode;
  922. r["MouldSource"] = "1";
  923. r["MOULDID"] = item["MOULDID"];
  924. r["MOULDCODE"] = item["MOULDCODE"];
  925. r["MOULDBarcode"] = item["MOULDBarcode"];
  926. r["GOODSID"] = item["GOODSID"];
  927. r["GOODSNAME"] = item["GOODSNAME"];
  928. r["GOODSCODE"] = item["GOODSCODE"];
  929. r["GoodsSpecification"] = item["GoodsSpecification"];
  930. r["GROUTINGCOUNT"] = item["GroutingNums"];
  931. r["StandardGroutingCount"] = item["StandardGroutingNum"];
  932. //r["MOULDSTATUS"] = Convert.ToInt32(Constant.GMouldStatus.Normal);
  933. //r["REMARKS"] = "";
  934. r["VALUEFLAG"] = "1";
  935. r["NEWFLAG"] = "1";
  936. dtInfo.Rows.Add(r);
  937. }
  938. else
  939. {
  940. // 一模多产时,必须绑定连续成型模具编号。 add by chenxy 2018-10-29
  941. string minGMouldCode = gMouldCode;
  942. int minIndex = Convert.ToInt32(this.txtGMouldCode.DataValue.Value);
  943. string maxGMouldCode = this.txtGroutingLineCode.Text + "-" + (minIndex + outputCount).ToString("000");
  944. DataRow[] grows = dtInfo.Select("GroutingMouldCode>='" + minGMouldCode + "' and GroutingMouldCode<'" + maxGMouldCode + "'");
  945. if (grows.Length > 0)
  946. {
  947. MessageBox.Show("此模具的产出数量为【" + outputCount + "】,当前成型模具编号不能连续添加,不能添加到成型线。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  948. this.txtBarcode.Focus();
  949. this.txtBarcode.SelectAll();
  950. return;
  951. }
  952. //for (int i = 0; i < outputCount; i++)
  953. foreach (DataRow itemOutput in sre.Data.Tables["InfoData"].Rows)
  954. {
  955. DataRow r = dtInfo.NewRow();
  956. r["GroutingMouldCode"] = minGMouldCode;
  957. r["MouldSource"] = "1";
  958. r["MOULDID"] = item["MOULDID"];
  959. r["MOULDCODE"] = item["MOULDCODE"];
  960. r["MOULDBarcode"] = item["MOULDBarcode"];
  961. r["GOODSID"] = item["GOODSID"];
  962. r["GOODSNAME"] = item["GOODSNAME"];
  963. r["GOODSCODE"] = item["GOODSCODE"];
  964. r["GoodsSpecification"] = item["GoodsSpecification"];
  965. r["GROUTINGCOUNT"] = itemOutput["GroutingNum"];
  966. r["MouldOutputNo"] = itemOutput["OutputNo"];
  967. r["StandardGroutingCount"] = item["StandardGroutingNum"];
  968. //r["MOULDSTATUS"] = Convert.ToInt32(Constant.GMouldStatus.Normal);
  969. //r["REMARKS"] = "";
  970. r["VALUEFLAG"] = "1";
  971. r["NEWFLAG"] = "1";
  972. dtInfo.Rows.Add(r);
  973. minGMouldCode = this.txtGroutingLineCode.Text + "-" + (++minIndex).ToString("000");
  974. }
  975. }
  976. //foreach (DataGridViewRow row in dgvDetail.Rows)
  977. //{
  978. // if (string.IsNullOrEmpty(row.Cells["MouldID"].Value + ""))
  979. // {
  980. // // 自动生成模具
  981. // row.Cells["GroutingCount"].ReadOnly = false;
  982. // row.Cells["StandardGroutingCount"].ReadOnly = false;
  983. // }
  984. // else
  985. // {
  986. // // 模具档案
  987. // row.Cells["GroutingCount"].ReadOnly = true;
  988. // row.Cells["StandardGroutingCount"].ReadOnly = true;
  989. // }
  990. //}
  991. //this.dgvDetail.IsSetInputColumnsColor = true;
  992. //this.txtGMouldCode.DataValue = this.txtGMouldCode.DataValue.Value + 1;
  993. this.txtGMouldCode.DataValue = this.txtGMouldCode.DataValue.Value + outputCount;
  994. this.txtBarcode.Clear();
  995. this.txtBarcode.Focus();
  996. }
  997. catch (Exception ex)
  998. {
  999. //_ShowFlag = true;
  1000. // 对异常进行共通处理
  1001. ExceptionManager.HandleEventException(this.ToString(),
  1002. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  1003. }
  1004. }
  1005. #endregion
  1006. #region 私有方法
  1007. /// <summary>
  1008. /// 加载成型线数据
  1009. /// </summary>
  1010. private void BindGrouting()
  1011. {
  1012. try
  1013. {
  1014. //首先绑定成型线基础信息
  1015. GroutingLineEntity ginfo = new GroutingLineEntity();
  1016. ginfo.GROUTINGLINEID = _groutingLineId;
  1017. ginfo.ValueFlag2 = "A";
  1018. //DataSet dsGroutingLine = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  1019. //{
  1020. // return PCModuleProxy.Service.GetGroutingLine(ginfo);
  1021. //}));
  1022. DataSet dsGroutingLine = PCModuleProxy.Service.GetGroutingLine(ginfo);
  1023. if (dsGroutingLine.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  1024. {
  1025. //给实体绑定值
  1026. BindGroutingEntity(dsGroutingLine.Tables[0].Rows[0]);
  1027. //将实体值绑定给界面控件
  1028. //this.txtBuildingNo.Text = _lineEntity.BUILDINGNO;
  1029. //this.txtFloorNo.Text = _lineEntity.FLOORNO;
  1030. //this.txtGroutingLineNo.Text = _lineEntity.GROUTINGLINENO;
  1031. this.txtGroutingLineCode.Text = _lineEntity.GROUTINGLINECODE;
  1032. this.txtGroutingLineName.Text = _lineEntity.GROUTINGLINENAME;
  1033. this.txtRemarks.Text = _lineEntity.REMARKS;
  1034. //this.dkUser.UserID = _lineEntity.USERID;
  1035. //this.dkUser.UserName = dsGroutingLine.Tables[0].Rows[0]["UserName"].ToString();
  1036. //this.dkUser.UserCode = dsGroutingLine.Tables[0].Rows[0]["UserCode"].ToString();
  1037. //this.dkUser.Text = dsGroutingLine.Tables[0].Rows[0]["UserCode"].ToString();
  1038. //this.dkType.MouldTypeID = _lineEntity.MOULDTYPEID;
  1039. //this.dkType.MouldTypeName = dsGroutingLine.Tables[0].Rows[0]["GMouldTypeName"].ToString();
  1040. //this.dkType.Text = dsGroutingLine.Tables[0].Rows[0]["GMouldTypeName"].ToString();
  1041. this.scbGMouldType.CheckedData = dsGroutingLine.Tables[0];
  1042. this.scbGMouldType.Text = dsGroutingLine.Tables[0].Rows[0]["GMouldTypeName"] + "";
  1043. this.scbUser1.InitValue(_lineEntity.MonitorCode, _lineEntity.MonitorID);
  1044. //xuwei add 2019-11-13 高压注浆
  1045. this.HighPressureFlag.Checked = this._lineEntity.HIGHPRESSUREFLAG == 1 ? true : false;
  1046. //xuwei end
  1047. if (this._lineEntity.ValueFlag2 == "1")
  1048. {
  1049. this.chkEnable.Checked = true;
  1050. }
  1051. else
  1052. {
  1053. this.chkEnable.Checked = false;
  1054. }
  1055. this._lineCode = _lineEntity.GROUTINGLINECODE;
  1056. // 变产的成型线不能添加模具 begin
  1057. if (this._gmouldstatus == 0 &&
  1058. "4" == dsGroutingLine.Tables[0].Rows[0]["GMOULDSTATUS"].ToString())
  1059. {
  1060. this.panel1.Visible = false;
  1061. this.lblGStatus.Visible = true;
  1062. }
  1063. // 变产的成型线不能添加模具 end
  1064. }
  1065. //然后绑定该成型线所属的明细信息
  1066. BindDetailInfo(_groutingLineId);
  1067. foreach (DataGridViewRow row in this.dgvDetail.Rows)
  1068. {
  1069. row.Cells["GROUTINGCOUNT"].ReadOnly = true;
  1070. }
  1071. this.dgvDetail.IsSetInputColumnsColor = true;
  1072. }
  1073. catch (Exception ex)
  1074. {
  1075. throw ex;
  1076. }
  1077. }
  1078. /// <summary>
  1079. /// 将DataRow转换为实体
  1080. /// </summary>
  1081. private void BindGroutingEntity(DataRow drGrouting)
  1082. {
  1083. try
  1084. {
  1085. this._lineEntity.GROUTINGLINEID = Convert.ToInt32(drGrouting["GROUTINGLINEID"]);
  1086. this._lineEntity.BUILDINGNO = drGrouting["BUILDINGNO"].ToString();
  1087. this._lineEntity.FLOORNO = drGrouting["FLOORNO"].ToString();
  1088. this._lineEntity.GROUTINGLINENO = drGrouting["GROUTINGLINENO"].ToString();
  1089. this._lineEntity.GROUTINGLINECODE = drGrouting["GROUTINGLINECODE"].ToString();
  1090. this._lineEntity.GROUTINGLINENAME = drGrouting["GROUTINGLINENAME"].ToString();
  1091. //xuwei add 2019-11-13
  1092. this._lineEntity.HIGHPRESSUREFLAG = Convert.ToInt32(drGrouting["HIGHPRESSUREFLAG"]);
  1093. //xuwei end
  1094. this._lineEntity.MOULDQUANTITY = Convert.ToDecimal(drGrouting["MOULDQUANTITY"]);
  1095. this._lineEntity.MOULDTYPEID = Convert.ToInt32(drGrouting["GMOULDTYPEID"]);
  1096. if (drGrouting["USERID"] != null && drGrouting["USERID"] != DBNull.Value)
  1097. {
  1098. this._lineEntity.USERID = Convert.ToInt32(drGrouting["USERID"]);
  1099. }
  1100. object mid = drGrouting["MonitorID"];
  1101. if (mid != null && mid != DBNull.Value)
  1102. {
  1103. this._lineEntity.MonitorID = Convert.ToInt32(mid);
  1104. }
  1105. this._lineEntity.MonitorCode = drGrouting["MonitorCode"]+"";
  1106. this._lineEntity.BEGINUSEDDATE = Convert.ToDateTime(drGrouting["BEGINUSEDDATE"]);
  1107. if (drGrouting["ENDUSEDDATE"].ToString() != string.Empty && drGrouting["ENDUSEDDATE"] != DBNull.Value)
  1108. {
  1109. this._lineEntity.ENDUSEDDATE = Convert.ToDateTime(drGrouting["ENDUSEDDATE"]);
  1110. }
  1111. this._lineEntity.MouldStatus = Convert.ToInt32(drGrouting["GMouldStatus"]);
  1112. if (drGrouting["REMARKS"].ToString() != string.Empty && drGrouting["REMARKS"] != DBNull.Value)
  1113. {
  1114. this._lineEntity.REMARKS = drGrouting["REMARKS"].ToString();
  1115. }
  1116. this._lineEntity.ACCOUNTID = Convert.ToInt32(drGrouting["ACCOUNTID"]);
  1117. this._lineEntity.VALUEFLAG = Convert.ToInt32(drGrouting["VALUEFLAG"]);
  1118. this._lineEntity.ValueFlag2 = drGrouting["VALUEFLAG2"].ToString();
  1119. this._lineEntity.CREATETIME = Convert.ToDateTime(drGrouting["CREATETIME"]);
  1120. this._lineEntity.CREATEUSERID = Convert.ToInt32(drGrouting["CREATEUSERID"]);
  1121. this._lineEntity.UPDATETIME = Convert.ToDateTime(drGrouting["UPDATETIME"]);
  1122. this._lineEntity.UPDATEUSERID = Convert.ToInt32(drGrouting["UPDATEUSERID"]);
  1123. this._lineEntity.OPTIMESTAMP = Convert.ToDateTime(drGrouting["OPTIMESTAMP"]);
  1124. }
  1125. catch (Exception ex)
  1126. {
  1127. throw ex;
  1128. }
  1129. }
  1130. /// <summary>
  1131. /// 根据成型线ID绑定该成型线所属成型线模具信息
  1132. /// </summary>
  1133. private void BindDetailInfo(int GroutingLineID)
  1134. {
  1135. try
  1136. {
  1137. //this.dgvDetail.AutoGenerateColumns = false;
  1138. //this.dgvDetail.IsSetInputColumnsColor = true;
  1139. //DataSet dsDetail = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  1140. //{
  1141. // return PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  1142. //}));
  1143. DataSet dsDetail = PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  1144. //this.DataTableToListByDetail(dsDetail);
  1145. DataColumn newFlag = new DataColumn("NewFlag", typeof(int));
  1146. newFlag.DefaultValue = 0;
  1147. dsDetail.Tables[0].Columns.Add(newFlag);
  1148. dsDetail.Tables[0].DefaultView.Sort = "GroutingMouldCode";
  1149. // 结束变产操作删除变产前模具
  1150. if (this._gmouldstatus == 4)
  1151. {
  1152. _oldDetail = dsDetail.Tables[0].Copy();
  1153. foreach (DataRow item in dsDetail.Tables[0].Rows)
  1154. {
  1155. item.Delete();
  1156. }
  1157. dsDetail.Tables[0].AcceptChanges();
  1158. }
  1159. DataView dv = dsDetail.Tables[0].DefaultView;
  1160. if (dv.Count > 0)
  1161. {
  1162. string groutingMouldCode = dv[dv.Count - 1]["GroutingMouldCode"].ToString();
  1163. int lineIndexOf = groutingMouldCode.LastIndexOf("-") + 1;
  1164. this._mouldCount = Convert.ToInt32(groutingMouldCode.Substring(lineIndexOf));
  1165. }
  1166. this.dgvDetail.AutoGenerateColumns = false;
  1167. this.dgvDetail.DataSource = dsDetail.Tables[0];
  1168. dsDetail.Tables[0].Columns["GroutingMouldCode"].Unique = true;
  1169. }
  1170. catch (Exception ex)
  1171. {
  1172. throw ex;
  1173. }
  1174. }
  1175. /// <summary>
  1176. /// 将成型线明细DataSet数据集转换为实体集合
  1177. /// </summary>
  1178. private void DataTableToListByDetail(DataSet dsDetail)
  1179. {
  1180. try
  1181. {
  1182. this._detailList.Clear();
  1183. defaultRow = dsDetail.Tables[0].Rows.Count;
  1184. foreach (DataRow drFor in dsDetail.Tables[0].Rows)
  1185. {
  1186. if (drFor["ValueFlag"].ToString() == "1")
  1187. {
  1188. GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity();
  1189. detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(drFor["GROUTINGLINEDETAILID"]);
  1190. detailEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
  1191. detailEntity.GROUTINGMOULDCODE = drFor["GROUTINGMOULDCODE"].ToString();
  1192. detailEntity.MOULDCODE = drFor["MOULDCODE"].ToString();
  1193. detailEntity.GOODSID = Convert.ToInt32(drFor["GOODSID"]);
  1194. detailEntity.StandardGroutingCount = Convert.ToDecimal(drFor["StandardGroutingCount"]);
  1195. detailEntity.GROUTINGCOUNT = Convert.ToDecimal(drFor["GROUTINGCOUNT"]);
  1196. detailEntity.MOULDSTATUS = Convert.ToInt32(drFor["GMOULDSTATUS"]);
  1197. detailEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
  1198. detailEntity.REMARKS = drFor["REMARKS"].ToString();
  1199. detailEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
  1200. detailEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
  1201. detailEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
  1202. detailEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
  1203. detailEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
  1204. detailEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
  1205. detailEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
  1206. detailEntity.GOODSNAME = drFor["GOODSNAME"].ToString();
  1207. detailEntity.GROUTINGLINENAME = drFor["GMOULDSTATUSNAME"].ToString();
  1208. detailEntity.GOODSCODE = drFor["GOODSCODE"].ToString();
  1209. detailEntity.GoodsSpecification = drFor["GoodsSpecification"].ToString();
  1210. detailEntity.MouldOutputNo = drFor["MouldOutputNo"];
  1211. this._detailList.Add(detailEntity);
  1212. }
  1213. }
  1214. if (_detailList.Count != 0)
  1215. {
  1216. //获取最后一个模具编号的最后数字
  1217. int lineIndexOf = _detailList[_detailList.Count - 1].GROUTINGMOULDCODE.LastIndexOf("-") + 1;
  1218. this._mouldCount = Convert.ToInt32(_detailList[_detailList.Count - 1].GROUTINGMOULDCODE.Substring(lineIndexOf));
  1219. this.dgvDetail.AutoGenerateColumns = false;
  1220. this.dgvDetail.DataSource = ListToTable();
  1221. }
  1222. else
  1223. {
  1224. DataTable dtDataSourse = new DataTable();
  1225. dtDataSourse.Columns.Add("GROUTINGLINEDETAILID", System.Type.GetType("System.String"));
  1226. dtDataSourse.Columns.Add("MOULDCODE", System.Type.GetType("System.String"));
  1227. dtDataSourse.Columns.Add("GROUTINGMOULDCODE", System.Type.GetType("System.String"));
  1228. dtDataSourse.Columns.Add("GOODSID", System.Type.GetType("System.String"));
  1229. dtDataSourse.Columns.Add("GOODSNAME", System.Type.GetType("System.String"));
  1230. dtDataSourse.Columns.Add("GoodsCode", System.Type.GetType("System.String"));
  1231. dtDataSourse.Columns.Add("GoodsSpecification", System.Type.GetType("System.String"));
  1232. dtDataSourse.Columns.Add("REMARKS", System.Type.GetType("System.String"));
  1233. dtDataSourse.Columns.Add("MOULDSTATUS", System.Type.GetType("System.String"));
  1234. dtDataSourse.Columns.Add("StandardGroutingCount", typeof(decimal));
  1235. dtDataSourse.Columns.Add("GROUTINGCOUNT", typeof(decimal));
  1236. dtDataSourse.Columns.Add("MouldOutputNo", typeof(int));
  1237. dtDataSourse.Columns.Add("NewFlag", System.Type.GetType("System.String"));
  1238. this.dgvDetail.DataSource = dtDataSourse;
  1239. }
  1240. this.dgvDetail.IsSetInputColumnsColor = true;
  1241. //((C_DataGridView)this.tabPage2.Controls[0]).IsSetInputColumnsColor = true;
  1242. }
  1243. catch (Exception ex)
  1244. {
  1245. throw ex;
  1246. }
  1247. }
  1248. /// <summary>
  1249. /// 验证添加项
  1250. /// </summary>
  1251. private int ValidationText()
  1252. {
  1253. try
  1254. {
  1255. int ErrorId = 0;
  1256. //string txtBuildingNo = this.txtBuildingNo.Text.Trim();
  1257. //string txtFloorNo = this.txtFloorNo.Text.Trim();
  1258. //string txtGroutingLineNo = this.txtGroutingLineNo.Text.Trim();
  1259. string txtGroutingLineCode = this.txtGroutingLineCode.Text.Trim();
  1260. string txtGroutingLineName = this.txtGroutingLineName.Text.Trim();
  1261. string txtRemarks = this.txtRemarks.Text.Trim();
  1262. //if (txtBuildingNo == string.Empty)
  1263. //{
  1264. // ErrorId = 1;
  1265. // return ErrorId;
  1266. //}
  1267. //if (txtFloorNo == string.Empty)
  1268. //{
  1269. // ErrorId = 2;
  1270. // return ErrorId;
  1271. //}
  1272. //if (txtGroutingLineNo == string.Empty)
  1273. //{
  1274. // ErrorId = 3;
  1275. // return ErrorId;
  1276. //}
  1277. if (txtGroutingLineCode == string.Empty)
  1278. {
  1279. ErrorId = 4;
  1280. return ErrorId;
  1281. }
  1282. if (txtGroutingLineName == string.Empty)
  1283. {
  1284. ErrorId = 5;
  1285. return ErrorId;
  1286. }
  1287. //if (dkUser.UserID == null)
  1288. //{
  1289. // ErrorId = 7;
  1290. // return ErrorId;
  1291. //}
  1292. if (scbGMouldType.SearchedPKMember == 0)
  1293. {
  1294. ErrorId = 8;
  1295. return ErrorId;
  1296. }
  1297. return ErrorId;
  1298. }
  1299. catch (Exception ex)
  1300. {
  1301. throw ex;
  1302. }
  1303. }
  1304. /// <summary>
  1305. /// 将实体数据转换为DataTable,绑定到控件中
  1306. /// </summary>
  1307. private DataTable ListToTable()
  1308. {
  1309. try
  1310. {
  1311. //detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(drFor["GROUTINGLINEDETAILID"]);
  1312. //detailEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
  1313. //detailEntity.GROUTINGMOULDCODE = drFor["GROUTINGMOULDCODE"].ToString();
  1314. //detailEntity.MOULDCODE = drFor["MOULDCODE"].ToString();
  1315. //detailEntity.GOODSID = Convert.ToInt32(drFor["GOODSID"]);
  1316. //detailEntity.GROUTINGCOUNT = Convert.ToDecimal(drFor["GROUTINGCOUNT"]);
  1317. //detailEntity.MOULDSTATUS = Convert.ToInt32(drFor["GMOULDSTATUS"]);
  1318. //detailEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
  1319. //detailEntity.REMARKS = drFor["REMARKS"].ToString();
  1320. //detailEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
  1321. //detailEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
  1322. //detailEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
  1323. //detailEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
  1324. //detailEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
  1325. //detailEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
  1326. //detailEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
  1327. //detailEntity.GOODSNAME = drFor["GOODSNAME"].ToString();
  1328. //detailEntity.GROUTINGLINENAME = drFor["GMOULDSTATUSNAME"].ToString();
  1329. //detailEntity.GOODSCODE = drFor["GOODSCODE"].ToString();
  1330. //detailEntity.GoodsSpecification = drFor["GoodsSpecification"].ToString();
  1331. DataTable dtDataSourse = new DataTable();
  1332. dtDataSourse.Columns.Add("GROUTINGLINEDETAILID", System.Type.GetType("System.String"));
  1333. dtDataSourse.Columns.Add("MOULDCODE", System.Type.GetType("System.String"));
  1334. dtDataSourse.Columns.Add("GROUTINGMOULDCODE", System.Type.GetType("System.String"));
  1335. dtDataSourse.Columns.Add("GOODSID", System.Type.GetType("System.String"));
  1336. dtDataSourse.Columns.Add("GOODSNAME", System.Type.GetType("System.String"));
  1337. dtDataSourse.Columns.Add("GoodsCode", System.Type.GetType("System.String"));
  1338. dtDataSourse.Columns.Add("GoodsSpecification", System.Type.GetType("System.String"));
  1339. dtDataSourse.Columns.Add("REMARKS", System.Type.GetType("System.String"));
  1340. dtDataSourse.Columns.Add("MOULDSTATUS", System.Type.GetType("System.String"));
  1341. dtDataSourse.Columns.Add("StandardGroutingCount", typeof(decimal));
  1342. dtDataSourse.Columns.Add("GroutingCount", typeof(decimal));
  1343. dtDataSourse.Columns.Add("MouldOutputNo", typeof(int));
  1344. dtDataSourse.Columns.Add("NewFlag", System.Type.GetType("System.String"));
  1345. for (int i = 0; i < this._detailList.Count; i++)
  1346. {
  1347. DataRow drRow = dtDataSourse.NewRow();
  1348. drRow["GROUTINGLINEDETAILID"] = this._detailList[i].GROUTINGLINEDETAILID;
  1349. drRow["GROUTINGMOULDCODE"] = this._detailList[i].GROUTINGMOULDCODE;
  1350. drRow["GOODSID"] = this._detailList[i].GOODSID;
  1351. drRow["GOODSNAME"] = this._detailList[i].GOODSNAME;
  1352. drRow["GoodsCode"] = this._detailList[i].GOODSCODE;
  1353. drRow["GoodsSpecification"] = this._detailList[i].GoodsSpecification;
  1354. drRow["REMARKS"] = this._detailList[i].REMARKS;
  1355. drRow["MOULDSTATUS"] = this._detailList[i].GROUTINGLINENAME;
  1356. drRow["StandardGroutingCount"] = this._detailList[i].StandardGroutingCount;
  1357. drRow["GROUTINGCOUNT"] = this._detailList[i].GROUTINGCOUNT;
  1358. drRow["MouldOutputNo"] = this._detailList[i].MouldOutputNo;
  1359. drRow["NewFlag"] = 0;
  1360. dtDataSourse.Rows.Add(drRow);
  1361. }
  1362. for (int i = 0; i < this._AddDetailList.Count; i++)
  1363. {
  1364. DataRow dr = dtDataSourse.NewRow();
  1365. dr["GROUTINGLINEDETAILID"] = this._AddDetailList[i].GROUTINGLINEDETAILID;
  1366. dr["GROUTINGMOULDCODE"] = _AddDetailList[i].GROUTINGMOULDCODE;
  1367. dr["GOODSID"] = this._AddDetailList[i].GOODSID;
  1368. dr["GOODSNAME"] = this._AddDetailList[i].GOODSNAME;
  1369. dr["GoodsCode"] = this._AddDetailList[i].GOODSCODE;
  1370. dr["GoodsSpecification"] = this._AddDetailList[i].GoodsSpecification;
  1371. dr["REMARKS"] = this._AddDetailList[i].REMARKS;
  1372. dr["MOULDSTATUS"] = "";
  1373. dr["StandardGroutingCount"] = 0;
  1374. dr["GROUTINGCOUNT"] = 0;
  1375. dr["NewFlag"] = 0;
  1376. dtDataSourse.Rows.Add(dr);
  1377. }
  1378. return dtDataSourse;
  1379. }
  1380. catch (Exception ex)
  1381. {
  1382. throw ex;
  1383. }
  1384. }
  1385. /// <summary>
  1386. /// 获取权限
  1387. /// </summary>
  1388. protected void getPurview()
  1389. {
  1390. try
  1391. {
  1392. StringBuilder sbPurview = new StringBuilder();
  1393. DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(6, LogInUserInfo.CurrentUser.UserID);
  1394. if (dsPurview != null)
  1395. {
  1396. foreach (DataRow dr in dsPurview.Tables[0].Rows)
  1397. {
  1398. sbPurview.Append(dr[0].ToString() + ",");
  1399. }
  1400. if (sbPurview.Length != 0)
  1401. {
  1402. this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1);
  1403. }
  1404. }
  1405. }
  1406. catch (Exception ex)
  1407. {
  1408. throw ex;
  1409. }
  1410. }
  1411. #endregion
  1412. }
  1413. }