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(); } }
/// <summary> /// 打印任务单报表 /// </summary> /// <param name="processType">前制程&后制程</param> private void PrintProcess(string processType) { this.gridTaskDetail.CloseEditor(); var taskDetailList = mESM202TaskDetailBindingSource.DataSource as List <MES_M202_Task_Detail>; //var taskJobLot = mESM202TaskJobLotBindingSource.Current as MES_M202_Task_JobLot; if (taskDetailList == null) { return; } var taskNoList = taskDetailList.Where(a => a.CheckBox == true).Select(a => a.TaskNo).ToList(); var taskReportHeadList = viewService.GetTaskReportHeadList(taskNoList); //foreach (var taskDetail in taskDetailList.Where(a=>a.CheckBox==true)) //{ // var product = productService.GetProduct().Where(a => a.PartNo == taskDetail.PartNo).Select(a => new { a.PartSpec, a.PartType, a.ProcessFlow }).FirstOrDefault(); // if (product == null) // throw new AppException("没有对应的产品基础资料,请检查产品基础信息"); // taskDetail.PartSpec = product.PartSpec; // taskDetail.PartType = product.PartType; // taskDetail.ProcessFlow = product.ProcessFlow; // //taskDetail.JobNo = taskJobLot.JobLotNo; // List<ERP_M001_Product_ProcessFlow> processList = productService.GetProcessFlowByProdutCode(taskDetail.PartNo).Where(a => a.ProcessType == processType).OrderBy(a => a.ProcessSeqNo).ToList(); // var procNameList = codeService.GetListByCodeID("PROC"); // foreach (var process in processList) // { // process.ProcessName = procNameList.Where(a => a.Code == process.ProcessCode).Select(a => a.Description).FirstOrDefault(); // } //} if (processType == "前制程") { JobLotPreReport frmreport = new JobLotPreReport(taskReportHeadList); ReportShowForm frm = new ReportShowForm(frmreport); frm.Show(); } else { JobLotPostReport frmreport = new JobLotPostReport(taskReportHeadList); ReportShowForm frm = new ReportShowForm(frmreport); frm.Show(); } }
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(); } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { mESM202TaskDetailBindingSource.AddNew(); MES_M202_Task_Detail temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; temp.TaskDt = DateTime.Now.Date; temp.TLevel = "01"; temp.Status = "01"; EditForm("跟踪单新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { MES_M202_Task_Detail temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; if (temp == null) { throw new AppException("请先选择要修改的数据"); } EditForm("跟踪单修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { MES_M202_Task_Detail temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; if (temp == null) { throw new AppException("请先选择要删除的数据"); } taskDetailService.Delete(temp.Id); mESM202TaskDetailBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.Watch) { MES_M202_Task_Detail temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; if (temp == null) { throw new AppException("请先选择要查看的数据"); } EditForm("跟踪单查看", BtnCommandEnum.Watch); } else if (e.Item.Caption == BtnCommandEnum.Refresh) { InitData(); } else if (e.Item.Caption == "打印任务单") { var taskDetailList = mESM202TaskDetailBindingSource.DataSource as List <MES_M202_Task_Detail>; if (taskDetailList == null) { return; } //MES_M202_Task temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task; //班次 var codeData = codeService.GetCodeDataByCodeId("SHIFT"); //客户 var customerData = customerServer.GetCustomerInputData(); foreach (var taskdetail in taskDetailList) { taskdetail.ShiftName = codeData.Where(a => a.Value == taskdetail.ShiftCode).Select(a => a.DisPlayName).FirstOrDefault(); taskdetail.CustName = customerData.Where(a => a.Value == taskdetail.CustCode).Select(a => a.DisPlayName).FirstOrDefault(); } MESTaskReport frmreport = new MESTaskReport(taskDetailList); ReportShowForm frm = new ReportShowForm(frmreport); frm.Show(); } else if (e.Item.Caption == "打印前制单") { PrintProcess("前制程"); } else if (e.Item.Caption == "打印后制单") { PrintProcess("后制程"); } else if (e.Item.Caption == "审核") { MES_M202_Task_Detail temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; if (temp == null) { throw new AppException("请先选择要要审核的数据"); } else if (temp.Status == "04") { throw new AppException("已审核"); } else { taskDetailService.ShenHe(temp); mESM202TaskDetailBindingSource.ResetCurrentItem(); XtraMessageBox.Show("审核成功"); } } else if (e.Item.Caption == "反审") { MES_M202_Task_Detail temp = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; if (temp == null) { throw new AppException("请先选择要要审核的数据"); } else if (temp.Status == "04") { temp.Auditor = null; temp.AuditingDt = null; temp.Status = "01"; taskDetailService.Update(temp); mESM202TaskDetailBindingSource.ResetCurrentItem(); XtraMessageBox.Show("反审成功"); } else { XtraMessageBox.Show("未审核"); } } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { mESM202TaskBindingSource.AddNew(); EditForm("跟踪单新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { MES_M202_Task temp = mESM202TaskBindingSource.Current as MES_M202_Task; if (temp == null) { throw new AppException("请先选择要修改的数据"); } EditForm("跟踪单修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { MES_M202_Task temp = mESM202TaskBindingSource.Current as MES_M202_Task; if (temp == null) { throw new AppException("请先选择要删除的数据"); } TaskService.Delete(temp.Id); mESM202TaskBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.Watch) { MES_M202_Task temp = mESM202TaskBindingSource.Current as MES_M202_Task; if (temp == null) { throw new AppException("请先选择要查看的数据"); } EditForm("跟踪单查看", BtnCommandEnum.Watch); } else if (e.Item.Caption == BtnCommandEnum.Refresh) { InitData(); } else if (e.Item.Caption == "打印任务单") { var taskDetailList = mESM202TaskDetailBindingSource.DataSource as List <MES_M202_Task_Detail>; if (taskDetailList == null) { return; } MES_M202_Task temp = mESM202TaskBindingSource.Current as MES_M202_Task; //班次 var codeData = codeService.GetCodeDataByCodeId("SHIFT"); //客户 var customerData = customerService.GetCustomerInputData(); foreach (var taskdetail in taskDetailList) { taskdetail.TaskDt = temp.TaskDt; taskdetail.ShiftName = codeData.Where(a => a.Value == taskdetail.ShiftCode).Select(a => a.DisPlayName).FirstOrDefault(); taskdetail.CustName = customerData.Where(a => a.Value == taskdetail.CustCode).Select(a => a.DisPlayName).FirstOrDefault(); } MESTaskReport frmreport = new MESTaskReport(taskDetailList); ReportShowForm frm = new ReportShowForm(frmreport); frm.Show(); } else if (e.Item.Caption == "打印前制单") { PrintProcess("前制程"); } else if (e.Item.Caption == "打印后制单") { //var taskDetail = mESM202TaskDetailBindingSource.Current as MES_M202_Task_Detail; //if (taskDetail != null) //{ // var product = productService.GetProduct().Where(a => a.PartNo == taskDetail.PartNo).Select(a => new { a.PartSpec, a.PartType, a.ProcessFlow }).FirstOrDefault(); // if (product == null) // throw new AppException("没有对应的产品基础资料,请检查产品基础信息"); // taskDetail.PartSpec = product.PartSpec; // taskDetail.PartType = product.PartType; // taskDetail.ProcessFlow = product.ProcessFlow; // List<ERP_M001_Product_ProcessFlow> processList = productService.GetProcessFlowByProdutCode(taskDetail.PartNo).OrderBy(a => a.ProcessSeqNo).ToList(); // var procNameList = codeService.GetListByCodeID("PROC"); // foreach (var process in processList) // { // process.ProcessName = procNameList.Where(a => a.Code == process.ProcessCode).Select(a => a.Description).FirstOrDefault(); // } // JobLotPostReport frmreport = new JobLotPostReport(taskDetail, processList); // ReportShowForm frm = new ReportShowForm(frmreport); // frm.Show(); //} PrintProcess("后制程"); } }