Exemplo n.º 1
0
 public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (e.Item.Caption == "保存界面")
     {
         Stream stream = new System.IO.MemoryStream();
         this.pivotGridControl1.SaveLayoutToStream(stream);
         stream.Seek(0, System.IO.SeekOrigin.Begin);
         ERP_C009_Layout layout = new ERP_C009_Layout();
         layout.FrmType  = this.Name;
         layout.LayFiles = FileStreamHelp.StreamToBytes(stream);
         C009_Layout frm = new C009_Layout(layout);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             XtraMessageBox.Show("保存成功");
         }
     }
     else if (e.Item.Caption == "显示表头")
     {
         this.pivotGridControl1.OptionsView.ShowColumnHeaders = !this.pivotGridControl1.OptionsView.ShowColumnHeaders;
         this.pivotGridControl1.OptionsView.ShowDataHeaders   = !this.pivotGridControl1.OptionsView.ShowDataHeaders;
         this.pivotGridControl1.OptionsView.ShowFilterHeaders = !this.pivotGridControl1.OptionsView.ShowFilterHeaders;
     }
     else if (e.Item.Caption == BtnCommandEnum.Print)
     {
         PrintHelper.Print(this.pivotGridControl1, "产量统计报表", "冲压框架事业部");
     }
 }
Exemplo n.º 2
0
 public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (e.Item.Caption == BtnCommandEnum.Add)
     {
         this.mESM501JobTxBindingSource.AddNew();
         toolStrip1.Visible = true;
         dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.False;
         gridJobTxDetail.OptionsBehavior.ReadOnly  = false;
         gridControlJobTx.Enabled = false;
     }
     else if (e.Item.Caption == BtnCommandEnum.Edit)
     {
         toolStrip1.Visible = true;
         dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.False;
         gridJobTxDetail.OptionsBehavior.ReadOnly  = false;
         gridControlJobTx.Enabled = false;
     }
     else if (e.Item.Caption == BtnCommandEnum.Save)
     {
         this.gridJobTxDetail.CloseEditor();
         this.mESM501JobTxBindingSource.EndEdit();
         var jobtx             = this.mESM501JobTxBindingSource.Current as MES_M501_JobTx;
         var jobtxDetailList   = this.mESM501JobTxDetailBindingSource.DataSource as List <MES_M501_JobTxDetail>;
         var jobtxProdInfoList = this.mESM501JobTxProdInfoBindingSource.DataSource as List <MES_M501_JobTxProdInfo>;
         jobtxService.Save(jobtx, jobtxDetailList.Where(a => a.OutDt != null).ToList(), null, jobtxProdInfoList);
         //DialogResult = DialogResult.OK;
         dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.True;
         gridJobTxDetail.OptionsBehavior.ReadOnly  = true;
         gridProdInfo.OptionsBehavior.ReadOnly     = true;
         gridControlJobTx.Enabled = true;
         toolStrip1.Visible       = false;
         XtraMessageBox.Show("保存成功");
     }
     else if (e.Item.Caption == BtnCommandEnum.Cancel)
     {
         if (ERPHelper.Instance.MessageIf("确定要取消未保存的数据吗"))
         {
             this.mESM501JobTxBindingSource.CancelEdit();
             dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.True;
             gridJobTxDetail.OptionsBehavior.ReadOnly  = true;
             gridControlJobTx.Enabled = true;
             toolStrip1.Visible       = false;
         }
     }
     else if (e.Item.Caption == BtnCommandEnum.Delete)
     {
         if (ERPHelper.Instance.MessageDel())
         {
             var jobtx = this.mESM501JobTxBindingSource.Current as MES_M501_JobTx;
             jobtxService.Delete(jobtx.Id);
             mESM501JobTxBindingSource.RemoveCurrent();
             dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.True;
             gridJobTxDetail.OptionsBehavior.ReadOnly  = true;
             gridProdInfo.OptionsBehavior.ReadOnly     = true;
             gridControlJobTx.Enabled = true;
             toolStrip1.Visible       = false;
         }
     }
     if (e.Item.Caption == "保存界面")
     {
         ERP_C009_Layout layout = new ERP_C009_Layout();
         layout.FrmType = this.Name;
         Stream stream1 = new System.IO.MemoryStream();
         this.dataLayoutControl1.SaveLayoutToStream(stream1);
         stream1.Seek(0, System.IO.SeekOrigin.Begin);
         layout.LayFiles = FileStreamHelp.StreamToBytes(stream1);
         Stream stream2 = new System.IO.MemoryStream();
         this.gridJobTxDetail.SaveLayoutToStream(stream2);
         stream2.Seek(0, System.IO.SeekOrigin.Begin);
         layout.LayFiles2 = FileStreamHelp.StreamToBytes(stream2);
         C009_Layout frm = new C009_Layout(layout);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             XtraMessageBox.Show("保存成功");
         }
     }
 }