F_PC_0103_1.cs 55 KB

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