public bool SaveOut(Info_store_out info) { ExeBatchTrans exeBatchTrans = this.BatchTrans(); exeBatchTrans.Append <long>((r, id) => { if (r.Remove <Tb_store_out>() .Where() .And(Tb_store_out.Table.StoreOut_Id, id) .EndWhere() .Save() < 0) { return(false); } return(true); }, info.StoreOut_Id); exeBatchTrans.Append <long>((r, id) => { if (r.Remove <Tb_store_out_item>() .Where() .And(Tb_store_out_item.Table.StoreOut_Id, id) .EndWhere().Save() < 0) { return(false); } return(true); }, info.StoreOut_Id); info.StoreOut_Id = NewId(); exeBatchTrans.Append <Info_store_out>((r, i) => { return(this.Add(r, i)); }, info); foreach (Info_store_out_item item in info.Items) { exeBatchTrans.Append <Tb_store_out_item>((r, t) => { t.Item_Id = NewId(); t.StoreOut_Id = info.StoreOut_Id; return(this.Add(r, t)); }, item); } return(exeBatchTrans.Save()); }
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()); }
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()); }