public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.TSDelivery) { List <vwSALE_R101_Delivery_Dtl> deliveryList = new List <vwSALE_R101_Delivery_Dtl>(); var model = this.vwSALER101DeliveryDtlBindingSource.DataSource as List <vwSALE_R101_Delivery_Dtl>; var mlotNoData = model.Select(a => a.MLotNo).Distinct(); foreach (var mlotNo in mlotNoData) { var boxQty = model.Where(a => a.MLotNo == mlotNo).Sum(a => a.BoxQty); var delivery = model.Where(a => a.MLotNo == mlotNo).First(); delivery.BoxQty = boxQty; delivery.SumAmount = boxQty * delivery.PerQty; deliveryList.Add(delivery); } StockTxDataReport reportFrm = new StockTxDataReport(deliveryList); ReportShowForm reportShowFrm = new ReportShowForm(reportFrm); reportShowFrm.ShowDialog(); //PrintingSystem printingSystem1 = reportFrm.PrintingSystem as PrintingSystem; //PrintableComponentLink printableComponentLink1 = new PrintableComponentLink(); ////printingSystem1.Links.Add(printableComponentLink1); //printableComponentLink1.Landscape = true; //printableComponentLink1.ClearDocument(); //printableComponentLink1.ShowPreview(); } else if (e.Item.Caption == BtnCommandEnum.Print) { PrintHelper.Print(ykGridControl1, "宁波康强电子", "送货单明细"); } else if (e.Item.Caption == BtnCommandEnum.FHDelivery) { List <vwSALE_R101_Delivery_Dtl> deliveryList = new List <vwSALE_R101_Delivery_Dtl>(); var model = this.vwSALER101DeliveryDtlBindingSource.DataSource as List <vwSALE_R101_Delivery_Dtl>; var lotNoData = model.Select(a => a.LotNo).Distinct(); foreach (var lotNo in lotNoData) { var boxQty = model.Where(a => a.LotNo == lotNo).Sum(a => a.BoxQty); var delivery = model.Where(a => a.LotNo == lotNo).First(); delivery.BoxQty = boxQty; delivery.SumAmount = boxQty * delivery.PerQty; deliveryList.Add(delivery); } DeliverReport reportFrm = new DeliverReport(deliveryList); ReportShowForm reportShowFrm = new ReportShowForm(reportFrm); reportShowFrm.ShowDialog(); } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { this.wMSM104PackingHdBindingSource.AddNew(); WMS_M104_Packing_Hd temp = this.wMSM104PackingHdBindingSource.Current as WMS_M104_Packing_Hd; temp.Code = "NINGBO KANGQIANG ELECTRONICS CO.,LTD"; OpenForm("装箱单新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { OpenForm("装箱单修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { WMS_M104_Packing_Hd tempData = this.wMSM104PackingHdBindingSource.Current as WMS_M104_Packing_Hd; packingService.Delete(tempData.Id); this.wMSM104PackingHdBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.Print) { WMS_M104_Packing_Hd temp = this.wMSM104PackingHdBindingSource.Current as WMS_M104_Packing_Hd; if (temp == null) { throw new AppException("请先选择数据"); } PackingListReport reportFrm = new PackingListReport(temp.Id); ReportShowForm reportShowFrm = new ReportShowForm(reportFrm); reportShowFrm.Text = "装箱单-" + temp.CustCode; reportShowFrm.ShowDialog(); } }