F_PC_0103_1.cs 54 KB

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