848 lines
30 KiB
C#
848 lines
30 KiB
C#
|
using RGD.DBUtility;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace RGD.WCS
|
|||
|
{
|
|||
|
public partial class UCellPanel : UserControl
|
|||
|
{
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD>
|
|||
|
private int bigWidth = 30;
|
|||
|
|
|||
|
private int bigHeight = 20;
|
|||
|
|
|||
|
//<2F><><EFBFBD>ݵIJ<DDB5><C4B2><EFBFBD>
|
|||
|
private Form parentForm;
|
|||
|
|
|||
|
private Control controlCellCode;
|
|||
|
|
|||
|
private Control controlShow;
|
|||
|
private Control controlBarCode;
|
|||
|
private int taskType = -1;
|
|||
|
|
|||
|
private DataTable tableCellInfoList; //V_CellInfoList
|
|||
|
private DataTable tableLines; //<2F><>ȡcmbLines<65><73>DataSource
|
|||
|
|
|||
|
private List<Rectangle> listRecCell = new List<Rectangle>(); //<2F>洢<EFBFBD><E6B4A2><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>
|
|||
|
private List<string> listCellCode = new List<string>(); //<2F>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
private List<int> listCellID = new List<int>(); //<2F>洢<EFBFBD><E6B4A2>λ<EFBFBD><CEBB>FID
|
|||
|
|
|||
|
private int cellID = -1; //ST_CELL<4C><4C><EFBFBD>е<EFBFBD>FID
|
|||
|
private string goodsName; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region -------<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
private const int tickFontSpac = 10; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>߽<EFBFBD>
|
|||
|
private const int tickTopBounds = 20; //<2F><><EFBFBD>˱߽<CBB1>
|
|||
|
private const int tickBottomBounds = 30; //<2F>ײ<EFBFBD><D7B2>߽<EFBFBD>
|
|||
|
private const int tickLeftBounds = 60; //<2F><><EFBFBD>߽<EFBFBD>
|
|||
|
private const int tickRightBounds = 10; //<2F>Ҷ˱߽<CBB1>
|
|||
|
private const int tickScroll = 15; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
|||
|
private const int tickClearance = 3; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶
|
|||
|
private Font fontCoordinate; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#endregion -------<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region -------<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
private int intXMax, intYMax, intXMin, intYMin;
|
|||
|
private Rectangle selectedRec; //<2F><>ǰѡ<C7B0><D1A1><EFBFBD>Ļ<EFBFBD>λ
|
|||
|
private Rectangle drawedRec; //<2F>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ƵĻ<C6B5>λ
|
|||
|
private SolidBrush brushSelectedRec = new SolidBrush(Color.FromArgb(80, Color.Transparent)); //ѡ<>л<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɫ
|
|||
|
private Color paintBorderColor = Color.Navy; //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD>ɫ
|
|||
|
|
|||
|
private string stackDevice = string.Empty; //<2F>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
private string laneway = string.Empty;
|
|||
|
|
|||
|
private string wareHouse = string.Empty; //ѡ<><D1A1><EFBFBD>IJֿ<C4B2>
|
|||
|
private string wareHouseDescription = string.Empty; //<2F>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private int selectedZ; //ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private string selectedCellCode = string.Empty; //ѡ<><D1A1><EFBFBD>Ļ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private int selectedCellStatus; //ѡ<><D1A1><EFBFBD>Ļ<EFBFBD>λ<EFBFBD>洢״̬
|
|||
|
private int selectedRunStatus; //ѡ<><D1A1><EFBFBD>Ļ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>״̬
|
|||
|
private string BoxBarCode = string.Empty; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ20110425
|
|||
|
|
|||
|
#endregion -------<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public string GoodsName
|
|||
|
{
|
|||
|
set { goodsName = value; }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public string WareHouse
|
|||
|
{
|
|||
|
get { return this.wareHouse; }
|
|||
|
set
|
|||
|
{
|
|||
|
this.wareHouse = value;
|
|||
|
if (!this.DesignMode)
|
|||
|
{
|
|||
|
//object obj = bllOperation.GetSingle("FNAME", "T_ITEMWAREHOUSE", "FCODE = '" + value + "'");
|
|||
|
//if (obj != null)
|
|||
|
//{
|
|||
|
cmbWareHouse.SelectedValue = value;
|
|||
|
//wareHouseDescription = obj.ToString();
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public string StackDevice
|
|||
|
{
|
|||
|
get { return stackDevice; }
|
|||
|
set
|
|||
|
{
|
|||
|
stackDevice = value;
|
|||
|
DataView dv = DbHelperSQL.Query("SELECT min(F_Z) FROM ST_CELL WHERE (FStack = " + stackDevice + ")").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
SelectedZ = Convert.ToInt32(dv[0][0]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>
|
|||
|
/// </summary>
|
|||
|
public string Laneway
|
|||
|
{
|
|||
|
get { return laneway; }
|
|||
|
set
|
|||
|
{
|
|||
|
laneway = value;
|
|||
|
|
|||
|
DataView dv = DbHelperSQL.Query("SELECT min(F_Z) FROM ST_CELL WHERE (Flaneway = " + laneway + ")").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
SelectedZ = Convert.ToInt32(dv[0][0]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĿؼ<C4BF>
|
|||
|
/// </summary>
|
|||
|
public Control ControlCellCode
|
|||
|
{
|
|||
|
get { return controlCellCode; }
|
|||
|
set { controlCellCode = value; }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>
|
|||
|
/// </summary>
|
|||
|
public int SelectedZ
|
|||
|
{
|
|||
|
get { return this.selectedZ; }
|
|||
|
set
|
|||
|
{
|
|||
|
if (!this.DesignMode)
|
|||
|
{
|
|||
|
this.selectedZ = value;
|
|||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
InitDataTable();
|
|||
|
this.cmbLine.Text = value.ToString();
|
|||
|
|
|||
|
//<2F><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>
|
|||
|
panelCell.Invalidate();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>CellCode
|
|||
|
/// </summary>
|
|||
|
public string CellCode
|
|||
|
{
|
|||
|
get { return this.selectedCellCode.TrimEnd(); }
|
|||
|
set
|
|||
|
{
|
|||
|
selectedCellCode = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public int CellID
|
|||
|
{
|
|||
|
get { return cellID; }
|
|||
|
set { cellID = value; ShowCellInformation(); }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public string TaskType
|
|||
|
{
|
|||
|
set { taskType = Convert.ToInt32(value); }
|
|||
|
}
|
|||
|
|
|||
|
private bool allowWareHouseChanged = false;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20>ֿ<EFBFBD><D6BF>Ƿ<EFBFBD><C7B7><EFBFBD>ѡ
|
|||
|
/// </summary>
|
|||
|
public bool AllowWareHouseChanged
|
|||
|
{
|
|||
|
set { allowWareHouseChanged = value; cmbWareHouse.Enabled = allowWareHouseChanged; }
|
|||
|
}
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
public UCellPanel()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
panelCell.AutoScroll = true;
|
|||
|
this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
|
|||
|
this.cmbLine.SelectionChangeCommitted += new EventHandler(cmbLine_SelectionChangeCommitted);
|
|||
|
|
|||
|
this.fontCoordinate = new Font("Tohoma", 9, FontStyle.Bold);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
|||
|
/// </summary>
|
|||
|
/// <param name="parent"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
/// <param name="control"><3E><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD></param>
|
|||
|
/// <param name="type"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ManageType</param>
|
|||
|
/// <param name="where">ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD></param>
|
|||
|
public UCellPanel(Form parent, Control control, Control ctrlShow, Control ctrlBarCode, string where)
|
|||
|
: this()
|
|||
|
{
|
|||
|
this.parentForm = parent;
|
|||
|
controlCellCode = control;
|
|||
|
controlShow = ctrlShow;
|
|||
|
controlBarCode = ctrlBarCode;
|
|||
|
//taskType = type;
|
|||
|
|
|||
|
//T_WAREHOUSE
|
|||
|
DataTable tableWareHouse = DbHelperSQL.Query("SELECT F_WarehouseIndex,F_Description FROM T_WAREHOUSE").Tables[0];
|
|||
|
cmbWareHouse.DisplayMember = "F_Description";
|
|||
|
cmbWareHouse.ValueMember = "F_WarehouseIndex";
|
|||
|
|
|||
|
cmbWareHouse.DataSource = tableWareHouse.DefaultView;
|
|||
|
|
|||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (cmbWareHouse.SelectedValue != null)
|
|||
|
{
|
|||
|
WareHouse = cmbWareHouse.SelectedValue.ToString();
|
|||
|
SelectedZ = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
private void InitDataTable()
|
|||
|
{
|
|||
|
string strstack = "";
|
|||
|
if (StackDevice != string.Empty)
|
|||
|
{
|
|||
|
strstack = " and FStack=" + StackDevice + " ";
|
|||
|
}
|
|||
|
string strlaneway = "";
|
|||
|
if (laneway != string.Empty)
|
|||
|
{
|
|||
|
strlaneway = " and FLaneway=" + laneway + " ";
|
|||
|
}
|
|||
|
//st_Cell <20><><EFBFBD><EFBFBD>ֵ
|
|||
|
tableLines = DbHelperSQL.Query("SELECT DISTINCT F_Z FROM ST_CELL WHERE 1=1 " + strstack + strlaneway + " ORDER BY F_Z").Tables[0];
|
|||
|
cmbLine.DisplayMember = "F_Z";
|
|||
|
cmbLine.DataSource = this.tableLines;
|
|||
|
|
|||
|
//ST_Cell
|
|||
|
tableCellInfoList = DbHelperSQL.Query("SELECT * FROM ST_CELL WHERE F_Z = '" + selectedZ + "' ORDER BY F_X,F_Y DESC").Tables[0];
|
|||
|
int count = tableCellInfoList.Rows.Count;
|
|||
|
|
|||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
InitMaxSet();
|
|||
|
|
|||
|
//ѡ<>л<EFBFBD>λΪ<CEBB><CEAA>
|
|||
|
selectedRec = Rectangle.Empty;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private void InitMaxSet()
|
|||
|
{
|
|||
|
DataView dv = DbHelperSQL.Query("SELECT MAX(F_X) FROM ST_CELL").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
intXMax = Convert.ToInt32(dv[0][0]);
|
|||
|
}
|
|||
|
dv = DbHelperSQL.Query("SELECT MAX(F_Y) FROM ST_CELL").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
intYMax = Convert.ToInt32(dv[0][0]);
|
|||
|
}
|
|||
|
dv = DbHelperSQL.Query("SELECT MIN(F_X) FROM ST_CELL").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
intXMin = Convert.ToInt32(dv[0][0]);
|
|||
|
}
|
|||
|
dv = DbHelperSQL.Query("SELECT MIN(F_Y) FROM ST_CELL ").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
intYMin = Convert.ToInt32(dv[0][0]);
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
panelCell.AutoScrollMinSize = new Size((Convert.ToInt32(bigWidth) + 2 * tickClearance) * (intXMax - intXMin + 1) + tickLeftBounds + 2 * tickClearance + tickFontSpac + tickScroll, (Convert.ToInt32(bigHeight) + 2 * tickClearance) * (intYMax - intYMin + 1) + 3 * tickTopBounds);
|
|||
|
}
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region ComboBox SeletedValueChanged<EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// ѡ<><D1A1><EFBFBD>ֿ<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
private void cmbWareHouse_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (cmbWareHouse.SelectedValue != null)
|
|||
|
{
|
|||
|
wareHouse = cmbWareHouse.SelectedValue.ToString();
|
|||
|
//DataView dv = dbo.ExceSQL("SELECT F_Description FROM T_WAREHOUSE WHERE F_WarehouseIndex = '" + wareHouse+ "'").Tables[0].DefaultView;
|
|||
|
DataView dv = DbHelperSQL.Query("SELECT F_Description FROM T_WAREHOUSE").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
wareHouseDescription = dv[0]["F_Description"].ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
SelectedZ = 1;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// ComboBox SeletedValueChanged<65>ı<EFBFBD><C4B1><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
private void cmbLine_SelectionChangeCommitted(object sender, EventArgs e)
|
|||
|
{
|
|||
|
SetBeginData();
|
|||
|
SelectedZ = Convert.ToInt32(this.cmbLine.Text);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20>ָ<EFBFBD><D6B8><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
private void SetBeginData()
|
|||
|
{
|
|||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʾ
|
|||
|
panelCell.AutoScrollPosition = new Point(0, 0);
|
|||
|
|
|||
|
cellID = -1;
|
|||
|
selectedCellCode = string.Empty;
|
|||
|
BoxBarCode = string.Empty;
|
|||
|
selectedRec = Rectangle.Empty;
|
|||
|
drawedRec = Rectangle.Empty;
|
|||
|
|
|||
|
lblCellCode.Text = string.Empty;
|
|||
|
lblCellStatus.Text = string.Empty;
|
|||
|
lblRunStatus.Text = string.Empty;
|
|||
|
lblBoxCode.Text = string.Empty;
|
|||
|
txtCellCode.Clear();
|
|||
|
}
|
|||
|
|
|||
|
#endregion ComboBox SeletedValueChanged<EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>λ
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>ƻ<EFBFBD>λ
|
|||
|
/// </summary>
|
|||
|
private void panelCell_Paint(object sender, PaintEventArgs e)
|
|||
|
{
|
|||
|
if (this.DesignMode)
|
|||
|
return;
|
|||
|
|
|||
|
Graphics g = e.Graphics;
|
|||
|
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
|||
|
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
g.TranslateTransform(panelCell.AutoScrollPosition.X, panelCell.AutoScrollPosition.Y);
|
|||
|
|
|||
|
int minBottom = 0, maxRight = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5>¼
|
|||
|
int nextPosition = tickTopBounds; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
int currentPosition = 0; //<2F><>ǰλ<C7B0><CEBB>
|
|||
|
Rectangle cellPaint = Rectangle.Empty; //<2F><><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
Point p1, p2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>
|
|||
|
Dictionary<int, int> paintArea = new Dictionary<int, int>(); //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
|
|||
|
int x = 0, y = 0; //<2F><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int width = 0, height = 0; //<2F><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
|||
|
|
|||
|
//<2F>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int areaWith = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
|
|||
|
int areaHeight = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߶<C4B8>
|
|||
|
|
|||
|
string code; //<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
int i = 0, j = 0, k = 0; //<2F><><EFBFBD><EFBFBD>
|
|||
|
//char side = Char.MinValue; //˫<><CBAB>λ<EFBFBD><CEBB>
|
|||
|
|
|||
|
//<2F><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD><EFBFBD>ļ<EFBFBD>¼
|
|||
|
listCellCode.Clear();
|
|||
|
listRecCell.Clear();
|
|||
|
listCellID.Clear();
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|||
|
foreach (DataRow rowCell in tableCellInfoList.Rows)
|
|||
|
{
|
|||
|
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
code = rowCell["FCELLCODE"].ToString().TrimEnd();
|
|||
|
i = Convert.ToInt32(code.Split('-')[1]);
|
|||
|
j = Convert.ToInt32(code.Split('-')[2]);
|
|||
|
|
|||
|
//<2F><><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD>
|
|||
|
|
|||
|
areaWith = bigWidth + 2 * tickClearance;
|
|||
|
areaHeight = bigHeight + 2 * tickClearance;
|
|||
|
|
|||
|
#region -------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
if (k == 0 || (k > 0 && code.Split('-').Length == 3) || (k > 0 && (code.Split('-').Length == 4) && listCellCode[k - 1].Substring(0, listCellCode[k - 1].Length - 2) != code.Substring(0, code.Length - 2)))
|
|||
|
{
|
|||
|
//<2F><><EFBFBD>㵱ǰλ<C7B0>ú<EFBFBD><C3BA><EFBFBD>һλ<D2BB><CEBB>
|
|||
|
if (paintArea.ContainsKey(j))
|
|||
|
{
|
|||
|
currentPosition = paintArea[j];
|
|||
|
nextPosition = currentPosition + areaHeight;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
currentPosition = nextPosition;
|
|||
|
nextPosition = currentPosition + areaHeight;
|
|||
|
//<2F>洢ֵ<E6B4A2><D6B5>
|
|||
|
paintArea[j] = currentPosition;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
x = tickLeftBounds + areaWith * (i - intXMin);
|
|||
|
y = currentPosition;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|||
|
g.FillRectangle(new SolidBrush(Color.FromArgb(-8355585)), x, y, areaWith, areaHeight);
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//width = Convert.ToInt32(rowCell["FWIDTH"].ToString());
|
|||
|
//height = (Convert.ToInt32(rowCell["FCELLMODEL"]) == 2) ? Convert.ToInt32(rowCell["FLENGTH"].ToString()) + 2 * tickClearance : Convert.ToInt32(rowCell["FLENGTH"].ToString());
|
|||
|
width = bigWidth;
|
|||
|
height = bigHeight;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
x += tickClearance;
|
|||
|
y += tickClearance;
|
|||
|
}
|
|||
|
|
|||
|
#endregion -------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region ----<EFBFBD>жϻ<EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
|
|||
|
//<2F>洢<EFBFBD><E6B4A2><EFBFBD>ƻ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>κͻ<CEBA>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
listRecCell.Insert(k, new Rectangle(x, y, width, height));
|
|||
|
listCellCode.Insert(k, code);
|
|||
|
listCellID.Insert(k, Convert.ToInt32(rowCell["FID"]));
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F1B1B3BE><EFBFBD>ɫ
|
|||
|
g.FillRectangle(new SolidBrush(Color.Black), x, y, width + 1, height + 1);
|
|||
|
//<2F>洢״̬<D7B4><CCAC>ɫ
|
|||
|
if (rowCell["FCELLSTATUS"].ToString().TrimEnd() == "1")//20110101
|
|||
|
{
|
|||
|
g.FillRectangle(new SolidBrush(Color.Navy), listRecCell[k]);
|
|||
|
}
|
|||
|
else
|
|||
|
if (rowCell["FCELLSTATUS"].ToString().TrimEnd() == "0")//20110101
|
|||
|
{
|
|||
|
g.FillRectangle(new SolidBrush(Color.FromArgb(Convert.ToInt32(-12550016))), listRecCell[k]);
|
|||
|
}
|
|||
|
else//-1<><31><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
g.FillRectangle(new SolidBrush(Color.Red), listRecCell[k]);
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>ʾ
|
|||
|
if (rowCell["FRUNSTATUS"].ToString().TrimEnd() == "1")
|
|||
|
{
|
|||
|
g.DrawString("R", fontCoordinate, new SolidBrush(Color.Lime), x + width / 2 - 5, y + height / 2 - fontCoordinate.Height / 2);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
g.DrawString("", fontCoordinate, new SolidBrush(Color.Black), x + width / 2 - 5, y + height / 2 - fontCoordinate.Height / 2);
|
|||
|
}
|
|||
|
|
|||
|
#endregion ----<EFBFBD>жϻ<EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե
|
|||
|
if (intXMax == i && maxRight == 0)
|
|||
|
maxRight = x + areaWith - tickLeftBounds - tickClearance;
|
|||
|
if (intYMin == j && minBottom == 0)
|
|||
|
minBottom = nextPosition - tickTopBounds;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
k++;
|
|||
|
|
|||
|
//<2F><>X<EFBFBD><58><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>̶<EFBFBD>
|
|||
|
if (((i + 1) % 5 == 0 && j == intYMin) || (i == intXMax - 1 && i > 5 && j == intYMin))
|
|||
|
g.DrawString((i + 1).ToString(), this.fontCoordinate, Brushes.Black, x + width / 2 - this.fontCoordinate.Height / 2 + width + 3, nextPosition + tickClearance + tickFontSpac);
|
|||
|
//Y<><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (i == intXMin)
|
|||
|
g.DrawString(i.ToString(), this.fontCoordinate, Brushes.Black, x + width / 2 - this.fontCoordinate.Height / 2 + 3, nextPosition + tickClearance + tickFontSpac);
|
|||
|
if ((j % 5 == 0 && i == intXMin) || (j == intYMax && j > 5 && i == intXMin))
|
|||
|
g.DrawString(j.ToString(), this.fontCoordinate, Brushes.Black, tickLeftBounds - tickFontSpac - tickClearance - 3 * this.fontCoordinate.Height / 2, y + height / 2 - this.fontCoordinate.Height / 2);
|
|||
|
}
|
|||
|
|
|||
|
#region ------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD>ƻ<EFBFBD>ͼ<EFBFBD>߿<EFBFBD>
|
|||
|
cellPaint = new Rectangle(tickLeftBounds, tickTopBounds, maxRight, minBottom);
|
|||
|
g.DrawRectangle(new Pen(paintBorderColor, 2), cellPaint);
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
p1 = new Point(tickLeftBounds - tickFontSpac, cellPaint.Bottom + tickFontSpac);
|
|||
|
p2 = new Point(cellPaint.Right + tickClearance + tickFontSpac, cellPaint.Bottom + tickFontSpac);
|
|||
|
g.DrawLine(new Pen(Color.Black, 2), p1, p2);
|
|||
|
//<2F><><EFBFBD>Ƽ<EFBFBD>ͷ
|
|||
|
g.DrawLine(new Pen(Color.Black, 1), p2, new Point(p2.X - tickClearance, p2.Y + tickClearance));
|
|||
|
g.DrawLine(new Pen(Color.Black, 1), p2, new Point(p2.X - tickClearance, p2.Y - tickClearance));
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
p2 = new Point(tickLeftBounds - tickFontSpac, tickTopBounds - tickFontSpac);
|
|||
|
g.DrawLine(new Pen(Color.Black, 2), p1, p2);
|
|||
|
//<2F><><EFBFBD>Ƽ<EFBFBD>ͷ
|
|||
|
g.DrawLine(new Pen(Color.Black, 1), p2, new Point(p2.X - tickClearance, p2.Y + tickClearance));
|
|||
|
g.DrawLine(new Pen(Color.Black, 1), p2, new Point(p2.X + tickClearance, p2.Y + tickClearance));
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
p2 = new Point(tickLeftBounds - tickFontSpac - tickClearance - 3 * this.fontCoordinate.Height / 2, cellPaint.Bottom + tickFontSpac + tickClearance);
|
|||
|
g.DrawString("O", new Font("Tohoma", 9, FontStyle.Bold | FontStyle.Italic), Brushes.Black, p2);
|
|||
|
|
|||
|
#endregion ------<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD>Ļ<EFBFBD><C4BB>ƾ<EFBFBD><C6BE>δ<EFBFBD>С
|
|||
|
if (cellID != -1)
|
|||
|
{
|
|||
|
int index = listCellID.IndexOf(cellID);
|
|||
|
if (index != -1)
|
|||
|
selectedRec = listRecCell[index];
|
|||
|
}
|
|||
|
|
|||
|
//ͻ<><CDBB><EFBFBD><EFBFBD>ʾѡ<CABE>еĻ<D0B5>λ
|
|||
|
DrawSelectedRectangel();
|
|||
|
|
|||
|
//<2F>ͷ<EFBFBD>
|
|||
|
g.Dispose();
|
|||
|
paintArea.Clear();
|
|||
|
}
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>λ
|
|||
|
|
|||
|
#region Mouse Down Event
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʾ<EFBFBD><CABE>λ<EFBFBD><CEBB>Ϣ
|
|||
|
/// </summary>
|
|||
|
private void panelCell_MouseClick(object sender, MouseEventArgs e)
|
|||
|
{
|
|||
|
foreach (Rectangle recCell in listRecCell)
|
|||
|
{
|
|||
|
if (recCell.Contains(e.X + Math.Abs(panelCell.AutoScrollPosition.X), e.Y + Math.Abs(panelCell.AutoScrollPosition.Y)))
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
if (recCell != drawedRec)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD>û<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
int index = listRecCell.IndexOf(recCell);
|
|||
|
selectedCellCode = listCellCode[index];
|
|||
|
cellID = listCellID[index];
|
|||
|
selectedRec = listRecCell[index];
|
|||
|
|
|||
|
//<2F><>ʾ<EFBFBD><CABE>λ<EFBFBD><CEBB>Ϣ
|
|||
|
ShowCellInformation();
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
DrawSelectedRectangel();
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ʾ<EFBFBD><CABE>λ<EFBFBD><CEBB>Ϣ
|
|||
|
/// </summary>
|
|||
|
private void ShowCellInformation()
|
|||
|
{
|
|||
|
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
DataRow[] rows = tableCellInfoList.Select("FID = '" + cellID + "'");
|
|||
|
if (rows.Length > 0)
|
|||
|
{
|
|||
|
//ѡ<><D1A1><EFBFBD>Ļ<EFBFBD>λ<EFBFBD>ĵ<EFBFBD>ǰDataRow
|
|||
|
DataRow row = rows[0];
|
|||
|
|
|||
|
//״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
selectedCellStatus = Convert.ToInt32(row["FCELLSTATUS"]);
|
|||
|
selectedRunStatus = Convert.ToInt32(row["FRUNSTATUS"]);
|
|||
|
|
|||
|
//<2F><>ʾ<EFBFBD><CABE>Ϣ
|
|||
|
this.lblCellCode.Text = row["FCELLCODE"].ToString();
|
|||
|
this.lblBoxCode.Text = row["FPALLETBARCODE"].ToString();//20110425
|
|||
|
lblCellStatus.Text = "";
|
|||
|
lblRunStatus.Text = "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ļ<EFBFBD>λ<EFBFBD><CEBB>ʽ
|
|||
|
/// </summary>
|
|||
|
private void DrawSelectedRectangel()
|
|||
|
{
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ظ<EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
if (selectedRec == Rectangle.Empty || cellID == -1)
|
|||
|
return;
|
|||
|
|
|||
|
//ȡ<><C8A1><EFBFBD>ɵ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʽ
|
|||
|
if (selectedRec != drawedRec && drawedRec != Rectangle.Empty)
|
|||
|
panelCell.Invalidate(new Rectangle(drawedRec.X - Math.Abs(panelCell.AutoScrollPosition.X) - 1, drawedRec.Y - Math.Abs(panelCell.AutoScrollPosition.Y) - 1, drawedRec.Width + 2, drawedRec.Height + 2));
|
|||
|
|
|||
|
using (Graphics g = panelCell.CreateGraphics())
|
|||
|
{
|
|||
|
Rectangle recTrans = new Rectangle(selectedRec.X - Math.Abs(panelCell.AutoScrollPosition.X), selectedRec.Y - Math.Abs(panelCell.AutoScrollPosition.Y), selectedRec.Width, selectedRec.Height);
|
|||
|
g.DrawRectangle(new Pen(Color.Red, 2), recTrans);
|
|||
|
g.FillRectangle(brushSelectedRec, recTrans);
|
|||
|
|
|||
|
//<2F><><EFBFBD>¼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ƵĻ<C6B5>λ
|
|||
|
drawedRec = selectedRec;
|
|||
|
|
|||
|
//<2F>ͷ<EFBFBD>
|
|||
|
g.Dispose();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion Mouse Down Event
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˫<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>λ
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD>˫<EFBFBD><CBAB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>λ
|
|||
|
/// </summary>
|
|||
|
private void panelCell_MouseDoubleClick(object sender, MouseEventArgs e)
|
|||
|
{
|
|||
|
if (e.Button != MouseButtons.Left)
|
|||
|
return;
|
|||
|
|
|||
|
if (parentForm == null || controlCellCode == null)//20110425
|
|||
|
return;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ
|
|||
|
cellID = -1;
|
|||
|
selectedCellCode = string.Empty;
|
|||
|
selectedRec = Rectangle.Empty;
|
|||
|
BoxBarCode = string.Empty;
|
|||
|
foreach (Rectangle recCell in listRecCell)
|
|||
|
{
|
|||
|
if (recCell.Contains(e.X + Math.Abs(panelCell.AutoScrollPosition.X), e.Y + Math.Abs(panelCell.AutoScrollPosition.Y)))
|
|||
|
{
|
|||
|
//<2F><><EFBFBD>û<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
int index = listRecCell.IndexOf(recCell);
|
|||
|
selectedCellCode = listCellCode[index];
|
|||
|
cellID = listCellID[index];
|
|||
|
selectedRec = listRecCell[index];
|
|||
|
DataRow[] rows = tableCellInfoList.Select("FID = '" + cellID + "'");
|
|||
|
if (rows.Length > 0)
|
|||
|
{
|
|||
|
DataRow row = rows[0];
|
|||
|
BoxBarCode = row["FPALLETBARCODE"].ToString();//20110425
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (cellID == -1)
|
|||
|
return;
|
|||
|
|
|||
|
//<2F><><EFBFBD>ݻ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ֵ
|
|||
|
SetCellCode();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Ϊ<>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD>ݻ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
private void SetCellCode()
|
|||
|
{
|
|||
|
if (controlCellCode.GetType() == typeof(TextBox))
|
|||
|
{
|
|||
|
TextBox textBox = controlCellCode as TextBox;
|
|||
|
textBox.Text = selectedCellCode;
|
|||
|
}
|
|||
|
else if (controlCellCode.GetType() == typeof(ComboBox))
|
|||
|
{
|
|||
|
ComboBox comboBox = controlCellCode as ComboBox;
|
|||
|
comboBox.Text = selectedCellCode;
|
|||
|
}
|
|||
|
if (controlBarCode != null)
|
|||
|
{
|
|||
|
if (controlBarCode.GetType() == typeof(TextBox))
|
|||
|
{
|
|||
|
TextBox textBox = controlBarCode as TextBox;
|
|||
|
//if (BoxBarCode != "-")
|
|||
|
//{
|
|||
|
textBox.Text = BoxBarCode;
|
|||
|
//}
|
|||
|
}
|
|||
|
else if (controlBarCode.GetType() == typeof(ComboBox))
|
|||
|
{
|
|||
|
ComboBox comboBox = controlBarCode as ComboBox;
|
|||
|
//if (BoxBarCode!="-")
|
|||
|
//{
|
|||
|
comboBox.Text = BoxBarCode;
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD>ؿؼ<D8BF>
|
|||
|
if (controlShow != null)
|
|||
|
{
|
|||
|
if (controlShow.GetType() == typeof(SplitContainer))
|
|||
|
{
|
|||
|
SplitContainer splitContainer = controlShow as SplitContainer;
|
|||
|
splitContainer.Panel1Collapsed = true;
|
|||
|
}
|
|||
|
}
|
|||
|
//this.Hide();
|
|||
|
//this.Parent.Visible = false;
|
|||
|
}
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˫<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>λ
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnFind_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (txtCellCode.Text == string.Empty)
|
|||
|
return;
|
|||
|
|
|||
|
int index = listCellCode.IndexOf(txtCellCode.Text);
|
|||
|
if (index == -1)
|
|||
|
return;
|
|||
|
|
|||
|
//<2F><>¼<EFBFBD><C2BC>λ<EFBFBD><CEBB>Ϣ
|
|||
|
selectedCellCode = txtCellCode.Text.TrimEnd();
|
|||
|
cellID = listCellID[index];
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>λ
|
|||
|
FindCell();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>λ
|
|||
|
/// </summary>
|
|||
|
private void FindCell()
|
|||
|
{
|
|||
|
if (cellID == -1)
|
|||
|
return;
|
|||
|
|
|||
|
int index = listCellID.IndexOf(cellID);
|
|||
|
if (index == -1)
|
|||
|
return;
|
|||
|
|
|||
|
Rectangle recFind = listRecCell[index];
|
|||
|
if (recFind != drawedRec)
|
|||
|
{
|
|||
|
selectedRec = recFind;
|
|||
|
|
|||
|
//<2F><>ʾ<EFBFBD><CABE>λ<EFBFBD><CEBB>Ϣ
|
|||
|
ShowCellInformation();
|
|||
|
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʽ
|
|||
|
DrawSelectedRectangel();
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
int difX = (selectedRec.X - Math.Abs(panelCell.AutoScrollPosition.X)) - panelCell.AutoScrollPosition.X - panelCell.Width / 2;
|
|||
|
int difY = (selectedRec.Y - Math.Abs(panelCell.AutoScrollPosition.Y)) - panelCell.AutoScrollPosition.Y - panelCell.Height / 2;
|
|||
|
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
panelCell.AutoScrollPosition = new Point(difX, difY);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>Ӧ<EFBFBD>س<EFBFBD><D8B3><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void txtCellCode_KeyDown(object sender, KeyEventArgs e)
|
|||
|
{
|
|||
|
if (e.KeyCode == Keys.Enter)
|
|||
|
{
|
|||
|
btnFind_Click(null, EventArgs.Empty);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// ˢ<>°<EFBFBD>ť
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnUpdate_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (cmbLine.Text == string.Empty)
|
|||
|
return;
|
|||
|
|
|||
|
this.SelectedZ = int.Parse(cmbLine.Text);
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>λ
|
|||
|
int index = listCellID.IndexOf(cellID);
|
|||
|
if (index == -1)
|
|||
|
return;
|
|||
|
|
|||
|
//<2F><>¼<EFBFBD><C2BC>λ<EFBFBD><CEBB>Ϣ
|
|||
|
selectedCellCode = listCellCode[index];
|
|||
|
FindCell();
|
|||
|
}
|
|||
|
|
|||
|
#endregion <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#region ȡ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20>رջ<D8B1><D5BB><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ؼ<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnHide_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.Hide();
|
|||
|
this.Parent.Visible = false;
|
|||
|
}
|
|||
|
|
|||
|
#endregion ȡ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>
|
|||
|
}
|
|||
|
}
|