示例#1
0
        public bool Save(List <Tb_send_sms_info> list)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Tb_send_sms_info>()
                    .Save() < 0)
                {
                    return(false);
                }

                return(true);
            }, 0);

            foreach (var v in list)
            {
                exeBatchTrans.Append <Tb_send_sms_info>((r, item) =>
                {
                    return(Add(r, item));
                }, v);
            }

            return(exeBatchTrans.Save());
        }
示例#2
0
        public bool StartCheckStore()
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //更新库存状态为盘库锁定
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoUpdateStoreState(r, Enum.StoreState.LockStore));
            }, 0);


            //清理盘库表数据
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoClearCheckStore(r));
            }, 0);

            //将库存表数据复制到盘库表中
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoCopyStoreToCheckStore(r));
            }, 0);

            return(exeBatchTrans.Save());
        }
示例#3
0
        public bool Save(Info_salary_tmp tmp)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <int>((r, id) =>
            {
                if (r.Remove <Tb_salary_tmp>()
                    .Where()
                    .And(Tb_salary_tmp.Table.Salary_Type, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }

                return(true);
            }, tmp.Salary_Type);

            exeBatchTrans.Append <Info_salary_tmp>((r, info) =>
            {
                return(this.Add(r, info));
            }, tmp);

            return(exeBatchTrans.Save());
        }
