F_PC_0103_1.cs 57 KB

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