F_PC_0103_1.cs 57 KB

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