예제 #1
0
        void 业务费用处理车辆承担Dao_EntityOperating(object sender, OperateArgs <业务费用> e)
        {
            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                业务费用 entity = e.Entity as 业务费用;

                // 车辆承担
                if (string.IsNullOrEmpty(entity.费用项编号))
                {
                    entity.车辆承担 = false;
                }
                else
                {
                    车队费用项 cdfyx = EntityBufferCollection.Instance.Get <车队费用项>(entity.费用项编号);

                    e.Repository.Initialize(entity.车辆产值, entity);
                    // 费用项.车辆承担 = true AND 费用归属 = 车主 AND 相关人 = 新概念(即自有车) 设置车辆承担 = true
                    if (cdfyx.车辆承担 && entity.费用归属 != 费用归属.车主 && entity.车辆产值.承运人编号 == "900001")
                    {
                        entity.车辆承担 = true;
                    }
                    else
                    {
                        entity.车辆承担 = false;
                    }

                    // 吊机费
                    if (entity.费用项编号 == "111" && entity.费用归属 == 费用归属.委托人)
                    {
                        entity.车辆承担 = false;
                    }
                }
            }
        }
예제 #2
0
 void IOperatingEntity.PreparingOperate(OperateArgs e)
 {
     if (string.IsNullOrEmpty(this.编号) && (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update))
     {
         this.编号 = PrimaryMaxIdGenerator.GetMaxId("财务_银行存取款", "编号", 8, "Y" + PrimaryMaxIdGenerator.GetIdYearMonth(日期)).ToString();
     }
 }
예제 #3
0
        void 非业务车辆费用处理车辆承担Dao_EntityOperating(object sender, OperateArgs <非业务车辆费用> e)
        {
            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                非业务车辆费用 entity = e.Entity as 非业务车辆费用;

                // 车辆承担
                if (string.IsNullOrEmpty(entity.费用项编号))
                {
                    entity.车辆承担 = false;
                }
                else
                {
                    if (entity.车辆费用实体 == null)
                    {
                        entity.车辆费用实体 = entity.费用实体 as 车辆费用实体;
                    }
                    else
                    {
                        e.Repository.Initialize(entity.车辆费用实体, entity);
                    }

                    // 费用项 != 固定资产出让 AND 费用归属 = 车主 AND 相关人 = 新概念(即自有车) 设置车辆承担 = true
                    if (entity.费用项编号 != "204" && entity.费用项编号 != "386" && entity.费用归属 != 费用归属.车主 && entity.车辆费用实体.车主编号 == "900001")
                    {
                        entity.车辆承担 = true;
                    }
                    else
                    {
                        entity.车辆承担 = false;
                    }
                }
            }
        }
예제 #4
0
        void 业务费用处理相关人Dao_EntityOperating(object sender, OperateArgs <业务费用> e)
        {
            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                业务费用 entity = e.Entity as 业务费用;

                if (entity.相关人编号 == null)
                {
                    //当 费用归属=车主   相关人=车辆产值.承运人
                    //当 费用归属=委托人 相关人=任务.委托人
                    //当 费用归属=驾驶员  相关人=车辆产值.驾驶员
                    switch (entity.费用归属)
                    {
                    case 费用归属.委托人:
                        entity.相关人编号 = entity.任务.委托人编号;
                        break;

                    case 费用归属.车主:
                        entity.相关人编号 = entity.车辆产值.承运人编号;
                        break;

                    case 费用归属.驾驶员:
                        entity.相关人编号 = entity.车辆产值.驾驶员编号;
                        break;

                    default:
                        break;
                    }
                }
                if (entity.车辆编号 == null)
                {
                    entity.车辆编号 = entity.车辆产值.车辆编号;
                }
            }
        }
