private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsGoodsTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmGoodsTransport_Oper frmShow = new FrmGoodsTransport_Oper(entity.Id, eEditMode.查看);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmGoodsTransport_Oper frmEdit = new FrmGoodsTransport_Oper(entity.Id, eEditMode.修改);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsGoodsTransport>(entity.Id);

                        //删除临时运输记录
                        Dbers.GetInstance().SelfDber.DeleteBySQL <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = entity.Id });
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsBuyFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            if (entity == null || entity.SerialNumber == "合计")
            {
                return;
            }
            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmPrint":
                if (entity.SuttleWeight <= 0)
                {
                    MessageBoxEx.Show("净重异常,禁止打印", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                if (entity.ProfitWeight > 0 && entity.ProfitWeight >= Convert.ToDecimal(CommonDAO.GetInstance().GetAppletConfigDouble("盈异常吨数")))
                {
                    MessageBoxEx.Show("盈吨异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                if (entity.ProfitWeight < 0 && entity.ProfitWeight >= Convert.ToDecimal(CommonDAO.GetInstance().GetAppletConfigDouble("亏异常吨数")))
                {
                    MessageBoxEx.Show("亏吨异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                FrmPrint_Oper frmPrint = new FrmPrint_Oper(entity.Id, false);
                if (frmPrint.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmShow":
                FrmBuyFuelTransport_Oper frmShow = new FrmBuyFuelTransport_Oper(entity.Id, false);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmBuyFuelTransport_Oper frmEdit = new FrmBuyFuelTransport_Oper(entity.Id, true);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Warn, "删除入厂煤运输记录", string.Format("车号:{0};毛重:{1};皮重:{2};矿点:{3};操作人:{4}", entity.CarNumber, entity.GrossWeight, entity.TareWeight, entity.MineName, SelfVars.LoginUser.UserName));
                        CommonDAO.GetInstance().RemoveDeduct(entity.Id);
                        Dbers.GetInstance().SelfDber.Delete <CmcsBuyFuelTransport>(entity.Id);
                        CommonDAO.GetInstance().RemoveUnFinishTransport(entity.Id);
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsBuyFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmBuyFuelTransport_Oper frmShow = new FrmBuyFuelTransport_Oper(entity.Id, eEditMode.查看);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmBuyFuelTransport_Oper frmEdit = new FrmBuyFuelTransport_Oper(entity.Id, eEditMode.修改);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        string logValue = "删除运输记录:" + Environment.NewLine;
                        logValue += "车号:" + entity.CarNumber + Environment.NewLine;
                        logValue += "矿点:" + entity.MineName + "   煤种:" + entity.FuelKindName + Environment.NewLine;
                        logValue += "入厂时间:" + entity.InFactoryTime + "   矿发量:" + entity.TicketWeight + Environment.NewLine;
                        logValue += "毛重时间:" + entity.GrossTime + "   毛重:" + entity.GrossWeight + Environment.NewLine;
                        logValue += "皮重时间:" + entity.TareTime + "   皮重:" + entity.TareWeight + Environment.NewLine;
                        logValue += "扣矸:" + entity.KgWeight + "   扣水:" + entity.KsWeight + "   自动扣水:" + entity.AutoKsWeight + Environment.NewLine;
                        logValue += "出厂时间:" + entity.OutFactoryTime + "   验收量:" + entity.CheckWeight + Environment.NewLine;
                        logValue += "修改人:" + SelfVars.LoginUser.UserName;
                        CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Info, "删除运输记录", logValue, SelfVars.LoginUser.UserAccount);
                        CommonDAO.GetInstance().SaveHandleEvent("删除入厂煤运输记录", entity.Id);
                        Dbers.GetInstance().SelfDber.Delete <CmcsBuyFuelTransport>(entity.Id);
                        Dbers.GetInstance().SelfDber.DeleteBySQL <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = entity.Id });
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsBuyFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmBuyFuelTransport_Oper frmShow = new FrmBuyFuelTransport_Oper(entity.Id, false);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmBuyFuelTransport_Oper frmEdit = new FrmBuyFuelTransport_Oper(entity.Id, true);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                if (entity.GrossWeight > 0 || entity.TareWeight > 0)
                {
                    MessageBoxEx.Show("该记录已有重量,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Warn, "删除入场煤运输记录:", string.Format("车号:{0};毛重:{1};皮重:{2};矿点:{3};操作人:{4}", entity.CarNumber, entity.GrossWeight, entity.TareWeight, entity.MineName, SelfVars.LoginUser.UserName));

                        if (QueuerDAO.GetInstance().DeleteTransport(entity.Id))
                        {
                            CommonDAO.GetInstance().InsertWaitForHandleEvent("汽车智能化_删除入厂煤运输记录", entity.Id);
                        }
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }