Procházet zdrojové kódy

产品线形图增加浏览

qinqi před 11 měsíci
rodič
revize
5e17f61dc9

+ 7 - 0
DK.Basics/BaseResources/Constant.cs

@@ -175,6 +175,13 @@ namespace Dongke.IBOSS.PRD.Basics.BaseResources
                                         + "|位图(*.bmp)|*.bmp"
                                         + "|GIF(*.gif)|*.gif"
                                         + "|PNG(*.png)|*.png";
+        /// <summary>
+        /// 图片的过滤格式
+        /// </summary>
+        public const string FILTER_PIC_GOODS = "PNG(*.png)|*.png"
+                                            + "|位图(*.bmp)|*.bmp"
+                                            + "|GIF(*.gif)|*.gif"
+                                            + "|JPEG(*jpg)|*.jpg;*.jpeg";
 
         /// <summary>
         /// 文档的过滤格式

+ 35 - 1
DK.Client/PCModule/F_MST_GoodsImage.cs

@@ -28,6 +28,7 @@ namespace Dongke.IBOSS.PRD.Client.Controls
 		#region 成员变量
 		// 窗体单例模式
 		private static F_MST_GoodsImage _instance = null;
+		private string _materialcode = null;
 		#endregion
 
 		#region 构造函数
@@ -318,6 +319,37 @@ namespace Dongke.IBOSS.PRD.Client.Controls
 				System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
 			}
 		}
+
+		/// <summary>
+		/// 双击查看
+		/// </summary>
+		/// <param name="sender"></param>
+		/// <param name="e"></param>
+		private void dgvGoodsImage_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+		{
+			try
+			{
+				// 获取活动行
+				DataGridViewRow currentRow = this.dgvGoodsImage.CurrentRow;
+				if (currentRow != null)
+				{
+					this._materialcode =  currentRow.Cells["MATERIALCODE"].Value.ToString();
+					F_MST_GoodsImageAdd frmGoodAdd = new F_MST_GoodsImageAdd("Edit", _materialcode);
+					DialogResult dialogresult = frmGoodAdd.ShowDialog();
+					if (DialogResult.OK == dialogresult)
+					{
+						QueryDataFromOther();
+					}
+				}
+				
+			}
+			catch (Exception ex)
+			{
+				// 对异常进行共通处理
+				ExceptionManager.HandleEventException(this.ToString(),
+					System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
+			}
+		}
 		#endregion
 
 		#region 重写方法
@@ -359,7 +391,9 @@ namespace Dongke.IBOSS.PRD.Client.Controls
 		#endregion
 
 		#region 私有方法
-		
+
 		#endregion
+
+		
 	}
 }

+ 28 - 27
DK.Client/PCModule/F_MST_GoodsImage.designer.cs

@@ -35,6 +35,9 @@
 			this.txtMATNR = new Dongke.WinForm.Controls.TxtTextBox();
 			this.lblInvoiceLayoutName = new Dongke.IBOSS.PRD.Basics.BaseControls.C_Label();
 			this.dgvGoodsImage = new Dongke.IBOSS.PRD.Basics.BaseControls.C_DataGridView();
+			this.MATERIALCODE = new System.Windows.Forms.DataGridViewTextBoxColumn();
+			this.IMAGE = new System.Windows.Forms.DataGridViewTextBoxColumn();
+			this.ishave = new System.Windows.Forms.DataGridViewTextBoxColumn();
 			this.gbxCondition = new System.Windows.Forms.GroupBox();
 			this.tsrSupplier = new Dongke.WinForm.Controls.TsrToolStrip();
 			this.tsbtnSearch = new System.Windows.Forms.ToolStripButton();
@@ -46,9 +49,6 @@
 			this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
 			this.tsbtnAdaptive = new System.Windows.Forms.ToolStripButton();
 			this.tsbtnClose = new System.Windows.Forms.ToolStripButton();
-			this.MATERIALCODE = new System.Windows.Forms.DataGridViewTextBoxColumn();
-			this.IMAGE = new System.Windows.Forms.DataGridViewTextBoxColumn();
-			this.ishave = new System.Windows.Forms.DataGridViewTextBoxColumn();
 			((System.ComponentModel.ISupportInitialize)(this.dgvGoodsImage)).BeginInit();
 			this.gbxCondition.SuspendLayout();
 			this.tsrSupplier.SuspendLayout();
@@ -144,8 +144,33 @@
 			this.dgvGoodsImage.TotalSumColumns = null;
 			this.dgvGoodsImage.ViewRowFilter = "";
 			this.dgvGoodsImage.VirtualNodes = false;
+			this.dgvGoodsImage.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGoodsImage_CellDoubleClick);
 			this.dgvGoodsImage.SelectionChanged += new System.EventHandler(this.dgvInvoice_SelectionChanged);
 			// 