예제 #5
0
        public virtual void PreparingOperate(OperateArgs e)
        {
            if (e.OperateType == OperateType.Save)
            {
                费用实体 entity = e.Entity as 费用实体;

                string        typeName = entity.GetType().FullName;
                IEntityBuffer eb       = EntityBufferCollection.Instance[typeof(费用类别)];

                if (entity.费用实体类型编号 == 0)
                {
                    foreach (费用类别 i in eb)
                    {
                        if (i.代码类型名 == typeName)
                        {
                            entity.费用实体类型编号 = i.代码;
                            break;
                        }
                    }
                }

                if (string.IsNullOrEmpty(entity.编号))
                {
                    string preKeyValue = Feng.Utils.RepositoryHelper.GetRepositoryPk(e.Repository, typeName);
                    if (string.IsNullOrEmpty(preKeyValue))
                    {
                        foreach (费用类别 i in eb)
                        {
                            if (i.代码类型名 == typeName)
                            {
                                entity.编号   = PrimaryMaxIdGenerator.GetMaxId("财务_费用实体", "编号", 8, i.前缀).ToString();
                                preKeyValue = entity.编号;
                                Feng.Utils.RepositoryHelper.SetRepositoryPk(e.Repository, typeName, preKeyValue);
                                break;
                            }
                        }
                    }
                    else
                    {
                        int delta = Feng.Utils.RepositoryHelper.GetRepositoryDelta(e.Repository, typeName);

                        foreach (费用类别 i in eb)
                        {
                            if (i.代码类型名 == typeName)
                            {
                                entity.编号 = PrimaryMaxIdGenerator.GetMaxIdFromPrevId(preKeyValue, i.前缀, delta + 1);
                                break;
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(entity.编号))
                    {
                        throw new InvalidOperationException("Invalid 费用实体类型 of " + typeName);
                    }
                }
            }
        }
예제 #6
0
파일: 任务.cs 프로젝트: qq5013/mERP-CD
 bool IDeletableEntity.CanBeDelete(OperateArgs e)
 {
     if (this.车辆产值 != null)
     {
         e.Repository.Initialize(this.车辆产值, this);
         if (this.车辆产值.Submitted)
         {
             return(false);
         }
     }
     return(true);
 }
예제 #7
0
 bool IDeletableEntity.CanBeDelete(OperateArgs e)
 {
     e.Repository.Initialize(this.费用, this);
     if (this.费用 != null && this.费用.Count > 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #8
0
        public override void PreparingOperate(OperateArgs e)
        {
            base.PreparingOperate(e);

            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                非业务车辆费用 entity = e.Entity as 非业务车辆费用;
                if (string.IsNullOrEmpty(entity.费用项编号))
                {
                    entity.费用类别编号 = null;
                }
                else
                {
                    e.Repository.Initialize(entity.费用实体, entity);
                    entity.费用类别编号 = entity.费用实体.费用实体类型编号;
                    if (entity.费用类别编号.HasValue && entity.费用类别编号.Value == 13) // 车辆库存加油
                    {
                        entity.费用类别编号 = 12;                                  //车辆加油
                        if (entity.费用归属 == 费用归属.驾驶员)
                        {
                            entity.费用类别编号 = 325;//业务油耗
                        }
                    }
                }

                if (entity.车辆编号 == null)
                {
                    if (entity.车辆费用实体 == null)
                    {
                        entity.车辆费用实体 = entity.费用实体 as 车辆费用实体;
                    }
                    else
                    {
                        e.Repository.Initialize(entity.车辆费用实体, entity);
                    }
                    entity.车辆编号 = entity.车辆费用实体 == null ? null : entity.车辆费用实体.车辆编号;
                }

                if (entity.费用归属 == 费用归属.车主 && entity.相关人编号 == null)
                {
                    if (entity.车辆费用实体 == null)
                    {
                        entity.车辆费用实体 = entity.费用实体 as 车辆费用实体;
                    }
                    else
                    {
                        e.Repository.Initialize(entity.车辆费用实体, entity);
                    }
                    entity.相关人编号 = entity.车辆费用实体.车主编号;
                }
            }
        }
예제 #9
0
        void IOperatingEntity.PreparingOperate(OperateArgs e)
        {
            if (e.OperateType == OperateType.Save)
            {
                if (string.IsNullOrEmpty(this.编号))
                {
                    // Todo
                    int delta = Feng.Utils.RepositoryHelper.GetRepositoryDelta(e.Repository, typeof(客户).Name);

                    this.编号 = PrimaryMaxIdGenerator.GetMaxId("参数备案_人员单位", "编号", 6, "90", delta).ToString();
                }
            }
        }
예제 #10
0
        public virtual bool CanBeDelete(OperateArgs e)
        {
            费用 entity = e.Entity as 费用;

            if (entity.凭证费用明细 != null)
            {
                throw new InvalidUserOperationException("此费用已出凭证,不能删除!");
            }
            if (entity.对账单 != null && entity.对账单.Submitted)
            {
                throw new InvalidUserOperationException("此费用已出对帐单且已确认,不能删除!");
            }
            return(true);
        }
예제 #11
0
 public override void PreparingOperate(OperateArgs e)
 {
     if (string.IsNullOrEmpty(this.编号))
     {
         if (this.结束日期.HasValue)
         {
             this.编号 = PrimaryMaxIdGenerator.GetMaxId("财务_对账单", "编号", 8, PrimaryMaxIdGenerator.GetIdYearMonth(this.结束日期.Value)).ToString();
         }
         if (this.关账日期.HasValue)
         {
             this.编号 = PrimaryMaxIdGenerator.GetMaxId("财务_对账单", "编号", 8, PrimaryMaxIdGenerator.GetIdYearMonth(this.关账日期.Value)).ToString();
         }
     }
 }
예제 #12
0
        void IOperatingEntity.PreparingOperate(OperateArgs e)
        {
            if (e.OperateType == OperateType.Save)
            {
                if (string.IsNullOrEmpty(this.编号))
                {
                    // Todo
                    int delta = Feng.Utils.RepositoryHelper.GetRepositoryDelta(e.Repository, typeof(车辆产值).Name);

                    this.编号 = PrimaryMaxIdGenerator.GetMaxId("财务_费用实体", "编号", 8, PrimaryMaxIdGenerator.GetIdYearMonth(日期), delta).ToString();
                }
            }

            base.PreparingOperate(e);
        }
예제 #13
0
        void 业务费用处理费用信息Dao_EntityOperating(object sender, OperateArgs <业务费用> e)
        {
            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                业务费用 entity = e.Entity as 业务费用;

                // 费用信息
                if (string.IsNullOrEmpty(entity.费用项编号))
                {
                    entity.费用信息 = null;
                }
                else
                {
                    HdBaseDao <费用信息> daoFyxx = new HdBaseDao <费用信息>();

                    // 当费用项变换时,要重新设置费用信息
                    IList <费用信息> list = (e.Repository as Feng.NH.INHibernateRepository).List <费用信息>(NHibernate.Criterion.DetachedCriteria.For <费用信息>()
                                                                                                    .Add(NHibernate.Criterion.Expression.Eq("费用项编号", entity.费用项编号))
                                                                                                    .Add(NHibernate.Criterion.Expression.Eq("车辆产值.ID", entity.费用实体.ID)));

                    if (list.Count == 0)
                    {
                        费用信息 item = new 费用信息();
                        item.车辆产值  = entity.车辆产值;
                        item.费用项编号 = entity.费用项编号;

                        daoFyxx.Save(e.Repository, item);

                        entity.费用信息 = item;
                    }
                    else if (list.Count == 1)
                    {
                        // 修改的时候,和完全标志无关?? && e.OperateType == OperateType.Save
                        if ((entity.收付标志 == 收付标志.收 && list[0].Submitted) ||
                            (entity.收付标志 == 收付标志.付 && list[0].完全标志付))
                        {
                            throw new InvalidUserOperationException("车辆产值" + entity.费用实体.ID + " 费用项" + entity.费用项编号 + "已打完全标志,不能操作费用!");
                        }
                        entity.费用信息 = list[0];
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "费用信息对同一费用主体同一费用项有多条!");
                    }
                }
            }
        }
        protected override void OnOperate(OperateArgs arg)
        {
            string path = _sharedSettings.ProjectTestRootPath + "/Base/Context/" + "TestBaseUIContext.cs";

            UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(path);

            string data;

            Debug.Log("Ensuring existence of BaseTestUIContext.cs");
            if (obj == null)
            {
                data = LoadTemplate();

                CodeUtilities.SaveFile(data, path);
                Debug.Log("File didn't existed generating...");
            }
        }
예제 #15
0
        public override bool CanBeDelete(OperateArgs e)
        {
            业务费用 entity = e.Entity as 业务费用;

            if (string.IsNullOrEmpty(entity.费用项编号))
            {
            }
            else
            {
                entity.费用类别 = EntityBufferCollection.Instance.Get <费用类别>(entity.费用类别编号);
                entity.费用项  = EntityBufferCollection.Instance.Get <费用项>(entity.费用项编号);

                if (entity.费用类别.大类 == "业务额外" || entity.费用类别.大类 == "业务常规")
                {
                    IList <费用信息> list = (e.Repository as Feng.NH.INHibernateRepository).List <费用信息>(NHibernate.Criterion.DetachedCriteria.For <费用信息>()
                                                                                                    .Add(NHibernate.Criterion.Expression.Eq("费用项编号", entity.费用项.编号))
                                                                                                    .Add(NHibernate.Criterion.Expression.Eq("票.ID", entity.票.ID)));
                    if (list.Count == 0)
                    {
                        // 可能原来未有费用项,没生成费用信息
                        //throw new ArgumentException("Deleted 费用 must have 费用信息!");
                    }
                    else if (list.Count == 1)
                    {
                        // 修改的时候,和完全标志无关?? && e.OperateType == OperateType.Save
                        if ((entity.收付标志 == 收付标志.收 && list[0].Submitted) ||
                            (entity.收付标志 == 收付标志.付 && list[0].完全标志付))
                        {
                            throw new InvalidUserOperationException("票" + entity.票.货代自编号 + " 费用项" + entity.费用项编号 + "已打完全标志,不能操作费用!");
                        }

                        HdBaseDao <费用信息> daoFyxx = new HdBaseDao <费用信息>();

                        daoFyxx.Update(e.Repository, list[0]); // 更新Updated时间
                        entity.费用信息 = list[0];
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "费用信息对同一费用主体同一费用项有多条!");
                    }
                }
            }

            return(base.CanBeDelete(e));
        }
