예제 #1
0
        /// <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();
            }
        }
예제 #2
0
        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("未审核");
                }
            }
        }
예제 #3
0
        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("后制程");
            }
        }