+			// MATERIALCODE
+			// 
+			this.MATERIALCODE.DataPropertyName = "MATERIALCODE";
+			this.MATERIALCODE.HeaderText = "物料编码";
+			this.MATERIALCODE.Name = "MATERIALCODE";
+			this.MATERIALCODE.ReadOnly = true;
+			this.MATERIALCODE.Width = 150;
+			// 
+			// IMAGE
+			// 
+			this.IMAGE.DataPropertyName = "IMAGE";
+			this.IMAGE.HeaderText = "图片(二进制编码)";
+			this.IMAGE.Name = "IMAGE";
+			this.IMAGE.ReadOnly = true;
+			this.IMAGE.Visible = false;
+			this.IMAGE.Width = 170;
+			// 
+			// ishave
+			// 
+			this.ishave.HeaderText = "存在图片";
+			this.ishave.Name = "ishave";
+			this.ishave.ReadOnly = true;
+			this.ishave.Visible = false;
+			// 
 			// gbxCondition
 			// 
 			this.gbxCondition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
@@ -267,30 +292,6 @@
 			this.tsbtnClose.Text = "关闭(&X)";
 			this.tsbtnClose.Click += new System.EventHandler(this.tsbtnClose_Click);
 			// 
-			// MATERIALCODE
-			// 
-			this.MATERIALCODE.DataPropertyName = "MATERIALCODE";
-			this.MATERIALCODE.HeaderText = "物料编码";
-			this.MATERIALCODE.Name = "MATERIALCODE";
-			this.MATERIALCODE.ReadOnly = true;
-			this.MATERIALCODE.Width = 150;
-			// 
-			// IMAGE
-			// 
-			this.IMAGE.DataPropertyName = "IMAGE";
-			this.IMAGE.HeaderText = "图片(二进制编码)";
-			this.IMAGE.Name = "IMAGE";
-			this.IMAGE.ReadOnly = true;
-			this.IMAGE.Visible = false;
-			this.IMAGE.Width = 170;
-			// 
-			// ishave
-			// 
-			this.ishave.HeaderText = "存在图片";
-			this.ishave.Name = "ishave";
-			this.ishave.ReadOnly = true;
-			this.ishave.Visible = false;
-			// 
 			// F_MST_GoodsImage
 			// 
 			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

+ 31 - 1
DK.Client/PCModule/F_MST_GoodsImageAdd.cs

@@ -78,6 +78,8 @@ namespace Dongke.IBOSS.PRD.Client.Controls
 			{
 				if (winStatus == "Edit")
 				{
+					this.btnUpload.Visible = false;
+					this.btnSave.Visible = false;  
 					ClientRequestEntity cre = new ClientRequestEntity();
 					cre.NameSpace = "F_MST_GoodsImage";
 					cre.Name = "getGoodsImage";
@@ -92,7 +94,35 @@ namespace Dongke.IBOSS.PRD.Client.Controls
 						// 查询成功
 						if (sre.Data.Tables[0].Rows.Count > 0)
 						{
+							this.txtMATNR.Text = winmatnr;
+							this.txtMATNR.Enabled = false;
+							// 读取二进制数据
+							byte[] binaryData = (byte[])(sre.Data.Tables[0].Rows[0]["IMAGE"]);
+
+							// 解码为图像对象
+							try
+							{
+								using (MemoryStream stream = new MemoryStream(binaryData))
+								{
+									//if (picGoodsImage.Image != null)
+									{
+										// 其他操作  
+										// 显示图像在PictureBox中
+										//picGoodsImage.Image = Image.FromStream(stream);
+
+										Image PicImage = Image.FromStream(stream);
+										this._picByteList.Add(ImageToByte(PicImage)); 
+										this.picGoodsImage.BackgroundImage = PicImage;
+									}
+								}
+							}
+							catch (ArgumentException ex)
+							{
+								// 处理异常,例如记录日志或显示用户友好的错误消息  
+								MessageBox.Show("加载失败: " + ex.Message);
+							}
 							//this.picGoodsImage.Image = "";
+
 						}
 					}
 				}
@@ -191,7 +221,7 @@ namespace Dongke.IBOSS.PRD.Client.Controls
 		{
 			try
 			{
-				odlgFile.Filter = Constant.FILTER_PIC;
+				odlgFile.Filter = Constant.FILTER_PIC_GOODS;
 				odlgFile.FilterIndex = Constant.INT_IS_ZERO;
 				odlgFile.RestoreDirectory = true;
 				odlgFile.Title = "选择产品图片";

+ 1 - 0
DK.Client/PCModule/F_MST_GoodsImageAdd.designer.cs

@@ -94,6 +94,7 @@
 			// picGoodsImage
 			// 
 			this.picGoodsImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+			this.picGoodsImage.InitialImage = null;
 			this.picGoodsImage.Location = new System.Drawing.Point(14, 33);
 			this.picGoodsImage.Name = "picGoodsImage";
 			this.picGoodsImage.Size = new System.Drawing.Size(370, 375);