示例#4
0
        public bool SaveLinkBillAll(Info_link_bill info)
        {
            ExeBatchTrans batchTrans = this.BatchTrans();

            batchTrans
            .Append <long>(
                (r, id) =>
            {
                if (r.Remove <Model.Tb_link_bill>()
                    .Where().And(Model.Tb_link_bill.Table.LinkBill_Id, info.LinkBill_Id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.LinkBill_Id).Append <long>(
                (r, id) =>
            {
                if (r.Remove <Model.Tb_link_bill_tent>()
                    .Where().And(Model.Tb_link_bill_tent.Table.LinkBill_Id, info.LinkBill_Id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.LinkBill_Id)
            .Append <Tb_link_bill>
            (
                (r, i) =>
            {
                return(Add(r, i));
            }, info);


            int seqNo = 1;

            foreach (var item in info.Items)
            {
                batchTrans.Append <Tb_link_bill_tent>
                (
                    (r, i) =>
                {
                    i.LinkBill_Id = info.LinkBill_Id;
                    i.Item_Id     = NewId();
                    i.Item_Seq    = seqNo;
                    return(Add(r, i));
                }, item);

                seqNo++;
            }


            return(batchTrans.Save());
        }
示例#5
0
        public bool SaveGenAll(Info_fin_order_gen info)
        {
            ExeBatchTrans batchTrans = this.BatchTrans();

            batchTrans
            .Append <string>(
                (r, id) =>
            {
                if (r.Remove <Model.Info_fin_order_gen>()
                    .Where().And(Model.Info_fin_order_gen.Table.Odr_No, info.Odr_No)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.Odr_No).Append <string>(
                (r, id) =>
            {
                if (r.Remove <Model.Tb_fin_order_item>()
                    .Where().And(Model.Tb_fin_order_item.Table.Odr_No, info.Odr_No)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.Odr_No)
            .Append <Info_fin_order_gen>
            (
                (r, i) =>
            {
                return(Add(r, i));
            }, info)
            ;
            int seqNo = 1;

            foreach (var item in info.Items)
            {
                batchTrans.Append <Tb_fin_order_item>
                (
                    (r, i) =>
                {
                    i.Odr_No   = info.Odr_No;
                    i.Item_Id  = NewId();
                    i.Item_Seq = seqNo;
                    return(Add(r, i));
                }, item)
                ;

                seqNo++;
            }

            return(batchTrans.Save());
        }
示例#6
0
        public bool Save(Info_salary_main salaryMain)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <string>((r, id) =>
            {
                if (r.Remove <Tb_salary_main>()
                    .Where()
                    .And(Tb_salary_main.Table.Odr_No_Main, id)
                    .EndWhere().Save() < 0)
                {
                    return(false);
                }

                if (r.Remove <Tb_salary_main_item>()
                    .Where()
                    .And(Tb_salary_main_item.Table.Odr_No_Main, id)
                    .EndWhere().Save() < 0)
                {
                    return(false);
                }

                return(true);
            }, salaryMain.Odr_No_Main);

            exeBatchTrans.Append <Info_salary_main>((r, info) =>
            {
                return(this.Add(r, info));
            }, salaryMain);

            foreach (var v in salaryMain.Items)
            {
                exeBatchTrans.Append <Info_salary_main_item>((r, item) =>
                {
                    return(this.Add(r, item));
                },
                                                             v);
            }

            exeBatchTrans.Append <string>((r, mainCode) =>
            {
                return(r.Update <Tb_fin_order_gen>()
                       .Set()
                       .Field(Tb_fin_order_gen.Table.Is_Salary, (int)Enum.IsFlag.Yes)
                       .EndSet()
                       .Where()
                       .And(Tb_fin_order_gen.Table.Odr_No_Main, mainCode)
                       .EndWhere()
                       .Save() > 0);
            }, salaryMain.Odr_No_Main);


            return(exeBatchTrans.Save());
        }
示例#7
0
        public bool SaveBodyAndVars(Info_tmp_xls info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <Info_tmp_xls>
                ((r, i) =>
            {
                if (r.Update <Model.Tb_tmp_xls>()
                    .Set()
                    .Field(Model.Tb_tmp_xls.Table.Tmp_Body, info.Tmp_Body)
                    .EndSet()
                    .Where().And(Model.Tb_tmp_xls.Table.Tmp_Id, info.Tmp_Id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }

                return(true);
            }, info

                );


            exeBatchTrans.Append <long>
                ((r, id) =>
            {
                if (r.Remove <Model.Tb_tmp_xls_var>()
                    .Where().And(Model.Tb_tmp_xls_var.Table.Tmp_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.Tmp_Id);

            foreach (var item in info.Vars)
            {
                exeBatchTrans.Append <Tb_tmp_xls_var>
                    ((r, i) =>
                {
                    return(Add(r, item));
                }, item

                    );
            }


            return(exeBatchTrans.Save());
        }
示例#8
0
        public bool SaveIn(Info_store_in info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Tb_store_in>()
                    .Where()
                    .And(Tb_store_in.Table.StoreIn_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.StoreIn_Id);

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Tb_store_in_item>()
                    .Where()
                    .And(Tb_store_in_item.Table.StoreIn_Id, id)
                    .EndWhere().Save() < 0)
                {
                    return(false);
                }

                return(true);
            }, info.StoreIn_Id);

            info.StoreIn_Id = NewId();
            exeBatchTrans.Append <Info_store_in>((r, i) =>
            {
                return(this.Add(r, i));
            }, info);

            foreach (Info_store_in_item item in info.Items)
            {
                exeBatchTrans.Append <Tb_store_in_item>((r, t) =>
                {
                    t.Item_Id    = NewId();
                    t.StoreIn_Id = info.StoreIn_Id;
                    return(this.Add(r, t));
                }, item);
            }

            return(exeBatchTrans.Save());
        }
示例#9
0
        public override bool Remove(Info_matchTb info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_matchTb>()
                    .Where().And(Model.Tb_matchTb.Table.MatchTb_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }
                return(true);
            }, info.MatchTb_Id)
            .Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_matchTb_item>()
                    .Where().And(Model.Tb_matchTb_item.Table.MatchTb_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.MatchTb_Id);

            return(exeBatchTrans.Save());
        }
示例#10
0
        public bool CommitCheckStore(List <Model.Info_store_check> list)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoSaveCheckStore(r, list));
            }, 0);


            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoUpdateStoreState(r, Enum.StoreState.Commit));
            }, 0);

            return(exeBatchTrans.Save());
        }
示例#11
0
        public bool CancelCheckStore()
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //更新库存状态为
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoUpdateStoreState(r, Enum.StoreState.Normal));
            }, 0);

            //清理盘库表数据
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoClearCheckStore(r));
            }, 0);

            return(exeBatchTrans.Save());
        }
