예제 #1
0
 public HouseCell(CellPos coord,Point ltCorner, Size size, Color bkgColor,Color borderColor)
 {
     CellCoord = coord;
     ltCornerPos = ltCorner;
     CellSize = size;
     ForeColor = bkgColor;
     BorderColor = borderColor;
     _CellRect = new Rectangle(ltCorner,size);
     CellStatus = CellStoreStatus.CELL_EMPTY;
 }
 public CellEventArgs(CellPos cellCoord)
 {
     CurCellCoord = cellCoord;
 }
 /// <summary>
 /// 触发仓位信息弹出显示事件
 /// </summary>
 /// <param name="pos"></param>
 private void OnCellPopupDisp(CellPos pos)
 {
     if(eventSwitchMode != null)
     {
         CellEventArgs eArgs = new CellEventArgs(pos);
         eventCellPopupDisp.Invoke(this, eArgs);
     }
 }
 /// <summary>
 /// 触发入库请求查询事件
 /// </summary>
 /// <param name="pos"></param>
 private void OnHouseoutRequire(CellPos pos)
 {
     if(eventHouseoutRequire != null)
     {
         CellEventArgs eArgs = new CellEventArgs(pos);
         eventHouseoutRequire.Invoke(this, eArgs);
     }
 }
 /// <summary>
 /// 添加手动出库指令
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonHouseoutAdd_Click(object sender, EventArgs e)
 {
     int L = int.Parse(this.comboBoxLayerlist.Text);
     if (L < 1)
     {
         L = 1;
         this.comboBoxLayerlist.Text = L.ToString();
     }
     if (L > this.wareHouseControl1.LayerCount)
     {
         L = this.wareHouseControl1.LayerCount;
         this.comboBoxLayerlist.Text = L.ToString();
     }
     int R = int.Parse(this.comboBoxRowlist.Text);
     if (R < 1)
     {
         R = 1;
         this.comboBoxRowlist.Text = R.ToString();
     }
     if (R > this.wareHouseControl1.ChannelCount * 2)
     {
         R = this.wareHouseControl1.ChannelCount * 2;
         this.comboBoxRowlist.Text = R.ToString();
     }
     int C = int.Parse(this.comboBoxColumnList.Text);// (int)this.comboBoxColumnList.SelectedItem;
     if (C < 1)
     {
         C = 1;
         this.comboBoxColumnList.Text = C.ToString();
     }
     if (C > this.wareHouseControl1.ColumnCount)
     {
         C = this.wareHouseControl1.ColumnCount;
         this.comboBoxColumnList.Text = C.ToString();
     }
     CellPos pos = new CellPos(L, R, C);
     OnHouseoutRequire(pos);
 }
        /// <summary>
        /// 手动出库列表应用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonHouseoutListApply_Click(object sender, EventArgs e)
        {
            List<CellPos> cellList = new List<CellPos>();
            foreach (DataRow row in _dataTableHouseout.Rows)
            {

                CellPos pos = new CellPos((int)row["层号"], (int)row["行号"], (int)row["列号"]);
                cellList.Add(pos);
            }
            OnHouseoutListApply(cellList);
        }
 /// <summary>
 /// 仓位信息弹出式显示
 /// </summary>
 /// <param name="cellInfo"></param>
 public void PopupDispCellinfo(CellPos pos,CellDispInfo cellInfo)
 {
     this.wareHouseControl1.ShowCellinfoTip(pos, cellInfo.titleText, cellInfo.contentText);
 }
 /// <summary>
 /// 查看指定单元格
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonCellView_Click(object sender, EventArgs e)
 {
     int L = int.Parse(this.comboBoxLayerlist.Text);
     if (L < 1)
     {
         L = 1;
         this.comboBoxLayerlist.Text = L.ToString();
     }
     if (L > this.wareHouseControl1.LayerCount)
     {
         L = this.wareHouseControl1.LayerCount;
         this.comboBoxLayerlist.Text = L.ToString();
     }
     int R = int.Parse(this.comboBoxRowlist.Text);
     if (R < 1)
     {
         R = 1;
         this.comboBoxRowlist.Text = R.ToString();
     }
     if (R > this.wareHouseControl1.ChannelCount * 2)
     {
         R = this.wareHouseControl1.ChannelCount * 2;
         this.comboBoxRowlist.Text = R.ToString();
     }
     int C = int.Parse(this.comboBoxColumnList.Text);// (int)this.comboBoxColumnList.SelectedItem;
     if (C < 1)
     {
         C = 1;
         this.comboBoxColumnList.Text = C.ToString();
     }
     if (C > this.wareHouseControl1.ColumnCount)
     {
         C = this.wareHouseControl1.ColumnCount;
         this.comboBoxColumnList.Text = C.ToString();
     }
     // wareHouseControl1_DisplayCell(new CellPos(L, R, C));
     CellPos pos = new CellPos(L, R, C);
     this.wareHouseControl1.CaptureCell(pos);
     OnCellPopupDisp(pos);
 }
 /// <summary>
 /// 释放单元格
 /// </summary>
 /// <param name="cellCoord"></param>
 private void ReleaseCell(CellPos cellCoord)
 {
     HouseCell cell = _LayersList[cellCoord.L - 1].RowsList[cellCoord.R - 1].CellsList[cellCoord.C - 1];
     if (cell != null)
     {
         SetCellCaptureStatus(cell, CellMouseStatus.MOUSE_LEAVE);
     }
 }
 /// <summary>
 /// 弹出显示仓位信息
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="title"></param>
 /// <param name="text"></param>
 public void ShowCellinfoTip(CellPos pos, string title, string text)
 {
     HouseCell cell = _LayersList[pos.L - 1].RowsList[pos.R - 1].CellsList[pos.C - 1];
     int x = (int)(cell.ltCornerPos.X *zoomScale / 100.0f) + this.panelWareCells.AutoScrollPosition.X;
     int y = (int)((cell.ltCornerPos.Y + cell.CellSize.Height * 2) * zoomScale / 100.0f )+ this.panelWareCells.AutoScrollPosition.Y;
     this.toolTip1.ToolTipTitle = title;
     this.toolTip1.Show(text, this.panelWareCells, x, y);
 }
        /// <summary>
        /// 得到仓位中心相对于控件原点的位置
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        public Point GetCellPosition(CellPos pos)
        {
            Point cellPosition = new Point();
            cellPosition.X = _CanvasLeftWidth + _CellColumnWidth * pos.C - CellColumnWidth / 2 + AutoScrollPosition.X;
            cellPosition.Y = _CanvasTopHeight + _CellRowHeight * pos.R - CellRowHeight / 2 + AutoScrollPosition.Y;

            return cellPosition;
        }
 /// <summary>
 /// 捕获货架单元格
 /// </summary>
 /// <param name="cellCoord"></param>
 public void CaptureCell(CellPos cellCoord)
 {
     if (_LastCaptureCell != null)
     {
         SetCellCaptureStatus(_LastCaptureCell, CellMouseStatus.MOUSE_LEAVE);
         _LastCaptureCell = null;
     }
     HouseCell cell = _LayersList[cellCoord.L - 1].RowsList[cellCoord.R - 1].CellsList[cellCoord.C - 1];
     if (cell != null)
     {
         SetCellCaptureStatus(cell, CellMouseStatus.MOUSE_ENTER);
         _LastCaptureCell = cell;
     }
 }
 //public readonly MouseEventArgs mouseArgs;
 public CellMouseEventArgs(CellPos cellCoord)
 {
     CurCellCoord = cellCoord;
        // mouseArgs = mouse;
 }