using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.Make { public partial class Make_BarcodeDetail : CustomControl.BaseForm.BaseForm { //所有用到了headBar的部分都需要这段代码 [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)] public static extern int GetWindowLong(HandleRef hWnd, int nIndex); [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)] public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong); public const int WM_SYSCOMMAND = 0x0112; public const int SC_MOVE = 0xF010; public const int HTCAPTION = 0x0002; DataHelper dh; LogStringBuilder sql = new LogStringBuilder(); string piinoutno; public Make_BarcodeDetail(string piinoutno) { dh = SystemInf.dh; InitializeComponent(); this.piinoutno = piinoutno; } private void Warehouse_ProdDetail_Load(object sender, EventArgs e) { pi_inoutno.Text = piinoutno; FillDataGridView(); } private void headBar1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } private void BatchProductDGV_CellContentClick66(object sender, DataGridViewCellEventArgs e) { if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow") { if (e.RowIndex >= 0) { string id = BatchProductDGV.Rows[e.RowIndex].Cells["bi_id"].Value.ToString(); if (id != "0") { dh.ExecuteSql("delete barcodeio where bi_id='" + id + "'", "delete"); FillDataGridView(); } } } } private void FillDataGridView() { sql.Clear(); sql.Append("select bi_id,bi_piid,bi_barcode,bi_inqty,pr_code,pr_detail,pr_spec from barcodeio left join product on bi_prodcode = pr_code "); sql.Append("where bi_inoutno = '" + pi_inoutno.Text + "' and bi_pdid is null order by bi_id asc " + "" + " "); DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt); } private void button1_Click(object sender, EventArgs e) { } private void BatchProductDGV_CellFormatting12(object sender, DataGridViewCellFormattingEventArgs e) { if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow") { if (BatchProductDGV.Rows[e.RowIndex].Cells["bi_id"].Value.ToString() == "0") e.Value = Properties.Resources.WhiteImage; else e.Value = Properties.Resources.bindingNavigatorDeleteItem_Image; } } private void button1_Click_1(object sender, EventArgs e) { } private void BatchProductDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position)); if (e.ColumnIndex > 0) { if (BatchProductDGV.Columns[e.ColumnIndex].Name == "bi_inqty") { SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255)); e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds); Rectangle border = e.CellBounds; border.Width -= 1; e.Graphics.DrawRectangle(Pens.White, border); e.PaintContent(e.CellBounds); e.Handled = true; } } } } }