示例#12
0
        public bool CommitOut(Info_store_out info)
        {
            //修改状态
            //更正库存数量
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Update <Tb_store_out>()
                    .Set().Field(Tb_store_out.Table.StoreOut_State, (int)Enum.OutStoreState.Valid)
                    .EndSet()
                    .Where()
                    .And(Tb_store_out.Table.StoreOut_Id, info.StoreOut_Id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }

                return(true);
            }, info.StoreOut_Id);

            foreach (Info_store_out_item item in info.Items)
            {
                exeBatchTrans.Append <Info_store_out_item>((r, t) =>
                {
                    if (r.Update <Tb_store_main>()
                        .Set()
                        .Decrease(Tb_store_main.Table.Mtl_Qty, item.Mtl_Qty)
                        .EndSet()
                        .Where()
                        .And(Tb_store_main.Table.Mtl_Code, item.Mtl_Code)
                        .EndWhere()
                        .Save() < 1)
                    {
                        return(false);
                    }

                    return(true);
                }, item);
            }

            return(exeBatchTrans.Save());
        }
示例#13
0
        public bool RemoveOut(Info_store_out info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                return(r.Remove <Tb_store_out>().Where().And(Tb_store_out.Table.StoreOut_Id, id)
                       .EndWhere().Save() > 0 ? true : false);
            }, info.StoreOut_Id);

            exeBatchTrans.Append <long>((r, id) =>
            {
                return(r.Remove <Tb_store_out_item>().Where().And(Tb_store_out_item.Table.StoreOut_Id, id)
                       .EndWhere().Save() > 0 ? true : false);
            }, info.StoreOut_Id);


            return(exeBatchTrans.Save());
        }
示例#14
0
        public bool Save(Model.Info_matchTb info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_matchTb>()
                    .Where().And(Model.Tb_matchTb.Table.MatchTb_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.MatchTb_Id)
            .Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_matchTb_item>()
                    .Where().And(Model.Tb_matchTb_item.Table.MatchTb_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.MatchTb_Id)
            .Append <Model.Info_matchTb>((r, m) =>
            {
                return(this.Add(r, m));
            }, info);

            foreach (var v in info.Items)
            {
                exeBatchTrans.Append <Info_matchTb_item>((r, item) =>
                {
                    item.Item_Id = NewId();
                    return(this.Add(r, item));
                }, v);
            }

            return(exeBatchTrans.Save());
        }
示例#15
0
        public override bool Add(Info_mtl_item t)
        {
            //同时增加库存0数据
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <Info_mtl_item>((r, i) =>
            {
                return(Add(r, i));
            }, t);

            exeBatchTrans.Append <Info_mtl_item>((r, i) =>
            {
                Model.Tb_store_main store = new Tb_store_main();
                store.Mtl_Code            = i.Mtl_Code;
                store.Mtl_Qty             = 0;
                return(Add(r, store));
            }, t);

            return(exeBatchTrans.Save());
        }
示例#16
0
        public bool SaveCheckStore(List <Model.Info_store_check> list)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoSaveCheckStore(r, list));
            }, 0);

            return(exeBatchTrans.Save());
        }
示例#17
0
        public bool UpdateTmpMain(Tb_tmp_main info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <int>((r, s) =>
            {
                if (r.Remove <Tb_tmp_main>().Save() < 0)
                {
                    return(false);
                }

                return(true);
            }, 0);

            exeBatchTrans.Append <Tb_tmp_main>((r, i) =>
            {
                return(Add(r, i));
            }, info);

            return(exeBatchTrans.Save());
        }
示例#18
0
        public bool RejectCheckStore()
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //更新库存状态为
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoUpdateStoreState(r, Enum.StoreState.LockStore));
            }, 0);

            return(exeBatchTrans.Save());
        }
