コード例 #1
0
        private void pnlChart_MouseClick(object sender, MouseEventArgs e)
        {
            int i     = e.Y < top[1] ? 0 : 1;
            int shelf = currentPage * 2 + i - 1;

            int column = Columns[currentPage - 1] - (e.X - left) / cellWidth;

            int row = Rows[currentPage - 1] - (e.Y - top[i]) / cellHeight + 1;

            if (column <= Columns[currentPage - 1] && row <= Rows[currentPage - 1])
            {
                DataRow[] cellRows = cellTable.Select(string.Format("ShelfCode='{0}' AND CellColumn='{1}' AND CellRow='{2}'", ShelfCode[shelf], column, row));
                if (cellRows.Length != 0)
                {
                    CellCode = cellRows[0]["CellCode"].ToString();
                }
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    if (cellRows.Length != 0)
                    {
                        frmCellInfo f = new frmCellInfo(CellCode, cellRows[0]["PalletCode"].ToString());
                        f.ShowDialog();
                    }
                }
                else if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (cellRows[0]["PalletCode"].ToString() != "")
                    {
                        ToolStripMenuItemOutStock.Visible = true;
                    }
                    else
                    {
                        ToolStripMenuItemOutStock.Visible = false;
                    }
                    contextMenuStrip1.Show(MousePosition.X, MousePosition.Y);
                }
            }
        }
コード例 #2
0
ファイル: frmCellQuery.cs プロジェクト: qq5013/ROBO
        private void pnlChart_MouseClick(object sender, MouseEventArgs e)
        {
            int i     = e.Y < top[1] ? 0 : 1;
            int shelf = currentPage * 2 + i - 1;

            int column = (e.X - left) / cellWidth + 1;

            int row = Rows[currentPage - 1] - (e.Y - top[i]) / cellHeight + 1;

            if (column <= Columns[currentPage - 1] && row <= Rows[currentPage - 1])
            {
                DataRow[] cellRows = cellTable.Select(string.Format("ShelfCode='{0}' AND CellColumn='{1}' AND CellRow='{2}'", ShelfCode[shelf], column, row));
                if (cellRows.Length != 0)
                {
                    CellCode = cellRows[0]["CellCode"].ToString();
                }
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    if (cellRows.Length != 0)
                    {
                        frmCellInfo f = new frmCellInfo(cellRows[0]["PalletBarCode"].ToString());
                        f.ShowDialog();
                        //Dictionary<string, Dictionary<string, object>> properties = new Dictionary<string, Dictionary<string, object>>();
                        //Dictionary<string, object> property = new Dictionary<string, object>();
                        //property.Add("产品编号", cellRows[0]["PalletBarCode"]);
                        ////property.Add("产品名称", cellRows[0]["ProductName"]);
                        ////property.Add("入库类型", cellRows[0]["BillTypeName"]);
                        ////property.Add("产品状态", cellRows[0]["StateName"]);
                        ////property.Add("条码", cellRows[0]["PalletBarcode"]);
                        ////property.Add("产品类型", cellRows[0]["ProductTypeName"]);
                        ////property.Add("托盘", cellRows[0]["PalletCode"]);

                        ////property.Add("单据号", cellRows[0]["BillNo"]);
                        //property.Add("入库时间", cellRows[0]["InDate"]);
                        //properties.Add("产品信息", property);

                        //property = new Dictionary<string, object>();
                        //property.Add("库区名称", cellRows[0]["AreaName"]);
                        //property.Add("货架名称", cellRows[0]["ShelfName"]);
                        //property.Add("列", column);
                        //property.Add("层", row);
                        //string strState = "正常";
                        //if (cellRows[0]["IsLock"].ToString() == "0")
                        //    strState = "正常";
                        //else
                        //    strState = "锁定";
                        //if (cellRows[0]["ErrorFlag"].ToString() == "1")
                        //    strState = "异常";

                        //if (cellRows[0]["IsActive"].ToString() == "0")
                        //    strState = "禁用";

                        //property.Add("状态", strState);
                        //properties.Add("货位信息", property);
                        //if (cellRows[0]["PalletBarCode"].ToString().Length > 0)
                        //{
                        //    frmCellDialog cellDialog = new frmCellDialog(properties);
                        //    cellDialog.ShowDialog();
                        //}
                    }
                }
                else if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    contextMenuStrip1.Show(MousePosition.X, MousePosition.Y);
                }
            }
        }