예제 #16
0
        public override void PreparingOperate(OperateArgs e)
        {
            if (string.IsNullOrEmpty(this.凭证号))
            {
                this.凭证号 = PrimaryMaxIdGenerator.GetMaxId("财务_凭证", "凭证号", 8, PrimaryMaxIdGenerator.GetIdYearMonth(this.日期)).ToString();
            }
            //if (this.操作人 == "会计")
            //{
            //    this.费用明细状态 = 费用明细状态.未审核;

            //    e.Repository.Initialize(this.凭证费用明细, this);

            //    if (凭证费用明细 != null && 凭证费用明细.Count > 0)
            //    {
            //        bool allHave = true;
            //        foreach (凭证费用明细 sub in 凭证费用明细)
            //        {
            //            if (sub.审核标志)
            //            {
            //                this.费用明细状态 = 费用明细状态.已部分审核;
            //            }
            //            else
            //            {
            //                allHave = false;
            //            }
            //        }
            //        if (allHave)
            //        {
            //            this.费用明细状态 = 费用明细状态.已审核完全;
            //        }
            //    }
            // }
            //if (this.操作人 == "会计")
            //{
            //    this.会计编号 = SystemConfiguration.UserName;
            //}
            //else if (this.操作人 == "出纳")
            //{
            //    this.出纳编号 = SystemConfiguration.UserName;
            //}
            //else if (this.操作人 == "审核人")
            //{
            //    this.审核人编号 = SystemConfiguration.UserName;
            //}
        }
