void Return()
        {
            GridRow gridRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow;

            if (gridRow == null)
            {
                return;
            }

            View_CarDumperInfo entity = gridRow.DataItem as View_CarDumperInfo;

            if (SendSamplingPlan(entity))
            {
                //this.Output = (entity);
                this.DialogResult = DialogResult.OK;
                commonDAO.SaveOperationLog("发送采样计划,样品码:" + entity.SampleCode, GlobalVars.LoginUser.Name);
                MessageBoxEx.Show("命令发送成功,等待执行");
            }
            else
            {
                //this.Output = (entity);
                this.DialogResult = DialogResult.No;
                MessageBoxEx.Show("命令发送失败,请重新发送");
            }


            this.Close();
        }
 private void FrmSupplier_Select_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Output       = null;
         this.DialogResult = DialogResult.Cancel;
         this.Close();
     }
 }
        /// <summary>
        /// 发送采样计划
        /// </summary>
        /// <returns></returns>
        bool SendSamplingPlan(View_CarDumperInfo plan)
        {
            InfBeltSamplePlan_KY oldBeltSamplePlan = Dbers.GetInstance().SelfDber.Entity <InfBeltSamplePlan_KY>("where SampleCode=:SampleCode and MachineCode=:MachineCode", new { SampleCode = plan.SampleCode, MachineCode = this.sqlWhere == "#4" ? "#1" : "#2" });;

            if (oldBeltSamplePlan == null)
            {
                oldBeltSamplePlan             = new InfBeltSamplePlan_KY();
                oldBeltSamplePlan.DataFlag    = 0;
                oldBeltSamplePlan.SampleCode  = plan.SampleCode;
                oldBeltSamplePlan.MachineCode = this.sqlWhere == "#4" ? "#1" : "#2";
                oldBeltSamplePlan.CarCount    = plan.CarNum;

                if (Dbers.GetInstance().SelfDber.Insert <InfBeltSamplePlan_KY>(oldBeltSamplePlan) > 0)
                {
                    commonDAO.SetSignalDataValue(oldBeltSamplePlan.MachineCode == "#1" ? GlobalVars.MachineCode_TrunOver_1 : GlobalVars.MachineCode_TrunOver_2, eSignalDataName.采样编码.ToString(), oldBeltSamplePlan.SampleCode);
                    commonDAO.SetSignalDataValue(oldBeltSamplePlan.MachineCode == "#1" ? GlobalVars.MachineCode_TrunOver_1 : GlobalVars.MachineCode_TrunOver_2, eSignalDataName.翻车机车数.ToString(), oldBeltSamplePlan.CarCount.ToString());
                    return(true);
                }
                return(false);
            }
            else
            {
                oldBeltSamplePlan.DataFlag    = 0;
                oldBeltSamplePlan.MachineCode = this.sqlWhere == "#4" ? "#1" : "#2";
                oldBeltSamplePlan.CarCount    = plan.CarNum;

                oldBeltSamplePlan.SyncFlag = 0;

                if (Dbers.GetInstance().SelfDber.Update <InfBeltSamplePlan_KY>(oldBeltSamplePlan) > 0)
                {
                    commonDAO.SetSignalDataValue(oldBeltSamplePlan.MachineCode == "#1" ? GlobalVars.MachineCode_TrunOver_1 : GlobalVars.MachineCode_TrunOver_2, eSignalDataName.采样编码.ToString(), oldBeltSamplePlan.SampleCode);
                    commonDAO.SetSignalDataValue(oldBeltSamplePlan.MachineCode == "#1" ? GlobalVars.MachineCode_TrunOver_1 : GlobalVars.MachineCode_TrunOver_2, eSignalDataName.翻车机车数.ToString(), oldBeltSamplePlan.CarCount.ToString());
                    return(true);
                }
                return(false);
            }
        }