Пример #1
0
        private bool WriteLog(Miles.Coro.ORM.Repository r, Model.Tb_order_log log, object obj)
        {
            string strSerializeJSON = JsonConvert.SerializeObject(obj);

            log.Oper_Info = strSerializeJSON;
            return(this.Add(r, log));
        }
Пример #2
0
        internal bool BackLinkBill(Info_link_bill info)
        {
            //记录日志
            //更新标志位
            return(this.BatchTrans()
                   .Append <long>((r, id) =>
            {
                Model.Tb_order_log log = new Model.Tb_order_log();
                log.Odr_No = info.Odr_No;
                log.Oper_log = "项目联络单召回";
                log.Msg = "项目联络单召回";
                if (!WriteLog(r, log, info))
                {
                    return false;
                }

                if (r.Update <Model.Tb_link_bill>()
                    .Set()
                    .Field(Model.Tb_link_bill.Table.Bill_State, (int)Enum.LinkState.New)
                    .EndSet()
                    .Where()
                    .And(Model.Tb_link_bill.Table.LinkBill_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return false;
                }

                return true;
            }, info.LinkBill_Id)
                   .Save());
        }
Пример #3
0
        private bool DoAdoptOrder(Miles.Coro.ORM.Repository r, Model.Info_OrderMain info)
        {
            int odrState = (int)Enum.OrderState.Pass;//2;

            info.Odr_State = odrState;
            Model.Tb_order_log log = new Model.Tb_order_log();
            log.Odr_No   = info.Odr_No;
            log.Oper_log = "合同审核通过";
            log.Msg      = "合同审核通过";
            if (!WriteLog(r, log, info))
            {
                return(false);
            }

            if (!UpdateOrderState(r, info))
            {
                return(false);
            }

            //新建合同摘要表部分数据
            if (!DoNewFinOrderGen(r, info))
            {
                return(false);
            }

            //新建项目联络单要表部分数据
            if (!DoNewLinkBill(r, info))
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        public bool AdoptFinIncome(Info_fin_order_income info)
        {
            return(this.BatchTrans().Append <Model.Info_fin_order_income>
                       ((r, f) =>
            {
                int odrState = (int)Enum.FinState.Pass;    // 2;
                info.Fin_State = odrState;

                Model.Tb_order_log log = new Model.Tb_order_log();
                //log.Ass_Id = info.Fin_Id;
                log.Oper_log = "回款审核通过";
                log.Msg = "回款审核通过";

                if (!WriteLog(r, log, info))
                {
                    return false;
                }

                SetOperateInfo(info, new List <string> {
                    Model.Tb_fin_order_income.Table.Audit_Code
                }
                               , new List <string> {
                    Model.Tb_fin_order_income.Table.Audit_Date
                });

                if (r.Update <Tb_fin_order_income>()
                    .Set()
                    .Field(Model.Tb_fin_order_income.Table.Fin_State, odrState)
                    .Field(Model.Tb_fin_order_income.Table.Audit_Code, info.Audit_Code)
                    .Field(Model.Tb_fin_order_income.Table.Audit_Date, info.Audit_Date)
                    .EndSet()
                    .Where()
                    .And(Model.Tb_fin_order_income.Table.Fin_Id, f.Fin_Id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return false;
                }

                //更新合同摘要的支付金额
                if (r.Update <Tb_fin_order_gen>()
                    .Set()
                    .Increase(Tb_fin_order_gen.Table.Pay_Cost, f.Pay_Cost)
                    .EndSet()
                    .Where()
                    .And(Model.Tb_fin_order_gen.Table.Odr_No, f.Odr_No)
                    .EndWhere()
                    .Save() < 1)
                {
                    return false;
                }


                return true;
            }, info
                       ).Save());
        }
Пример #5
0
        internal bool CancelLinkBill(Info_link_bill info)
        {
            //作废原来的单据标志位=-1
            //新建一个取消的联络单,编码相同
            return(this.BatchTrans()
                   .Append <long>((r, id) =>
            {
                Model.Tb_order_log log = new Model.Tb_order_log();
                log.Odr_No = info.Odr_No;
                log.Oper_log = "项目联络单取消";
                log.Msg = "项目联络单取消";
                if (!WriteLog(r, log, info))
                {
                    return false;
                }

                if (r.Update <Model.Tb_link_bill>()
                    .Set()
                    .Field(Model.Tb_link_bill.Table.Bill_State, (int)Enum.LinkState.Invalid)
                    .EndSet()
                    .Where()
                    .And(Model.Tb_link_bill.Table.LinkBill_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return false;
                }

                info.LinkBill_Id = NewId();
                info.Bill_State = (int)Enum.LinkState.Valid;        // 1;  //直接提交状态
                info.LinkBill_Type = (int)Enum.LinkBillType.Cancel; // 1;
                info.LinkBill_Name += "-取消单";

                if (!this.Add(r, info))
                {
                    return false;
                }

                foreach (var v in info.Items)
                {
                    v.Item_Id = NewId();
                    v.LinkBill_Id = info.LinkBill_Id;
                    if (!this.Add(r, v))
                    {
                        return false;
                    }
                }

                return true;
            }, info.LinkBill_Id)
                   .Save());
        }
Пример #6
0
        private bool DoTerminationOrder(Repository r, Info_OrderMain info)
        {
            int odrState = (int)Enum.OrderState.Termination;//3;

            info.Odr_State = odrState;
            Model.Tb_order_log log = new Model.Tb_order_log();
            log.Odr_No   = info.Odr_No;
            log.Oper_log = "合同手工终止";
            log.Msg      = "合同手工终止";
            if (!WriteLog(r, log, info))
            {
                return(false);
            }

            if (!UpdateOrderState(r, info))
            {
                return(false);
            }

            //更新合同摘要
            if (r.Update <Tb_fin_order_gen>()
                .Set()
                .Field(Tb_fin_order_gen.Table.Gen_State, (int)Enum.GenState.Termination)
                .EndSet()
                .Where()
                .And(Tb_fin_order_gen.Table.Odr_No, info.Odr_No)
                .EndWhere().Save() < 0)
            {
                return(false);
            }
            //更新项目联络单
            if (r.Update <Tb_link_bill>()
                .Set()
                .Field(Tb_link_bill.Table.Bill_State, (int)Enum.LinkState.Termination)
                .EndSet()
                .Where()
                .And(Tb_link_bill.Table.Odr_No, info.Odr_No)
                .EndWhere().Save() < 0)
            {
                return(false);
            }
            //物流单
            //工程部费用表


            return(true);
        }
Пример #7
0
        public bool RejectFinIncome(Info_fin_order_income info, string msg)
        {
            return(this.BatchTrans().Append <Model.Info_fin_order_income>
                       ((r, f) =>
            {
                int odrState = (int)Enum.FinState.New;    // 0;
                info.Fin_State = odrState;

                Model.Tb_order_log log = new Model.Tb_order_log();
                //log.Ass_Id = info.Fin_Id;
                log.Oper_log = "回款审核不通过";
                log.Msg = msg == null ? "回款审核不通过" : msg;
                if (!WriteLog(r, log, info))
                {
                    return false;
                }

                SetOperateInfo(info, new List <string> {
                    Model.Tb_fin_order_income.Table.Audit_Code
                }
                               , new List <string> {
                    Model.Tb_fin_order_income.Table.Audit_Date
                });

                if (r.Update <Tb_fin_order_income>()
                    .Set()
                    .Field(Model.Tb_fin_order_income.Table.Fin_State, odrState)
                    .Field(Model.Tb_fin_order_income.Table.Audit_Code, info.Audit_Code)
                    .Field(Model.Tb_fin_order_income.Table.Audit_Date, info.Audit_Date)
                    .EndSet()
                    .Where()
                    .And(Model.Tb_fin_order_income.Table.Fin_Id, f.Fin_Id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return false;
                }

                return true;
            }, info
                       ).Save());
        }
Пример #8
0
        private bool DoRejectOrder(Repository r, Info_OrderMain info)
        {
            int odrState = (int)Enum.OrderState.New;// 0;

            info.Odr_State = odrState;

            Model.Tb_order_log log = new Model.Tb_order_log();
            log.Odr_No   = info.Odr_No;
            log.Oper_log = "合同审核不通过";
            log.Msg      = info.Tag == null?"合同审核不通过":info.Tag.ToString();
            if (!WriteLog(r, log, info))
            {
                return(false);
            }

            if (!UpdateOrderState(r, info))
            {
                return(false);
            }

            return(true);
        }