示例#19
0
        public override bool Remove(Info_mtl_item t)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //删除库存数据
            exeBatchTrans.Append <string>((r, c) =>
            {
                return(r.Remove <Tb_mtl_item>().Where()
                       .And(Model.Tb_mtl_item.Table.Mtl_Code, c)
                       .EndWhere()
                       .Save() > 0 ? true : false);
            }, t.Mtl_Code);

            exeBatchTrans.Append <string>((r, c) =>
            {
                return(r.Remove <Tb_store_main>().Where()
                       .And(Model.Tb_store_main.Table.Mtl_Code, c)
                       .EndWhere()
                       .Save() > 0 ? true : false);
            }, t.Mtl_Code);

            return(exeBatchTrans.Save());
        }
示例#20
0
        public bool PermitCheckStore(List <Model.Info_store_check> list)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //更新库存状态为
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoUpdateStoreState(r, Enum.StoreState.Normal));
            }, 0);

            //清理盘库表数据
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoClearCheckStore(r));
            }, 0);

            //更新库存
            exeBatchTrans.Append <List <Model.Info_store_check> >((r, lt) =>
            {
                return(DoSyncCheckStoreToStore(r, lt));
            }, list);

            //记录日志
            exeBatchTrans.Append <List <Model.Info_store_check> >((r, lt) =>
            {
                return(DoLogCheckStore(r, lt));
            }, list);

            //清理盘库表
            exeBatchTrans.Append <int>((r, s) =>
            {
                return(DoClearCheckStore(r));
            }, 0);

            return(exeBatchTrans.Save());
        }
示例#21
0
        public bool Save(List <Tb_expend_item> items)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <int>((r, id) =>
            {
                if (r.Remove <Tb_expend_item>().Save() < 0)
                {
                    return(false);
                }

                return(true);
            }, 0);

            foreach (var v in items)
            {
                exeBatchTrans.Append <Tb_expend_item>((r, it) =>
                {
                    return(this.Add(r, it));
                }, v);
            }

            return(exeBatchTrans.Save());
        }
示例#22
0
        public bool Commit(Info_matchTb info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <Info_matchTb>((r, i) => {
                return(r.Update <Model.Tb_matchTb>()
                       .Set().Field(Model.Tb_matchTb.Table.MatchTb_State, (int)Enum.MatchTbState.Valid)
                       .EndSet()
                       .Where()
                       .And(Model.Tb_matchTb.Table.MatchTb_Id, i.MatchTb_Id)
                       .EndWhere()
                       .Save() > 0 ? true : false);
            }, info);


            return(exeBatchTrans.Save());
        }
示例#23
0
        public override bool Remove(Info_place_info t)
        {
            ExeBatchTrans batchTrans = this.BatchTrans();

            batchTrans.Append <long>((r, id) => {
                if (r.Remove <Tb_place_info>().Where()
                    .And(Model.Tb_place_info.Table.Place_Id, id)
                    .EndWhere().Save() < 1)
                {
                    return(false);
                }

                return(true);
            }, t.Place_Id);

            AddDeleteBatch(batchTrans, t);

            return(batchTrans.Save());
        }
示例#24
0
        private void AddDeleteBatch(ExeBatchTrans batchTrans, Info_place_info t)
        {
            if (t.Children.Count > 0)
            {
                batchTrans.Append <long>((r, id) => {
                    if (r.Remove <Tb_place_info>().Where()
                        .And(Model.Tb_place_info.Table.Parent_Id, id)
                        .EndWhere().Save() < 1)
                    {
                        return(false);
                    }

                    return(true);
                }, t.Place_Id);

                foreach (var v in t.Children)
                {
                    AddDeleteBatch(batchTrans, v);
                }
            }
        }
