F_PC_0103_1.cs 57 KB

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