コード例 #1
0
ファイル: process_fy_piao.cs プロジェクト: qq5013/mERP-HD
        /// <summary>
        /// 与“自动生成全部费用”功能一样
        /// 当2个不同window,用DetailWindow配置时,用这个函数
        /// </summary>
        /// <param name="masterForm"></param>
        public static void 自动生成全部费用DetailWindow(ArchiveOperationForm masterForm)
        {
            if (!MessageForm.ShowYesNo("是否要自动生成全部费用?", "确认"))
            {
                return;
            }
            ProgressForm progressForm = new ProgressForm();
            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
                {
                    费用实体 entity = (masterForm.ParentForm as ArchiveOperationForm).DisplayManager.CurrentItem as 费用实体;
                    if (entity == null)
                    {
                        throw new ArgumentException("请选择要生成费用的票!");
                    }

                    生成票费用(entity);
                    return null;
                }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
                {
                    Feng.Grid.BoundGridExtention.ReloadData((masterForm.ParentForm as ArchiveOperationForm).MasterGrid as IBoundGrid);
                    progressForm.Stop();
                }));
        }
コード例 #2
0
        private void StartLoadData()
        {
            if (this.EnableProgressForm)
            {
                if (m_progressForm == null)
                {
                    m_progressForm = new ProgressForm();
                    m_progressForm.ProgressStopped += new EventHandler(progressForm_ProgressStopped);
                }

                m_progressForm.Start(this.ContainerForm, "����");
            }

            //this.btnSearch.Text = "ֹͣ";
            this.Enabled = false;
            m_isLoading = true;
        }
コード例 #3
0
ファイル: process_fy_piao.cs プロジェクト: qq5013/mERP-HD
        public static void 自动生成全部票费用(ArchiveOperationForm masterForm)
        {
            if (!MessageForm.ShowYesNo("是否要自动生成全部票费用?", "确认"))
            {
                return;
            }

            ProgressForm progressForm = new ProgressForm();
            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
                {
                    foreach (object obj in masterForm.DisplayManager.Items)
                    {
                        费用实体 entity = obj as 费用实体;
                        if (entity == null)
                        {
                            throw new ArgumentException("费用实体 is null!");
                        }

                        生成票费用(entity);
                    }
                    return null;
                }),
                    new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
                    {
                        Feng.Grid.BoundGridExtention.ReloadData(masterForm.MasterGrid as IBoundGrid);
                        progressForm.Stop();
                    }));
        }