예제 #17
0
        public override void PreparedOperate(OperateArgs e)
        {
            base.PreparedOperate(e);

            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                if (this.成本发票明细 != null)
                {
                    e.Repository.Initialize(this.成本发票明细, this);
                    decimal sum = 0;
                    foreach (成本发票明细 i in this.成本发票明细)
                    {
                        sum += i.金额;
                    }
                    this.入账金额 = sum;
                }
            }
        }
예제 #18
0
파일: 投资.cs 프로젝트: qq5013/mERP-HD
 void IOperatingEntity.PreparedOperate(OperateArgs e)
 {
     if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
     {
         if (this.费用 != null)
         {
             e.Repository.Initialize(this.费用, this);
             foreach (费用 i in this.费用)
             {
                 if (string.IsNullOrEmpty(i.相关人编号))
                 {
                     i.相关人编号 = this.相关人编号;
                     i.相关人   = this.相关人;
                 }
             }
         }
     }
 }
예제 #19
0
        protected override void OnOperate(OperateArgs arg)
        {
            string gameScreensPath = _sharedSettings.ProjectConstantsPath + "/" + "GameScreens.cs";

            UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(gameScreensPath);

            string data;

            if (obj == null)
            {
                data = LoadTemplate();

                Debug.Log("File didn't existed generating...");
            }
            else
            {
                data = LoadFileOnPath(gameScreensPath);

                Debug.Log("Changing on existing file...");
            }

            if (data.Contains(_name))
            {
                Debug.Log("Constant already exists");
                return;
            }
            string addition = "\r\t\t";

            addition += "//-%Name%";
            addition += "\r\t\t";
            addition += "public const string %Name% = \"%Name%\";";
            addition += "\r\t\t";
            addition += "//-";
            addition += "\r\t\t";
            addition += "ADDPOINT";
            data      = data.Replace("//*ADDITION*//", addition);
            data      = data.Replace("%Name%", _name);
            data      = data.Replace("ADDPOINT", "//*ADDITION*//");
            CodeUtilities.SaveFile(data, gameScreensPath);
            Debug.Log("Added Constants");
        }