示例#25
0
        public bool DoneOut(Info_link_bill link)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Update <Tb_link_bill>()
                    .Set().Field(Tb_link_bill.Table.Is_OutStore, (int)Enum.IsFlag.Yes)
                    .EndSet()
                    .Where()
                    .And(Tb_link_bill.Table.LinkBill_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }

                return(true);
            }, link.LinkBill_Id);

            return(exeBatchTrans.Save());
        }
示例#26
0
        public bool Save(Info_carriage_bill info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_carriage_bill>()
                    .Where().And(Model.Tb_carriage_bill.Table.Carriage_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.Carriage_Id)
            .Append <Model.Tb_carriage_bill>((r, m) =>
            {
                return(this.Add(r, m));
            }, info);


            return(exeBatchTrans.Save());
        }
示例#27
0
        public bool DoneBackOrder(Info_link_bill info)
        {
            //更新项目联络单完成标志位
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Update <Tb_link_bill>()
                    .Set().Field(Tb_link_bill.Table.Is_BackStore, (int)Enum.IsFlag.Yes)
                    .EndSet()
                    .Where()
                    .And(Tb_link_bill.Table.LinkBill_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }

                return(true);
            }, info.LinkBill_Id);

            return(exeBatchTrans.Save());
        }
示例#28
0
        public bool Commit(Info_carriage_bill info)
        {
            Model.Tb_default_adress defaultAdress = defaultAdressManager.FindThe();
            Info_place_fee          feeOrigen;
            Info_place_fee          updateFee = new Info_place_fee();
            string transDirection;

            //装车地址是默认地址,发车
            if (info.Load_Place_Id == defaultAdress.Place_Id)
            {
                updateFee.Place_Id = info.Unload_Place_Id;
                transDirection     = "发车";
                feeOrigen          = this.Repository.Query().From <Model.Tb_place_fee>()
                                     .ToSelect().EndSelect()
                                     .ToWhere()
                                     .And(Model.Tb_place_fee.Table.Place_Id, info.Unload_Place_Id)
                                     .And(Model.Tb_place_fee.Table.Truck_Name, info.Trunk_Spec)
                                     .And(Model.Tb_place_fee.Table.Trans_Direction, transDirection)
                                     .EndWhere()
                                     .ToQuery()
                                     .First <Info_place_fee>();
            }
            else
            {
                updateFee.Place_Id = info.Load_Place_Id;
                //回车
                transDirection = "回车";
                feeOrigen      = this.Repository.Query().From <Model.Tb_place_fee>()
                                 .ToSelect().EndSelect()
                                 .ToWhere()
                                 .And(Model.Tb_place_fee.Table.Place_Id, info.Load_Place_Id)
                                 .And(Model.Tb_place_fee.Table.Truck_Name, info.Trunk_Spec)
                                 .And(Model.Tb_place_fee.Table.Trans_Direction, transDirection)
                                 .EndWhere()
                                 .ToQuery()
                                 .First <Info_place_fee>();
            }


            updateFee.Truck_Name      = info.Trunk_Spec;
            updateFee.Trans_Direction = transDirection;
            updateFee.Trans_Cost      = info.Carriage_Cost;
            if (feeOrigen != null)
            {
                updateFee.Place_Distance = feeOrigen.Place_Distance;
            }

            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            //更新运费表
            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Update <Model.Tb_carriage_bill>()
                    .Set()
                    .Field(Model.Tb_carriage_bill.Table.Carriage_State, (int)Enum.CarriageState.Valid)
                    .EndSet()
                    .Where().And(Model.Tb_carriage_bill.Table.Carriage_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }
                return(true);
            }, info.Carriage_Id);

            //更新运输单状态
            exeBatchTrans.Append <Info_place_fee>((r, f) =>
            {
                if (r.Remove <Model.Tb_place_fee>()
                    .Where()
                    .And(Model.Tb_place_fee.Table.Place_Id, f.Place_Id)
                    .And(Model.Tb_place_fee.Table.Truck_Name, f.Truck_Name)
                    .And(Model.Tb_place_fee.Table.Trans_Direction, f.Trans_Direction)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, updateFee);

            exeBatchTrans.Append <Model.Info_place_fee>((r, m) =>
            {
                m.Fee_Id = NewId();
                return(this.Add(r, m));
            }, updateFee);

            return(exeBatchTrans.Save());
        }
示例#29
0
        public bool SaveOrderAllInfo(Info_OrderMain info, bool isUpdate = false)
        {
            Doc.DocBuilder docBuilder = new Doc.DocBuilder(info);
            Miles.IMSFramework.Model.Sm_employee user = Miles.IMSFramework.AppCache.Employee as Miles.IMSFramework.Model.Sm_employee;
            string Oper_Code = user.Employ_Code;

            ExeBatchTrans batchTrans = this.BatchTrans();

            if (isUpdate)
            {
                batchTrans.Append <string>(
                    (r, id) =>
                {
                    if (r.Remove <Model.Tb_order_main>()
                        .Where().And(Model.Tb_order_main.Table.Odr_No, info.Odr_No)
                        .EndWhere()
                        .Save() < 0)
                    {
                        return(false);
                    }
                    return(true);
                }, info.Odr_No).Append <string>(
                    (r, id) =>
                {
                    if (r.Remove <Model.Tb_order_item>()
                        .Where().And(Model.Tb_order_item.Table.Odr_No, info.Odr_No)
                        .EndWhere()
                        .Save() < 0)
                    {
                        return(false);
                    }
                    return(true);
                }, info.Odr_No)
                .Append <string>(
                    (r, id) =>
                {
                    if (r.Remove <Model.Tb_order_text>()
                        .Where().And(Model.Tb_order_text.Table.Odr_No, info.Odr_No)
                        .EndWhere()
                        .Save() < 0)
                    {
                        return(false);
                    }
                    return(true);
                }, info.Odr_No);
            }

            if (!isUpdate)
            {
                //追加合同
                if (info.Odr_Type == 4)
                {
                    //更新主合同的seq_No
                    batchTrans.Append <string>
                        ((r, oldCode) =>
                    {
                        //更新合同编码生成
                        if (r.Update <Model.Tb_order_main>()
                            .Set()
                            .Increase(Model.Tb_order_main.Table.Odr_Seq, 1)
                            .EndSet()
                            .Where().And(Model.Tb_order_main.Table.Odr_No, oldCode)
                            .EndWhere()
                            .Save() < 0)
                        {
                            return(false);
                        }
                        return(true);
                    }, info.Odr_No_Main);
                }
                else
                {
                    batchTrans.Append <string>
                        ((r, c) =>
                    {
                        //更新合同编码生成
                        if (r.Update <Model.Tb_order_code>()
                            .Set()
                            .Increase(Model.Tb_order_code.Table.Seq_No, 1)
                            .EndSet()
                            .Where().And(Model.Tb_order_code.Table.Employ_Code, c).EndWhere()
                            .Save() < 0)
                        {
                            return(false);
                        }
                        return(true);
                    }, Oper_Code);
                }
            }

            return(batchTrans.Append <Model.Tb_order_main>(
                       (r, t) =>
            {
                return this.Add(r, t);     // r.Add(t);
            }, info
                       ).Append <Model.Info_OrderMain>(
                       (r, t) =>
            {
                foreach (var v in t.Items)
                {
                    v.Odr_No = t.Odr_No;
                    v.Item_Id = NewId();
                    if (!r.Add(v))
                    {
                        return false;
                    }
                }
                return true;
            }, info
                       )
                   .Append <Model.Info_OrderMain>(
                       (r, t) =>
            {
                Model.Tb_order_text orderText = new Tb_order_text();
                orderText.Odr_No = info.Odr_No;
                orderText.Odr_Clause = info.Odr_Clause;
                orderText.Odr_Pay = docBuilder.GetOrderPay();
                orderText.Odr_Text = docBuilder.ToStream(info.Odr_Clause).ToArray();

                return r.Add(orderText);
            }, info
                       )
                   .Save());
        }