Esempio n. 1
0
        public MES202TaskEditForm(MES_M202_Task task, IMES_M202_TaskService taskservice)
        {
            InitializeComponent();
            this.tempData    = task;
            this.TaskService = taskservice;

            tempData.TaskDt = DateTime.Now.Date;
        }
Esempio n. 2
0
        public void Create(MES_M202_Task MES_M202_Task)
        {
            MES_M202_Task.TaskDt   = DateTime.Now;
            MES_M202_Task.CreateDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            MES_M202_Task.CreateUser = tempUser.UserName;
            MES_M202_Task.Validate();
            this.MES_M202_TaskRepository.Add(MES_M202_Task);
            this.runtimeService.Commit();
        }
Esempio n. 3
0
        public void Update(MES_M202_Task MES_M202_Task)
        {
            MES_M202_Task.ModifyDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            MES_M202_Task.ModifyUser = tempUser.UserName;
            MES_M202_Task.Validate();
            var existstb_Sys_Menu = this.GetById(MES_M202_Task.Id);

            this.MES_M202_TaskRepository.SetValues(MES_M202_Task, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }
Esempio n. 4
0
        public void Save(MES_M202_Task task, List <MES_M202_Task_Detail> taskdtllist)
        {
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            var existtask = this.GetById(task.Id);

            if (existtask == null)
            {
                task.CompCode   = tempUser.CompCode;
                task.CreateDt   = DateTime.Now;
                task.CreateUser = tempUser.UserName;
                task.Validate();
                this.MES_M202_TaskRepository.Add(task);
            }
            else
            {
                task.ModifyDt   = DateTime.Now;
                task.ModifyUser = tempUser.UserName;
                task.Validate();
                this.MES_M202_TaskRepository.SetValues(task, existtask);
            }
            foreach (var taskdtl in taskdtllist)
            {
                var existtaskdtl = MES_M202_TaskDetailRepository.GetByID(taskdtl.Id);
                var planDetail   = planDetailRepository.GetByID(taskdtl.PlanDetailId.ToGuidOrNull());
                if (existtaskdtl == null)
                {
                    taskdtl.CompCode   = tempUser.CompCode;
                    taskdtl.CreateDt   = DateTime.Now;
                    taskdtl.CreateUser = tempUser.UserName;
                    taskdtl.TaskNo     = task.TaskNo;
                    taskdtl.Validate();
                    this.MES_M202_TaskDetailRepository.Add(taskdtl);
                    planDetail.FQty += taskdtl.JobQty ?? 0;
                }
                else
                {
                    taskdtl.ModifyDt   = DateTime.Now;
                    taskdtl.ModifyUser = tempUser.UserName;
                    taskdtl.Validate();
                    planDetail.FQty += taskdtl.JobQty ?? 0 - existtaskdtl.JobQty ?? 0;
                    this.MES_M202_TaskDetailRepository.SetValues(taskdtl, existtaskdtl);
                }
            }

            this.runtimeService.Commit();
        }
Esempio n. 5
0
        private void EditForm(string formText, string btnCommand)
        {
            MES_M202_Task      temp = mESM202TaskBindingSource.Current as MES_M202_Task;
            MES202TaskEditForm edit = new MES202TaskEditForm(temp, TaskService);

            edit.Text = formText;
            edit.Tag  = btnCommand;

            if (edit.ShowDialog() != DialogResult.OK)
            {
                mESM202TaskBindingSource.CancelEdit();
            }
            else
            {
                mESM202TaskBindingSource_CurrentChanged(null, null);
            }
        }
Esempio n. 6
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("后制程");
            }
        }