Ejemplo n.º 1
0
 /// <summary>
 /// 修改缓存托盘集合
 /// </summary>
 /// <param name="cacheTrayList"></param>
 public void UpdateCacheTableList(List <CacheStackTray> cacheTrayList)
 {
     using (BaseAccess access = new BaseAccess(true))
     {
         try
         {
             access.Open();
             access.BeginTransaction();
             foreach (CacheStackTray entity in cacheTrayList)
             {
                 string updateSql = string.Format("UPDATE {0} SET Barcode='{1}',Batch={2} WHERE Id ={3}", lineDevice.PrefixTable + "CacheStackTray", entity.Barcode, entity.Batch, entity.Id);
                 access.ExecuteNonQuery(updateSql);
                 //access.Update(entity, new string[] { CacheStackTray.ID }, CacheStackTray.BARCODE, CacheStackTray.BATCH);
             }
             access.Commit();
         }
         catch (Exception ex)
         {
             access.Rollback();
             PrintInfo.I(ex.Message);
             Console.WriteLine(ex.Message);
         }
         finally
         {
             access.Close();
         }
     }
 }
Ejemplo n.º 2
0
 public static void CreateTable(string prefixTable)
 {
     using (BaseAccess access = new BaseAccess(true))
     {
         try
         {
             access.Open();
             access.BeginTransaction();
             //创建缓存托盘表
             access.ExecuteNonQuery(GetCacheStackTraySql(prefixTable));
             //创建托盘详情表
             access.ExecuteNonQuery(GetStackTrayFlowSql(prefixTable));
             //创建托盘表
             access.ExecuteNonQuery(GetStackTraysSql(prefixTable));
             //创建注册托盘表
             //access.ExecuteNonQuery(GetRegisterTraySql(prefixTable));
             //创建用户事件日志表
             access.ExecuteNonQuery(GetUserEventLogSql(prefixTable));
             access.Commit();
         }
         catch (Exception ex)
         {
             access.Rollback();
             throw new Exception("创建表失败:" + ex.Message);
         }
         finally
         {
             access.Close();
         }
     }
 }