예제 #20
0
        public override void PreparingOperate(OperateArgs e)
        {
            base.PreparingOperate(e);

            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                非业务费用 entity = e.Entity as 非业务费用;
                if (string.IsNullOrEmpty(entity.费用项编号))
                {
                    entity.费用类别编号 = null;
                }
                else
                {
                    // 当费用项变换时,要重新设置费用类别编号
                    entity.费用项    = EntityBufferCollection.Instance.Get <费用项>(entity.费用项编号);
                    entity.费用类别编号 = entity.收付标志 == 收付标志.收 ? entity.费用项.收入类别 : entity.费用项.支出类别;
                    if (!entity.费用类别编号.HasValue)
                    {
                        throw new InvalidUserOperationException("您选择的费用项和收付有误,请重新选择!");
                    }
                }
            }
        }
예제 #21
0
 void IOperatingEntity.PreparedOperate(OperateArgs e)
 {
 }
 protected override void OnOperate(OperateArgs startArg)
 {
     CreateViewScript();
     CreateMediatorScript();
 }
예제 #23
0
 bool IDeletableEntity.CanBeDelete(OperateArgs e)
 {
     return(!this.Submitted);
 }
 protected override void OnOperate(OperateArgs arg)
 {
     CreateScene();
 }
예제 #25
0
 public virtual void PreparingOperate(OperateArgs e)
 {
 }
예제 #26
0
 bool IDeletableEntity.CanBeDelete(OperateArgs e)
 {
     e.Repository.Initialize(this.费用, this);
     return(this.费用.Count == 0);
 }
예제 #27
0
 void AttachmentForm_EntityOperating(object sender, OperateArgs <AttachmentInfo> e)
 {
     e.Entity.EntityName = m_attachmentEntityName;
     e.Entity.EntityId   = m_attachmentEntityId;
 }
예제 #28
0
        void 业务费用处理费用类别Dao_EntityOperating(object sender, OperateArgs <业务费用> e)
        {
            if (e.OperateType == OperateType.Save || e.OperateType == OperateType.Update)
            {
                业务费用 entity = e.Entity as 业务费用;

                // 费用类别
                if (string.IsNullOrEmpty(entity.费用项编号))
                {
                    entity.费用类别编号 = null;
                }
                else
                {
                    // 当费用项变换时,要重新设置费用信息
                    车队费用项 cdfyx = EntityBufferCollection.Instance.Get <车队费用项>(entity.费用项编号);
                    switch (entity.费用归属)
                    {
                    case 费用归属.委托人:
                        entity.费用类别编号 = cdfyx.委托人;
                        break;

                    case 费用归属.车主:
                        //如果是车主的,付给车主的  费用类别:拆、装、回 这种的
                        //问车主收的话,费用类别:业务支出
                        entity.费用类别编号 = cdfyx.车主;
                        if (entity.费用项编号 == "111" && entity.收付标志 == 收付标志.付)
                        {
                            entity.费用类别编号 = 321;
                        }
                        break;

                    case 费用归属.驾驶员:
                        entity.费用类别编号 = cdfyx.驾驶员;
                        break;

                    case 费用归属.对外:
                        entity.费用类别编号 = cdfyx.对外;
                        break;

                    default:
                        entity.费用类别编号 = null;
                        break;
                    }

                    if (entity.费用类别编号.HasValue && entity.费用类别编号.Value == 321)    // 运费,税
                    {
                        if (entity.任务 == null)
                        {
                            throw new InvalidUserOperationException("任务为空,无法保存");
                        }
                        e.Repository.Initialize(entity.任务, entity);
                        entity.费用类别编号 = (int?)entity.任务.任务类别;
                    }

                    if (!entity.费用类别编号.HasValue)
                    {
                        throw new InvalidUserOperationException("您选择的费用项和费用归属有误,请重新选择!费用项为" + entity.费用项编号);
                    }
                }
            }
        }
 void AttachmentForm_EntityOperating(object sender, OperateArgs<AttachmentInfo> e)
 {
     e.Entity.EntityName = m_attachmentEntityName;
     e.Entity.EntityId = m_attachmentEntityId;
 }
예제 #30
0
 protected override void OnOperate(OperateArgs arg)
 {
     AddScript(_testScriptsPath, _name, TemplateType.Root, _type);
     AddScript(_testScriptsPath, _name, TemplateType.Context, _type);
 }
예제 #31
0
 public virtual bool CanBeDelete(OperateArgs e)
 {
     return(!(this.Submitted || this.是否作废));
 }