コード例 #4
0
        private void btn网上导入_Click(object sender, EventArgs e)
        {
            string tdh = (string)(pnl提单号.Controls[0] as IWindowDataControl).SelectedDataValue;
            string hc = (string)(pnl船名.Controls[0] as IWindowDataControl).SelectedDataValue;

            if (string.IsNullOrEmpty(tdh))
            {
                MessageForm.ShowWarning("请填写提单号!");
                return;
            }

            if (!string.IsNullOrEmpty(hc) && hc.Contains('/'))
            {
                hc = hc.Substring(hc.LastIndexOf('/') + 1).Trim();
            }

            IList<Hd.NetRead.集装箱数据> boxList = null;
            int piao_successCount = 0;//成功导入的票数量
            int rw_successCount = 0;//成功导入的任务数量

            ProgressForm progressForm = new ProgressForm();
            progressForm.Start(this, "网上导入");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
                {
                    nbeportRead m_nbeportGrab = new nbeportRead();
                    m_nbeportGrab.SetLoginInfo(Feng.DBDef.Instance.TryGetValue("NetReadUserName"),
                        Feng.DBDef.Instance.TryGetValue("NetReadPassword"));

                    if (string.IsNullOrEmpty(hc))
                    {
                        boxList = m_nbeportGrab.查询集装箱数据(ImportExportType.进口集装箱, tdh);
                    }
                    else
                    {
                        boxList = m_nbeportGrab.查询集装箱数据(ImportExportType.进口集装箱, tdh, hc);
                    }

                    if (boxList != null && boxList.Count > 0)
                    {
                        AskToReplace(m_cm, "任务性质", 任务性质.进口拆箱);
                        AskToReplace(m_cm, "提单号", boxList[0].提单号);
                        AskToReplace(m_cm, "船名航次", boxList[0].船名 + "/" + boxList[0].航次);
                        piao_successCount++;

                        foreach (集装箱数据 jzx in boxList)
                        {
                            bool have = false;
                            foreach (Xceed.Grid.DataRow row in m_显示区Grid.DataRows)
                            {
                                if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == jzx.集装箱号.Trim())
                                {
                                    have = true;
                                    break;
                                }
                            }
                            if (!have)
                            {
                                任务 rw = new 任务();
                                rw.任务来源 = 任务来源.网上;
                                rw.任务性质 = 任务性质.进口拆箱;
                                rw.提箱点编号 = NameValueMappingCollection.Instance.FindIdFromName("人员单位_全部", jzx.堆场区).ToString();
                                rw.箱号 = jzx.集装箱号;
                                rw.船名 = jzx.船名;
                                rw.航次 =  jzx.航次;
                                m_cm2.AddNew();
                                m_cm2.DisplayManager.Items[m_cm2.DisplayManager.Position] = rw;
                                m_cm2.EndEdit();
                                rw_successCount++;
                            }
                        }
                    }
                    return null;
                }),
               new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
               {
                   MessageForm.ShowInfo("成功导入 " + piao_successCount + " 票," + rw_successCount + " 条任务。");
                   progressForm.Stop();
               }));
        }
コード例 #5
0
        private void searchManager_DataLoading(object sender, DataLoadingEventArgs e)
        {
            if (e.Cancel)
                return;

            ISearchManager sm = sender as ISearchManager;
            if (progressForm == null)
            {
                progressForm = new ProgressForm();
                progressForm.ProgressStopped += new EventHandler(progressForm_ProgressStopped);
            }
            System.Threading.Interlocked.Increment(ref m_progressDoings);
            if (!progressForm.IsActive)
            {
                progressForm.Start(this, "查找");
            }
        }
コード例 #6
0
        public void DisableSearchProgressForm(ISearchManager sm)
        {
            if (sm == null)
            {
                foreach (var i in m_progressSms)
                {
                    sm = i as ISearchManager;
                    if (sm != null)
                    {
                        sm.DataLoaded -= new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
                        sm.DataLoading -= new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);
                    }
                }
                m_progressSms.Clear();

                if (progressForm != null)
                {
                    progressForm.ProgressStopped -= new EventHandler(progressForm_ProgressStopped);
                    progressForm.Stop();
                    progressForm.Dispose();
                    progressForm = null;
                }
            }
            else
            {
                sm.DataLoaded -= new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
                sm.DataLoading -= new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);
                m_progressSms.Remove(sm);
            }
        }
コード例 #7
0
ファイル: process_fy_piao.cs プロジェクト: daniushou/mERP-CD
        public static void 自动生成全部费用(ArchiveOperationForm masterForm)
        {
            if (!ServiceProvider.GetService<IMessageBox>().ShowYesNo("是否要自动全部生成费用?", "确认"))
            {
                return;
            }
            ProgressForm progressForm = new ProgressForm();
            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
                {
                    费用实体 entity = masterForm.DisplayManager.CurrentItem as 费用实体;
                    if (entity == null)
                    {
                        throw new ArgumentException("请选择要生成费用的产值!");
                    }
                    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<车辆产值>())
                    {
                        车辆产值 piao = rep.Get<车辆产值>(entity.ID);
                        rep.Initialize(piao.任务, piao);
                        process_fy_yw.批量生成费用(rep, piao, piao.任务, null, null);
                    }

                    return null;
                }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
                {
                    masterForm.ControlManager.OnCurrentItemChanged();
                    progressForm.Stop();
                }));
        }