F_MST_0502.cs 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_0502.cs
  5. * 2.功能描述:新建或编辑产品档案信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Drawing.Drawing2D;
  15. using System.Drawing.Imaging;
  16. using System.IO;
  17. using System.Windows.Forms;
  18. using Dongke.IBOSS.PRD.Basics.BaseControls;
  19. using Dongke.IBOSS.PRD.Basics.BaseResources;
  20. using Dongke.IBOSS.PRD.Client.CommonModule;
  21. using Dongke.IBOSS.PRD.Client.CommonModule.FormCommon;
  22. using Dongke.IBOSS.PRD.WCF.DataModels;
  23. using Dongke.IBOSS.PRD.WCF.Proxys;
  24. namespace Dongke.IBOSS.PRD.Client.SystemModule
  25. {
  26. /// <summary>
  27. /// 新建或编辑产品档案信息
  28. /// </summary>
  29. public partial class F_MST_0502 : FormBase
  30. {
  31. #region 成员变量
  32. //页面状态
  33. private Constant.FormMode _formStatus;
  34. // 产品ID
  35. private int _formGoodsId;
  36. // 产品图片二进制集合
  37. private List<byte[]> _picByteList = new List<byte[]>();
  38. // 产品图片缩略图二进制集合
  39. private List<byte[]> _smallByteList = new List<byte[]>();
  40. // 产品图片实体集合
  41. private List<GoodsImageEntity> _imgList = new List<GoodsImageEntity>();
  42. // 已存在的图片实体集合(修改)
  43. private List<GoodsImageEntity> _updateImgList = new List<GoodsImageEntity>();
  44. // 产品附件实体集合
  45. private List<GoodsAttachmentEntity> _attList = new List<GoodsAttachmentEntity>();
  46. // 当前编辑实体
  47. private GoodsEntity _thisGoodsEntity = new GoodsEntity();
  48. private DataTable _sapInfo = null;
  49. #endregion
  50. #region 构造函数
  51. /// <summary>
  52. /// 新建/编辑产品档案窗体构造
  53. /// </summary>
  54. /// <param name="modelId">窗体模式,0为新建,1为编辑</param>
  55. /// <param name="goodsId">编辑产品ID</param>
  56. public F_MST_0502(Constant.FormMode status, int goodsId)
  57. {
  58. InitializeComponent();
  59. this.dgvGoodsSap.AutoGenerateColumns = false;
  60. this._formStatus = status;
  61. this._formGoodsId = goodsId;
  62. if (this._formStatus == Constant.FormMode.Add)
  63. {
  64. this.Text = FormTitles.F_MST_0502_ADD;
  65. }
  66. else
  67. {
  68. this.Text = FormTitles.F_MST_0502_EDIT;
  69. }
  70. this.btnSave.Text = ButtonText.BTN_SAVE;
  71. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  72. this.btnUpload.Text = ButtonText.BTN_UPLOAD;
  73. this.btnDelete.Text = ButtonText.BTN_DELETE;
  74. }
  75. #endregion
  76. #region 事件
  77. /// <summary>
  78. /// 窗体加载
  79. /// </summary>
  80. private void F_MST_0702_Load(object sender, EventArgs e)
  81. {
  82. try
  83. {
  84. this.scbGoodsType.IsOnlyDisplayEnd = true;
  85. LoadDataSource();
  86. if (this._formStatus == Constant.FormMode.Edit)
  87. {
  88. // 产品编码不能编辑 add by chenxy 2016-08-16 begin
  89. this.txtGoodsCode.ReadOnly = true;
  90. // 产品编码不能编辑 add by chenxy 2016-08-16 end
  91. //根据goodsId查询对应的产品信息
  92. this._thisGoodsEntity.GoodsID = this._formGoodsId;
  93. DataSet updateGoods = SystemModuleProxy.Service.SerachGoods(this._thisGoodsEntity);
  94. if (updateGoods.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  95. {
  96. //把值绑入实体
  97. DataRow drGoods = updateGoods.Tables[0].Rows[0];
  98. this._thisGoodsEntity.GoodsCode = drGoods["GoodsCode"].ToString();
  99. this._thisGoodsEntity.GoodsTypeID = Convert.ToInt32(drGoods["GOODSTYPEID"]);
  100. this._thisGoodsEntity.GlazeTypeID = Convert.ToInt32(drGoods["GLAZETYPEID"]);
  101. this._thisGoodsEntity.CeaseFlag = Convert.ToInt32(drGoods["CEASEFLAG"]);
  102. this._thisGoodsEntity.Remarks = drGoods["Remarks"].ToString();
  103. this._thisGoodsEntity.AccountID = Convert.ToInt32(drGoods["AccountID"]);
  104. this._thisGoodsEntity.ValueFlag = Convert.ToInt32(drGoods["ValueFlag"]);
  105. this._thisGoodsEntity.CreateTime = Convert.ToDateTime(drGoods["CreateTime"]);
  106. this._thisGoodsEntity.CreateUserID = Convert.ToInt32(drGoods["CreateUserID"]);
  107. this._thisGoodsEntity.UpdateTime = Convert.ToDateTime(drGoods["UpdateTime"]);
  108. this._thisGoodsEntity.UpdateUserID = Convert.ToInt32(drGoods["UpdateUserID"]);
  109. this._thisGoodsEntity.OPTimeStamp = Convert.ToDateTime(drGoods["OPTimeStamp"]);
  110. this._thisGoodsEntity.StartingDate = Convert.ToDateTime(drGoods["StartingDate"]);
  111. this._thisGoodsEntity.AutoLossCycle = Convert.ToInt32(drGoods["AutoLossCycle"]);
  112. this._thisGoodsEntity.DeliverLimitCycle = Convert.ToInt32(drGoods["DeliverLimitCycle"]);
  113. this._thisGoodsEntity.PlateLimitNum = Convert.ToInt32(drGoods["PlateLimitNum"]);
  114. this._thisGoodsEntity.UnitPrice = Convert.ToDecimal(drGoods["UnitPrice"]);
  115. this._thisGoodsEntity.ReservedDays = Convert.ToInt32(drGoods["ReservedDays"]);
  116. this._thisGoodsEntity.MouldOutputCount = Convert.ToInt32(drGoods["MouldOutputCount"]);
  117. this._thisGoodsEntity.StandardGroutingNum = Convert.ToInt32(drGoods["StandardGroutingNum"]);
  118. this._thisGoodsEntity.MouldMaterialCode = drGoods["MouldMaterialCode"] + "";
  119. this._thisGoodsEntity.WaterLabelCode = drGoods["WaterLabelCode"] + "";
  120. //将实体的值赋给各控件
  121. this.txtGoodsCode.Text = drGoods["GoodsCode"].ToString();
  122. this.txtGoodsName.Text = drGoods["GoodsName"].ToString();
  123. this.txtGoodsSpecification.Text = drGoods["GoodsSpecification"].ToString();
  124. this.txtGoodsModel.Text = drGoods["GoodsModel"].ToString();
  125. this.scbGoodsType.CheckedData = updateGoods.Tables[0];
  126. //this.scbGoodsType.InitValue(drGoods["GoodsTypeName"].ToString(), _thisGoodsEntity.GoodsTypeID);
  127. this.scbGoodsType.Text = drGoods["GoodsTypeName"].ToString();
  128. this.ddlGlazeTypeID.SelectedValue = _thisGoodsEntity.GlazeTypeID;
  129. this.txtMudWeight.Text = drGoods["MudWeight"].ToString();
  130. this.txtGlazeWeight.Text = drGoods["GlazeWeight"].ToString();
  131. this.txtLusterwareWeight.Text = drGoods["LusterwareWeight"].ToString();
  132. this.txtProductionCycle.Text = drGoods["ProductionCycle"].ToString();
  133. this.cbCeaseFlag.Checked = (_thisGoodsEntity.CeaseFlag == Constant.INT_IS_ONE);
  134. this.cbValueFlag.Checked = (this._thisGoodsEntity.ValueFlag == Constant.INT_IS_ONE);
  135. this.txtRemarks.Text = this._thisGoodsEntity.Remarks;
  136. this.dtpStartingDate.Value = this._thisGoodsEntity.StartingDate;
  137. this.txtSPM001.DataValue = this._thisGoodsEntity.AutoLossCycle;
  138. this.txtSPM002.DataValue = this._thisGoodsEntity.DeliverLimitCycle;
  139. this.txtMouldOutputCount.DataValue = this._thisGoodsEntity.MouldOutputCount;
  140. this.txtStandardGroutingNum.DataValue = this._thisGoodsEntity.StandardGroutingNum;
  141. this.txtMouldMaterialCode.Text = this._thisGoodsEntity.MouldMaterialCode;
  142. this.txtWaterLabelCode.Text = this._thisGoodsEntity.WaterLabelCode;
  143. this.txtPlateLimitNum.DataValue = this._thisGoodsEntity.PlateLimitNum;
  144. this.txtUnitPrice.DataValue = this._thisGoodsEntity.UnitPrice;
  145. this.txtReservedDays.DataValue = this._thisGoodsEntity.ReservedDays;
  146. this.chkGLT.Checked = (drGoods["GOODS_LINE_TYPE"] + "" == "1");
  147. this.txtPackageNum.Text = drGoods["PackageNum"].ToString();
  148. this.txtOutletDistance.Text = drGoods["OutletDistance"].ToString();
  149. this.scbSAPCode1.Text = drGoods["MaterialCode"].ToString();
  150. this.txtMaterialRemark.Text = drGoods["MaterialRemark"].ToString();
  151. this.txtCopies.Text = drGoods["printcopies"].ToString();
  152. this.ftcLogo.InitValue(drGoods["logoname"] + "", drGoods["logoid"]);
  153. if (drGoods["MouldWeight"] != DBNull.Value)
  154. {
  155. this.txtMouldWeight.DataValue = Convert.ToDecimal(drGoods["MouldWeight"]);
  156. }
  157. if (drGoods["MouldCost"] != DBNull.Value)
  158. {
  159. this.txtMouldCost.DataValue = Convert.ToDecimal(drGoods["MouldCost"]);
  160. }
  161. this.chkScrapSumFlag.Checked = (drGoods["ScrapSumFlag"] + "" == "1");
  162. if (drGoods["SeatCoverCode"] != DBNull.Value)
  163. {
  164. this.txtSEATCOVERCODE.DataValue = Convert.ToInt32(drGoods["SeatCoverCode"]);
  165. }
  166. //查询对应的图片
  167. DataSet dsImg = SystemModuleProxy.Service.getImageByGoodsId(this._formGoodsId);
  168. BindByteImage(dsImg);
  169. }
  170. }
  171. // 产品物料信息
  172. ClientRequestEntity cre = new ClientRequestEntity();
  173. cre.NameSpace = "MST_Goods";
  174. cre.Name = "GetGoodsSAPByEdit";
  175. cre.Request = this._formGoodsId;
  176. // 调用服务器端获取数据集
  177. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  178. if (sre != null && sre.Data != null && sre.Data.Tables.Count > 0)
  179. {
  180. this._sapInfo = sre.Data.Tables[0];
  181. this.dgvGoodsSap.DataSource = this._sapInfo;
  182. }
  183. this.txtGoodsCode.Focus();
  184. }
  185. catch (Exception ex)
  186. {
  187. // 对异常进行共通处理
  188. ExceptionManager.HandleEventException(this.ToString(),
  189. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  190. }
  191. }
  192. /// <summary>
  193. /// 获取数据事件
  194. /// </summary>
  195. private void btnSave_Click(object sender, EventArgs e)
  196. {
  197. try
  198. {
  199. //基础数据验证
  200. int ErrorId = ValidationText();
  201. if (ErrorId != Constant.INT_IS_ZERO)
  202. {
  203. string errorAddress = "";
  204. switch (ErrorId)
  205. {
  206. case 1:
  207. this.txtGoodsCode.Focus();
  208. errorAddress = "产品编码";
  209. break;
  210. case 3:
  211. this.txtGoodsName.Focus();
  212. errorAddress = "产品名称";
  213. break;
  214. case 6:
  215. this.scbGoodsType.Focus();
  216. errorAddress = "产品类别";
  217. break;
  218. case 7:
  219. this.ddlGlazeTypeID.Focus();
  220. errorAddress = "釉料类别";
  221. break;
  222. default:
  223. break;
  224. };
  225. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, errorAddress),
  226. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  227. return;
  228. }
  229. if (string.IsNullOrEmpty(scbSAPCode1.Text))
  230. {
  231. this.scbSAPCode1.Focus();
  232. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "物料编码"),
  233. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  234. return;
  235. }
  236. //if (string.IsNullOrEmpty(txtGroutmaterialcode.Text))
  237. //{
  238. // this.txtGroutmaterialcode.Focus();
  239. // MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "注浆初始物料编码"),
  240. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  241. // return;
  242. //}
  243. if (string.IsNullOrEmpty(txtMouldMaterialCode.Text))
  244. {
  245. this.txtMouldMaterialCode.Focus();
  246. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "模具物料编码"),
  247. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  248. return;
  249. }
  250. if (string.IsNullOrEmpty(ftcLogo.SelectedValue+""))
  251. {
  252. this.ftcLogo.Focus();
  253. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "注浆商标"),
  254. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  255. return;
  256. }
  257. //查询产品编号唯一性
  258. if ((this.txtGoodsCode.Text != this._thisGoodsEntity.GoodsCode && _formStatus == Constant.FormMode.Edit)
  259. || this._formStatus == Constant.FormMode.Add)
  260. {
  261. if (ValidationCode(this.txtGoodsCode.Text) == false)
  262. {
  263. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "产品编码"), this.Text,
  264. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  265. return;
  266. }
  267. }
  268. //实体赋值
  269. if (this._thisGoodsEntity == null)
  270. {
  271. this._thisGoodsEntity = new GoodsEntity();
  272. }
  273. this._thisGoodsEntity.GoodsCode = this.txtGoodsCode.Text;
  274. this._thisGoodsEntity.GoodsModel = this.txtGoodsModel.Text;
  275. this._thisGoodsEntity.GoodsName = this.txtGoodsName.Text;
  276. this._thisGoodsEntity.GoodsSpecification = this.txtGoodsSpecification.Text;
  277. this._thisGoodsEntity.GoodsTypeID = Convert.ToInt32(scbGoodsType.SearchedItem["GoodsTypeID"]);
  278. this._thisGoodsEntity.GlazeTypeID = this.ddlGlazeTypeID.SelectedValue.ToString() == "" ? null : (int?)Convert.ToInt32(this.ddlGlazeTypeID.SelectedValue);
  279. this._thisGoodsEntity.MudQuantity = this.txtMudWeight.Text == "" ? Constant.INT_IS_ZERO : Convert.ToDecimal(this.txtMudWeight.Text);
  280. this._thisGoodsEntity.GlazeQuantity = this.txtGlazeWeight.Text == "" ? Constant.INT_IS_ZERO : Convert.ToDecimal(this.txtGlazeWeight.Text);
  281. this._thisGoodsEntity.LusterwareWeight = this.txtLusterwareWeight.Text == "" ? Constant.INT_IS_ZERO : Convert.ToDecimal(this.txtLusterwareWeight.Text);
  282. this._thisGoodsEntity.ProductionCycle = this.txtProductionCycle.Text == "" ? Constant.INT_IS_ZERO : Convert.ToDecimal(this.txtProductionCycle.Text);
  283. this._thisGoodsEntity.StartingDate = this.dtpStartingDate.Value.Date;
  284. this._thisGoodsEntity.AutoLossCycle = (this.txtSPM001.DataValue.HasValue ? Convert.ToInt32(this.txtSPM001.DataValue) : 0);
  285. this._thisGoodsEntity.DeliverLimitCycle = (this.txtSPM002.DataValue.HasValue ? Convert.ToInt32(this.txtSPM002.DataValue) : 0);
  286. this._thisGoodsEntity.MouldOutputCount = (this.txtMouldOutputCount.DataValue.HasValue ? Convert.ToInt32(this.txtMouldOutputCount.DataValue) : 1);
  287. this._thisGoodsEntity.StandardGroutingNum = (this.txtStandardGroutingNum.DataValue.HasValue ? Convert.ToInt32(this.txtStandardGroutingNum.DataValue) : 0);
  288. this._thisGoodsEntity.MouldMaterialCode = this.txtMouldMaterialCode.Text;
  289. this._thisGoodsEntity.WaterLabelCode = this.txtWaterLabelCode.Text;
  290. this._thisGoodsEntity.PlateLimitNum = (this.txtPlateLimitNum.DataValue.HasValue ? Convert.ToInt32(this.txtPlateLimitNum.DataValue) : 0);
  291. this._thisGoodsEntity.UnitPrice = (this.txtUnitPrice.DataValue.HasValue ? this.txtUnitPrice.DataValue.Value : 0);
  292. this._thisGoodsEntity.ReservedDays = (this.txtReservedDays.DataValue.HasValue ? Convert.ToInt32(this.txtReservedDays.DataValue) : 0);
  293. this._thisGoodsEntity.PackageNum = this.txtPackageNum.Text.Trim();
  294. this._thisGoodsEntity.OutletDistance = this.txtOutletDistance.Text.Trim();
  295. this._thisGoodsEntity.MaterialCode = this.scbSAPCode1.Text.Trim();
  296. this._thisGoodsEntity.MaterialRemark = this.txtMaterialRemark.Text;
  297. this._thisGoodsEntity.PrintCopies = (this.txtCopies.DataValue.HasValue ? Convert.ToInt32(this.txtCopies.DataValue) : 0);
  298. this._sapInfo.AcceptChanges();
  299. this._thisGoodsEntity.SAPInfo = this._sapInfo;
  300. this._thisGoodsEntity.LogoID = Convert.ToInt32(ftcLogo.SelectedValue);
  301. if (this.txtMouldWeight.DataValue != null)
  302. {
  303. this._thisGoodsEntity.MouldWeight = this.txtMouldWeight.DataValue;
  304. }
  305. if (this.txtMouldCost.DataValue != null)
  306. {
  307. this._thisGoodsEntity.MouldCost = this.txtMouldCost.DataValue;
  308. }
  309. if (this.txtSEATCOVERCODE.DataValue != null)
  310. {
  311. this._thisGoodsEntity.SeatCoverCode = Convert.ToInt32(this.txtSEATCOVERCODE.DataValue);
  312. }
  313. if (this.cbCeaseFlag.Checked)
  314. {
  315. this._thisGoodsEntity.CeaseFlag = Convert.ToInt32(Constant.ValueFlag.Effective);
  316. }
  317. else
  318. {
  319. this._thisGoodsEntity.CeaseFlag = Convert.ToInt32(Constant.ValueFlag.Invalid);
  320. }
  321. if (this.cbValueFlag.Checked)
  322. {
  323. this._thisGoodsEntity.ValueFlag = Convert.ToInt32(Constant.ValueFlag.Effective);
  324. }
  325. else
  326. {
  327. this._thisGoodsEntity.ValueFlag = Convert.ToInt32(Constant.ValueFlag.Invalid);
  328. }
  329. this._thisGoodsEntity.ScrapSumFlag = (this.chkScrapSumFlag.Checked ? "1" : "0");
  330. this._thisGoodsEntity.GoodsLineType = (this.chkGLT.Checked ? "1" : "0");
  331. this._thisGoodsEntity.Remarks = this.txtRemarks.Text;
  332. //首先将未修改的图片从集合中删除
  333. for (int i = 0; i < _imgList.Count; i++)
  334. {
  335. this._picByteList.RemoveAt(Constant.INT_IS_ZERO);
  336. this._smallByteList.RemoveAt(Constant.INT_IS_ZERO);
  337. }
  338. this._imgList.Clear();
  339. //循环插入图片
  340. for (int i = 0; i < _picByteList.Count; i++)
  341. {
  342. GoodsImageEntity imgEntity = new GoodsImageEntity();
  343. imgEntity.ValueFlag = Convert.ToInt32(Constant.ValueFlag.Effective);
  344. byte[] buffer = _picByteList[i];
  345. imgEntity.Image = buffer;
  346. imgEntity.Thumbnail = _smallByteList[i];
  347. this._imgList.Add(imgEntity);
  348. }
  349. //如果是编辑模式,有被删除的图片,那么要把这些图片也加入到集合中
  350. if (this._updateImgList.Count != Constant.INT_IS_ZERO)
  351. {
  352. for (int i = 0; i < this._updateImgList.Count; i++)
  353. {
  354. GoodsImageEntity updateImgEntity = this._updateImgList[i];
  355. this._imgList.Add(updateImgEntity);
  356. }
  357. }
  358. if (this._formGoodsId == Constant.INT_IS_ZERO)
  359. {
  360. int MyReturn = (int)DoAsync(new BaseAsyncMethod(() =>
  361. {
  362. return SystemModuleProxy.Service.AddGoods(this._thisGoodsEntity, this._imgList, this._attList);
  363. }));
  364. if (MyReturn > Constant.INT_IS_ZERO)
  365. {
  366. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "产品档案", "保存"),
  367. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  368. PageInitialization();
  369. }
  370. else if (MyReturn == -10)
  371. {
  372. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "物料编码"), this.Text,
  373. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  374. this.scbSAPCode1.Focus();
  375. return;
  376. }
  377. else
  378. {
  379. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "产品档案", "保存"),
  380. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  381. }
  382. }
  383. else
  384. {
  385. int MyReturn = SystemModuleProxy.Service.UpdateGoods(_thisGoodsEntity, _imgList, _attList);
  386. if (MyReturn > Constant.INT_IS_ZERO)
  387. {
  388. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "产品档案", "保存"),
  389. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  390. this.DialogResult = DialogResult.OK;
  391. }
  392. else if (MyReturn == -10)
  393. {
  394. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "物料编码"), this.Text,
  395. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  396. this.scbSAPCode1.Focus();
  397. return;
  398. }
  399. else if (MyReturn == -500)
  400. {
  401. MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK,
  402. MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  403. this.DialogResult = DialogResult.OK;
  404. }
  405. else
  406. {
  407. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "产品档案", "保存"),
  408. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  409. }
  410. }
  411. }
  412. catch (Exception ex)
  413. {
  414. // 对异常进行共通处理
  415. ExceptionManager.HandleEventException(this.ToString(),
  416. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  417. }
  418. }
  419. /// <summary>
  420. /// 上传缩略图
  421. /// </summary>
  422. private void btnUpload_Click(object sender, EventArgs e)
  423. {
  424. try
  425. {
  426. odlgFile.Filter = Constant.FILTER_PIC;
  427. odlgFile.FilterIndex = Constant.INT_IS_ZERO;
  428. odlgFile.RestoreDirectory = true;
  429. odlgFile.Title = "选择产品图片";
  430. odlgFile.FileName = null;
  431. odlgFile.RestoreDirectory = true;
  432. if (odlgFile.ShowDialog() == DialogResult.OK)
  433. {
  434. FileInfo file = new FileInfo(odlgFile.FileName);
  435. if (Constant.UPLOAD_PIC_MAX_SIZE < file.Length)
  436. {
  437. MessageBox.Show(string.Format(Messages.MSG_CMN_W013, "产品图片", "大小", "1M"),
  438. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  439. }
  440. else
  441. {
  442. Image PicImage = Image.FromStream(file.OpenRead());
  443. this._picByteList.Add(ImageToByte(PicImage));
  444. GetThumbnail(file);
  445. BindImg();
  446. }
  447. }
  448. }
  449. catch (Exception ex)
  450. {
  451. // 对异常进行共通处理
  452. ExceptionManager.HandleEventException(this.ToString(),
  453. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  454. }
  455. }
  456. /// <summary>
  457. /// 删除某缩略图
  458. /// </summary>
  459. private void btnDelete_Click(object sender, EventArgs e)
  460. {
  461. try
  462. {
  463. foreach (ListViewItem lvSelect in lvPic.SelectedItems)
  464. {
  465. int index = lvSelect.Index;
  466. if (index < Constant.INT_IS_ZERO)
  467. {
  468. index = Constant.INT_IS_ZERO;
  469. }
  470. ilPic.Images.RemoveAt(index);
  471. this._picByteList.RemoveAt(index);
  472. this._smallByteList.RemoveAt(index);
  473. lvPic.Items.RemoveAt(index);
  474. if (index < this._imgList.Count)
  475. {
  476. if (this._imgList[index].GoodsImageID != Constant.INT_IS_ZERO)
  477. {
  478. GoodsImageEntity deleteImgEntity = this._imgList[index];
  479. this._imgList[index].ValueFlag = Convert.ToInt32(Constant.ValueFlag.Invalid);
  480. this._updateImgList.Add(deleteImgEntity);
  481. this._imgList.RemoveAt(index);
  482. }
  483. }
  484. }
  485. BindImg();
  486. }
  487. catch (Exception ex)
  488. {
  489. // 对异常进行共通处理
  490. ExceptionManager.HandleEventException(this.ToString(),
  491. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  492. }
  493. }
  494. /// <summary>
  495. /// 关闭窗体
  496. /// </summary>
  497. private void btnCancel_Click(object sender, EventArgs e)
  498. {
  499. this.DialogResult = DialogResult.OK;
  500. }
  501. /// <summary>
  502. /// 查看图片
  503. /// </summary>
  504. private void lvPic_DoubleClick(object sender, EventArgs e)
  505. {
  506. try
  507. {
  508. foreach (ListViewItem lvSelect in lvPic.SelectedItems)
  509. {
  510. int index = lvSelect.Index;
  511. if (index < Constant.INT_IS_ZERO)
  512. {
  513. index = Constant.INT_IS_ZERO;
  514. }
  515. F_CMN_0102 addGoods = new F_CMN_0102(_picByteList[index]);
  516. DialogResult dialogresult = addGoods.ShowDialog();
  517. }
  518. }
  519. catch (Exception ex)
  520. {
  521. // 对异常进行共通处理
  522. ExceptionManager.HandleEventException(this.ToString(),
  523. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  524. }
  525. }
  526. /// <summary>
  527. /// SAP物料编码改变事件
  528. /// </summary>
  529. /// <param name="sender"></param>
  530. /// <param name="e"></param>
  531. private void txtSAPRemark_TextChanged(object sender, EventArgs e)
  532. {
  533. if (this.dgvGoodsSap.CurrentRow == null)
  534. {
  535. return;
  536. }
  537. try
  538. {
  539. DataRowView row = this.dgvGoodsSap.CurrentRow.DataBoundItem as DataRowView;
  540. if (row != null)
  541. {
  542. row["materialremark"] = txtSAPRemark.Text;
  543. row.EndEdit();
  544. }
  545. }
  546. catch (Exception ex)
  547. {
  548. // 对异常进行共通处理
  549. ExceptionManager.HandleEventException(this.ToString(),
  550. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  551. }
  552. }
  553. #endregion
  554. #region 私有方法
  555. /// <summary>
  556. /// 加载页面所需的数据源
  557. /// </summary>
  558. private void LoadDataSource()
  559. {
  560. try
  561. {
  562. // 绑定釉料类别
  563. DataTable dtGlazeType = SystemModuleProxy.Service.GetDataDictionaryByType(Constant.DictionaryType.TPC002, Constant.INT_IS_ONE);
  564. if (dtGlazeType != null)
  565. {
  566. ddlGlazeTypeID.DisplayMember = "DictionaryValue";
  567. ddlGlazeTypeID.ValueMember = "DictionaryID";
  568. ddlGlazeTypeID.DataSource = dtGlazeType;
  569. }
  570. DataSet logos = SystemModuleProxy.Service.GetLogoInfo();
  571. if (logos != null && logos.Tables.Count > 0)
  572. {
  573. ftcLogo.DisplayMember = "LogoNameCode";
  574. ftcLogo.ValueMember = "LogoID";
  575. ftcLogo.DataSource = logos.Tables[0];
  576. }
  577. }
  578. catch (Exception ex)
  579. {
  580. throw ex;
  581. }
  582. }
  583. /// <summary>
  584. /// 绑定缩略图到控件中
  585. /// </summary>
  586. private void BindImg()
  587. {
  588. try
  589. {
  590. //每次绑定要清空数据源
  591. this.ilPic.Images.Clear();
  592. //将缩略图二进制集合中的数据转换成图片文件
  593. List<Image> LSImageList = new List<Image>();
  594. foreach (byte[] smallby in _smallByteList)
  595. {
  596. LSImageList.Add(byteArrayToImage(smallby));
  597. }
  598. //添加数据源
  599. foreach (Image img in LSImageList)
  600. {
  601. ilPic.Images.Add(img);
  602. }
  603. this.ilPic.ImageSize = new Size(Constant.INT_IS_HUNDRED, Constant.INT_IS_HUNDRED);
  604. this.lvPic.LargeImageList = this.ilPic;
  605. this.lvPic.BeginUpdate();
  606. //清空列表的数据源
  607. lvPic.Items.Clear();
  608. //添加列表的数据源
  609. for (int i = 0; i < ilPic.Images.Count; i++)
  610. {
  611. ListViewItem lvi = new ListViewItem();
  612. lvi.ImageIndex = i;
  613. this.lvPic.Items.Add(lvi);
  614. }
  615. this.lvPic.EndUpdate();
  616. }
  617. catch (Exception ex)
  618. {
  619. throw ex;
  620. }
  621. }
  622. /// <summary>
  623. /// 重绘缩略图并把缩略图转为二进制储存在集合众
  624. /// </summary>
  625. /// <param name="sourceFile">图片实体</param>
  626. /// <returns></returns>
  627. private void GetThumbnail(FileInfo sourceFile)
  628. {
  629. try
  630. {
  631. Image imgSource = Image.FromStream(sourceFile.OpenRead());
  632. ImageFormat thisFormat = imgSource.RawFormat;
  633. int sW = Constant.INT_IS_ZERO, sH = Constant.INT_IS_ZERO;
  634. // 按比例缩放
  635. int sWidth = imgSource.Width;
  636. int sHeight = imgSource.Height;
  637. int destWidth = Constant.INT_IS_HUNDRED;
  638. int destHeight = getSmallImageHeight(sWidth, sHeight, destWidth);
  639. if (sHeight > destHeight || sWidth > destWidth)
  640. {
  641. if ((sWidth * destHeight) > (sHeight * destWidth))
  642. {
  643. sW = destWidth;
  644. sH = (destWidth * sHeight) / sWidth;
  645. }
  646. else
  647. {
  648. sH = destHeight;
  649. sW = (sWidth * destHeight) / sHeight;
  650. }
  651. }
  652. else
  653. {
  654. sW = sWidth;
  655. sH = sHeight;
  656. }
  657. Bitmap outBmp = new Bitmap(destWidth, destHeight);
  658. Graphics g = Graphics.FromImage(outBmp);
  659. g.Clear(Color.Black);
  660. // 设置画布的描绘质量
  661. g.CompositingQuality = CompositingQuality.HighQuality;
  662. g.SmoothingMode = SmoothingMode.HighQuality;
  663. g.InterpolationMode = InterpolationMode.HighQualityBicubic;
  664. g.DrawImage(imgSource, new Rectangle((destWidth - sW) / Constant.INT_IS_TWO, (destHeight - sH) /
  665. Constant.INT_IS_TWO, sW, sH), Constant.INT_IS_ZERO, Constant.INT_IS_ZERO,
  666. imgSource.Width, imgSource.Height, GraphicsUnit.Pixel);
  667. g.Dispose();
  668. //将重绘的图片转为二进制并保存
  669. Image image = (Image)outBmp;
  670. byte[] smallbuffer = ImageToByte(image);
  671. this._smallByteList.Add(smallbuffer);
  672. imgSource.Dispose();
  673. outBmp.Dispose();
  674. }
  675. catch (Exception ex)
  676. {
  677. throw ex;
  678. }
  679. }
  680. /// <summary>
  681. /// 根据原图片宽高比获取缩略图的高(根据宽)
  682. /// </summary>
  683. /// <param name="BigWidth">原图宽度</param>
  684. /// <param name="BigHeight">原图高度</param>
  685. /// <param name="SmallWidth">缩略图宽度</param>
  686. /// <returns>缩略图的高度</returns>
  687. private int getSmallImageHeight(int BigWidth, int BigHeight, int SmallWidth)
  688. {
  689. try
  690. {
  691. decimal scale = Convert.ToDecimal(BigWidth) / Convert.ToDecimal(BigHeight);
  692. return Convert.ToInt32(SmallWidth / scale);
  693. }
  694. catch (Exception ex)
  695. {
  696. throw ex;
  697. }
  698. }
  699. /// <summary>
  700. /// 验证添加项
  701. /// </summary>
  702. private int ValidationText()
  703. {
  704. int ErrorID = 0;
  705. if (this.ddlGlazeTypeID.SelectedValue.ToString() == string.Empty)
  706. {
  707. ErrorID = 7;
  708. }
  709. if (this.txtGoodsName.Text == string.Empty)
  710. {
  711. ErrorID = 3;
  712. }
  713. if (scbGoodsType.SearchedItem == null)
  714. {
  715. ErrorID = 6;
  716. }
  717. if (this.txtGoodsCode.Text == string.Empty)
  718. {
  719. ErrorID = 1;
  720. }
  721. return ErrorID;
  722. }
  723. /// <summary>
  724. /// 绑定缩略图到缩略图集合中
  725. /// </summary>
  726. /// <param name="ImageData">图片集合</param>
  727. private void BindByteImage(DataSet ImageData)
  728. {
  729. try
  730. {
  731. foreach (DataRow dr in ImageData.Tables[0].Rows)
  732. {
  733. //将数据库中的缩略图取出
  734. this._smallByteList.Add((byte[])dr[2]);
  735. this._picByteList.Add((byte[])dr[3]);
  736. //绑定实体到修改图片集合中
  737. GoodsImageEntity imgEntity = new GoodsImageEntity();
  738. imgEntity.GoodsImageID = Convert.ToDecimal(dr[0]);
  739. imgEntity.GoodsID = Convert.ToDecimal(dr[1]);
  740. imgEntity.Thumbnail = (byte[])dr[2];
  741. imgEntity.Image = (byte[])dr[3];
  742. imgEntity.AccountID = Convert.ToDecimal(dr[4]);
  743. imgEntity.ValueFlag = Convert.ToDecimal(dr[5]);
  744. imgEntity.CreateTime = Convert.ToDateTime(dr[6]);
  745. imgEntity.CreateUserID = Convert.ToDecimal(dr[7]);
  746. imgEntity.UpdateTime = Convert.ToDateTime(dr[8]);
  747. imgEntity.UpdateUserID = Convert.ToDecimal(dr[9]);
  748. imgEntity.OPTimeStamp = Convert.ToDateTime(dr[10]);
  749. this._imgList.Add(imgEntity);
  750. }
  751. //绑定缩略图
  752. BindImg();
  753. }
  754. catch (Exception ex)
  755. {
  756. throw ex;
  757. }
  758. }
  759. /// <summary>
  760. /// 将数据库中的二进制转换成图片
  761. /// </summary>
  762. /// <param name="data">需要转换成图片的二进制数据</param>
  763. /// <returns>图片文件实体</returns>
  764. private static Image byteArrayToImage(object data)
  765. {
  766. try
  767. {
  768. System.IO.MemoryStream ms = new System.IO.MemoryStream((byte[])data);
  769. System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
  770. return returnImage;
  771. }
  772. catch (Exception ex)
  773. {
  774. throw ex;
  775. }
  776. }
  777. /// <summary>
  778. /// 将图片文件转换成二进制
  779. /// </summary>
  780. /// <param name="img">需要转换的图片</param>
  781. /// <returns>图片二进制数据</returns>
  782. private static byte[] ImageToByte(Image img)
  783. {
  784. try
  785. {
  786. byte[] smallbuffer = null;
  787. using (MemoryStream ms = new MemoryStream())
  788. {
  789. img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
  790. ms.Position = Constant.INT_IS_ZERO;
  791. smallbuffer = new byte[ms.Length];
  792. ms.Read(smallbuffer, Constant.INT_IS_ZERO, Convert.ToInt32(ms.Length));
  793. ms.Flush();
  794. }
  795. return smallbuffer;
  796. }
  797. catch (Exception ex)
  798. {
  799. throw ex;
  800. }
  801. }
  802. /// <summary>
  803. /// 验证产品编号唯一性
  804. /// </summary>
  805. /// <param name="goodsCode">产品编号</param>
  806. /// <returns>是否重复,真为不重复,可插入</returns>
  807. private bool ValidationCode(string goodsCode)
  808. {
  809. try
  810. {
  811. GoodsEntity vgoods = new GoodsEntity();
  812. vgoods.GoodsCodeOnly = goodsCode;
  813. int i = ((DataSet)SystemModuleProxy.Service.SerachGoods(vgoods)).Tables[0].Rows.Count;
  814. if (i > Constant.INT_IS_ZERO)
  815. {
  816. return false;
  817. }
  818. else
  819. {
  820. return true;
  821. }
  822. }
  823. catch (Exception ex)
  824. {
  825. throw ex;
  826. }
  827. }
  828. /// <summary>
  829. /// 页面控件初始化
  830. /// </summary>
  831. private void PageInitialization()
  832. {
  833. //页面控件初始化
  834. this.txtGoodsCode.Text = "";
  835. //this.gtsGoodaType.GoodsTypeCode = null;
  836. //this.gtsGoodaType.GoodsTypeID = null;
  837. //this.gtsGoodaType.GoodsTypeName = null;
  838. //this.gtsGoodaType.Text = "";
  839. this.scbGoodsType.ClearValue();
  840. this.txtGoodsName.Text = "";
  841. this.txtGoodsModel.Text = "";
  842. this.txtGoodsSpecification.Text = "";
  843. this.txtMudWeight.Text = "";
  844. this.txtGlazeWeight.Text = "";
  845. //this.ddlGlazeTypeID.SelectedValue = null;
  846. this.txtProductionCycle.Text = "";
  847. this.txtLusterwareWeight.Text = "";
  848. this.txtRemarks.Text = "";
  849. this.lvPic.Items.Clear();
  850. this.cbCeaseFlag.Checked = true;
  851. this.cbValueFlag.Checked = true;
  852. this.chkGLT.Checked = false;
  853. this.txtSPM001.DataValue = 0;
  854. this.txtSPM002.DataValue = 0;
  855. this.txtMouldOutputCount.DataValue = 1;
  856. this.txtStandardGroutingNum.DataValue = 0;
  857. this.dtpStartingDate.Value = DateTime.Now.Date;
  858. //成员变量初始化
  859. this._thisGoodsEntity = new GoodsEntity();
  860. this._picByteList = new List<byte[]>();
  861. this._smallByteList = new List<byte[]>();
  862. this._imgList = new List<GoodsImageEntity>();
  863. this._updateImgList = new List<GoodsImageEntity>();
  864. this.txtUnitPrice.DataValue = 0;
  865. this.txtPlateLimitNum.DataValue = 0;
  866. this.txtReservedDays.DataValue = 0;
  867. this.txtPackageNum.Text = "";
  868. this.txtOutletDistance.Text = "";
  869. this.scbSAPCode1.Text = "";
  870. this.txtMaterialRemark.Text = "";
  871. this.txtMouldWeight.DataValue = null;
  872. this.txtMouldCost.DataValue = null;
  873. this.txtSEATCOVERCODE.DataValue = null;
  874. this.txtWaterLabelCode.Clear();
  875. this.chkScrapSumFlag.Checked = true;
  876. this.txtMouldMaterialCode.Clear();
  877. foreach (DataRow row in this._sapInfo.Rows)
  878. {
  879. row["materialcode"] = DBNull.Value;
  880. row["materialremark"] = DBNull.Value;
  881. row["WaterLabelCode"] = DBNull.Value;
  882. }
  883. this._sapInfo.AcceptChanges();
  884. }
  885. #endregion
  886. #region SAP物料
  887. private void dgvGoodsSap_SelectionChanged(object sender, EventArgs e)
  888. {
  889. if (this.dgvGoodsSap.CurrentRow == null)
  890. {
  891. //this.scbSAPCode2.Clear();
  892. //this.txtSAPRemark.Clear();
  893. return;
  894. }
  895. try
  896. {
  897. this.scbSAPCode2.Text = this.dgvGoodsSap.CurrentRow.Cells["colmaterialcode"].Value + "";
  898. this.txtSAPRemark.Text = this.dgvGoodsSap.CurrentRow.Cells["colmaterialremark"].Value + "";
  899. this.txtSAPWaterLabelCode.Text = this.dgvGoodsSap.CurrentRow.Cells["colWaterLabelCode"].Value + "";
  900. }
  901. catch (Exception ex)
  902. {
  903. // 对异常进行共通处理
  904. ExceptionManager.HandleEventException(this.ToString(),
  905. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  906. }
  907. }
  908. private void txtSAPCode_Validated(object sender, EventArgs e)
  909. {
  910. //if (this.dgvGoodsSap.CurrentRow == null)
  911. //{
  912. // return;
  913. //}
  914. //try
  915. //{
  916. // DataRowView row = this.dgvGoodsSap.CurrentRow.DataBoundItem as DataRowView;
  917. // if (row != null)
  918. // {
  919. // row["materialcode"] = txtSAPCode.Text;
  920. // row.EndEdit();
  921. // }
  922. //}
  923. //catch (Exception ex)
  924. //{
  925. // // 对异常进行共通处理
  926. // ExceptionManager.HandleEventException(this.ToString(),
  927. // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  928. //}
  929. }
  930. private void txtSAPRemark_Validated(object sender, EventArgs e)
  931. {
  932. //if (this.dgvGoodsSap.CurrentRow == null)
  933. //{
  934. // return;
  935. //}
  936. //try
  937. //{
  938. // DataRowView row = this.dgvGoodsSap.CurrentRow.DataBoundItem as DataRowView;
  939. // if (row != null)
  940. // {
  941. // row["materialremark"] = txtSAPRemark.Text;
  942. // row.EndEdit();
  943. // }
  944. //}
  945. //catch (Exception ex)
  946. //{
  947. // // 对异常进行共通处理
  948. // ExceptionManager.HandleEventException(this.ToString(),
  949. // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  950. //}
  951. }
  952. private void txtSAPWaterLabelCode_Validated(object sender, EventArgs e)
  953. {
  954. if (this.dgvGoodsSap.CurrentRow == null)
  955. {
  956. return;
  957. }
  958. try
  959. {
  960. DataRowView row = this.dgvGoodsSap.CurrentRow.DataBoundItem as DataRowView;
  961. if (row != null)
  962. {
  963. row["WaterLabelCode"] = txtSAPWaterLabelCode.Text;
  964. row.EndEdit();
  965. }
  966. }
  967. catch (Exception ex)
  968. {
  969. // 对异常进行共通处理
  970. ExceptionManager.HandleEventException(this.ToString(),
  971. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  972. }
  973. }
  974. /// <summary>
  975. /// 物料编码改变事件
  976. /// </summary>
  977. /// <param name="sender"></param>
  978. /// <param name="e"></param>
  979. private void scbSAPCode2_VisibleChanged(object sender, EventArgs e)
  980. {
  981. if (this.dgvGoodsSap.CurrentRow == null)
  982. {
  983. return;
  984. }
  985. try
  986. {
  987. DataRowView row = this.dgvGoodsSap.CurrentRow.DataBoundItem as DataRowView;
  988. if (row != null)
  989. {
  990. row["materialcode"] = scbSAPCode2.Text;
  991. row.EndEdit();
  992. }
  993. }
  994. catch (Exception ex)
  995. {
  996. // 对异常进行共通处理
  997. ExceptionManager.HandleEventException(this.ToString(),
  998. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  999. }
  1000. }
  1001. #endregion
  1002. private void txtMouldOutputCount_TextChanged(object sender, EventArgs e)
  1003. {
  1004. try
  1005. {
  1006. int mouldOutputCount = (this.txtMouldOutputCount.DataValue.HasValue ? Convert.ToInt32(this.txtMouldOutputCount.DataValue) : 1);
  1007. int standardGroutingNum = (this.txtStandardGroutingNum.DataValue.HasValue ? Convert.ToInt32(this.txtStandardGroutingNum.DataValue) : 0);
  1008. this.txtStandardGroutingSum.DataValue = mouldOutputCount * standardGroutingNum;
  1009. }
  1010. catch (Exception ex)
  1011. {
  1012. // 对异常进行共通处理
  1013. ExceptionManager.HandleEventException(this.ToString(),
  1014. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  1015. }
  1016. }
  1017. }
  1018. }