コード例 #1
0
ファイル: 进口票.cs プロジェクト: qq5013/mERP-HD
        //IList<进口箱> IMasterGenerateDetailEntity<进口票, 进口箱>.GenerateDetails()
        //{
        //    IList<进口箱> ret = new List<进口箱>();
        //    if (this.箱量.HasValue)
        //    {
        //        for (int i = 0; i < this.箱量.Value; ++i)
        //        {
        //            ret.Add(new 进口箱());
        //        }
        //    }
        //    return ret;
        //}

        //IList<费用> IMasterGenerateDetailEntity<费用实体, 费用>.GenerateDetails()
        //{
        //    IList<费用项> feeItems = (new 费用项Bll()).Get费用项(this, 费用实体类型.进口票);
        //    IList<费用> ret = new List<费用>();
        //    foreach (费用项 i in feeItems)
        //    {
        //        常规业务费用 fee1 = null, fee2 = null;
        //        if (i.收)
        //        {
        //            fee1 = new 常规业务费用();
        //            fee1.费用实体 = this;
        //            fee1.费用项编号 = i.编号;
        //            fee1.收付标志 = 收付标志.收;
        //            fee1.相关人编号 = this.委托人编号;
        //            fee1.理论值 = (new 费用理论值Bll()).Calculate理论值(this, i.编号);
        //            ret.Add(fee1);
        //        }
        //        if (i.付)
        //        {
        //            fee2 = new 常规业务费用();
        //            fee2.费用实体 = this;
        //            fee2.费用项编号 = i.编号;
        //            fee2.收付标志 = 收付标志.付;
        //            //fee.相关人编号 = this.委托人编号;
        //            fee2.理论值 = (new 费用理论值Bll()).Calculate理论值(this, i.编号);
        //            ret.Add(fee2);
        //        }

        //        if (i.收 && i.付)
        //        {
        //            fee1.关联费用 = fee2;
        //            fee2.关联费用 = fee1;
        //        }
        //    }
        //    return ret;
        //}

        protected override IList <费用信息> Generate费用信息Details()
        {
            IList <费用信息> ret = new List <费用信息>();

            // 不再判断,无用
            //if (this.滞箱费减免标志)
            {
                费用信息 item = new 费用信息();
                item.票Id    = this.ID;
                item.费用项编号  = "167";  // 滞箱, 类别25
                item.业务类型编号 = 11;     // 进口

                ret.Add(item);
            }
            return(ret);
        }
コード例 #2
0
ファイル: process_fy_piao.cs プロジェクト: qq5013/mERP-HD
        public static bool 票费用保存(ArchiveOperationForm masterForm)
        {
            IBoundGrid grid = (masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0];

            if (grid.DataRows.Count == 0)
            {
                return(true);
            }

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <费用信息>())
            {
                try
                {
                    rep.BeginTransaction();

                    IList <费用信息> list = (rep as Feng.NH.INHibernateRepository).List <费用信息>(NHibernate.Criterion.DetachedCriteria.For <费用信息>()
                                                                                           .Add(NHibernate.Criterion.Expression.Eq("票Id", (Guid)grid.DataRows[0].Cells["费用实体"].Value)));
                    Dictionary <string, 费用信息> fyxxs = new Dictionary <string, 费用信息>();
                    foreach (费用信息 i in list)
                    {
                        fyxxs[i.费用项编号] = i;
                    }

                    // 收
                    foreach (Xceed.Grid.DataRow row in grid.DataRows)
                    {
                        bool?b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["Submitted"].Value);
                        if (!b.HasValue)
                        {
                            continue;
                        }

                        string fyx = (string)(row.Cells["费用项"].Value);
                        if (!fyxxs.ContainsKey(fyx))
                        {
                            费用信息 fyxx = new 费用信息();
                            fyxx.票Id       = (Guid)row.Cells["费用实体"].Value;
                            fyxx.费用项编号     = (string)(row.Cells["费用项"].Value);
                            fyxx.业务类型编号    = (int)(row.Cells["业务类型"].Value);
                            fyxx.Submitted = b.Value;

                            (new HdBaseDao <费用信息>()).Save(rep, fyxx);

                            fyxxs[fyxx.费用项编号] = fyxx;
                            // MessageForm.ShowInfo("此费用项下还未有费用,不需要打完全标志!");
                        }
                        else
                        {
                            费用信息 fyxx = fyxxs[fyx];
                            if (fyxx.Submitted != b.Value)
                            {
                                fyxx.Submitted = b.Value;
                                (new HdBaseDao <费用信息>()).Update(rep, fyxx);
                            }
                        }
                    }

                    // 付
                    foreach (Xceed.Grid.DataRow row in grid.DataRows)
                    {
                        bool?b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["完全标志付"].Value);
                        if (!b.HasValue)
                        {
                            continue;
                        }

                        string fyx = (string)(row.Cells["费用项"].Value);
                        if (!fyxxs.ContainsKey(fyx))
                        {
                            费用信息 fyxx = new 费用信息();
                            fyxx.票Id    = (Guid)row.Cells["费用实体"].Value;
                            fyxx.费用项编号  = (string)(row.Cells["费用项"].Value);
                            fyxx.业务类型编号 = (int)(row.Cells["业务类型"].Value);
                            fyxx.完全标志付  = b.Value;

                            (new HdBaseDao <费用信息>()).Save(rep, fyxx);

                            fyxxs[fyxx.费用项编号] = fyxx;
                            // MessageForm.ShowInfo("此费用项下还未有费用,不需要打完全标志!");
                        }
                        else
                        {
                            费用信息 fyxx = fyxxs[fyx];
                            if (fyxx.完全标志付 != b.Value)
                            {
                                fyxx.完全标志付 = b.Value;
                                (new HdBaseDao <费用信息>()).Update(rep, fyxx);
                            }
                        }
                    }

                    rep.CommitTransaction();


                    masterForm.ControlManager.OnCurrentItemChanged();

                    grid.ReloadData();

                    masterForm.ControlManager.State = Feng.StateType.View;
                    if (masterForm.ControlManager.ControlCheckExceptionProcess != null)
                    {
                        masterForm.ControlManager.ControlCheckExceptionProcess.ClearAllError();
                    }
                    masterForm.ControlManager.EndEdit(false);

                    return(true);
                }
                catch (Exception ex)
                {
                    rep.RollbackTransaction();
                    ServiceProvider.GetService <IExceptionProcess>().ProcessWithNotify(ex);
                }
                return(false);
            }
        }
