Beispiel #1
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());
        }
Beispiel #2
0
        public bool CommitIn(Info_store_in info)
        {
            //修改状态
            //更正库存数量
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

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

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

            foreach (Info_store_in_item item in info.Items)
            {
                exeBatchTrans.Append <Info_store_in_item>((r, t) =>
                {
                    if (r.Update <Tb_store_main>()
                        .Set()
                        .Increase(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());
        }
Beispiel #3
0
        public bool RemoveIn(Info_store_in info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

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

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


            return(exeBatchTrans.Save());
        }