Beispiel #1
0
 /// <summary>
 /// 更新出库单
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public int UpdateStockOut(StockOutInfo stockOut, bool changebody, SqlTransaction trans)
 {
     string sql = @"UPDATE [StockOutHead]
                    SET [StockInNO] = @StockInNO
                       ,[WarehouseID] = @WarehouseID
                       ,[StockOutTP] = @StockOutTP
                       ,[StockOutDate] = @StockOutDate
                       ,[StockOutReason] = @StockOutReason
                       ,[InsertDateTime] = @InsertDateTime
                       ,[InsertUser] = @InsertUser
                       ,[UpdateDateTime] = @UpdateDateTime
                       ,[UpdateUser] = @UpdateUser
                  WHERE id=@id";
     SqlParameter[] spvalues = DBTool.GetSqlPm(stockOut);
     int res = SqlHelper.ExecuteNonQuery(trans, CommandType.Text, sql, spvalues);
     if (changebody)
     {
         DeleteDetail(stockOut.id, trans);
         foreach (StockOutBody ckb in stockOut.stockOutDetail)
         {
             InsertDetail(ckb, trans);
         }
     }
     return res;
 }
 public int InsertStockOut(StockOutInfo stockOut)
 {
     SqlConnection conn;
     int count = 0;
     using (conn = SqlHelper.CreateConntion())
     {
         conn.Open();
         SqlTransaction trans = conn.BeginTransaction();
         try
         {
             count = DAL.InsertStockOut(stockOut, trans);
             trans.Commit();
         }
         catch (Exception)
         {
             trans.Rollback();
         }
         conn.Close();
     }
     return count;
 }
Beispiel #3
0
 /// <summary>
 /// 增加出库单
 /// </summary>
 /// <param name="changeStock"></param>
 /// <param name="conn"></param>
 /// <returns></returns>
 public int InsertStockOut(StockOutInfo stockOut, SqlTransaction trans)
 {
     Guid g = Guid.NewGuid();
     stockOut.id = g;
     string sql = @"INSERT INTO [StockOutHead]
                            ([id]
                            ,[StockInNO]
                            ,[WarehouseID]
                            ,[StockOutTP]
                            ,[StockOutDate]
                            ,[StockOutReason]
                            ,[InsertDateTime]
                            ,[InsertUser])
                      VALUES
                            (@id
                            ,@StockInNO
                            ,@WarehouseID
                            ,@StockOutTP
                            ,@StockOutDate
                            ,@StockOutReason
                            ,@InsertDateTime
                            ,@InsertUser)";
     SqlParameter[] spvalues = DBTool.GetSqlPm(stockOut);
     int res = SqlHelper.ExecuteNonQuery(trans, CommandType.Text, sql, spvalues);
     foreach (StockOutBody ckb in stockOut.stockOutDetail)
     {
         ckb.HeadId = g;
         InsertDetail(ckb, trans);
     }
     return res;
 }