コード例 #3
0
ファイル: process_fy_piao.cs プロジェクト: qq5013/mERP-HD
        public static bool 票费用保存(ArchiveOperationForm masterForm)
        {
            IBoundGrid grid = (masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0];
            if (grid.DataRows.Count == 0)
                return true;

            using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<费用信息>())
            {
                try
                {
                    rep.BeginTransaction();

                    IList<费用信息> list = (rep as Feng.NH.INHibernateRepository).List<费用信息>(NHibernate.Criterion.DetachedCriteria.For<费用信息>()
                            .Add(NHibernate.Criterion.Expression.Eq("票Id", (Guid)grid.DataRows[0].Cells["费用实体"].Value)));
                    Dictionary<string, 费用信息> fyxxs = new Dictionary<string, 费用信息>();
                    foreach (费用信息 i in list)
                    {
                        fyxxs[i.费用项编号] = i;
                    }

                    // 收
                    foreach (Xceed.Grid.DataRow row in grid.DataRows)
                    {
                        bool? b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["Submitted"].Value);
                        if (!b.HasValue)
                            continue;

                        string fyx = (string)(row.Cells["费用项"].Value);
                        if (!fyxxs.ContainsKey(fyx))
                        {
                            费用信息 fyxx = new 费用信息();
                            fyxx.票Id = (Guid)row.Cells["费用实体"].Value;
                            fyxx.费用项编号 = (string)(row.Cells["费用项"].Value);
                            fyxx.业务类型编号 = (int)(row.Cells["业务类型"].Value);
                            fyxx.Submitted = b.Value;

                            (new HdBaseDao<费用信息>()).Save(rep, fyxx);

                            fyxxs[fyxx.费用项编号] = fyxx;
                            // MessageForm.ShowInfo("此费用项下还未有费用,不需要打完全标志!");
                        }
                        else
                        {
                            费用信息 fyxx = fyxxs[fyx];
                            if (fyxx.Submitted != b.Value)
                            {
                                fyxx.Submitted = b.Value;
                                (new HdBaseDao<费用信息>()).Update(rep, fyxx);
                            }
                        }
                    }

                    // 付
                    foreach (Xceed.Grid.DataRow row in grid.DataRows)
                    {
                        bool? b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["完全标志付"].Value);
                        if (!b.HasValue)
                            continue;

                        string fyx = (string)(row.Cells["费用项"].Value);
                        if (!fyxxs.ContainsKey(fyx))
                        {
                            费用信息 fyxx = new 费用信息();
                            fyxx.票Id = (Guid)row.Cells["费用实体"].Value;
                            fyxx.费用项编号 = (string)(row.Cells["费用项"].Value);
                            fyxx.业务类型编号 = (int)(row.Cells["业务类型"].Value);
                            fyxx.完全标志付 = b.Value;

                            (new HdBaseDao<费用信息>()).Save(rep, fyxx);

                            fyxxs[fyxx.费用项编号] = fyxx;
                            // MessageForm.ShowInfo("此费用项下还未有费用,不需要打完全标志!");
                        }
                        else
                        {
                            费用信息 fyxx = fyxxs[fyx];
                            if (fyxx.完全标志付 != b.Value)
                            {
                                fyxx.完全标志付 = b.Value;
                                (new HdBaseDao<费用信息>()).Update(rep, fyxx);
                            }
                        }
                    }

                    rep.CommitTransaction();

                    masterForm.ControlManager.OnCurrentItemChanged();

                    grid.ReloadData();

                    masterForm.ControlManager.State = Feng.StateType.View;
                    if (masterForm.ControlManager.ControlCheckExceptionProcess != null)
                        masterForm.ControlManager.ControlCheckExceptionProcess.ClearAllError();
                    masterForm.ControlManager.EndEdit(false);

                    return true;
                }
                catch (Exception ex)
                {
                    rep.RollbackTransaction();
                    ServiceProvider.GetService<IExceptionProcess>().ProcessWithNotify(ex);
                }
                return false;
            }
        }